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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ The MiniMax Code Agent communicates through the host MCP client. Business reques

| MiniApp | What it does | Author |
| --- | --- | --- |
| [道闸运维知识助手](plugins/yakuyama1979-art/daozha-ops-knowledge-assistant/) | Run a local-model operations console: ingest manuals into a searchable knowledge base, answer with cited standard answers and analysis, and turn plain-language change requests into reviewable SEARCH/REPLACE patches with unified diff, automatic backup and rollback | [yakuyama1979-art](https://github.com/yakuyama1979-art) |
| [道闸运维知识助手](plugins/pendingauthor/daozha-ops-knowledge-assistant/) | Run a local-model operations console: ingest manuals into a searchable knowledge base, answer with cited standard answers and analysis, and turn plain-language change requests into reviewable SEARCH/REPLACE patches with unified diff, automatic backup and rollback | [pendingauthor](https://github.com/pendingauthor) |
| [DeepSeek Chat Migration](plugins/danielwalnut/deepseek-chat-migration/) | Preview official DeepSeek web exports locally, restore branches and attachments, and import selected conversations as native MiniMax Code sessions with a bundled importer | [DanielWalnut](https://github.com/DanielWalnut) |
| [OpenFilm](plugins/cristinamadureira353-svg/openfilm/) | Run OpenFilm inside MiniMax Code with the desktop interface: Studio editor, chat column and local agents, with a web-Studio fallback | [最爱双皮奶](https://github.com/cristinamadureira353-svg) |
| [Dynamic Workflow Console](plugins/stevenjj33/workflow-console/) | Run and supervise MiniMax Code dynamic workflows from one page: live status, a stage-and-dependency flow graph, per-node output, approval and control, templates, and report export | [stevenjj33](https://github.com/stevenjj33) |
Expand Down
2 changes: 2 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ MiniMax Code Agent 通过宿主 MCP 客户端与 MiniApp 协作。业务请求

| MiniApp | 功能 | 作者 |
| --- | --- | --- |
| [道闸运维知识助手](plugins/yakuyama1979-art/daozha-ops-knowledge-assistant/) | 本地模型驱动的运维控制台:投喂资料建知识库、带来源的标准答案与解析、可审阅的 SEARCH/REPLACE 补丁与 unified diff、自动备份与回滚 | [yakuyama1979-art](https://github.com/yakuyama1979-art) |
| [道闸运维知识助手](plugins/pendingauthor/daozha-ops-knowledge-assistant/) | 本地模型驱动的运维控制台:投喂资料建知识库、带来源的标准答案与解析、可审阅的 SEARCH/REPLACE 补丁与 unified diff、自动备份与回滚 | [pendingauthor](https://github.com/pendingauthor) |
| [DeepSeek 会话迁移](plugins/danielwalnut/deepseek-chat-migration/README_ZH.md) | 在本机预览 DeepSeek 网页版官方导出包,恢复分支和附件,并用自带的导入脚本把选中对话导入成 MiniMax Code 原生会话 | [DanielWalnut](https://github.com/DanielWalnut) |
| [OpenFilm](plugins/cristinamadureira353-svg/openfilm/) | 把 OpenFilm 装进 MiniMax Code:桌面版界面(Studio 编辑器 + 聊天栏 + 本地 agent),桌面模式不可用时回落网页版 | [最爱双皮奶](https://github.com/cristinamadureira353-svg) |
| [动态工作流控制台](plugins/stevenjj33/workflow-console/README.zh-CN.md) | 在一个页面里运行并盯住 MiniMax Code 动态工作流:实时状态、按阶段与依赖画出的流程图、节点输出、审核与控制、模板与报告导出 | [stevenjj33](https://github.com/stevenjj33) |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"schemaVersion": 1,
"name": "daozha-ops-knowledge-assistant",
"displayName": "道闸运维知识助手",
"version": "1.0.0",
"description": "Local-model operations console: ingest manuals into a searchable knowledge base, answer with cited standard answers and analysis, and turn plain-language change requests into reviewable SEARCH/REPLACE patches with unified diff, automatic backup and rollback.",
"author": "yakuyama1979-art",
"icon": "icon.png",
"category": "Business",
"exampleQueries": [
"打开道闸运维知识助手",
"投喂道闸售后运维规则手册并回答质保期问题"
],
"apps": [],
"mcpServers": [],
"skills": []
}
21 changes: 21 additions & 0 deletions plugins/yakuyama1979-art/daozha-ops-knowledge-assistant/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 yakuyama1979-art

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.
148 changes: 148 additions & 0 deletions plugins/yakuyama1979-art/daozha-ops-knowledge-assistant/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# 道闸运维知识助手

A local-model operations console for barrier-gate / access-control after-sales teams.

Feed it your own manuals, rule sheets and contracts and it builds a searchable local knowledge
base. Ask a question and it returns a **standard answer with its analysis, a confidence score and
the exact source chunks it used**. Ask it to change a piece of code in plain language and it
returns a reviewable `SEARCH`/`REPLACE` patch plus a unified diff — the file is backed up before
anything is written, and any change can be rolled back from the same panel.

Everything that needs understanding, judgement or generation calls a real model. There are no
canned answers, no keyword matching and no fixed scoring: the local model does the work, and the
page only renders what the model returned.

## What it does

| Panel | What it does |
| --- | --- |
| 知识库 / Knowledge base | Ingests `.txt`, `.md`, `.docx`, `.xlsx` and `.pdf` files, tags each with a category (知识点 / 规则 / 合同 / 其他), asks the model for a title, a summary and the key points, splits the text into chunks and stores one `bge-m3` embedding per chunk. |
| 运维问答 / Ops Q&A | Embeds the question, retrieves the top-k chunks by cosine similarity, and asks the model for a standard answer, an analysis, a confidence score and the gaps the material does not cover. Returns every retrieved source with its score. |
| AI 改代码 / AI code edit | Locates the region to change, asks the model for `SEARCH`/`REPLACE` blocks, requires each `SEARCH` block to match the file **exactly once**, and shows a unified diff before anything is written. Files above 12 000 characters go through a two-stage flow (model locates the region, then the patch is generated inside a bounded window). |
| 部署 / Deploy | Runs a deployment command that you saved in the settings, in a working directory that must sit inside an allowed write root, and keeps the exit code, stdout and stderr of every run. |
| 路由与设置 / Routing & settings | Switches the routing mode, and holds the allowed write roots, the material directories, the backup root and the deployment commands. |

## Model routing

The app can run entirely on your own machine, entirely on the Host's online model, or mix the
two. Four modes are available in **路由与设置**:

| Mode | Behaviour |
| --- | --- |
| `auto` | Picks a route per request from the size of the prompt and the local model's context window. If the request is too large for the local window it starts with the online model and degrades back to local; otherwise it starts local and degrades to online. |
| `local_first` | Always tries the local model first, degrades to the online model when the local call fails. |
| `local_only` | Local only. Never calls the online model. |
| `online_only` | Online only. Never calls the local model. |

Degradation works in both directions and is always reported: every answer and every patch shows
the route that was requested, the route that was actually used, the model that served it and the
reason. `local_only` and `online_only` never degrade.

Local models come from [Ollama](https://ollama.com) on `http://127.0.0.1:11434` (the base URL is
configurable). The app prefers a chat model whose name starts with `qwen3:14b`; otherwise it
picks the largest available chat model, or falls back to the first one. The context window is
fixed by the model's size: **14B-class models get 8 192 tokens, smaller models get 16 384**.

The embedding model is always `bge-m3` and never participates in routing — retrieval quality does
not depend on which chat model answered the question.

The "online" route is the Host's own Agent channel (`context.agent`). It is used for a single
scoped JSON reply, with no file, tool or network access of its own.

## Install and open it

1. Install the plugin package (this directory) in MiniMax Code.
2. Start [Ollama](https://ollama.com) and pull the models you want to use:
```bash
ollama pull qwen3:14b
ollama pull bge-m3
```
3. Open the app and go to **路由与设置**:
- **允许写入的目录** — the roots the AI code editor may write to. Nothing outside these roots
can be modified; a target outside them is rejected with an explicit error.
- **资料目录** — the roots that may be browsed and ingested from disk.
- **备份根目录** — where backups are written. Each patch application creates
`<backup root>/<timestamp>/` holding the original file, a `manifest.json` that maps the backup
file name to its original path, and a `record.json` with the patch and hash details.
- **部署命令** — the commands the deploy panel may run.
4. Pick a routing mode and start ingesting material.

The panel headings are in Chinese because this is the app's original product language; the
README, the plugin manifest and the code comments are in English.

## Backup and rollback

Applying a patch never overwrites a file silently:

1. The original file is copied into a new timestamped directory under the backup root.
2. `manifest.json` maps `<backup file name>` → `<original absolute path>`.
3. `record.json` stores the patch, the unified diff, the SHA-256 of the file before and after,
and the status.
4. The new content is written atomically.

The backup list in the **AI 改代码** panel lists every recorded operation. **回滚** restores the
file from its backup and verifies the result against the stored hash. Backups written by an
earlier tool with the same `manifest.json` layout are listed and can be rolled back too.

## Safety properties

- Writes are confined to the configured write roots. The check resolves the real path, so a
symlink cannot be used to escape a root.
- Only text formats on the editable-extension list can be patched.
- A patch is applied only when every `SEARCH` block matches the current file **exactly once**; a
non-unique or stale match is refused and the model is asked again.
- The deploy panel can only run commands that are already saved in the settings — there is no
free-text command field on a single request — and each command's working directory must be
inside an allowed write root.
- Secrets never reach the page: the page talks to the Node service over narrow business routes
and no model call happens in the browser.

## Tested environment

- MiniMax Code 3.1.19 on Windows 11 (build 26300).
- The package declares `agentAccess: ["session.run"]` and `surface.window`, so it needs
**MiniMax Code 3.1.2 or later**.
- Client acceptance exercised in the in-app Browser: ingesting a `.txt` operations manual
(model summary, `bge-m3` index, 1 chunk), asking a warranty-period question (standard answer,
analysis, confidence, cited source with its similarity score, routing decision), previewing a
patch (unique `SEARCH` match and a correct unified diff), applying it (backup directory with
`manifest.json`, before/after SHA-256), rolling it back (file restored, status updated),
running a deployment command (exit code and output captured), switching the routing mode
(persisted and restored), and rejecting a write outside the allowed roots. The console reported
no errors and no failed requests.
- The Node-side test suite additionally covered `.docx`, `.xlsx`, `.pdf` (ASCII and Chinese text
via `ToUnicode`), GBK-encoded text and a corrupt file, all against a real local Ollama.

## Data & access

- **Files read** — files the user uploads in the page (`.txt`, `.md`, `.docx`, `.xlsx`, `.pdf`),
files browsed under the configured material directories, and the target source file of a patch
request (which must sit inside an allowed write root).
- **Files written** — the patched target file; the backup copy, `manifest.json` and `record.json`
under the configured backup root; and the Mini App's own state (see below).
- **Network hosts** — the local Ollama server at `http://127.0.0.1:11434` (configurable base URL),
used for `/api/tags`, `/api/chat` and `/api/embed`. No other outbound request is made by this
package.
- **Spawned processes** — the deployment commands the user saved in the settings, each started with
`shell: true` in its configured working directory; on Windows the process tree is terminated with
`taskkill` when the app is disposed.
- **Agent turns** — `context.agent.run` is used for the "online" route, one scoped JSON reply per
request, with no file, tool or network access granted to that turn.
- **Conversations read** — none. The package does not declare `session.read` and never lists or
observes the user's conversations.
- **Tools called** — none. The package does not declare `toolAccess` and never calls a Connector
or MCP tool.
- **Microphone / camera / notifications** — none. `deviceAccess` is not declared and the page
requests no browser permission.
- **Host navigation read** — none. `hostAccess` is not declared; the page only follows the Host's
light/dark theme, which needs no grant.
- **Where state is stored** — in the Host's private `context.dataDir`: `kb/` holds the ingested
chunks, their embeddings and the document records, `patches/` holds the pending patch payloads,
`settings.json` holds the routing mode, the roots, the backup root and the deployment commands,
and `deploy-logs.json` holds the recent deployment logs. The page keeps only its current view
state in `localStorage`. The package reads no Host file and no runtime state outside
`context.dataDir`.

## License

MIT. See [LICENSE](LICENSE).
Loading