Skip to content

Commit 3ce9bee

Browse files
committed
feat(agent-flow): observe subagents through plugin hooks
1 parent 9f0440e commit 3ce9bee

18 files changed

Lines changed: 900 additions & 996 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The MiniMax Code Agent communicates through the host MCP client. Business reques
7878
| [Disk Insight](plugins/zch0227/disk-insight/) | See where disk space went on macOS and Windows with a sunburst space map, find junk files sorted into three safety tiers, large and duplicate files, and how much code repositories and Git worktrees take; ask an Agent about any item, and permanently delete what you select after a confirmation that lists every item. Requires MiniMax Code 3.1.2 or later | [zch0227](https://github.com/zch0227) |
7979
| [A/时差保安 / Timezone Guard](plugins/liuchen19960902/timezone-guard/) | Check the other side's local time before you message: the target city's clock turns into a green "now is fine", yellow "keep it short", or red "go to sleep" verdict. Requires MiniMax Code 3.1.2 or later | [FineCat](https://github.com/LiuChen19960902) |
8080
| [AI Node Canvas](plugins/antianqi/ai-node-canvas/) | An infinite-canvas node graph for MiniMax Code: wire text, image, video and audio runs into a graph, let each result flow downstream, and run media tools on any result | [antianqi](https://github.com/antianqi) |
81-
| [Agent Flow](plugins/huixin615/agent-flow/) | Inspect native sub-agent timelines across parent and child sessions: actual serial or overlapping execution, child tool activity, and result matches in the current parent history. Requires MiniMax Code 3.1.4 or later | [Huixin615](https://github.com/Huixin615) |
81+
| [Agent Flow](plugins/huixin615/agent-flow/) | Import this plugin's Hook event file to inspect native task calls and sub-agent lifecycles, with exact task-to-child links when IDs are available. Choose a recorded chat or the latest imported record; no Host session files are opened. Requires MiniMax Code 3.1.4 or later | [Huixin615](https://github.com/Huixin615) |
8282

8383
<details>
8484
<summary>Preview: Token Usage Board</summary>

‎README.zh-CN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ MiniMax Code Agent 通过宿主 MCP 客户端与 MiniApp 协作。业务请求
7878
| [磁盘透视](plugins/zch0227/disk-insight/README.zh-CN.md) | 查看 macOS 和 Windows 的磁盘空间去向:旭日图空间地图,按三档风险分类的垃圾文件,大文件和重复文件,代码仓库和 Git worktree 的占用;任何条目都可以问 Agent,选中的条目在确认框里逐一列出,确认后直接永久删除。需要 MiniMax Code 3.1.2 或更高版本 | [zch0227](https://github.com/zch0227) |
7979
| [A/时差保安](plugins/liuchen19960902/timezone-guard/README.zh-CN.md) | 发消息前先看对方那边几点:按对方城市当地时间给出「现在可以聊 / 短聊就好 / 先睡,别发」三档判定。需要 MiniMax Code 3.1.2 或更高版本 | [FineCat](https://github.com/LiuChen19960902) |
8080
| [AI 节点画布](plugins/antianqi/ai-node-canvas/README.zh-CN.md) | MiniMax Code 里的无限画布节点图:把文本、图片、视频、音频的生成接成一张图,结果顺着连线往下传,任何一张结果都能直接做二次处理 | [antianqi](https://github.com/antianqi) |
81-
| [Agent 协作透视](plugins/huixin615/agent-flow/README.zh-CN.md) | 跨父子会话查看原生子 Agent 时间线:实际串行或重叠执行、子任务工具活动,以及当前父会话历史中的回传匹配情况;本机只读。需要 MiniMax Code 3.1.4 或更高版本 | [Huixin615](https://github.com/Huixin615) |
81+
| [Agent 协作透视](plugins/huixin615/agent-flow/README.zh-CN.md) | 手动导入插件 Hook 记录,查看原生 task 调用与子 Agent 运行区间;有明确 ID 时关联父子任务。可选择记录会话或一键查看最近导入的记录,不读取宿主会话文件。需要 MiniMax Code 3.1.4 或更高版本 | [Huixin615](https://github.com/Huixin615) |
8282

8383
<details>
8484
<summary>预览:Token 用量看板</summary>

‎plugins/huixin615/agent-flow/.minimax-plugin/plugin.json‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
"name": "agent-flow",
44
"displayName": "Agent 协作透视",
55
"version": "1.0.0",
6-
"description": "Read-only timeline of native sub-agent tasks, child sessions, and result handoffs in local MiniMax Code conversations.",
6+
"description": "Import plugin-recorded Hook events to inspect native sub-agent and task timing without reading Host session files.",
77
"author": "Huixin615",
88
"icon": "icon.png",
99
"category": "Code",
10-
"exampleQueries": ["打开 Agent 协作透视", "查看这次任务的子 Agent 协作过程"],
10+
"exampleQueries": ["打开 Agent 协作透视", "查看插件记录的 task 与子 Agent 时间事件"],
1111
"apps": [],
1212
"mcpServers": [],
13-
"skills": []
13+
"skills": [],
14+
"hooks": ["hooks/hooks.json"]
1415
}

‎plugins/huixin615/agent-flow/README.md‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
# Agent Flow (`agent-flow`)
22

3-
A read-only Mini App for inspecting **native `task` sub-agents** in local MiniMax Code conversations. Open it while working normally: it shows when a parent Agent delegated work, the child session and its tool activity, the child's final reply, and whether a matching result appeared in the parent conversation. It does not launch or control Agents.
3+
Agent Flow shows a timeline of native `task` calls and sub-agent lifecycle events from a file that **this plugin's Hooks create**. The user works in ordinary MiniMax Code chats. The Mini App reads a file only after the user selects it; it does not discover or open Host runtime databases or session history.
44

5-
The timeline uses persisted task times and reports whether tasks delegated in one turn actually overlapped, plus whether each result can be matched in the current parent history. Two tool calls in one parent message are not assumed to have run in parallel. A task marked “delivered” is not treated as a verified parent-history match; compaction or an unreadable history can leave that match unverified. A match does not prove the parent understood or used the result.
5+
The timeline shows observed `PreToolUse` → `PostToolUse` intervals, whether a tool result field was present, and `SubagentStart` → `SubagentStop` intervals. It compares completed task-call intervals for overlap. A tool result does not prove that the parent Agent adopted it. A child is linked only when the structured `task` result names the same child session ID as its lifecycle events, or a Hook explicitly supplies a parent session ID. The selected-session view excludes unrelated and unlinked child events; the import file itself is unchanged.
66

77
## Install and use
88

9-
Requires MiniMax Code 3.1.4 or later.
9+
Requires MiniMax Code 3.1.4 or later and `node` available on the Hook command's `PATH`.
1010

11-
Copy this whole directory, including `.minimax-plugin/`, to `~/.minimax/plugins/agent-flow/`. Restart MiniMax Code, then ask it to “Open Agent Flow” or “打开 Agent 协作透视”. The Mini App tab belongs to the conversation where it was opened; the page can still inspect earlier conversations through its picker. It follows the most recently updated local conversation as an **inference**, including conversations with zero tasks, because the Host does not expose the current chat ID to this Mini App. Use the picker to hold a specific conversation, or choose “Follow latest” to resume automatic selection. It refreshes task data every three seconds and the conversation list every fifteen seconds while open; it stops when closed.
11+
Copy this directory, including `.minimax-plugin/` and `hooks/`, to the local MiniMax Code plugin directory as `agent-flow`, then restart MiniMax Code. Work normally and invoke native `task` sub-agents. Open “Agent 协作透视” and select `agent-flow-events.jsonl` from this plugin's Hook data directory. Select rotated `agent-flow-events-*.jsonl` files together if needed.
1212

13-
The detail panel shows the `task` instruction, the child Agent's final reply, and tool names. These are recorded statements and actions, not proof that an advertised code change is correct. Previous messages removed from the active history by compaction may no longer be available in the detail panel; the persisted task and parent-child relation remain visible. The session picker starts with 40 entries and offers “Load more” when needed.
13+
On the tested macOS desktop layout, Finder's **Go to Folder** can navigate to `~/.minimax/v2/plugin-data/hooks/agent-flow/`. This is a **manual file-picker hint**, not a path used by the plugin's code or a promised stable Host layout. If the directory is empty, check that the plugin is enabled, a new native task has run since installation, and `node` is available to the desktop application's Hook process.
1414

15-
This version covers native `task` sub-agents only. MiniMax Bot groups, MoMo-managed tasks, cloud sessions, and arbitrary plugin-owned Agent sessions are outside its scope.
15+
Choose the file again to see newly appended events. The page keeps imported data only in memory and does not poll the file. Records from before the Hooks were installed cannot be reconstructed. Session identifiers are SHA-256 digests; the picker lists sessions with observed `task` calls, sorted by their latest event with full local dates and times. Choose a session or click “查看最近记录” to select the newest **imported** task session in one step. This selection is an inference and may not be the chat containing the Mini App; the page never binds it automatically to the current chat. Only children explicitly associated with the chosen session appear in its view.
1616

1717
## Tested environment
1818

19-
- MiniMax Code 3.1.4 on macOS: read-only reconstruction verified against one real parent conversation with two foreground `explore` children and matching parent tool results. The plugin appears in the installed plugin list, and the user confirmed that the Mini App page displays both tasks.
20-
- Node.js 24.21.0: synthetic tests cover old sessions, mismatched paths, missing parent results, and nested failed background tasks; the repository `npm run check` passes.
21-
- Windows paths are implemented with Node's cross-platform path utilities but have not been tested on Windows.
19+
- MiniMax Code 3.1.4 on macOS: after installation and restart, a new Work chat produced two `task` calls, two tool returns, and two complete sub-agent lifecycles. The user imported the plugin-generated file and confirmed that both calls matched their respective children by exact hashed session ID. The two child running intervals overlapped. Older records created before structured child ID capture remain unlinked.
20+
- Node.js 24.21.0 for the Hook recorder and synthetic tests. Windows has not been tested.
2221

2322
## Data & access
2423

25-
- Reads `~/.minimax/v2/sqlite/runtime-state.sqlite` with `node:sqlite` in read-only mode, plus selected session `messages.jsonl` files under `~/.minimax/v2/sessions`. It checks that a history directory encodes the selected session ID, rejects symlinked history paths, and caches unchanged files while open. If `MAVIS_HOME` is set, that directory replaces `~/.minimax`.
26-
- The Mini App Host does not provide a supported API to observe other conversations. These paths and schemas are **internal, undocumented layouts** observed in MiniMax Code 3.1.4; a client update may break them. A missing or incompatible store produces an error, not guessed relationships.
27-
- Does not write Host files, plugin data, or browser storage. No outbound network requests, spawned processes, Agent turns, MCP endpoints, or background monitoring after the page closes.
28-
- The browser receives only selected conversation and task details from the local Node process. Nothing is uploaded. The page renders stored text as text, never as HTML.
24+
- The `SessionStart`, `PreToolUse(task)`, `PostToolUse(task)`, `SubagentStart`, and `SubagentStop` Hooks receive event JSON from MiniMax Code on stdin. Each Hook invocation runs `node "${PLUGIN_ROOT}/hooks/record.mjs"`. These invocations can occur while the Mini App page is closed.
25+
- The recorder writes `agent-flow-events.jsonl` under the runtime-provided `PLUGIN_DATA` directory, rotating at 8 MiB. It keeps timestamps, SHA-256 digests of opaque IDs (including a structured child session ID when present in a `task` result), agent type, a task description/title/name truncated to 160 characters, and whether the tool response field exists. **That short task title may contain user-supplied text, including a path or sensitive value.** It does not separately collect workspace paths or credentials and does not store the full task prompt, tool result body, or child final reply. The records remain on the user's machine until the user deletes them.
26+
- The Mini App's Node process serves only its own HTML, CSS, and JavaScript. The browser parses only files explicitly selected by the user, in memory, and does not upload or persist the content. No Mini App Agent turns, MCP endpoints, outbound network requests, or Host runtime/session-file access. Hook processes are the only subprocesses; no additional process is started by the Mini App.
27+
- The Mini App declares no Agent access. It cannot identify the chat containing the page and does not list or read Host sessions or run Agent turns. The user chooses a recorded session explicitly; choosing one does not claim it is the currently open chat.
28+
- The UI renders imported strings as text. A mismatched, incomplete, or oversized file is rejected rather than merged into a guessed history.
2929

3030
## Development
3131

32-
Run `node --test plugins/huixin615/agent-flow/tests/*.test.mjs` and `npm run check` from the repository root. Synthetic tests create temporary stores and contain no real conversation content.
32+
Run `node --test plugins/huixin615/agent-flow/tests/*.test.mjs` and `npm run check` at the repository root. Tests use only synthetic events and a temporary plugin data directory.
3333

3434
## License
3535

0 commit comments

Comments
 (0)