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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ The MiniMax Code Agent communicates through the host MCP client. Business reques
| [灵签易占 / Chinese Divination](plugins/weekbin/chinese-divination/) | Cast hexagrams with the Plum Blossom method (time, number, three-coin, or daily), read the result through the classical body/use rules, and browse all sixty-four hexagrams with a ganzhi almanac | [weekbin](https://github.com/weekbin) |
| [Session Trajectory](plugins/avatasia/mmc-trajectory/) | Browse a conversation's model trajectory: messages, reasoning, tool calls and results, Token usage, and per-turn timing | [avatasia](https://github.com/avatasia) |
| [CadQuery Viewer](plugins/hanzijie/cq-viewer/) | View STL / STEP models from your project (STEP keeps assembly part names, colours, and real CAD edges), watch models pushed from CadQuery scripts, and mark positions on the model to send to the conversation in one click; MCP tools let the AI add model folders and open models, and a CadQuery parametric-design skill is bundled | [HanZijie](https://github.com/HanZijie) · [flowful-ai](https://github.com/flowful-ai) |
| [Text Editor](plugins/trentchou/text-editor/) | A Sublime-style text editor you share live with the Agent: it reads, edits, and saves the same buffers you see, and highlights code with notes during reviews without touching the file | [TrentChou](https://github.com/TrentChou) |

<details>
<summary>Preview: Token Usage Board</summary>
Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ MiniMax Code Agent 通过宿主 MCP 客户端与 MiniApp 协作。业务请求
| [灵签易占](plugins/weekbin/chinese-divination/README.zh-CN.md) | 梅花易数起卦与解卦:时间、数字、铜钱摇卦、每日一卦四法起卦,按体用生克断吉凶,另备六十四卦全文与干支历法 | [weekbin](https://github.com/weekbin) |
| [会话轨迹](plugins/avatasia/mmc-trajectory/README.zh-CN.md) | 按轮次浏览一段会话的模型轨迹:消息流、思考过程、工具调用与结果、token 用量与每轮耗时 | [avatasia](https://github.com/avatasia) |
| [CadQuery Viewer](plugins/hanzijie/cq-viewer/README.zh-CN.md) | 本地查看项目里的 STL / STEP(保留装配零件名称、颜色和真实边线),实时显示 CadQuery 脚本推送的模型,在模型上标注位置后一键发给 AI;AI 可通过 MCP 工具添加模型文件夹、打开模型,并内置 CadQuery 参数化建模 skill | [HanZijie](https://github.com/HanZijie) · [flowful-ai](https://github.com/flowful-ai) |
| [文本编辑器](plugins/trentchou/text-editor/README.zh-CN.md) | 与 Agent 实时共享的 Sublime 风格文本编辑器:Agent 读写、保存的就是你眼前的缓冲区;Review 时可以高亮代码并附上注释,不会改动文件 | [TrentChou](https://github.com/TrentChou) |

<details>
<summary>预览:Token 用量看板</summary>
Expand Down
23 changes: 23 additions & 0 deletions plugins/trentchou/text-editor/.minimax-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"schemaVersion": 1,
"name": "text-editor",
"displayName": "文本编辑器",
"version": "1.3.1",
"description": "Sublime 风格的本地文本编辑器:多标签、快速打开、语法高亮、JSON/YAML/TOML 折叠、多光标。Agent 可通过 MCP 工具与你共同读写、创建和保存同一份文件,并在 Review 时高亮代码、附上注释(只叠加显示,不改文件)。",
"author": "TrentChou",
"icon": "icon.png",
"category": "Code",
"exampleQueries": [
"打开文本编辑器,加载当前项目",
"把编辑器里我正在看的 YAML 改成两空格缩进,然后保存",
"Review 一下当前文件,把有问题的地方在编辑器里高亮出来并写上原因"
],
"apps": [],
"mcpServers": [
"servers.mcp.json"
],
"skills": [],
"hooks": [
"hooks/hooks.json"
]
}
25 changes: 25 additions & 0 deletions plugins/trentchou/text-editor/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
MIT License

Copyright (c) 2026 TrentChou

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Third-party code and fonts bundled in this package keep their own licenses; see
miniapp/client/vendor/THIRD_PARTY_LICENSES.txt,
miniapp/node/vendor/THIRD_PARTY_LICENSES.txt, and miniapp/client/fonts/OFL.txt.
115 changes: 115 additions & 0 deletions plugins/trentchou/text-editor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Text Editor

[简体中文](README.zh-CN.md) | English

A Sublime-style local text editor that you and the MiniMax Code Agent work in together. Both of you edit
the same live buffers: the Agent reads, edits, creates, and saves files through MCP tools while you see
every change as it happens, and during a code review it can highlight code and attach notes that never
touch the file.

Author: [TrentChou](https://github.com/TrentChou) · Version: `1.3.1`

![Text Editor with Agent review highlights (synthetic code)](docs/preview.jpg)

## Install & use

1. Copy this directory, including the hidden `.minimax-plugin/`, to `<dataDir>/plugins/text-editor/`
(`~/.minimax/plugins/text-editor/` by default), then restart MiniMax Code.
2. Open it from the right panel's "+" menu, `@文本编辑器` in a conversation, or ask the Agent to
"打开文本编辑器,加载当前项目".
3. Add folders to the sidebar, or let the Agent add the conversation's workspace. The Agent sees the
editor's MCP tools from the next conversation turn after installation.

The interface is in Chinese.

## Features

- Tabs, sidebar file tree, quick open (`⌘P`), go to line (`⌃G`), command palette (`⇧⌘P`), find and
replace, multiple cursors (`⌘D`, `⇧⌘L`), folding, minimap, indentation guides.
- Syntax highlighting for about 40 languages and formats, including JSON, YAML, TOML, Markdown,
JavaScript/TypeScript, Python, Go, Rust, Java, C/C++, SQL, and shell.
- Hot exit: unsaved edits survive closing the page and restarting MiniMax Code.
- Disk awareness: files changed by other programs reload automatically, or show a conflict banner when
you have unsaved edits; deleted files can be re-created by saving.
- Follows your conversations: when the editor opens, the workspace of the conversation you most recently
used moves to the top of the sidebar.

## Agent tools (MCP)

| Tool | What it does |
| --- | --- |
| `get_editor_state` | Sidebar folders, open tabs (unsaved/conflict flags, highlight counts), active file, the user's selection, highlight settings |
| `list_directory` | List a folder inside the sidebar folders |
| `read_file` | Read a file; returns the live buffer, including unsaved edits, when it is open |
| `create_file` | Create a file and open it in a tab |
| `write_file` / `edit_file` | Replace content, or an exact snippet, in the buffer the user sees; stays unsaved unless `save: true` |
| `save_file` | Save a buffer; refuses to overwrite changes made on disk by other programs unless told to |
| `open_in_editor` | Open a file at a line, or add a folder to the sidebar |
| `highlight_code` | Highlight lines, a character range, or an exact snippet, with an optional note and kind (`info`, `warning`, `error`, `success`) |
| `list_highlights` / `clear_highlights` | See which highlights remain (users can dismiss them) and remove them |

The tools only reach files inside the sidebar folders, and they refuse credential-like files such as
`.env`, `.secrets/`, `.ssh/`, and private keys. You can still open those yourself.

## Review highlights

Highlights are overlays: they never change the buffer or the file on disk. Each one follows the code as
it is edited, and a note appears as a card under the highlighted code. Press `F8` / `⇧F8` to jump between
highlights; the status bar shows the count and opens a menu.

You control their lifetime, from the status bar menu or Settings:

- **Keep highlights until cleared** (off by default). When off, a highlight disappears as soon as its
code is edited (by you, the Agent, or a reload from disk; edits right at its edges count too) or its
file is closed. When on, highlights stay, also across restarts, until you or the Agent
clear them; if the file changed while it was closed, a highlight is re-anchored to its unchanged code,
or dropped with a notice if that code was rewritten.
- **Show Agent highlights** hides or shows them without deleting anything.

Dismiss a single note with its ×, or clear the current file or everything from the status bar menu.

## Data & access

- **Files read:** files you open and files inside the folders you add to the sidebar. Open files are
checked with `stat` every 1.5 seconds to detect changes made by other programs.
- **Files written:** only when you or the Agent save (`⌘S`, `save_file`, or `save: true`) or create a
file or folder. Saving writes a temporary file (`.<name>.<pid>.<n>.tmp`) in the same directory as the
target, copies the original permission bits, then renames it over the target. Symbolic links are
followed, so the link stays a link and its target is updated. Hard links to the old file keep the old
content, and extended attributes are not copied. If the directory is not writable but the file is,
the file is written in place instead. New files are created exclusively and never overwrite an
existing file. Highlights never write anything to your files.
- **State** (under the Mini App data directory): `state.json` (sidebar folders, tabs, settings), `hot/`
(unsaved buffers for hot exit), `drafts/` (the default 草稿 folder), and `highlights.json` (only while
"keep highlights" is on; removed when it is turned off).
- **Hooks:** on `SessionStart` and `UserPromptSubmit`, `hooks/record-workspace.sh` (or
`record-workspace.ps1` on Windows) writes the conversation's workspace path to
`<PLUGIN_DATA>/active-workspace`. It reads nothing else and prints nothing. The editor reads that file
from the hook data directory next to its own data directory.
- **Processes:** `git -C <sidebar folder> ls-files -co --exclude-standard -z` (arguments passed as an
array, 5-second timeout) to build the quick-open list; without Git it walks the folder instead,
skipping `node_modules`, build outputs, and similar directories. The hooks run `sh` or `powershell`.
- **Network:** none. The page and the MCP endpoint are served only on the Host-assigned
`127.0.0.1` port; cross-site requests and MCP calls from other web origins are rejected.

## Tested environment

- MiniMax Code 3.1.1 on macOS 26.5 (Apple silicon): installed, opened, and used through the page and
through the Agent's MCP tools in a real conversation, in light and dark themes.
- An isolated runtime test covers the highlight tools, edit mapping, both lifetimes, restart recovery,
external changes while a file is closed, and atomic saves (permission bits, symlinks, no leftover
temporary files, read-only directories).
- Windows and Linux are untested; the Windows hook script has not been run.

## Building the vendored code

`miniapp/client/vendor/codemirror.js` and `miniapp/node/vendor/cm-state.mjs` are prebuilt bundles of
CodeMirror 6. To rebuild them: `cd vendor-src && npm ci && node build.mjs ../miniapp`. Versions are
pinned in `vendor-src/package-lock.json`.

## License

[MIT](./LICENSE). Bundled third-party code keeps its own licenses: CodeMirror 6, Lezer, and the minimap
and indentation-marker extensions (MIT, see `miniapp/client/vendor/THIRD_PARTY_LICENSES.txt` and
`miniapp/node/vendor/THIRD_PARTY_LICENSES.txt`), and JetBrains Mono (SIL Open Font License 1.1, see
`miniapp/client/fonts/OFL.txt`).
73 changes: 73 additions & 0 deletions plugins/trentchou/text-editor/README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 文本编辑器

[English](README.md) | 简体中文

一个 Sublime 风格的本地文本编辑器,由你和 MiniMax Code 的 Agent 一起使用。双方编辑的是同一份实时缓冲区:Agent 通过 MCP 工具读取、修改、新建和保存文件,你能实时看到每一处改动。Review 代码时,Agent 还可以高亮代码并附上注释,这些都不会写进文件。

作者:[TrentChou](https://github.com/TrentChou) · 版本:`1.3.1`

![带有 Agent 评审高亮的文本编辑器(合成代码)](docs/preview.jpg)

## 安装与使用

1. 把整个目录(包括隐藏的 `.minimax-plugin/`)复制到 `<dataDir>/plugins/text-editor/`(默认是 `~/.minimax/plugins/text-editor/`),然后重启 MiniMax Code。
2. 从右侧面板的「+」打开,或在对话里 `@文本编辑器`,也可以直接对 Agent 说「打开文本编辑器,加载当前项目」。
3. 在侧边栏添加文件夹,或者让 Agent 把当前对话的工作区加进来。安装之后,从下一轮对话开始,Agent 就能使用编辑器的 MCP 工具。

## 功能

- 多标签、侧边栏文件树、快速打开(`⌘P`)、跳转到行(`⌃G`)、命令面板(`⇧⌘P`)、查找替换、多光标(`⌘D`、`⇧⌘L`)、代码折叠、小地图、缩进参考线。
- 约 40 种语言和格式的语法高亮,包括 JSON、YAML、TOML、Markdown、JavaScript/TypeScript、Python、Go、Rust、Java、C/C++、SQL、Shell 等。
- 热退出:关闭页面或重启 MiniMax Code 后,未保存的修改仍然保留。
- 感知磁盘变化:其他程序修改了文件时自动重新加载;如果你也有未保存的修改,会提示冲突。被删除的文件保存后会重新创建。
- 跟随对话:打开编辑器时,你最近使用的对话的工作区会排到侧边栏最上方。

## Agent 工具(MCP)

| 工具 | 作用 |
| --- | --- |
| `get_editor_state` | 侧边栏文件夹、已打开的标签(未保存/冲突标记、高亮数)、当前文件、用户选区、高亮设置 |
| `list_directory` | 列出侧边栏文件夹内的目录 |
| `read_file` | 读取文件;文件已打开时返回实时缓冲区,包括未保存的修改 |
| `create_file` | 新建文件并在标签中打开 |
| `write_file` / `edit_file` | 替换用户看到的缓冲区的全部内容或一段精确文本;除非传 `save: true`,否则保持未保存 |
| `save_file` | 保存缓冲区;如果磁盘上的文件已被其他程序修改,除非明确要求,否则拒绝覆盖 |
| `open_in_editor` | 打开文件并跳到指定行,或把文件夹加入侧边栏 |
| `highlight_code` | 按行、字符范围或精确片段高亮代码,可附带注释和类型(`info`、`warning`、`error`、`success`) |
| `list_highlights` / `clear_highlights` | 查看还存在哪些高亮(用户可以自行关掉),以及清除高亮 |

这些工具只能访问侧边栏文件夹内的文件,并且拒绝读写 `.env`、`.secrets/`、`.ssh/`、私钥等凭据类文件。这类文件你仍然可以自己打开。

## Review 高亮

高亮只是叠加显示,不会修改缓冲区或磁盘上的文件。代码被编辑时,高亮会跟着移动;注释以卡片形式显示在被高亮的代码下面。按 `F8` / `⇧F8` 在高亮之间跳转,状态栏会显示高亮数,点击可以打开菜单。

高亮的生命周期由你决定,可以在状态栏菜单或设置里切换:

- **保留高亮,直到手动清除**(默认关闭):关闭时,被高亮的代码一旦被编辑(你改、Agent 改、从磁盘重新加载都算,紧贴边缘的修改也算),或者文件被关闭,这处高亮就自动消失。打开时,高亮会一直保留,重启后也在,直到你或 Agent 清除;如果文件在关闭期间被改过,高亮会重新定位到原样未变的代码上,那段代码被改写时则失效并提示你。
- **显示 Agent 高亮**:只控制显示或隐藏,不会删除任何高亮。

单条注释可以点它的 × 关掉,也可以从状态栏菜单清除当前文件或全部高亮。

## 数据与访问

- **读取的文件**:你打开的文件,以及你加入侧边栏的文件夹内的文件。已打开的文件每 1.5 秒 `stat` 一次,用来发现其他程序做的修改。
- **写入的文件**:只在你或 Agent 保存(`⌘S`、`save_file` 或 `save: true`)以及新建文件、文件夹时写入。保存时先在目标所在目录写一个临时文件(`.<文件名>.<pid>.<序号>.tmp`),复制原文件的权限位,再重命名覆盖目标。软链接会被跟随:链接本身保持不变,更新的是它指向的目标。指向旧文件的硬链接会保留旧内容,扩展属性不会复制。如果目录不可写但文件可写,会改为直接覆盖写入。新建文件采用独占方式创建,不会覆盖已有文件。高亮不会向你的文件写入任何内容。
- **状态**(存放在 Mini App 数据目录):`state.json`(侧边栏文件夹、标签、设置)、`hot/`(热退出用的未保存内容)、`drafts/`(默认的「草稿」文件夹)、`highlights.json`(只在开启「保留高亮」时存在,关闭后删除)。
- **Hook**:在 `SessionStart` 和 `UserPromptSubmit` 时,`hooks/record-workspace.sh`(Windows 上是 `record-workspace.ps1`)把当前对话的工作区路径写入 `<PLUGIN_DATA>/active-workspace`,不读取其他内容,也不输出任何东西。编辑器从自己数据目录旁边的 Hook 数据目录读取这个文件。
- **子进程**:执行 `git -C <侧边栏文件夹> ls-files -co --exclude-standard -z`(参数以数组传递,超时 5 秒)生成快速打开列表;没有 Git 时改为遍历目录,跳过 `node_modules`、构建产物等目录。Hook 会运行 `sh` 或 `powershell`。
- **网络**:无。页面和 MCP 端点只在宿主分配的 `127.0.0.1` 端口上提供服务,跨站请求和来自其他网页来源的 MCP 调用都会被拒绝。

## 测试环境

- macOS 26.5(Apple 芯片)上的 MiniMax Code 3.1.1:完成安装、打开,在亮色和暗色主题下通过页面使用,并在真实对话中通过 Agent 的 MCP 工具使用。
- 隔离的运行时测试覆盖了:高亮工具、编辑后的位置映射、两种生命周期、重启后恢复、文件关闭期间的外部修改,以及原子保存(权限位、软链接、不残留临时文件、只读目录)。
- 未在 Windows 和 Linux 上测试,Windows 的 Hook 脚本也没有实际运行过。

## 构建内置的第三方代码

`miniapp/client/vendor/codemirror.js` 和 `miniapp/node/vendor/cm-state.mjs` 是预先构建好的 CodeMirror 6 包。重新构建方法:`cd vendor-src && npm ci && node build.mjs ../miniapp`。版本锁定在 `vendor-src/package-lock.json`。

## 许可证

[MIT](./LICENSE)。内置的第三方代码沿用各自的许可证:CodeMirror 6、Lezer、小地图与缩进参考线扩展(MIT,见 `miniapp/client/vendor/THIRD_PARTY_LICENSES.txt` 和 `miniapp/node/vendor/THIRD_PARTY_LICENSES.txt`);JetBrains Mono(SIL Open Font License 1.1,见 `miniapp/client/fonts/OFL.txt`)。
Binary file added plugins/trentchou/text-editor/docs/preview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions plugins/trentchou/text-editor/hooks/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "sh \"${PLUGIN_ROOT}/hooks/record-workspace.sh\"",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\hooks\\record-workspace.ps1\"",
"timeout": 3
}
]
}
],
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "sh \"${PLUGIN_ROOT}/hooks/record-workspace.sh\"",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\hooks\\record-workspace.ps1\"",
"timeout": 3
}
]
}
]
}
}
Loading
Loading