Skip to content

feat(mouserecorder): upload your own mouse and game-key input to your Microbot account - #2264

Merged
chsami merged 8 commits into
developmentfrom
feature/input-recorder
Nov 14, 2026
Merged

chsami merged 8 commits into
developmentfrom
feature/input-recorder

Conversation

@chsami

@chsami chsami commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Replaces the Mouse Macro Recorder with Input Recorder. Instead of writing JSONL files locally, it uploads the player's own mouse and game-key input to their Microbot account (/api/input, chsami/Microbot-Api #72 and #73, both deployed).

Who can use it: only accounts microbot.cloud allows (Admin role, Input:Audience on the API).

  • The plugin runs idle for everyone. A linked client asks GET /api/input/access once per link (and again every 6 h or when the link changes) and appears in the Microbot plugin list only after a 204. The answer is remembered between restarts.
  • A 403 not-available from that check or from an upload hides the plugin again.
  • The API refuses every input route for other accounts, so a modified client can't upload or read anything.
  • New hook: plugins can hide themselves from the Microbot plugin list by implementing ConditionallyListed and posting PluginListingChanged.

What it records while upload is on, the client is linked and the player is logged in:

  • Mouse moves, buttons and scroll.
  • Game keys only. Digits only while dialogue options are open; typed text is never recorded.
  • Context: ticks, tile and instance template, camera, hovered and opened menus, the player's own menu actions, animations, XP.
  • Content segments: Tithe Farm, Combat: <npc>, Skilling: <skill>.
  • Menu targets other than NPCs, objects, ground items and items are blanked, so player names never appear.

Human input only:

  • Script-dispatched events (BotEventGuard) are dropped.
  • Recording pauses for 30 s after any synthetic input, bot menu action or script start, and for as long as a Hub script runs.
  • It also pauses while typing, while a chatbox prompt or the bank PIN is open, and when the window loses focus.
  • A script pause ends the content segment. Other pauses stay inside it as pause/resume events.

Upload: 30 s chunks, gzipped off the client thread, a bounded queue of 40, retries with backoff. Uploading stops on a refused token or the daily limit and is flushed on client exit. The overlay shows the status, the pause reason and the current content.

Tests: InputPrivacyTest, ContentDetectorTest, InputUploaderTest, InputAccessCheckTest, MouseMacroRecorderPluginEventsTest (EventBus registration) and ClientThreadGuardrailTest are green.

Live checks, 2026-11-14:

  • A manual Tithe Farm session recorded correctly: game keys only, no player names.
  • Driven through the agent server with real X input on Xvfb, an agent walk paused recording within 1 s and a Hub script paused it immediately. Input during the pause was not recorded, and recording resumed 30 s after the last bot input.
  • After the gate, the plugin appeared for an admin account once the access check passed.

Draft until the owner approves the merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XwwsPumKzuGjss5QHRrRfC

… Microbot account

The Mouse Macro Recorder now records every mouse move, button, scroll and
game key (typed characters are never stored, player names in menu targets
become <player>), with game context: ticks, position and instance template,
camera, hovered and opened menus, menu actions marked human or not, the
player's animations, XP and the content being done (Tithe Farm, combat by
NPC, skilling). It records only real input: events dispatched by scripts
(BotEventGuard) are dropped, and recording pauses while any script runs, on
the login screen, the bank PIN, a chatbox prompt or without focus. Chunks of
30 s are gzipped off the client thread and uploaded to /api/input with the
client link token; nothing is written to disk any more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X2jMX72L53891CRTE9AXZp
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

chsami and others added 7 commits November 14, 2026 19:19
…ear status

Review fixes for the Input Recorder:
- Upload needs the new "Upload my input" switch (off by default), so users
  of the old local recorder never start uploading without opting in.
- Bot activity pauses recording for 30 s: any script input (BotEventGuard now
  stamps its last dispatch, which also covers Quest Helper, the walker and the
  agent server), a menu action not preceded by the user's own click or key, a
  script start, or a running Hub script. Enabled but idle plugins (Break
  Handler, utilities) no longer pause it. Microbot.targetMenu is read before
  MicrobotPlugin clears it.
- Menu targets keep their name only for NPC, object, ground-item and item
  entries; friends, chat, clan and lookup names are blanked. Non-game keys are
  not sent at all, and recording pauses while chat input is non-empty or a
  RuneLite chatbox input or prompt is open. Pause checks run every client tick.
- Content segments end on pause; content names are cleaned to the API's
  characters and length.
- Uploader: sessions are bound to the token that created them (no upload into
  another account), refused chunks are removed by identity, chunks are gzipped
  as soon as they are queued, a malformed 201 backs off, close without parts
  sends no finalSeq, a 401 rejects the shared link token, the daily limit is
  retried every 30 minutes, and stopping the plugin never blocks the UI thread
  (the client's exit waits for the last upload).
- Overlay tells the player what to do: where to link, telemetry off, link
  removed, retrying, the limit retry time, which script pauses it, and lost
  input in minutes. The plugin is now listed as "Input Recorder" (2.0.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X2jMX72L53891CRTE9AXZp
…link, keep sessions over loading screens

Second review: a refused link stays "Link removed" instead of falling back to
"Not linked"; a session only starts when recording would not be paused, so a
hopping bot creates no sessions; each session is bound to the link token it
started with, so relinking before the first upload never sends it to the new
account; loading screens skip the tick instead of ending the session (only
the login screen and world hops end it); a real mouse release counts as the
user's input (hold-and-release menu picks); upload being switched off is
re-checked inside session start, the due chunk is drained under the lock,
and the not-uploaded counter resets per session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X2jMX72L53891CRTE9AXZp
The EventBus requires subscriber methods to be named on<Event>, so a second
MenuOptionClicked handler on the plugin stopped it from starting. The
priority-1 check now lives in a small inner subscriber registered next to the
plugin, and a test registers both on a real EventBus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X2jMX72L53891CRTE9AXZp
Typing, a chatbox prompt, the bank PIN or losing focus split one Tithe Farm
run into six segments. Only a script pause ends the segment now; the other
pauses stay visible as pause and resume events inside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X2jMX72L53891CRTE9AXZp
The plugin now runs idle for everyone and asks GET /api/input/access once
per link (again every 6 hours or when the link changes). It appears in the
Microbot plugin list and records only after a yes, remembered between
restarts, and hides itself again when the API answers 403 not-available
for the check or for an upload. The API enforces the same rule on every
input route, so a modified client still cannot upload or read anything.

Plugins can now hide themselves from the Microbot plugin list by
implementing ConditionallyListed and posting PluginListingChanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XwwsPumKzuGjss5QHRrRfC
- Always on: the plugin only checks access and stays idle until "Upload my
  input" is on, so an old "off" setting from Mouse Macro Recorder can no
  longer hide it from an admin for good.
- Notice a new link within 10 s instead of 60.
- Show the pause reason when a session cannot start yet (script running,
  window not focused) instead of showing nothing.
- Recover from "Link removed" once the client is linked again.
- Turning upload off drops what was recorded but not sent yet.
- Skip the Hub script scan while not recording; clamp event times at 0.
- Break Handler V2 lists the plugin as Input Recorder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XwwsPumKzuGjss5QHRrRfC
@chsami
chsami marked this pull request as ready for review November 14, 2026 20:33
@chsami
chsami merged commit a5091a1 into development Nov 14, 2026
2 checks passed
@chsami chsami mentioned this pull request Nov 14, 2026
2 of 4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant