Commit Graph
351 Commits
Author SHA1 Message Date
0xSelenicDove 8893ba81a6 fix(*): harden local service boundaries (#2062) 2026-07-17 17:50:50 +08:00
027ad7436f refactor(minecraft): restore services to neutral Minecraft semantics (#1950)
## Summary

Restores `services/minecraft` to own **only Minecraft semantics**,
decoupling the already-merged #1915 runtime contract from the (unmerged)
#1916 desktop-relay design — as requested by @shinohara-rin in the #1916
review:

> I'd prefer we first restore `services/minecraft` to only own Minecraft
semantics, then reintroduce desktop relay/read-aloud through a generic
module capability/tool contribution path or a Minecraft adapter.
Otherwise `main` now contains half of a cross-PR runtime contract whose
other half we are saying should not land as-is.

The perception/reflex/brain reliability work from #1915 is untouched.
This PR only removes the three desktop-coupling points baked into the
bot service.

## Changes

- **`airi-bridge.ts` — `handleActionIntent`**: a `spark:command` is
high-level guidance from the AIRI server, now attributed to a neutral
`'airi'` source. Removed the hardcoded `username = '主人'` / `relayedFrom:
'desktop-airi'` "treat it as if the master typed it in-game" framing.
The generic server→bot directive still routes through
`signal:chat_message` to trigger a fresh decision cycle, exactly as
before — only the identity/provenance is neutralized. Binding a relayed
command to the master's in-game identity is desktop-relay policy and
will live in the Minecraft adapter.
- **`minecraft-context-service.ts`**: stopped emitting the
machine-readable `master:` status hint (whose only consumer was the
desktop `gaming-minecraft` store) and removed the desktop-coupling
NOTICE. The owner identity remains in the human-readable status **text**
for the bot's own brain.
- **`cognitive/index.ts`**: stopped forwarding the bot's own in-game
chat over the `context:update` lane `minecraft:speech` (only meaningful
with the #1916 desktop TTS consumer). The bot still ignores its own
messages.

## How tested

- Updated `minecraft-context-service.test.ts` to assert the neutral
behavior (owner identity in status text, **never** as a `master:` hint).
2/2 pass.
- `pnpm exec eslint <changed files>` → 0 problems.
- The changed files typecheck clean. (Note: this worktree surfaces
pre-existing `vec3@0.1.10` vs `vec3@0.2.0` dependency-resolution errors
in unrelated files —
`gaze.ts`/`runtime.ts`/`patched-goto.ts`/`world.ts`/`map-renderer`/`brain`/`rules`
— present on `main` before this change too; not introduced here.)

## Follow-up

Desktop relay (`relayToMinecraft`) and read-aloud will be reintroduced
through a Minecraft adapter in the renderer (registering tools/prompts
into the existing generic stores), so the runtime contract is owned by
the Minecraft surface rather than baked into the neutral bot service.
The generic stage-ui robustness fixes are already split out in #1949.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Rin <shinohara-rin@users.noreply.github.com>
2026-06-10 06:51:56 +00:00
RainbowBird 9382a12137 chore: cleanup and lint fix 2026-06-07 20:31:22 +08:00
RainbowBird 007fae6810 chore: update package dependencies and remove specific catalog references
- Removed specific catalog references for '@unocss/core', 'es-toolkit', 'nanoid', and 'valibot' in pnpm-workspace.yaml and various service package.json files.
- Updated versions for '@vueuse/core', 'es-toolkit', 'nanoid', 'reka-ui', and 'valibot' to their latest compatible versions.
- Cleaned up unused catalog entries in pnpm-workspace.yaml.
2026-06-07 19:45:28 +08:00
Zhou fanqi f6b53a37fa feat(minecraft): accurate perception, autonomic reflexes, and brain reliability (#1915)
## Summary

This PR upgrades the Minecraft bot's cognitive stack so it perceives
danger
accurately, reacts below the LLM brain with fast reflexes, and recovers
from
common brain failure modes. All changes are confined to
`services/minecraft/**`.

The desktop-side integration (spoken in-game chat, the online-gated
relay tool,
master binding in the UI) is submitted separately to keep this PR
focused; the
two are coupled only at runtime via AIRI context lanes, not at compile
time.

## What's included

**Perception — accurate damage attribution**
- `fall-tracker`: classify fall damage from physics-tick vertical
velocity.
- `attacker-tracker`: record the *real* attacker from the `entityHurt`
source,
  fixing "a mob shot me but I chased the player standing next to me".
- `low-health`: emit a danger signal at health ≤ 6 when no ready food is
held.
- `damage-taken`: resolve the source via a lava → drown → fire → fall →
  attacker chain and surface the attacker's name to the brain.

**Reflex — autonomic behaviors (run on the FSM tick, below the brain)**
- `defend`: auto-engage a hostile mob that attacks the bot/master and
hold the
  fight instead of thrashing (suppress damage wakes while attacking).
- `escape-hazard`: climb out of lava, or surface when drowning.
- `auto-eat`: eat ready food at health ≤ 6 (skipped during combat).
- A `reflexEngaged` autonomy flag suppresses auto-follow and auto-eat
while a
  defend/escape reflex owns the body.

**Conscious / skills — master recognition and reliability**
- Bind the "主人" role to the owner's in-game username so the bot
recognizes its
master in-world; enforce master-only command authority, never attack the
master, and react to a light hit with a short protest. Resolve players
by
  username, never the literal "player"/"主人".
- `js-planner`: strip prose-mixed LLM replies that caused `X is not
defined` and
give-up spirals; add a `botCall` sandbox bridge and the `whereName`
query
  chain method.
- Brain-prompt discipline: *saying is not doing*, *`recipePlan` is recon
not
crafting*, *eat only when food < 18* (regen is time-based), *defer equip
until
  a queued craft lands*.
- Skills: collect drops that spawn shortly after a kill (no more 0
loot);
`goToBed` skips occupied beds; detach auto-follow while
mining/collecting so
  digging is not interrupted.
- Platform: load perception rules on Windows (`fileURLToPath`); widen
the AIRI
  client read timeout to stop connection flapping.

The master username is injected via `generateBrainSystemPrompt(..., {
masterUsername })`
from config — it is **not** hardcoded.

## How tested

```bash
pnpm -F @proj-airi/minecraft-bot exec vitest run   # 220 tests; +56 new, all green
pnpm -F @proj-airi/minecraft-bot typecheck
pnpm exec moeru-lint services/minecraft            # 0 problems on changed files
```

- Each feature ships with unit tests (trackers, reflex behaviors,
planner
  salvage, skills, prompt, context service).
- Manual in-game testing: combat vs. pillagers/zombies, lava/water
escape,
low-health eating, crafting, master recognition with multiple players
present.

### Pre-existing baseline (not introduced by this PR)

Measured on `main` (`cb5c0783e`) before any change here:
- `tsc` reports 12 errors, all from a `vec3` 0.1.x/0.2.0
dependency-dedup
mismatch (`angleTo`) and `unknown[]` casts in `map-renderer.ts` /
`mcdata.ts` —
  files this PR does not touch. This PR adds **0** new type errors.
- 7 unit tests already fail on `main` (4 in `map-renderer.test.ts`, 2
timing-sensitive `brain.test.ts`, 1 timing-sensitive `rules.test.ts`).
This
  PR leaves those exactly as-is and does not touch those modules.

## Known limitations / follow-ups

- The `defend` reflex does not yet reliably engage ranged pillagers at
distance;
  the brain's `attack` tool currently covers that case.
- `craftRecipe` does not auto-unpack blocks (e.g. diamond_block →
diamond) or
  auto-gather missing intermediates for complex recipes.
- `inferDamageSource` orders environmental causes before
`recentAttacker`, which
  can mis-attribute an in-water-while-shot hit; low impact, deferred.
2026-06-05 11:51:18 +08:00
RainbowBird 7841df28f8 build(deps): migrate workspace dependencies to catalogs
Move direct external dependency versions into pnpm catalogs and update workspace packages to reference catalog entries.

Signed-off-by: RainbowBird <git@luoling.moe>

Commit-Message-Assisted-by: Codex
2026-06-03 17:12:13 +08:00
Neko Ayaka b9f88ef84f style: lint 2026-04-15 14:44:59 +08:00
d86314f5a3 fix(minecraft): multiple core crashes and logic bugs in Minecraft bots (#1375)
## Description

本次修复解决了 Minecraft 机器人运行中的多个核心崩溃与逻辑问题,让 AI 能稳定执行挖掘、跟随、资源收集等任务:

1.  **修复 `expectMoved()` 验证逻辑**:
    - 当动作结果中不存在 `movedDistance` 字段时,默认使用 0 而非抛出错误
    - 新增非移动动作白名单(挖掘、放置、交互等),对这类动作直接返回成功,不再强制要求移动距离
- 解决了「挖掘动作被误判失败」的核心问题(报错:`Expectation failed: expectMoved() requires
last action result with movedDistance telemetry`)

2.  **优化 `breakBlockAt()` 挖掘逻辑**:
    - 修正脚下方块位置计算,提升挖掘精准度
    - 补充详细调试日志,便于排查挖掘相关问题

3.  **修复 `InventoryQueryChain.count()` 空值问题**:
    - 增加对 `name` 参数的空值检查,避免 `undefined` 调用 `toLowerCase()` 导致崩溃
- 解决了 `Cannot read properties of undefined (reading 'toLowerCase')` 报错

4.  **补全查询链缺失方法**:
    - 为 `EntityQueryChain` 新增 `whereName()` 方法,支持按实体名称过滤
    - 为 `BlockQueryChain` 新增 `where()` 方法,支持自定义谓词过滤
- 解决了 `whereName is not a function` / `where is not a function` 等类型错误

5.  **修复 `JavaScriptPlanner.runAction()` 异步竞态问题**:
- 在异步操作后增加 `this.activeRun` 空值检查,避免 `activeRun` 为 `null` 时访问 `executed`
导致崩溃
    - 解决了 `Cannot read properties of null (reading 'executed')` 报错

## Linked Issues

Fixes #1352

## Additional Context
- 所有修改均在 Minecraft 服务目录下,不影响其他模块
- 测试验证:机器人可正常执行挖掘、跟随、资源收集等任务,不再出现上述崩溃
- 原项目 Mineflayer 版本即将弃用,但本修复可让当前实验版机器人稳定可用,也为后续原生 Mod 版本提供参考

---------

Co-authored-by: Rin <shinohara-rin@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-13 18:21:38 +08:00
Neko Ayaka 95eac8e41c chore(deps): bump dependencies 2026-04-11 04:00:49 +08:00
Richard Pinedo 99be852fe4 feat(stage-tamagotchi,stage-ui,server-sdk,server-runtime): zero-trust websocket authentication (#1582) 2026-04-07 04:05:35 +08:00
fdeb9561bc feat(minecraft,stage-*): airi integration, isolated-vm plus misc updates (#1371)
* feat(minecraft): contextflow integration

Add AiriBridge to cognitive engine to enable communication with Airi system. Expose `notifyAiri` and `updateAiriContext` functions in JS planner runtime globals for sending notifications and context updates from agent code.

* refactor(minecraft): remove redundant destinations field from airi-bridge

Remove hardcoded `destinations: ['minecraft']` from spark:command, spark:notify, and context:update events as the destination is already implied by the bridge context.

* feat(minecraft): complete AIRI context flow integration

Wire up bidirectional AIRI ↔ Minecraft communication via dedicated
signal channels instead of reusing signal:chat_message.

- Add airi_command and airi_context to PerceptionSignalType
- Route spark:command intents: action/plan/proposal/reroute emit
  signal:airi_command; context intent emits signal:airi_context
- Add inbound context:update listener so AIRI can push context to
  the Minecraft agent
- airi_context signals are injected into conversation history directly
  without triggering a full cognitive cycle
- airi_command events reset the no-action budget (like player chat)
- enterContext/exitContext auto-emit context:update back to AIRI for
  task lifecycle visibility
- Add sendEmit() helper for queued/working/done progress reporting

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(minecraft): report bot startup state to AIRI

Send initial context update to AIRI when brain comes online, including
bot username, server address, position, health, game mode, and list of
other online players. Tagged with 'startup' and bot username for
filtering.

* feat(minecraft): manage bot config through airi

* feat(stage-ui): add minecraft service shell

* fix(stage-ui): use applied minecraft config for chat context

* fix(minecraft): fall back on invalid env port

* fix(minecraft): support quoted env values

* fix(minecraft): ignore empty env overrides

* fix(stage-ui): keep minecraft draft during apply

* fix(stage-ui): simplify minecraft heartbeat label

* feat(stage-ui): simplify minecraft settings shell

* fix(minecraft): use registry heartbeat for stage liveness

* chore(minecraft): remove annoying detector decision logging

* fix(minecraft): limit context flow to bot pushes

* fix(minecraft): use workspace server sdk

* fix(stage-ui): replay registry snapshots for late listeners

* chore(minecraft): add todo for explicit stage deregistration

* feat: improve context flow observability

* fix(stage-ui): remove redundant header and callout from settings and context flow pages

* feat(stage-ui): enhance context flow prompt projection UI with readiness indicator

* docs(stage-ui): clarify context flow prompt projection terminology

* fix(stage-ui): add test for clone-safe context snapshots with nested fields

* todo

* fix(minecraft): avoid blocking startup on airi connection

* Remove LLM timeouts from the Minecraft brain

* Remove context boundary system from Minecraft brain

* feat(minecraft): use isolated-vm for JS planner sandbox

* refactor(minecraft): harden planner sandbox defaults

* Remove LLM attempt timeout guard

* [autofix.ci] apply automated fixes

* Fix server runtime shutdown signal handling

* Remove misleading Minecraft integration toggle

* contextflow destination to stage-*

* chore(deps): updated

* Add settings layout route for web devtools

* chore: default to expand context panels

* fix(server-*): should export more types, and for module:announced should ignore self

* refactor(minecraft): better context orchestration, handle module announce, context sync, and more

* feat(stage-ui): not spark command ready

* [autofix.ci] apply automated fixes

* clean up

* refactor: use :class arrays per AGENTS.md styling guidelines

* cleanup bloated tests

* rm more tests

* use errorMessageFrom

* hardcode to reduce bloat

* update setup instructions

* timeout for brain

* remove more bloat

* fix

---------

Co-authored-by-agent: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by-agent: Codex
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Neko Ayaka <neko@ayaka.moe>
2026-04-01 23:33:59 +08:00
Neko Ayaka ce60323d8a style: lint 2026-03-23 02:16:10 +08:00
Neko Ayaka ac1de680d0 chore(deps): bump dependencies 2026-03-23 02:15:40 +08:00
Neko Ayaka 956a4541e9 style: lint 2026-03-19 14:27:23 +08:00
Rin e83c17fe57 fix(minecraft): xss mitigation for minecraft debug dashboard (#1344)
Authored-by-agent: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-03-14 00:20:15 +08:00
5157b9c445 fix(services): resolve lint issues (#1261)
* fix: resolve lint issues

## Summary

Fix lint issues identified by the linter.

## Changes

- **app.js**: Use `Number.isNaN()` instead of global `isNaN()`
- **app.js**: Prefix unused variable `result` with underscore
- **scheduler.ts**: Remove unused variable `log`

## Details

- `Number.isNaN()` is the preferred way to check for NaN in modern JavaScript
- Unused variables are flagged by the linter and should be removed or prefixed with underscore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Apply suggestion from @gemini-code-assist[bot]

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: hobostay <hobostay@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Garfield Lee <Garfield550@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-11 17:15:56 +08:00
Kunal Bhujbal 57b04d957b fix(minecraft): add stop method to Ticker to prevent resource leak (#1213) 2026-03-09 20:45:46 +08:00
Rin 7b11d1e0bd feat(minecraft): disable debug servers by default (#1193) 2026-03-08 18:41:32 +08:00
Rin 561b608c03 fix(minecraft): downgrade to mitigate upstream issue and mcp cleanup (#1192)
* fix(minecraft): downgrade minecraft-data to 3.102.3

Serialization error for play.toServer : Write error for undefined : The value of "value" is out of range. It must be >= -128 and <= 127. Received 218 stack=RangeError [ERR_OUT_OF_RANGE]: Write error for undefined : The value of "value" is out of range. It must be >= -128 and <= 127. Received 218

* fix(minecraft): close existing MCP transports on client reconnect

Handle client refresh scenarios by closing existing streamable and SSE transports before creating new ones, preventing resource leaks and connection conflicts.
2026-03-08 05:54:49 +08:00
19822e3c43 refactor(minecraft): migrate reflex runtime to alien-signals, harden zod validation, and unify skill utilities (#1092)
* chore: use utils

* feat: refactor pathfinding stagnation detection and add navigation tests

* refactor(minecraft): simplify ensure.ts with shared ensureMined helper

* refactor(minecraft): centralize collectible block aliases and extraction flow

- move block collection usage onto the dedicated action module
- extract collectible alias expansion for ores, deepslate variants, and dirt
- keep exact block validation strict while widening collection lookups
- preserve original smelting errors when temporary furnace cleanup fails
- add regression coverage for alias handling and furnace cleanup

* chore: sleep() using shared utils

* refactor(minecraft): container helpers; guarantee close in takeFromChest()

* chore: add unsafe type comment

refactor: zod schema for YAML rule DSL

refactor: zod for hardened config validation

refactor: zod schema for ws client command validation

* refactor(minecraft): alien-signals for reflex context/runtime/manager state

* fix(minecraft): prevent reconnect deadlock before spawn; centralize plugin lifecycle

* fix(minecraft): make command chat listener idempotent across spawn/reconnect

* refactor(minecraft): extract reconnect state machine into connection supervisor; further centralize plugin-related logic

* fix(minecraft): temp type fix

* fix(minecraft): add LLM call timeout/cancel boundaries and ignore pause abort errors

* fix(minecraft): enforce deterministic temporal rule semantics and honor accumulator.mode

* fix(minecraft): preserve callback errors during container cleanup

* fix(minecraft): report EventBus subscriber failures via project logger

* refactor(minecraft): migrate perception temporal accumulator to detector with decision tracing

* feat(minecraft): add detector.groupBy and optimize rule engine detector hot path

* fix(minecraft): bound event queue and temp anti-starvation scheduling

* fix(minecraft): normalize debug dashboard tool param typing

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Neko <neko@ayaka.moe>
Co-authored-by: Rin <shinohara-rin@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-03-07 03:01:49 +08:00
Neko Ayaka 3605548973 chore: lint & lock 2026-03-06 16:49:31 +08:00
Neko Ayaka 92d87833be chore(deps): bump dependencies 2026-02-26 18:33:52 +08:00
Rin a5287c08d2 refactor(minecraft): add ETA-based pathfinding timeout with stuck detection and retry limits
Patches mineflayer-pathfinder to implement estimated-time-of-arrival based navigation timeouts (2× estimated travel time + grace period). Adds stuck detection counter that triggers failure after 3 consecutive resets without progress. Introduces patchedGoto wrapper returning {ok, reason, elapsedMs, estimatedTimeMs, message} for all navigation calls. Updates goToPlayer/goToPosition actions to surface timeout
2026-02-19 00:25:06 +08:00
Rin 91e5158cf3 refactor(minecraft): redesign debug dashboard conversation view with turn-based grouping and context boundary visualization
Replaces flat message list with collapsible turn cards (user+assistant pairs). Parses user messages into tagged sections ([EVENT], [FEEDBACK], [PERCEPTION], etc.) with inline/collapsible rendering based on content type. Adds context status bar showing active context label and archived summaries. Introduces Brain.broadcastConversationState() to emit full context metadata (active
2026-02-19 00:25:06 +08:00
Rin 08afe0f2aa feat(minecraft): add context boundary system with auto-summarization to prevent unbounded conversation history growth
Introduces task context boundaries via enterContext()/exitContext() REPL functions. Active context messages remain in full; completed contexts are summarized and archived. Adds [CONTEXT_HISTORY] prefix message with archived summaries, auto-trim when active context exceeds 30 messages, and auto-collapse when >10 summaries accumulate. Provides history query runtime (recent/search/playerChats/
2026-02-19 00:25:06 +08:00
Rin 4ce0c427bc refactor(minecraft): simplify giveUp action to halt until player input instead of timed cooldown
Removes cooldown_seconds parameter and timer-based resumption from giveUp action. Brain now uses boolean givenUp flag instead of giveUpUntil timestamp. Action halts all autonomous processing until next player chat message. Updates error-burst guard to remove suggestedCooldownSeconds field. Adjusts prompts, tests, and MCP server to reflect halt-until-input semantics.
2026-02-19 00:25:06 +08:00
autofix-ci[bot] f176aecaee [autofix.ci] apply automated fixes 2026-02-18 03:18:35 +00:00
Neko Ayaka 7b9ee3c24b chore(minecraft-bot): improve 2026-02-18 11:14:59 +08:00
Rin f3486005ea refactor(minecraft): simplify EventBus by removing history and trace query features
Strips ring buffer history storage, getHistory(), getEventsByTrace(), and historySize config from EventBus. Removes logger dependency and default config object. EventBus now only handles emit/subscribe/dispatch without persistent event storage. Updates container to use zero-config createEventBus(). Moves event-bus from cognitive/os/ to cognitive/ directory.

Update services/minecraft/codex-skills/minecraft-debug-mcp/references/mcp-surface.md

Update services/minecraft/codex-skills/minecraft-debug-mcp/references/mcp-surface.md

Update services/minecraft/codex-skills/minecraft-debug-mcp/SKILL.md
2026-02-18 11:14:46 +08:00
Rin fca2f9a244 docs(minecraft): update README to reflect current perception pipeline and cognitive architecture
Replaces outdated attention-detector/buffer references with EventRegistry + RuleEngine pipeline. Updates Conscious layer to Brain/JS-planner/Query-DSL. Clarifies Action layer components (TaskExecutor, ActionRegistry, Tool Catalog). Revises project structure to match current codebase organization.
2026-02-18 11:14:46 +08:00
Rin aa2d7af17c refactor(minecraft): further cleanup 2026-02-18 11:14:45 +08:00
Rin 13805ab7b5 chore(minecraft): remove unused scenario test files
Removes basic-chat.json and damage-reaction.json scenario definitions that are no longer used for testing chat responses and damage reactions.
2026-02-18 11:14:45 +08:00
Rin ae297e8b06 refactor(minecraft): dead code cleanup
Strips saliency thresholds, window counters, signal generation, and route filtering from all perception event definitions and EventRegistry. Events now emit raw data directly via onRawEvent callback without conscious/reflex/debug routing or threshold-based filtering. Removes WindowCounter, SaliencySnapshot, and related timer/slot logic.
2026-02-18 11:14:45 +08:00
Rin 46b1a8d438 refactor(minecraft): replace look-at and teabag behaviors with idle-gaze behavior 2026-02-18 11:14:45 +08:00
Rin 2022c733b3 feat(minecraft): add map() query DSL for ASCII spatial awareness and terrain visualization
Adds `query.map(options?)` to Brain's query runtime, returning ASCII top-down or cross-section maps with configurable radius (1-32), entity/elevation overlays, and yLevel slicing. Symbols include ground, stone, water, lava, trees, ores, chests, players, and mobs. Enables spatial navigation, resource finding, and underground exploration.
2026-02-18 11:14:45 +08:00
Rin 122be40782 chore(minecraft): add @modelcontextprotocol/sdk dependency 2026-02-18 11:14:45 +08:00
Rin a135b07957 fix(minecraft): await reconnect plugin initialization before spawn hooks to prevent race conditions
Plugin loadPlugin calls were fire-and-forget during reconnect, allowing spawn
event handlers to run before plugins finished loading. Now initializeReconnectPlugins
runs sequentially and spawn waits for completion before invoking spawned hooks.
2026-02-18 11:14:45 +08:00
Rin e668b9b410 fix(minecraft): nullify EventRegistry context on stop() to prevent stale handler execution
When stop() is called before detachFromBot(), mineflayer listeners remain
attached. Nullifying context ensures handleMineflayerEvent's guard clause
silently ignores any events that fire in this window.
2026-02-18 11:14:44 +08:00
Rin 32957e4269 fix(minecraft): make action tool globals updatable so REPL reflects runtime action changes
Action tools were defined with configurable: false, preventing updates after
the first evaluate() call. New defineUpdatableGlobal uses configurable: true
so installActionTools can redefine them when available actions change.
2026-02-18 11:14:44 +08:00
Rin a140ce5065 fix(minecraft): stop McpReplServer and destroy Brain on cleanup to prevent port conflicts on reconnect 2026-02-18 11:14:44 +08:00
Rin 303c07747d fix(minecraft): fix Brain resource leaks, race conditions, and unbounded growth
- Store and clean up EventBus subscription and TaskExecutor listeners in destroy()
- Clear stopCancelledControlActionIds Set in destroy() to prevent unbounded growth
- Use setImmediate in enqueueEvent to prevent re-entrant processQueue bypassing isProcessing guard
- Add conversation history trimming (max 40 messages) to prevent exceeding LLM context window
- Remove duplicate pause check block before REPL execution
2026-02-18 11:14:44 +08:00
Rin 2202154b1d fix(minecraft): remove hardcoded return in isCerebrasBaseURL that prevented reasoning from being sent to all LLM providers 2026-02-18 11:14:44 +08:00
Rin fdb0d26b4d feat(minecraft): add patterns runtime to REPL with block alias support for collect actions
Add PatternRuntime to brain sandbox exposing patterns.get/find/ids/list helpers for known-working recipes, update mcp-surface.md to document patterns global, add patterns to brain-prompt.md globals list with usage guidance, expose patterns in js-planner sandbox and introspection, add test coverage for patterns.get/find in REPL, integrate matchesBlockAlias in breakBlockAt action to support variant-aware block verification

[autofix.ci] apply automated fixes

chore(minecraft): cleanup

[autofix.ci] apply automated fixes
2026-02-18 11:14:44 +08:00
Rin 6a50bcf98e feat(minecraft): remove greeting reflex behavior and associated state tracking
Remove greetingBehavior from reflex system, delete lastGreetingAtBySpeaker tracking from ReflexSocialState and context snapshot, unregister greeting behavior from ReflexManager, clean up stale comments about greeting behavior compatibility
2026-02-18 11:14:43 +08:00
Rin b170094a99 fix(minecraft): add toJSON/inspect.custom serialization to query chains for cleaner REPL output 2026-02-18 11:14:43 +08:00
Rin 797a00346b chore(minecraft): document query.gaze + remove stale gaze context 2026-02-18 11:14:43 +08:00
Rin 942d03584a feat(minecraft): move gaze to perception + query.gaze 2026-02-18 11:14:43 +08:00
Rin 5ea05fb33e fix(minecraft): remove returnValue from prevRun/lastRun to prevent stringified return mirror exposure
Remove returnValue assignment from sandbox.lastRun after script execution (keep only returnRaw for typed values), add test verifying prevRun does not expose stringified returnValue property, update brain-prompt.md to remove returnValue references and guide users to stringify returnRaw explicitly for text output (JSON.stringify(prevRun.returnRaw)), update value-first rule examples to use prevRun.returnRaw instea
2026-02-18 11:14:43 +08:00
Rin 4a354c357e feat(minecraft): add live conversation panel with session tracking and processing state
Replace LLM traces panel with live conversation view showing real-time chat messages, add ConversationUpdateEvent/RequestConversationCommand types, implement emitConversationUpdate in Brain to broadcast conversation state changes (on forgetConversation/turn completion/errors), add session boundary tracking to grey out cleared conversations, implement typing indicator during LLM processing, add collapsible system
2026-02-18 11:14:42 +08:00
Rin 165fde7745 fix(minecraft): remove autoCraft action and fix craftRecipe num parameter to mean craft count not output count
Remove autoCraft action (redundant with craftRecipe's auto-handling of intermediate materials), update craftRecipe description to clarify num parameter is craft count not output item count (e.g. crafting planks once yields 4 planks), fix ensurePlanks to pass logsToCraft instead of logsToCraft*PLANKS_PER_LOG to craftRecipe, fix craftRecipe to use replaceAll instead of replace for space norm
2026-02-18 11:14:42 +08:00