Skip to content

Commit 097f319

Browse files
authored
fix(mmx-octopus): cross-session awareness is off by default and really stops collecting (v1.10.0) (#138)
* fix(mmx-octopus): cross-session awareness is off by default and really stops collecting (v1.10.0) The marketplace review (issue #136) found two real problems, and both were ours: - petAware defaulted to true. A privacy-sensitive cross-session feature has to be off by default, so a fresh install now starts with it off and the user turns it on themselves. - Turning it off only stopped the summary from reaching the prompt; the collection kept going. observe({all:true}) and sessions() were still called. The switch now reaches the collection layer: while it is off the package does not subscribe to session events, does not list sessions, and does not put anything about other sessions into her prompt. Turning it off at runtime aborts the subscription, stops the board timer and clears what the board had already shown. A restart keeps it off. Also: the README said the package needs MiniMax Code 3.1.5; it needs 3.1.6. Version 1.9.0 -> 1.10.0. * test(mmx-octopus): ship the petAware scenarios so the default-off behaviour is verifiable * docs(mmx-octopus): point the self-check note at the bundled test command * fix(mmx-octopus): reset cross-session awareness on upgrade unless the user opted in The marketplace review (2026-11-17) pointed out that an existing state.json with petAware: true kept that value after upgrading, so cross-session collection continued without a new opt-in. 1.9.0 persisted true because that was its default, and a saved true does not show that the user ever enabled collection. - state.mjs: new pure function migratePetAware() is the single place holding the rule. Only a saved petAwareOptIn marker counts as an explicit opt-in; older states are reset to off and the panel keeps a "please turn it on again" note. setPetAware(true) is the only place that records the opt-in; setPetAware(false) withdraws it. The reset is written back to disk so the old true cannot be read back as a choice. - client: the panel shows the upgrade note while the switch is reset. - tests: the regression the review asked for, in the shared scenario module that the bundled test and the internal self-check both run: start from a legacy state.json with petAware: true, assert the switch is off and that no observe or sessions() call happens, then assert that turning it on starts collection and that the opt-in survives a restart. Plus a negative injection that puts the old read-back rule back and must turn the check red. - README (both languages): the upgrade section says the switch is reset to off. --------- Co-authored-by: antianqi <antianqi@users.noreply.github.com>
1 parent 3697174 commit 097f319

11 files changed

Lines changed: 815 additions & 35 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"schemaVersion": 1,
33
"name": "mmx-octopus",
44
"displayName": "MMX 章鱼娘",
5-
"version": "1.9.0",
6-
"description": "桌面上的 MMX 章鱼娘 —— MMX Agent 的可视化身体,也是你自己的专属聊天对象。她会反映 Agent 正在思考还是正在干活,还能被 Agent 和技能通过托管 MCP 直接指挥说话、换表情、挪位置。权限说明:本插件会读取你每个对话每轮的最终回复、标题与运行状态,用来判断 Agent 正在思考还是已经完成,并在你主动问她时用她自己的固定会话跑一轮 Agent,把回答直接说出来;她的对话历史只存在本机。",
5+
"version": "1.10.0",
6+
"description": "桌面上的 MMX 章鱼娘 —— MMX Agent 的可视化身体,也是你自己的专属聊天对象。打开面板里的「她知道我在忙什么」之后,她会反映 Agent 正在思考还是正在干活;她还能被 Agent 和技能通过托管 MCP 直接指挥说话、换表情、挪位置。权限说明:本插件声明了 session.read,会读你每个对话每轮的最终回复、标题与运行状态,用来判断 Agent 正在思考还是已经完成 —— **这项跨会话感知默认关闭**,需要你在面板里手动打开;打开后它才订阅你的会话事件、把你其它会话的标题与运行状态送进她的提示词,关着的时候一概不采集。另外它会在你主动问她时用她自己的固定会话跑一轮 Agent,把回答直接说出来;她的对话历史只存在本机。",
77
"author": "antianqi",
88
"icon": "icon.png",
99
"category": "Productivity",

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

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,15 @@ it like the rest of the port.
108108
## Tested environment
109109

110110
- MiniMax Code 3.1.7 on Windows 11 (x64).
111-
- The package needs **MiniMax Code 3.1.5 or later**: it declares
111+
- The package needs **MiniMax Code 3.1.6 or later**: it declares
112112
`agentAccess: ["session.read", "session.run"]`, and a client older than
113-
3.1.5 rejects the whole package rather than installing half of it.
113+
3.1.6 rejects the whole package rather than installing half of it.
114114
- A desktop client that supports MiniApps and Agent turns.
115-
- The bundled self-check script needs Node 22 or later.
115+
- The bundled tests need Node 22 or later. Run them from the package directory:
116+
`node --test tests/petaware-default-off.test.mjs`
117+
It starts a real server against a mock host and asserts that cross-session
118+
awareness is **off by default**, and that turning it off really stops the
119+
collection (no `observe`, no `sessions()`).
116120

117121
## Data & access
118122

@@ -167,10 +171,18 @@ it like the rest of the port.
167171
sent again every turn. Since 1.9.0 this is the only channel: the sheet is
168172
no longer written into any agent file, so the per-turn copy is the one and
169173
only copy.
170-
- **Sessions read** — the package declares `session.read`. It reads the title,
171-
the running state and the final reply of a turn, to tell whether the Agent is
172-
thinking or has finished, and to summarise the turn. The board in the panel
173-
lists the running sessions and refreshes every 30 seconds.
174+
- **Sessions read** — the package declares `session.read`. **Since 1.10.0 this is
175+
off by default**: on a fresh install the package does **not** subscribe to your
176+
session events, does **not** list your sessions, and does **not** put anything
177+
about them into her prompt. Turn it on in the panel (Settings →
178+
「她知道我在忙什么」) and it reads the title, the running state and the final
179+
reply of a turn, to tell whether the Agent is thinking or has finished, and to
180+
summarise the turn; the board in the panel then lists the running sessions and
181+
refreshes every 30 seconds. Turning it off again stops the subscription and
182+
the reads — nothing about your other sessions is collected while it is off.
183+
**Upgrading from 1.9.0**: the switch starts **off** — 1.9.0 wrote `true` into
184+
the saved state because that was its default value, and a saved `true` does not
185+
show that you ever turned it on. Turn it on again in the panel if you want it.
174186
- **Agent turns it runs** — it declares `session.run`, and it runs **one Agent
175187
turn per message you send her in the chat area**, in her own session. The
176188
turn runs through the Host Agent, so it carries the capabilities the Host
@@ -194,9 +206,11 @@ it like the rest of the port.
194206
Her static lines (a greeting, "you have been quiet", "you ignored me") are **not**
195207
model turns and cost nothing — turning idle talk off only stops the model ones.
196208
- **Other sessions' titles** — with 「她知道我在忙什么」 ("She knows what I am
197-
busy with") **on (the default)**, the titles and running state of your **other**
198-
sessions are put into her prompt, so she can tell what you are busy with. **Turn
199-
it off in the panel**: Settings → 「她知道我在忙什么」.
209+
busy with") **on**, the titles and running state of your **other** sessions are
210+
put into her prompt, so she can tell what you are busy with. It is **off by
211+
default** (since 1.10.0): a fresh install neither subscribes to your session
212+
events nor lists your sessions, and nothing about them reaches her prompt.
213+
**Turn it on in the panel**: Settings → 「她知道我在忙什么」.
200214
- **Tools it calls** — only its own four MCP tools, on its own port. It calls no
201215
connector, no provider and no third-party service.
202216
- **Processes spawned** — none. This package starts no child process and runs no
@@ -210,6 +224,16 @@ it like the rest of the port.
210224
- **State location** — `context.dataDir`. Treat it as opaque: it may move
211225
between versions, so do not hard-code it.
212226

227+
### Upgrading from 1.9.0
228+
229+
1.10.0 changes one thing about your saved state: the cross-session awareness switch
230+
(「她知道我在忙什么」 / 「She knows what I am busy with」) is **reset to off**.
231+
1.9.0 wrote `true` into the state file because that was its default value, and a
232+
saved `true` does not show that you ever turned it on — so the package now starts
233+
with the switch off and stays off until you turn it on again in the panel
234+
(Settings → 「她知道我在忙什么」). Until then nothing about your other sessions is
235+
read or collected.
236+
213237
### Upgrading from 1.8.0
214238

215239
1.9.0 changes what the plugin does with the Host's agents, not just the

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,14 @@ English | [简体中文](README.zh-CN.md)
8282
## 已验证环境
8383

8484
- MiniMax Code 3.1.7 on Windows 11 (x64)。
85-
- 这个包**要求 MiniMax Code 3.1.5 或更高**:它声明了
86-
`agentAccess: ["session.read", "session.run"]`,比 3.1.5 老的客户端会直接拒装整个包,
85+
- 这个包**要求 MiniMax Code 3.1.6 或更高**:它声明了
86+
`agentAccess: ["session.read", "session.run"]`,比 3.1.6 老的客户端会直接拒装整个包,
8787
而不是只装一半。
8888
- 需要支持 MiniApp 与 Agent 轮次的桌面客户端。
89-
- 附带的自检脚本需要 Node 22 或更高。
89+
- 附带的测试需要 Node 22 或更高。在包目录里跑:
90+
`node --test tests/petaware-default-off.test.mjs`
91+
它会真起一套 server 配一个假宿主,断言跨会话感知**默认是关的**,而且关掉之后
92+
真的不再采集(不调 `observe`、不调 `sessions()`)。
9093

9194
## 数据与访问
9295

@@ -124,9 +127,13 @@ English | [简体中文](README.zh-CN.md)
124127
⚠️ 代价:这一份走的是会话历史 ⇒ 宿主做上下文压缩时可能把它压掉(所以每轮都重发一份)。
125128
1.9.0 起这就是**唯一**一条路:不再往任何 agent 文件里写她的底稿了,每轮随消息带的
126129
那份就是唯一的一份。
127-
- **读哪些会话** —— 这个包声明了 `session.read`。它读一轮对话的标题、运行状态和最终回复,
128-
用来分辨 Agent 是在想还是做完了,也用来给这一轮做摘要。面板里的看板列出正在跑的会话,
129-
每 30 秒刷新一次。
130+
- **读哪些会话** —— 这个包声明了 `session.read`。**1.10.0 起这一项默认关闭**:
131+
新装时它**不订阅**你的会话事件、**不列**你的会话,提示词里也**不会出现**任何你别的会话的
132+
信息。在面板里打开(设置 → 「她知道我在忙什么」)之后,它才会读一轮对话的标题、运行状态和
133+
最终回复,用来分辨 Agent 是在想还是做完了,也用来给这一轮做摘要;面板里的看板这时才列出
134+
正在跑的会话,每 30 秒刷新一次。关掉之后订阅与读取**一起停** —— 关着的时候她一概不采集。
135+
**从 1.9.0 升级**:这个开关升级后是**关**的 —— 1.9.0 把 `true` 存了下来,可那只是它当时的默认值,
136+
存下来并不说明你开过 ⇒ 现在一律从关开始,你要的话在面板里再打开一次。
130137
- **会跑哪些 Agent 轮次** —— 它声明了 `session.run`,并且**你在聊天区给她发的每一句话,
131138
都在她自己的会话里跑一轮 Agent**。这一轮走宿主的 Agent,因此带着宿主给那个 agent 的权限;
132139
它会读宿主的 agent 列表;如果你自己有一个叫 `mmx` 的 agent,就用它来回答
@@ -142,8 +149,9 @@ English | [简体中文](README.zh-CN.md)
142149

143150
她的静态台词(打招呼、「好久没人理我了」、「你刚才不理我」)**不走模型、不花额度** ——
144151
关掉闲话只停模型那几轮。
145-
- **别的会话标题** —— 「她知道我在忙什么」**默认开着**,这时你**其它会话**的标题与运行状态
146-
会进她的提示词,她才知道你在忙什么。**面板里能关**:设置 → 「她知道我在忙什么」。
152+
- **别的会话标题** —— 「她知道我在忙什么」**开着**的时候,你**其它会话**的标题与运行状态
153+
会进她的提示词,她才知道你在忙什么。**1.10.0 起默认关闭**:新装时她既不订阅你的会话事件、
154+
也不列你的会话,你的其它会话信息不会进她的提示词。**面板里能开**:设置 → 「她知道我在忙什么」。
147155
- **会调用哪些工具** —— 只有它自己那四个 MCP 工具,走它自己的端口。
148156
不调用 connector、不调用任何厂商服务、不调用任何第三方服务。
149157
- **进程** —— 不起。这个包不 spawn 任何子进程,也不跑任何外部二进制。
@@ -153,6 +161,13 @@ English | [简体中文](README.zh-CN.md)
153161
- **麦克风** —— 从不。这个包没有声明 `deviceAccess`,也不申请任何浏览器权限。
154162
- **状态放在哪** —— `context.dataDir`。把它当成不透明路径:版本之间可能变,别写死。
155163

164+
### 从 1.9.0 升级
165+
166+
1.10.0 对你的存档只改一件事:跨会话感知开关(「她知道我在忙什么」)**被重置为关**。
167+
1.9.0 把 `true` 存进存档,可那只是它当时的默认值,存下来的 `true` 说明不了你开过 ⇒
168+
现在一律从关开始,你要的话在面板里(设置 → 「她知道我在忙什么」)再打开一次。
169+
在那之前,她的其它会话一概不读、不采集。
170+
156171
### 从 1.8.0 升级
157172

158173
1.9.0 改的是插件和宿主 agent 的关系,不只是一个版本号:**它不再创建任何 agent 文件**,

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,11 +1956,15 @@
19561956
<section class="set-group">
19571957
<span class="set-title">她知道我在忙什么</span>
19581958
<div class="seg" role="group" aria-label="状态感知" id="petaware-group">
1959-
<button type="button" data-petaware="on" aria-pressed="true">开</button>
1960-
<button type="button" data-petaware="off" aria-pressed="false">关</button>
1959+
<button type="button" data-petaware="on" aria-pressed="false">开</button>
1960+
<button type="button" data-petaware="off" aria-pressed="true">关</button>
19611961
</div>
19621962
<p class="set-note" id="petaware-note">
1963-
开着的话,你其它会话的标题和运行状态会进她的提示词;关掉她就不看这些了。
1963+
<b>默认关。</b>开着的话,她会订阅你的会话事件、列出你的会话,
1964+
并把其它会话的标题、运行状态和最终回复写进她的提示词;
1965+
关掉这些一概不采、也不进提示词。
1966+
<b id="petaware-reset-note" hidden>从 1.9.0 升上来的:那个「开」是旧默认值、
1967+
不是你自己选的,已经重置为关;需要的话请手动打开。</b>
19641968
</p>
19651969
</section>
19661970

@@ -3434,8 +3438,9 @@ <h3 id="naming-ask-title">先认识一下</h3>
34343438
scopeButtons[j].getAttribute('data-scope') === state.scope ? 'true' : 'false'
34353439
);
34363440
}
3437-
// ⚠️ **undefined 算「开」** —— 老运行时的快照没有这两个字段,
3438-
// 按「默认开」显示,别让面板显示成「关」。
3441+
// ⚠️ **undefined 按各自的默认值走** —— 老运行时的快照可能没有这两个字段:
3442+
// 闲话按「开」显示(v1.7.0 之前的默认);状态感知按「关」显示
3443+
// (2026-11-16 起默认关,取更安全的那一边)。
34393444
var idleButtons = document.querySelectorAll('#idletalk-group button');
34403445
for (var k = 0; k < idleButtons.length; k++) {
34413446
idleButtons[k].setAttribute(
@@ -3449,11 +3454,17 @@ <h3 id="naming-ask-title">先认识一下</h3>
34493454
for (var m = 0; m < awareButtons.length; m++) {
34503455
awareButtons[m].setAttribute(
34513456
'aria-pressed',
3452-
awareButtons[m].getAttribute('data-petaware') === (snapshot.petAware === false ? 'off' : 'on')
3457+
awareButtons[m].getAttribute('data-petaware') === (snapshot.petAware === true ? 'on' : 'off')
34533458
? 'true'
34543459
: 'false'
34553460
);
34563461
}
3462+
// ⚠️ **升级提示**(官方评审 2026-11-17):旧存档里那个「开」是 1.9.0 的
3463+
// 默认值、不是用户选的 ⇒ 升级后已重置为关,并在这里请用户重新打开。
3464+
var petAwareResetNote = document.getElementById('petaware-reset-note');
3465+
if (petAwareResetNote) {
3466+
petAwareResetNote.hidden = snapshot.petAwareReset !== true;
3467+
}
34573468
// 诊断与看板
34583469
renderTracking(snapshot);
34593470
renderBoard(state.board);

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

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const TURN_TEXT_SESSIONS = 50;
5353
* dispose: () => void,
5454
* }}
5555
*/
56-
export function createObserve({ context, state, onTaskEvent = null }) {
56+
export function createObserve({ context, state, onTaskEvent = null, boardIntervalMs = BOARD_INTERVAL }) {
5757
// 这几个在 createServer 之前算好:请求处理器会读它们,不能等到后面才初始化。
5858
const agentAvailable = !!context.agent;
5959
const capabilitiesKnown = !!context.capabilities;
@@ -481,6 +481,10 @@ export function createObserve({ context, state, onTaskEvent = null }) {
481481
*/
482482
function scheduleObserve() {
483483
if (observeStarted || !agentAvailable || context.signal.aborted) return;
484+
// ⚠️ **她知道 MCode 在干什么**这个开关关着 ⇒ **一个跨会话事件都不订阅**。
485+
// (官方插件市场 2026-11-16 评审:关掉就必须真的不采集,
486+
// 不能只是「收了不往提示词里写」。)
487+
if (!state.petAware) return;
484488
observeStarted = true;
485489
// G2:宿主明确不支持 observe —— 直说,不做无意义的退避重试。
486490
if (!observeSupported) {
@@ -498,14 +502,16 @@ export function createObserve({ context, state, onTaskEvent = null }) {
498502
*/
499503
function scheduleBoard() {
500504
if (boardStarted || !agentAvailable || context.signal.aborted) return;
505+
// ⚠️ **同一个开关**:关着就不列会话 —— 看板本身也是跨会话信息。
506+
if (!state.petAware) return;
501507
boardStarted = true;
502508
// 激活延迟是毫秒级的,1 秒足够越过;太早调用只会拿到一次假的失败。
503509
boardTimer = setTimeout(() => {
504510
if (context.signal.aborted) return;
505511
void refreshBoard();
506512
boardTimer = setInterval(() => {
507513
void refreshBoard();
508-
}, BOARD_INTERVAL);
514+
}, boardIntervalMs);
509515
}, 1000);
510516
}
511517

@@ -516,11 +522,48 @@ export function createObserve({ context, state, onTaskEvent = null }) {
516522
function restartObserve() {
517523
if (!agentAvailable || context.signal.aborted) return;
518524
stopObserve();
525+
// ⚠️ **关着就不订阅**(与 scheduleObserve 同一个判断在同一个地方)。
526+
if (!state.petAware) {
527+
observeStarted = false;
528+
return;
529+
}
519530
observeAttempts = 0;
520531
observeStarted = true;
521532
observeTimer = setTimeout(attemptObserve, 900);
522533
}
523534

535+
/**
536+
* 「她知道 MCode 在干什么」开关落地:**关 ⇒ 真的不采集**。
537+
*
538+
* ⚠️ **关掉时要做三件事**(官方插件市场 2026-11-16 评审):
539+
* ① 掐断订阅(`observe`)—— 不再收任何跨会话事件;
540+
* ② 停掉看板计时器 —— 不再调 `sessions()` 列会话;
541+
* ③ 清掉已经显示出来的跨会话信息(看板、订阅状态、会话计数)。
542+
* ⚠️ 只在提示词里不拼摘要**不算数** —— 那是「收了不用」,不是「没收」。
543+
*
544+
* @param {boolean} enabled
545+
*/
546+
function setAware(enabled) {
547+
if (enabled) {
548+
// 重新走一遍「排订阅 / 排看板」—— 关过一次之后这两步被跳过过了。
549+
observeStarted = false;
550+
boardStarted = false;
551+
scheduleObserve();
552+
scheduleBoard();
553+
return;
554+
}
555+
stopObserve();
556+
observeStarted = false;
557+
if (boardTimer) {
558+
clearTimeout(boardTimer);
559+
clearInterval(boardTimer);
560+
boardTimer = null;
561+
}
562+
boardStarted = false;
563+
state.setAgentTracking({ subscribed: false, sessions: 0, sessionTitle: null, error: null });
564+
void state.setBoard({ running: [], recent: [] }).catch(() => undefined);
565+
}
566+
524567
/**
525568
* 关停:掐断订阅 + 停掉看板计时器。
526569
*
@@ -544,6 +587,7 @@ export function createObserve({ context, state, onTaskEvent = null }) {
544587
scheduleBoard,
545588
restartObserve,
546589
stopObserve,
590+
setAware,
547591
listSessions,
548592
runningSince,
549593
dispose,

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ function formatDuration(ms) {
384384

385385
/**
386386
* @param {any} context
387-
* @param {{bubbleMs?: number}} [options] 测试用的时长覆盖(生产不传)
387+
* @param {{bubbleMs?: number, boardIntervalMs?: number}} [options] 测试用的时长覆盖(生产不传)
388388
*/
389389
export async function start(context, options = {}) {
390390
// 聊天历史独立于 state.json:chat.json。
@@ -502,7 +502,7 @@ export async function start(context, options = {}) {
502502
// 从本文件抽成独立模块 `observe.mjs`:
503503
// 它只认注入进来的 `context` 和 `state`,自己的状态(订阅取消器 / 退避计时器 /
504504
// 看板计时器 / 轮次正文缓存)全在自己的闭包里,不再挤在这个大闭包的外层。
505-
const observe = createObserve({ context, state, onTaskEvent });
505+
const observe = createObserve({ context, state, onTaskEvent, boardIntervalMs: options.boardIntervalMs });
506506
state.setAgentTracking({ available: observe.agentAvailable, capability: observe.observeCapability });
507507

508508
// ============ 闲话生产者(idle):她不说话的时候也在活着 ============
@@ -1155,6 +1155,9 @@ export async function start(context, options = {}) {
11551155
if (path === '/api/petaware') {
11561156
const enabled = body.enabled === true || body.enabled === 'true';
11571157
const petAware = await state.setPetAware(enabled);
1158+
// ⚠️ **开关要真的落到采集层**(官方插件市场 2026-11-16 评审):
1159+
// 关 ⇒ 掐断订阅 + 停掉 sessions() 轮询;开 ⇒ 恢复订阅与看板。
1160+
observe.setAware(petAware);
11581161
sendJson(response, 200, { ok: true, petAware, snapshot: state.snapshot() });
11591162
return;
11601163
}

0 commit comments

Comments
 (0)