Public: anyone can read this; the crew can change it.

The Minecraft kind's console adapter answers /forge in game in under 300 ms, in rich text, and keeps a conversation #18533

opened this

Merged 3h 11m ago, live in production

I built the in-game /forge handler and the rich-text replies inside src/kinds/minecraft/. It is not wired to the box agent or the plugin yet, so no player can type /forge against it today. The new tests and the kinds, feature-index and feature-doors tests pass, and bun x tsc --noEmit is clean.

Notes

opened this

I built the in-game /forge handler and the rich-text replies inside src/kinds/minecraft/. It is not wired to the box agent or the plugin yet, so no player can type /forge against it today. The new tests and the kinds, feature-index and feature-doors tests pass, and bun x tsc --noEmit is clean. I did not run the full suite, the design lint or the gate's duplicate-code check beyond its last run. That last gate run only printed two "one implementation?" notes about near-duplicate helpers (see below).

What changed

  • speak.ts builds replies as Adventure component JSON. Each reply opens with a gold bold [forge] prefix and has grey body text, a hover, a click-to-suggest /forge … button and a click-to-copy value.
    • Replies stay short: at most 5 lines of 120 characters each.
    • § codes and control characters are stripped.
    • Player or forge text only ever goes into a text field, and suggest buttons are limited to /forge … commands.
  • command.ts parses status, servers, ask <words> and reply <words>. It also holds:
    • within, which gives every handler 250 ms and then falls back to a "did not answer in time" reply with a try-again suggestion.
    • A per-player cooldown of 5 s on ask and reply; reads are not limited.
  • kind.ts gets console.forge(door), and the Minecraft kind returns the handler from it. ForgeDoor (read, ask, reply) is how the forge side plugs in. The forge token stays with the box's agent, so this code never holds one.
  • I added test/minecraft-command.test.ts and docs/features/game-forge-command.md. The commit says No door: because this is a command typed in the game, with no page, route or tool.

Not done

  • The heartbeat-on-marked-request path and the forge answering a read in that same response are not changed. agent.sh, games/door.ts and games/chat.ts already handle /forge, but they send plain tellraw text. I did not wire them to produce components.
  • I wrote no Java plugin. speak.ts only produces the JSON the plugin would send.
  • I did not connect ask and reply to askThrough or the Talk conversation code. They are ForgeDoor methods to be filled in.
  • The gate noted within as similar to a test helper and plain as similar to line in games/forge_read.ts. I kept plain separate to avoid a kind-to-general import, and forge_read.ts could later reuse it.

To try it: bun test test/minecraft-command.test.ts.

🤖 Generated with Claude Code

Closes #18466

3 earlier comments
commented

I built the in-game /forge handler and the rich-text replies inside src/kinds/minecraft/. It is not wired to the box agent or the plugin yet, so no player can type /forge against it today. The new tests and the kinds, feature-index and feature-doors tests pass, and bun x tsc --noEmit is clean. I did not run the full suite, the design lint or the gate's duplicate-code check beyond its last run. That last gate run only printed two "one implementation?" notes about near-duplicate helpers (see below).

What changed

  • speak.ts builds replies as Adventure component JSON. Each reply opens with a gold bold [forge] prefix and has grey body text, a hover, a click-to-suggest /forge … button and a click-to-copy value.
    • Replies stay short: at most 5 lines of 120 characters each.
    • § codes and control characters are stripped.
    • Player or forge text only ever goes into a text field, and suggest buttons are limited to /forge … commands.
  • command.ts parses status, servers, ask <words> and reply <words>. It also holds:
    • within, which gives every handler 250 ms and then falls back to a "did not answer in time" reply with a try-again suggestion.
    • A per-player cooldown of 5 s on ask and reply; reads are not limited.
  • kind.ts gets console.forge(door), and the Minecraft kind returns the handler from it. ForgeDoor (read, ask, reply) is how the forge side plugs in. The forge token stays with the box's agent, so this code never holds one.
  • I added test/minecraft-command.test.ts and docs/features/game-forge-command.md. The commit says No door: because this is a command typed in the game, with no page, route or tool.

Not done

  • The heartbeat-on-marked-request path and the forge answering a read in that same response are not changed. agent.sh, games/door.ts and games/chat.ts already handle /forge, but they send plain tellraw text. I did not wire them to produce components.
  • I wrote no Java plugin. speak.ts only produces the JSON the plugin would send.
  • I did not connect ask and reply to askThrough or the Talk conversation code. They are ForgeDoor methods to be filled in.
  • The gate noted within as similar to a test helper and plain as similar to line in games/forge_read.ts. I kept plain separate to avoid a kind-to-general import, and forge_read.ts could later reuse it.

To try it: bun test test/minecraft-command.test.ts.

🤖 Generated with Claude Code

commented

The failing timer check is fixed and pushed. test/timers-named.test.ts now passes locally (9 of 9). I ran bun scripts/gate.ts --fix, which changed nothing. I did not run tsc or any other suite.

The setTimeout in within() (src/kinds/minecraft/command.ts:48) is the Minecraft plugin's 250 ms handler bound. It only resolves the race with the fallback and does no work of its own. That is the same kind of timer as the machine-load deadline already on the test's allow list. I added it there, with the reason, instead of wrapping it in background. The only change is that one allow entry in test/timers-named.test.ts.

The gate also printed two "one implementation?" similarity notes, which I did not act on:

  • within in command.ts against test/helpers/real-spawn-e2e.ts.
  • plain in speak.ts against line in src/games/forge_read.ts.
commented

/forge's rich reply is now wired into the games door that already runs /forge, and it works end to end in the forge. The pinned forge-velocity jar isn't in this repo and I couldn't change it, so I haven't seen a player's chat show the component. bun x tsc --noEmit is clean. About 270 tests pass, including dup-imports, unused-exports, timers-named, kinds, and the game-door, game-chat, game-desk and game-agent suites. I did not run the first-view-budget tests, since no page changed.

What changed

  • Wiring. toldTo in src/games/door.ts adds component, the Minecraft kind's rich reply, to every answer except a confirm. The agent forwards it, with one jq line in agent.sh. It rides the same response as a read, which the door already returns within 250 ms.
  • text stays. It stays beside component so the pinned plugin jar keeps working. Nothing in the repo can make the jar read component, so the plain text isn't retired yet. Once the plugin reads component, text can go.
  • Talk. /forge ask <words> starts a new Talk conversation, and /forge reply <words> continues the account's latest one on that box. Other words behave as before. gameAsk in chat.ts calls the kind's forge.hear.
  • Tests. New in test/game-door.test.ts:
    • Same-response read. A read comes back in the same sync reply with the component, and the box token isn't in the body.
    • Ask/reply. The ask/reply conversation test goes through the door to real Talk conversations.
    • Spoofed name. A spoofed name is refused.
  • Doc. docs/features/game-forge-command.md is rewritten for what now exists.

Where I disagree with the review

  • No new ForgeDoor or handler. The door's one() already maps the proxy's verified UUID to a linked account, role and limits, so a second implementation would have been a second policy. I deleted ForgeDoor, handler, within, cooldown and HANDLER_MS; they were dead code, and so is the timers-named allow entry I added earlier. The kind now supplies only forge.hear (ask and reply) and forge.say (the rich reply).
  • Identity (item 4). The name and UUID in an ask are the proxy's. A name sent with another player's UUID is refused and its link dropped, and an unlinked name reads nothing; both are tested.
  • Cooldown (item 5). I dropped the extra 5 s cooldown. The account's existing limits (5 commands, 30 reads, 12 Talk turns a minute) apply, and they're counted when a command is accepted. They aren't refunded if the forge's later answer fails.
  • Clean (item 6). The two blank lines, the next/copyable ternary and the unused exports are gone. plain was a copy of line in forge_read.ts, so speak.ts now uses line, which is exported.

Left out

  • /forge reply with no earlier conversation starts one. It doesn't say so.
  • The terminal side has no change ("No door:" is in the commit).
commented

Left #18466 open: 3 unticked items remain (instant: the agent sends a heartbeat the moment the proxy marks a request, and the forge answers a read in that same response; every plugin handler times out at 250 ms with a clear fallback; the forge token stays with the agent, never in the plugin; rich text: replies as Adventure components with a [forge] prefix, colour, hover, click-to-suggest and copy-to-clipboard; private to the player and short; all of it lives in src/kinds/minecraft/).

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs