Add mcode-island plugin: Windows Dynamic Island status pill for MiniMax Code agents - #17
Open
antianqi wants to merge 3 commits into
Open
Add mcode-island plugin: Windows Dynamic Island status pill for MiniMax Code agents#17antianqi wants to merge 3 commits into
antianqi wants to merge 3 commits into
Conversation
…ax Code agents Adds a Skill-first plugin that surfaces the agent working state in a 320x60 WPF pill anchored to the top center of the primary display, so the user can leave the terminal in the background and still watch progress. States: idle / thinking / working / waiting / done / error. Includes wrap-tool.ps1, a thin bash wrapper that pushes working / done / error / waiting based on $LASTEXITCODE, so the user does not have to remember to call notify-island.ps1 for every shell command.
Adds a 1-second-polling daemon that reads the active mcode session messages.jsonl and infers the agent state (idle/thinking/working/done/error) without requiring the agent to call notify-island.ps1. State mapping: role=user -> idle role=assistant + toolCall -> working "<tool>: <args>" role=assistant + thinking -> thinking role=assistant + text -> idle (just replied) role=toolResult + !isError -> done "<tool> 完成" role=toolResult + isError -> error "<tool> 失败" mcode 进程不在 -> error "mcode 进程已退出" 60s 无新事件 -> idle 兑底 Priority logic: agent-pushed states (with Message) are preserved; detector takes over only for settle states (idle / error). Tested on Windows 11 24H2 + PowerShell 5.1 against a live mcode session. All 6 state transitions verified, including mcode exit and recovery.
hetaoBackend
left a comment
Collaborator
There was a problem hiding this comment.
Review result: do not approve / do not merge yet.
The repository check passes (27 tests), but the core Windows detector is not ready:
mcode-status-detect.ps1:79-80hard-codesC:\Users\Administrator\...and scansmessages.jsonl, while the repository runtime uses resolved data directories andledger.jsonl. Ordinary installations therefore reportmcode 已退出instead of detecting state.mcode-status-detect.ps1:117-118,228-243returns no message when the file mtime is unchanged, so the advertised 60-second idle fallback is unreachable during inactivity.start-island.ps1:15-22,stop-island.ps1, and the detector start/stop scripts trust stale PID files and can refuse startup orStop-Process -Forcean unrelated process after PID reuse. Validate executable/command-line identity before acting.wrap-tool.ps1:47-56advertises a bash wrapper but executes-CommandwithInvoke-Expressionas PowerShell code, creating an injection/shell-semantics boundary that should be removed or explicitly documented.- The quick-start commands are invalid PowerShell:
README.md:82-90uses%PLUGIN_DIR%and-Enable, butautostart.ps1:7-10only supports-Action Enable. start-island.ps1:40-44waits forabout to ShowDialog, a log message the widget never emits, so readiness is always reported as waiting.
Please fix the detector data-path/session contract, idle logic, PID validation, and launch/docs issues before requesting another review.
Fixes for review comments from hetaoBackend (commit fce7c5f): MiniMax-AI#1 detector hard-coded path: resolve the [userprofile]/.minimax-code directory at runtime via the mcode node process cmdline (regex on @minimax-ai/code/cli.js), with fallbacks to $env:USERPROFILE/.minimax-code, $env:APPDATA/minimax-code, and the current working directory. Override with -Root [path]. MiniMax-AI#2 idle fallback unreachable: mtime cache now returns the last inferred message instead of null, so the 60s stale -> idle branch fires every poll. Verified locally: idle :: already idle 195s after 65s of inactivity. #2b session log: prefer ledger.jsonl (mcode v2 event stream) and fall back to messages.jsonl when ledger is missing. Both formats are handled in Infer-State (kind/phase for ledger, message.role for messages). MiniMax-AI#3 PID reuse safety: start/stop-{island,detect-island}.ps1 now verify the target PID command line contains the expected script path before acting. Stale PIDs and PID-reused processes are refused with a REFUSED log line instead of being killed. MiniMax-AI#4 wrap-tool.ps1 shell-injection: removed Invoke-Expression entirely. The wrapper is now status-only; the agent runs the command via mcode's own bash tool and passes -ExitCode to publish the outcome. Documented in README + SKILL.md. MiniMax-AI#5 README: -Enable -> -Action Enable to match autostart.ps1 parameter set. MiniMax-AI#6 start-island.ps1 readiness: dropped the 'about to ShowDialog' log wait (which was never emitted). Now polls MainWindowHandle != 0 every 500ms for up to 8s. Tests: validator reports OK plugin antianqi/mcode-island. wrap-tool 6-state matrix verified locally (working / done / waiting / error).
Author
|
Thanks for the review. Pushed Code fixes
Local verification
Not in this push (out of scope of the review)
Ready for another pass. |
antianqi
added a commit
to antianqi/mcode-island
that referenced
this pull request
Aug 22, 2026
This standalone mirror is now in lockstep with the in-flight PR #17 (MiniMax-AI/MiniMax-Code-Plugins#17), commit bad0868. Changes since v0.1.0: + mcode-status-detect.ps1 v0.2 detector daemon + start-detect-island.ps1 + stop-detect-island.ps1 + status-detect-island.ps1 M README.md detector + wrap-tool new API + -Action Enable M mcode-island.cmd detect-on / detect-off / detect-status subcommands M skills/mcode-island/SKILL.md detector + new wrap-tool two-step pattern M start-island.ps1 PID + cmdline check; readiness via MainWindowHandle M stop-island.ps1 PID + cmdline check (refuse on PID reuse) M wrap-tool.ps1 removed Invoke-Expression; status-only; -ExitCode arg Detector resolves the mcode install root at startup by regexing the mcode node process command line (matched on @minimax-ai/code/cli.js), with fallbacks to $env:USERPROFILE/.minimax-code, $env:APPDATA/minimax-code, and the current working directory. Validator: OK plugin antianqi/mcode-island (same as PR #17 head).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mcode-island — Windows Dynamic Island for MiniMax Code agents
A Skill-first Plugin that surfaces the agent's working state in a small WPF pill
anchored to the top center of the primary display, so the user can leave the
terminal in the background and still see exactly what the agent is doing.
The agent's only contract with the widget is: write JSON to
%APPDATA%\mcode-island\status.json(or call thenotify-island.ps1helperthat does that for you). The widget polls that file every 400 ms.
The problem this solves
While the agent runs a long tool call (compile, install, test, refactor), the
user often switches away from the terminal to read code, check docs, or browse
the web. There is no visible progress signal. The agent may also be paused on
a permission prompt, or have failed silently.
mcode-islandmakes all ofthat visible at a glance, without forcing the user to switch back.
Copyable example
In the agent loop, wrap every
bashcall through the bundled wrapper:State flow this triggers automatically:
working — bash: run tests(pushed before the command runs)done — bash 完成waiting — bash 等待审批 (exit=1)error — bash 失败 (exit=N)For other tools (
read/write/edit), the agent pushes state directlyvia
notify-island.ps1before and after each tool call. The Skill body inskills/mcode-island/SKILL.mddocuments the exact timing.Expected result
After each push the widget on the user's primary display updates within
~400 ms (one polling cycle). On click, the originating terminal tab regains
focus. The widget is intentionally hard to kill:
Alt+F4hides it (notcloses), and
mcode-island showre-raises the hidden window in under onesecond.
Requirements
user32/kernel32)Bypassfor this directory; not changed globallyThe plugin contains no
node_modules, no native binaries, no symlinks, noinstallers, no private endpoints, no telemetry.
Network and data behavior
%APPDATA%\mcode-island\:status.json,caller.json,config.json,widget.pid,island.log,widget.log,show.signal.HKCU\Software\Microsoft\Windows\CurrentVersion\Runfor logon auto-start (opt-in, user runs
autostart.ps1 -Enable).Test evidence
This plugin was exercised on Windows 11 24H2 with PowerShell 5.1 against a
live MiniMax Code session. Concrete observations captured during development:
island.logover a multi-hour session(21
working/ 14done/ 11idle/ 6waiting/ 5thinking/ 1error).assets/state-*.png).wrap-demo.png:thinking→working→waiting→working→doneon a realbash npm testrun.focus jumps to the originating Windows Terminal tab (HWND consistent).
wrap-tool.ps1exit-code semantics: 0 →done, 1 →waiting(default,configurable via
-WaitingExitCodes), other →error.npm run checkresultValidator output for the hosted plugin directory:
The 8 unrelated
FAILlines innpm run checkare pre-existing onupstream/main(other contributors' hosted plugins missing YAMLfrontmatter); this PR does not touch them. The single
npm testfailure(
hosted-plugins.test.mjs:39) is a Windows-only path-separator mismatchin the upstream test (
plugins\alice\hello-worldvs/plugins\/alice\/hello-world/)and is unrelated to this PR.
Package contents
Limitations
wrap-tool.ps1only wrapsbash; forread/write/editthe agentcalls
notify-island.ps1directly.Tauri rewrite).
License
Apache-2.0.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.