20 Commits
Author SHA1 Message Date
max bittkerandClaude Opus 5.5 df3d8888ae feat(sdk,mcp): cancellable execute_code, bot.mineRock, bounded walkTo
execute_code
- Cancellation now reaches inside the SDK via an AsyncLocalStorage scope:
  timeout, MCP cancel, or a newer call rejects pending waits and blocks
  further action packets, including those inside walkTo().
- One execution per bot: a new call supersedes the running one and starts
  once it has unwound; disconnect_bot does the same.
- Cancelled user code parks on bot/sdk calls instead of throwing, so a
  catch-all loop can't spin and starve the server.
- Console capture is routed per execution, so concurrent bots no longer
  clobber each other's output; leftover logs go to stderr.
- Stale world state warns and still runs, so a stale client can be diagnosed.
- Credentials are redacted from logs, results and launch messages.

SDK
- bot.mineRock() waits for ore plus Mining XP; interactLoc docs note that
  success can mean the action only started.
- walkTo() takes options.timeout (default 120s), refuses stale state, and
  reports the real last position.
- runScript uses the same cancellation scope for timeouts and signals.

Docs trimmed of duplicated or stale execute_code text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 14:30:19 -04:00
max bittkerandClaude Fable 5 2ae032c998 docs(wiki,sdk): shop-page coordinates, decoy-furnace learning, disconnectAfter doc
From the GLM 5.3 zero-score run analysis (rs-bench2 2026-08-14):

- generate-shops.ts now emits a Coordinates row from owner NPC map
  spawns, so agents can walk to a shop instead of sweeping the area
  name (Dommik wild-goose chase). 105/117 pages gain coordinates.
- learnings/smithing.md sample used the bare nearest-name furnace
  match that selects the inert decoy loc; now uses {withOption}.
- runner.ts disconnectAfter docstring claimed default false; the
  actual default is true for runner-opened connections, which is
  what tears down a shared MCP client.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 18:04:16 -04:00
max bittker 160ffcbb50 combat improvements 2026-07-26 15:16:37 -04:00
max bittkerandClaude Opus 5 9958f2b074 fix(sdk): correct interface-option clicks and make quantity actions honest
Audit of codex/porcelain-action-reliability, landing the changes that fix
real defects and leaving the speculative parts behind.

Interface options are published with a 1-based `index` label, but
`sendClickInterfaceOption` takes a 0-based array position. `fletchLogs`
and `craftLeather` matched an option by text and then fed its `index`
straight into that method, so both crafted the product *after* the one
requested — and matching the first option skipped it entirely. Adds
`sdk.clickInterfaceOption(selector)`, which resolves by object or visible
text and dispatches the option's `componentId`, and uses it at both call
sites. `sendClickInterfaceOption` keeps its behaviour with a renamed
parameter and a doc comment naming the trap.

`buyFromShop`/`sellToShop` decomposed the requested amount into an array
of 10/5/1 steps before sending anything, so `buyFromShop(item, 1e9)`
allocated a hundred-million-element array. Quantities are now validated
up front and the packets are streamed under a packet cap and deadline;
`sellAllToShop`'s unbounded `while (true)` is bounded the same way.

`sellToShop` reused the shop slot captured before the loop. Selling a
batch of non-stackables removes that slot, so later packets sold whatever
had slid into it. The slot is re-resolved by item id before each packet.

Shop and bank quantity actions returned `success: true` for short fills,
so a caller that asked for 28 proceeded believing it had 28. They now
report `requestedAmount`, the amount that actually moved, and
`partial: true`, and reserve `success` for an exact fill.

`chopTree` returned success when the tree merely despawned — which
happens when another player fells it — and then reported logs already in
the inventory as the ones just chopped. Success now requires the log
count to rise; the despawn still ends the wait, as a failure.

`withdrawItem` identified the withdrawn item by diffing inventory slots,
which names whatever landed in a changed slot rather than what was
withdrawn. It now tracks the bank item's id.

