Skip to content

Commit 26e403e

Browse files
committed
fix(minimax-bot): 队列只从成员表出,管理员不在表里也有成员接话
2 parents bb2428f + 53364ee commit 26e403e

15 files changed

Lines changed: 147 additions & 603 deletions

File tree

‎plugins/antianqi/mmx-octopus/.minimax-plugin/plugin.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
"schemaVersion": 1,
33
"name": "mmx-octopus",
44
"displayName": "MMX 章鱼娘",
5-
"version": "1.6.0",
5+
"version": "1.7.0",
66
"description": "桌面上的 MMX 章鱼娘 —— MMX Agent 的可视化身体,也是你自己的专属聊天对象。她会反映 Agent 正在思考还是正在干活,还能被 Agent 和技能通过托管 MCP 直接指挥说话、换表情、挪位置。权限说明:本插件会读取你每个对话每轮的最终回复、标题与运行状态,用来判断 Agent 正在思考还是已经完成,并在你主动问她时用她自己的固定会话跑一轮 Agent,把回答直接说出来;她的对话历史只存在本机。",
77
"author": "antianqi",
88
"icon": "icon.png",
99
"category": "Productivity",
1010
"exampleQueries": [
1111
"跟章鱼娘聊两句",
1212
"让章鱼娘说句话",
13-
"把章鱼娘浮到桌面右下角",
14-
"看看章鱼娘现在什么状态"
13+
"把章鱼娘浮到桌面右下角"
1514
],
1615
"apps": [],
1716
"mcpServers": ["servers.mcp.json"],

‎plugins/antianqi/mmx-octopus/README.md‎

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ doing, and the Agent can tell her what to say.*
55

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

8-
Author: [antianqi](https://github.com/antianqi) · Version: `1.6.0` ·
8+
Author: [antianqi](https://github.com/antianqi) · Version: `1.7.0` ·
99
Plugin ID: `mmx-octopus` · Category: `Productivity`
1010

1111
*The app interface is in Chinese.*
@@ -110,40 +110,28 @@ it like the rest of the port.
110110
`context.pluginRoot`: `miniapp/node/identity/AGENTS.md` and
111111
`miniapp/node/identity/STORY.md` (who she is), plus the page assets under
112112
`miniapp/client/`.
113-
- **And one file of the Host's** — to keep the name in the Host's agent list in sync
114-
with the name set in the panel, the runtime rewrites the `displayName:` line in the
115-
frontmatter of the `agent.md` of **the agent that has this Mini App installed** —
116-
the one whose folder contains `miniapps/<plugin-id>`. It never goes looking for
117-
other agents' files: it does not walk up the directory tree for an `agent.md`, and
118-
it leaves every other agent's file alone. The `agents` folder is derived from this
119-
package's own data directory rather than a hard-coded home path. **This still
120-
relies on the Host's on-disk layout, which is not a documented API.**
121-
- **What it writes** — four JSON files under `context.dataDir`, the private
122-
directory the Host creates for this plugin: `context.dataDir/state.json` (her
123-
expression, position, bubble and the Agent's busy state),
124-
`context.dataDir/chat.json` (your chat with her),
113+
- **What it writes** — and **nothing else**. Four JSON files under
114+
`context.dataDir`, the private directory the Host creates for this plugin:
115+
`context.dataDir/state.json` (her expression, position, bubble and the Agent's
116+
busy state), `context.dataDir/chat.json` (your chat with her),
125117
`context.dataDir/diary.json` (her diary) and `context.dataDir/style.json`
126118
(how she has learned to write). Every write is atomic — a temporary file in
127119
the same directory, then a rename — so a crash cannot leave a half-written
128-
file behind.
129-
- **The two writes outside that folder** —
130-
- **`AGENTS.md` in the workspace directory of her own Agent session.** She keeps
131-
her identity there. The Host re-reads that file every turn and puts it into the
132-
system prompt, which is why her identity survives context compaction. It is
133-
written atomically (a temporary file in the same directory, then a rename) and
134-
only when its content differs from the template shipped in this package — so **a
135-
hand edit to it is lost on the next turn**. It belongs to this Mini App's own
136-
agent workspace. It is written **only when that workspace is this package's own
137-
`miniapps/<plugin-id>` folder**; if the Host resolves some other agent for her
138-
and the workspace turns out to be a real project, the file is **not** written and
139-
her identity is passed in the message instead — so a project's own `AGENTS.md`
140-
is never overwritten.
141-
- **The `displayName:` line in the frontmatter of that agent's `agent.md`**, so the
142-
name in the Host's agent list follows the name set in the panel. Only that one
143-
line is rewritten — the rest of the file is kept verbatim, and nothing is
144-
written when the file has no frontmatter. It is written when the name changes;
145-
the candidate files are tried in order and the runtime stops at the first one it
146-
can use.
120+
file behind. **No file outside `context.dataDir` is ever written**: not the
121+
Host's `agent.md`, not the `AGENTS.md` of the agent's workspace, nothing else.
122+
- **Leftovers from earlier versions** — versions before 1.7.0 wrote an `AGENTS.md`
123+
into the workspace of the agent that has this Mini App installed, to carry her
124+
identity there. That is no longer written and no longer needed. If you are
125+
upgrading from an earlier version the old file may still be there
126+
(`agents/<agent>/miniapps/<plugin-id>/AGENTS.md`) and you can delete it — the
127+
runtime never touches it, because a plugin must not write outside its own
128+
data directory.
129+
- **How her identity reaches her** — in the message, every turn. Her character
130+
sheet (who she is, what she looks like, her rules) is read from this package's
131+
own `miniapp/node/identity/AGENTS.md` and passed inside each prompt, so no
132+
file has to be written for it. Because it travels in the conversation, the
133+
Host's context compaction may drop it — that is why it is sent again every
134+
turn.
147135
- **Sessions read** — the package declares `session.read`. It reads the title,
148136
the running state and the final reply of a turn, to tell whether the Agent is
149137
thinking or has finished, and to summarise the turn. The board in the panel
@@ -156,9 +144,11 @@ it like the rest of the port.
156144
none. It never runs turns on your own sessions.
157145
- **Agent turns it starts on its own** — besides your messages, the runtime starts
158146
a few turns by itself, and **each of them uses your model quota**:
159-
- **Idle talk** — after 20 minutes of quiet she may start a conversation of her
160-
own; at most 2 turns an hour, and at least 45 minutes apart. **Turn it off in
161-
the panel**: Settings → 「她没人的时候自己说话」 ("She talks when you are away").
147+
- **Idle talk** — **off by default**; turn it on in the panel: Settings →
148+
「她没人的时候自己说话」 ("She talks when you are away"). Once on, after 20
149+
minutes of quiet she may start a conversation of her own; at most 2 turns an
150+
hour, and at least 45 minutes apart. The same switch turns those turns off
151+
again.
162152
- **A diary entry** — after a chat, if today has no entry yet, she writes one.
163153
- **Style learning** — after a chat, your recent chat lines are sent to the model
164154
so she can pick up how you write.

‎plugins/antianqi/mmx-octopus/README.zh-CN.md‎

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

7-
作者:[antianqi](https://github.com/antianqi) · 版本:`1.6.0` ·
7+
作者:[antianqi](https://github.com/antianqi) · 版本:`1.7.0` ·
88
插件 ID:`mmx-octopus` · 分类:`Productivity`
99

1010
## 它做什么
@@ -87,28 +87,20 @@ English | [简体中文](README.zh-CN.md)
8787
- **读什么** —— 读这个包自己的文件,从 `context.pluginRoot` 读:
8888
`miniapp/node/identity/AGENTS.md` 和 `miniapp/node/identity/STORY.md`(她是谁),
8989
以及 `miniapp/client/` 下的页面素材。
90-
- **外加宿主的一个文件** —— 为了让宿主 agent 列表里的名字跟着面板里设的名字走,
91-
运行时会改写「**装了本 Mini App 的那个 agent**」(也就是它的目录里含
92-
`miniapps/<plugin-id>` 的那个)的 `agent.md` 里 frontmatter 的 `displayName:` 那一行。
93-
它**不会满世界找别人的 agent 文件**:不往目录树上翻 `agent.md`,也不碰别的 agent 的文件。
94-
`agents` 目录由本包自己的数据目录推出来,不是写死的家目录路径。
95-
⚠️ **这依赖宿主的磁盘布局,而它不是有文档的 API。**
96-
- **写什么** —— `context.dataDir` 下四个 JSON 文件,也就是宿主给这个包建的私有目录:
97-
`context.dataDir/state.json`(她的表情、位置、气泡,以及 Agent 忙不忙)、
98-
`context.dataDir/chat.json`(你和她的聊天)、
90+
- **写什么** —— 而且**只写这些**。`context.dataDir` 下四个 JSON 文件,也就是宿主给这个包建的私有目录:
91+
`context.dataDir/state.json`(她的表情、位置、气泡,以及 Agent 忙不忙),
92+
`context.dataDir/chat.json`(你和她的聊天),
9993
`context.dataDir/diary.json`(她的日记)、`context.dataDir/style.json`(她学到的语气)。
10094
每次落盘都是原子的 —— 先写同目录临时文件,再改名 —— 所以崩了也不会留下半个文件。
101-
- **这个目录之外的两处写** ——
102-
- **她自己 Agent 会话工作区里的 `AGENTS.md`**:她把身份放在那儿。宿主每轮重读那个文件
103-
并拼进 system prompt,所以她的身份不会被上下文压缩掉。写法是原子的(同目录临时文件 +
104-
改名),且只在内容与包里这份模板不一致时才写 —— **所以你手改它,下一轮就被覆盖**。
105-
它属于这个 Mini App 自己的 agent 工作区。
106-
⚠️ **只有工作区就是本包自己的 `miniapps/<plugin-id>` 目录时才会写它** —— 要是宿主给她
107-
解析到了别的 agent、工作区是个真实项目,那就不写,身份改成**在消息里带上**
108-
⇒ **你项目里那份 `AGENTS.md` 永远不会被覆盖**。
109-
- **那个 agent 的 `agent.md` 里 frontmatter 的 `displayName:` 那一行** ——
110-
让宿主 agent 列表里的名字跟着面板里设的名字走。**只重写那一行**,文件其余内容逐字保留;
111-
文件没有 frontmatter 就什么都不写。只在名字变了才写;候选文件按顺序试,命中第一个能用的就停。
95+
⚠️ **`context.dataDir` 之外一个文件都不写**:不改宿主的 `agent.md`,不写 agent 工作区里的
96+
`AGENTS.md`,别的更不写。
97+
- **老版本留下的东西** —— 1.7.0 之前的版本会把一份 `AGENTS.md` 写进「装了本插件的那个 agent」
98+
的工作区,用来把她的身份放在那儿。**现在不再写了,也不再需要它**。从老版本升级的话,
99+
那份文件可能还在(`agents/<agent>/miniapps/<plugin-id>/AGENTS.md`),可以直接删 ——
100+
运行时不会去动它:**插件不许写自己 dataDir 之外的文件**。
101+
- **她的身份怎么送到她那儿** —— **随消息带,每一轮都带**。她的底稿、样子和规矩从本包自己的
102+
`miniapp/node/identity/AGENTS.md` 读出来,拼进每次的提示词里,所以**不需要为此写任何文件**。
103+
⚠️ 代价:身份层走的是会话历史 ⇒ 宿主做上下文压缩时可能把它压掉(所以每轮都重发一份)。
112104
- **读哪些会话** —— 这个包声明了 `session.read`。它读一轮对话的标题、运行状态和最终回复,
113105
用来分辨 Agent 是在想还是做完了,也用来给这一轮做摘要。面板里的看板列出正在跑的会话,
114106
每 30 秒刷新一次。
@@ -117,8 +109,9 @@ English | [简体中文](README.zh-CN.md)
117109
它会读一次宿主的 agent 列表,找有没有专属于这个 Mini App 的 agent,没有就退回默认 agent。
118110
它不会去跑你自己的会话。
119111
- **它自己会起的那些轮次** —— 除了你发的消息,运行时还会自己起几轮,**每一轮都花你的模型额度**:
120-
- **闲话**:你安静 20 分钟后,她可能自己开口;一小时最多 2 轮,两轮之间至少隔 45 分钟。
121-
**面板里能关**:设置 → 「她没人的时候自己说话」。
112+
- **闲话**:**默认关着**,要她主动开口自己在面板里开:设置 → 「她没人的时候自己说话」。
113+
开了以后,你安静 20 分钟后她可能自己开口;一小时最多 2 轮,两轮之间至少隔 45 分钟。
114+
**同一个开关也能再关掉**。
122115
- **写日记**:聊完天,如果今天还没有日记,她会写一篇。
123116
- **学语气**:聊完天,你最近的聊天记录会送给模型,让她学你说话的样子。
124117
- **回你给日记写的评论**:每条评论再跑一轮。

‎plugins/antianqi/mmx-octopus/miniapp/client/index.html‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,11 +1914,12 @@
19141914
<section class="set-group">
19151915
<span class="set-title">她没人的时候自己说话</span>
19161916
<div class="seg" role="group" aria-label="闲话开关" id="idletalk-group">
1917-
<button type="button" data-idletalk="on" aria-pressed="true">开</button>
1918-
<button type="button" data-idletalk="off" aria-pressed="false">关</button>
1917+
<button type="button" data-idletalk="on" aria-pressed="false">开</button>
1918+
<button type="button" data-idletalk="off" aria-pressed="true">关</button>
19191919
</div>
19201920
<p class="set-note" id="idletalk-note">
1921-
开着的话,你安静 20 分钟后她可能自己开口(会用到你的模型额度,一小时最多 2 次)。
1921+
<b>默认关着</b>,要她主动开口你自己打开。开着的话,你安静 20 分钟后她可能自己开口
1922+
(会用到你的模型额度,一小时最多 2 次)。
19221923
关掉只停她「主动搭话」那几句,招呼和静态台词照旧(那几句不花额度)。
19231924
</p>
19241925
</section>

‎plugins/antianqi/mmx-octopus/miniapp/node/atomic-json.mjs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,13 @@ export async function writeJsonAtomic(file, value, options = {}) {
7474
/**
7575
* 把一段文本原子地写进文件。
7676
*
77-
* **为什么要有这个(而不是裸 `writeFile`)**:身份层 `AGENTS.md` 要写进宿主给
78-
* 这个 Mini App 建的 agent 目录,宿主**每轮重读**它。写到一半被读到,
79-
* 模型就会看到半截身份(底稿有、规矩没有)—— 那比整份旧身份更糟。
80-
* 裸写没有这个保证,所以走同一套「临时文件 → fsync → rename」的原子发布。
81-
*
8277
* **和 `writeJsonAtomic` 的关系**:同一个原子发布的**唯一实现**,
8378
* 只是一个序列化、一个直接写文本。node 层**不允许**别处裸调 `writeFile`。
8479
*
80+
* ⚠️ **生产代码现在没有调用点** —— 插件只落盘 `context.dataDir` 下的
81+
* 四个 JSON(走 `writeJsonAtomic`),**不往宿主目录写任何文件**
82+
* (Marketplace 评审要求)。这个函数留着给随包发布的自检脚本铺夹具。
83+
*
8584
* @param {string} file 目标文件绝对路径
8685
* @param {string} text 要写的内容
8786
* @returns {Promise<void>}

‎plugins/antianqi/mmx-octopus/miniapp/node/chatinput.mjs‎

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ export function buildHeartHint(heart) {
114114
* 段落顺序(不要随手改):
115115
* 1. 状态摘要 —— 她得知道 MCode 现在在干什么
116116
* 2. 称呼 —— **每轮都带**(名字和称呼用户随时能改,静态化就不生效了)
117-
* 3. 身份层(底稿 + 样子 + 规矩)—— **只在降级时带**;
118-
* 正常情况下它已经写进 agent 目录的 `AGENTS.md`,宿主每轮读它(压缩压不掉)
117+
* 3. 身份层(底稿 + 样子 + 规矩)—— **每轮都带**
118+
* (插件不往宿主目录写任何文件 ⇒ 身份层没有别的落点,只能随消息传进去)
119119
* 4. 接续摘要 —— 换会话时让她接上上一段(见 `buildCarryOver`)
120120
* 5. **日记记忆** —— 她的日记(见 `memory.mjs` 的 `pickDiaryMemory`)
121121
* 5b. **背景故事** —— 她的来历(见 `storyscope.mjs` 的 `shouldLoadStory`;**问到才给**)
@@ -126,10 +126,10 @@ export function buildHeartHint(heart) {
126126
* 它每轮都在变,`AGENTS.md` 那种静态落点装不下它。
127127
* 选这个位置是因为它是**最后一段背景**,紧接着就是用户原话 —— 最后读到的最容易用。
128128
*
129-
* ⚠️ **「身份层要不要带」这个开关不外传** ——
130-
* 它由 `identityInFile`(身份层是不是已经在文件里)**在函数内部**决定。
131-
* 外传就等于把「每轮都重贴」这个开关交到调用方手上,
132-
* 迟早有人传 true,而那时候自检是抓不到的(负向注入实测过这个洞)。
129+
* ⚠️ **身份层没有开关** —— 以前这里有个 `identityInFile`
130+
* (身份层是不是已经在宿主文件里),现在**没有别的落点了** ⇒ 身份层**必须**每轮带。
131+
* 外传这个开关就等于留一条「可以不带」的岔路,迟早有人走那条路,
132+
* 而那时候自检是抓不到的(负向注入实测过这个洞)。
133133
*
134134
* @param {{
135135
* text: string,
@@ -138,7 +138,6 @@ export function buildHeartHint(heart) {
138138
* baseline?: string,
139139
* appearance?: string,
140140
* rules?: string,
141-
* identityInFile?: boolean,
142141
* carryOver?: string | null,
143142
* memory?: string | null,
144143
* storyScope?: string | null,
@@ -218,7 +217,6 @@ export function assembleChatInput({
218217
baseline = '',
219218
appearance = '',
220219
rules = '',
221-
identityInFile = false,
222220
carryOver = null,
223221
memory = null,
224222
storyScope = null,
@@ -230,12 +228,10 @@ export function assembleChatInput({
230228
const blocks = [];
231229
if (summary) blocks.push(String(summary));
232230
if (naming) blocks.push(String(naming));
233-
if (!identityInFile) {
234-
// 降级:身份层没进文件,只能每轮拼在 user 消息里。
235-
// 三样都要带:底稿(她是谁)、样子(她长什么样)、规矩(她怎么做事)。
236-
const fallback = [baseline, appearance, rules].filter(Boolean).join('\n\n');
237-
if (fallback) blocks.push(fallback);
238-
}
231+
// 身份层:**每轮都带**(插件不往宿主目录写文件 ⇒ 没有别的落点)。
232+
// 三样都要带:底稿(她是谁)、样子(她长什么样)、规矩(她怎么做事)。
233+
const identity = [baseline, appearance, rules].filter(Boolean).join('\n\n');
234+
if (identity) blocks.push(identity);
239235
if (carryOver) blocks.push(String(carryOver));
240236
if (memory) blocks.push(String(memory));
241237
// ⭐ **背景故事**:她自己的来历。

0 commit comments

Comments
 (0)