Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions plugins/antianqi/mcode-island/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,28 @@ alternative:
& "%PLUGIN_DIR%\mcode-island\notify-island.ps1" -State error -Message "npm test failed"
```

For sub-step progress (Computer Use iterative loops, multi-step plans),
pass `-Step` / `-Total` / `-Detail` so the pill shows what the agent is
doing *right now*:

```powershell
& "%PLUGIN_DIR%\mcode-island\notify-island.ps1" -State working -Message "Computer Use" `
-Step 3 -Total 12 -Detail "fill username field"
# → pill renders: "step 3/12 · fill username field"

& "%PLUGIN_DIR%\mcode-island\notify-island.ps1" -State working -Message "Bash" `
-Step 5 -Detail "npm install"
# → pill renders: "step 5 · npm install"

& "%PLUGIN_DIR%\mcode-island\notify-island.ps1" -State done -Message "Bash ok"
# → pill renders: "Bash ok" (no step → legacy behavior, backward compat)
```

All three params are optional and backward compatible. The detail field
replaces the message in the rendered pill when present (avoids stacking
"Bash ok · fill username"). See `skills/mcode-island/SKILL.md` for the
full semantics and the contract with the widget renderer.

## Quick start

1. **Install** — copy this folder into your `~/.minimax/plugins/mcode-island/`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ function Push-Island {
[ValidateSet('idle','thinking','working','waiting','done','error')]
[string]$State,

[string]$Message = ''
[string]$Message = '',
[int]$Step = -1,
[int]$Total = -1,
[string]$Detail = ''
)
if (-not (Test-Path -LiteralPath $script:NotifyIsland)) {
# Widget is not installed yet — silent no-op. The plugin's
Expand All @@ -52,7 +55,7 @@ function Push-Island {
return
}
try {
& $script:NotifyIsland -State $State -Message $Message 2>$null | Out-Null
& $script:NotifyIsland -State $State -Message $Message -Step $Step -Total $Total -Detail $Detail 2>$null | Out-Null
} catch {
# Hook must never block the agent on a notification failure.
}
Expand Down Expand Up @@ -97,6 +100,26 @@ function Format-ToolSummary {
'WebSearch' { $detail = [string]$Event.tool_input.query }
'Task' { $detail = [string]$Event.tool_input.description }
'NotebookEdit' { $detail = [string]$Event.tool_input.notebook_path }
# mcode-internal: Computer Use 抽 action + coordinate/text
# 例: "mcode-computer-use : click at (1024,768)"
# "mcode-computer-use : type 'hello'"
# 注意:coordinate 是 array,PowerShell 默认 $OFS=' ' 会让
# "$coord" 渲染成 "(1024 768)" 不是 "(1024,768)"。必须
# 显式 -join ','。' ' 在 pill 上看起来像数字被截断,
# 影响用户判断坐标。
'mcode-computer-use' {
$act = if ($Event.tool_input.action) { [string]$Event.tool_input.action } else { '' }
if ($Event.tool_input.coordinate) {
$coord = $Event.tool_input.coordinate
$coordStr = "($($coord -join ','))"
$detail = "$act at $coordStr"
} elseif ($Event.tool_input.text) {
$txt = [string]$Event.tool_input.text
$detail = "$act '$txt'"
} else {
$detail = $act
}
}
default { $detail = '' }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# Note: Fires after every tool call returns. Heuristic: if the
# tool_result is empty or matches an error pattern, push
# error; otherwise push done. Self-push calls are filtered.
# Per-tool summary (Format-ToolSummary) is split into
# Message="<tool> ok|failed" and Detail=<the rest>, so the pill
# renders "Bash ok · ls -la /tmp" instead of just "Bash ok".
. "$PSScriptRoot\_lib.ps1"
$evt = Read-HookStdin
if (Test-IsSelfPush $evt) { exit 0 }
Expand All @@ -20,9 +23,18 @@ if ($null -eq $result) {
elseif ($s -match '^\s*(Error|ERROR|✕|Error:|\[ERROR\])') { $isError = $true }
}

# Format-ToolSummary 抽 detail,但要剥掉 "tool : " 前缀,只留后半段
$summary = Format-ToolSummary $evt
$detail = ''
if ($summary -and $summary.StartsWith("$tool : ")) {
$detail = $summary.Substring($tool.Length + 3)
} elseif ($summary -and $summary -ne $tool) {
$detail = $summary
}

if ($isError) {
Push-Island -State error -Message "$tool failed"
Push-Island -State error -Message "$tool failed" -Detail $detail
} else {
Push-Island -State done -Message "$tool ok"
Push-Island -State done -Message "$tool ok" -Detail $detail
}
exit 0
Loading
Loading