Also regenerates sdk/API.md, which was already stale on main (`bun run
check` fails there at docs:api:check), and adds unit coverage for option
resolution and quantity handling to test:focused.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-24 18:16:14 -04:00
Max BittkerandClaude Opus 5 e5fb1e9d07 Make the agent API self-describing and add regression CI (#43)
* Improve agent API docs and validation

* Drop the wiki search tool

Removes wiki/search.ts and its test. The index only covered names, aliases,
summaries and Sources lines, so it had worse recall than grep on body text
(e.g. "cow hide" missed skills/crafting.md), and normalize() stripped
underscores so map-square queries matched every neighbouring square
(m50_50 returned m50_53 NPCs). The computed mapSquareBounds were only
indexed as text, so coordinate lookups — the one thing grep can't do —
never worked.

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

* Regenerate the wiki from server/content

Adds the coordinate-samples column to NPC location tables and picks up
content drift the checked-in pages had missed (807 NPC, 117 shop, 1573 item
pages; 335 of them new). Examples: Aubury now stocks 1000 chaos/death runes
rather than 500, and shop rows point at "Vial of water"/"Bolts" instead of
the stale "Vial"/"Bolt" names.

Also stops all three generators from crashing on their final step. Each one
read wiki/README.md unconditionally, but that file has never existed, so the
index update threw ENOENT on every run. Skip it when absent.

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

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-07-24 17:52:51 -04:00
max bittker 3663fa8157 cow hide 2026-07-20 12:39:20 -04:00
max bittker 16676bd20e learnigns 2026-07-16 18:10:41 -04:00
max bittkerandClaude Fable 5 0f4e5fae85 SDK chat: 500-deep accumulated history + waitForChat
The SDK read chat only from the latest state-sync snapshot (50 messages),
so anything older was unrecoverable and getNewChat missed messages that
scrolled out of the window between polls. Also, chat cursors were
high-water *ticks* (Client.loopCycle), which restart near 0 on page
reload — permanently muting getNewChat and the MCP chat display.

- sdk/chat-history.ts: ChatHistory merges every snapshot into a deduped
  500-deep buffer. Handles the same-tick split (chat packet processed
  after the PLAYER_INFO that triggered the previous sync shares its
  loopCycle) and re-baselines on tick reset instead of dropping messages.
- getChat/getNewChat/getChatFrom read the accumulated history;
  getChat({limit: 0}) returns everything since connect. getNewChat's
  cursor is now a count into the history — immune to resets/eviction.
- sdk.waitForChat({from, matching, types, timeout}): await the next
  matching message (null on timeout), own private cursor so it doesn't
  consume getNewChat's. One-liner for bot<->bot coordination.
- mcp/server.ts: reset lastShownMessageTick when every visible tick is
  below it (client reloaded), instead of muting chat forever.
- learnings/chat.md usage guide, CLAUDE.md quick-ref rows, API.md
  regenerated, 24-case logic test (sdk/test/chat-history.test.ts).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 11:45:22 -04:00
max bittkerandClaude Opus 4.6 2d51749095 Fix stale rocks regex in mining learnings
Remove $ anchor from /rocks?$/i so it matches loc names like
"Rocks tin ore" where "Rocks" isn't at the end of the string.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:33:53 -04:00
max bittker 98b3b16d58 prospecting 2026-03-05 20:49:08 -05:00
Max Bittker 8e0d386908 Merge pull request #30 from MaxBittker/claude/fix-rs-sdk-issue-22-MLlrY
Add dismissBlockingUI calls to action methods
2026-02-15 19:13:16 -05:00
max bittker ce76f19d06 jewerly api 2026-02-11 10:58:22 -05:00
Claude b9956f6b51 Update docs to reflect automatic dismissBlockingUI() in actions
Remove redundant dismissBlockingUI() calls from code examples in
claude.md, agents.md, and scripts/CLAUDE.md. Update API table
descriptions and guidance in learnings/smithing.md,
learnings/dialogs.md, and scripts/script_best_practices.md to note
that all BotActions methods now handle this automatically.

https://claude.ai/code/session_01TosUs2T4chtUiBvhLPj5Fq
2026-02-11 14:35:58 +00:00
max bittker 2c9a10fa7c fixes 2026-02-09 19:25:02 -05:00
max bittker a465fa0cac learnings 2026-02-09 12:13:38 -05:00
max bittker b15385fe9e some mcp fixes 2026-02-09 09:49:33 -05:00
Daniel Griesser bb9a8ec09a remove mcp_tips.md from PR 2026-02-07 22:53:25 +01:00
Daniel Griesser d03dd19033 Update and add learnings docs
- Updated: mining.md, shops.md
- New: mcp_tips.md, smithing.md
2026-02-07 10:30:31 +01:00
max bittker f419035284 refactor script runner 2026-02-02 22:57:15 -05:00
max bittker 7b0c37aa29 claude.md 2026-01-29 23:57:25 -05:00