Skip to content
Merged
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
4 changes: 2 additions & 2 deletions plugins/antianqi/mmx-octopus/.minimax-plugin/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"schemaVersion": 1,
"name": "mmx-octopus",
"displayName": "MMX 章鱼娘",
"version": "1.9.0",
"description": "桌面上的 MMX 章鱼娘 —— MMX Agent 的可视化身体,也是你自己的专属聊天对象。她会反映 Agent 正在思考还是正在干活,还能被 Agent 和技能通过托管 MCP 直接指挥说话、换表情、挪位置。权限说明:本插件会读取你每个对话每轮的最终回复、标题与运行状态,用来判断 Agent 正在思考还是已经完成,并在你主动问她时用她自己的固定会话跑一轮 Agent,把回答直接说出来;她的对话历史只存在本机。",
"version": "1.10.0",
"description": "桌面上的 MMX 章鱼娘 —— MMX Agent 的可视化身体,也是你自己的专属聊天对象。打开面板里的「她知道我在忙什么」之后,她会反映 Agent 正在思考还是正在干活;她还能被 Agent 和技能通过托管 MCP 直接指挥说话、换表情、挪位置。权限说明:本插件声明了 session.read,会读你每个对话每轮的最终回复、标题与运行状态,用来判断 Agent 正在思考还是已经完成 —— **这项跨会话感知默认关闭**,需要你在面板里手动打开;打开后它才订阅你的会话事件、把你其它会话的标题与运行状态送进她的提示词,关着的时候一概不采集。另外它会在你主动问她时用她自己的固定会话跑一轮 Agent,把回答直接说出来;她的对话历史只存在本机。",
"author": "antianqi",
"icon": "icon.png",
"category": "Productivity",
Expand Down
44 changes: 34 additions & 10 deletions plugins/antianqi/mmx-octopus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,15 @@ it like the rest of the port.
## Tested environment

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

## Data & access

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

### Upgrading from 1.9.0

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

### Upgrading from 1.8.0

1.9.0 changes what the plugin does with the Host's agents, not just the
Expand Down
31 changes: 23 additions & 8 deletions plugins/antianqi/mmx-octopus/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,14 @@ English | [简体中文](README.zh-CN.md)
## 已验证环境

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

## 数据与访问

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

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

### 从 1.9.0 升级

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

### 从 1.8.0 升级

1.9.0 改的是插件和宿主 agent 的关系,不只是一个版本号:**它不再创建任何 agent 文件**,
Expand Down
23 changes: 17 additions & 6 deletions plugins/antianqi/mmx-octopus/miniapp/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1956,11 +1956,15 @@
<section class="set-group">
<span class="set-title">她知道我在忙什么</span>
<div class="seg" role="group" aria-label="状态感知" id="petaware-group">
<button type="button" data-petaware="on" aria-pressed="true">开</button>
<button type="button" data-petaware="off" aria-pressed="false">关</button>
<button type="button" data-petaware="on" aria-pressed="false">开</button>
<button type="button" data-petaware="off" aria-pressed="true">关</button>
</div>
<p class="set-note" id="petaware-note">
开着的话,你其它会话的标题和运行状态会进她的提示词;关掉她就不看这些了。
<b>默认关。</b>开着的话,她会订阅你的会话事件、列出你的会话,
并把其它会话的标题、运行状态和最终回复写进她的提示词;
关掉这些一概不采、也不进提示词。
<b id="petaware-reset-note" hidden>从 1.9.0 升上来的:那个「开」是旧默认值、
不是你自己选的,已经重置为关;需要的话请手动打开。</b>
</p>
</section>

Expand Down Expand Up @@ -3434,8 +3438,9 @@ <h3 id="naming-ask-title">先认识一下</h3>
scopeButtons[j].getAttribute('data-scope') === state.scope ? 'true' : 'false'
);
}
// ⚠️ **undefined 算「开」** —— 老运行时的快照没有这两个字段,
// 按「默认开」显示,别让面板显示成「关」。
// ⚠️ **undefined 按各自的默认值走** —— 老运行时的快照可能没有这两个字段:
// 闲话按「开」显示(v1.7.0 之前的默认);状态感知按「关」显示
// (2026-11-16 起默认关,取更安全的那一边)。
var idleButtons = document.querySelectorAll('#idletalk-group button');
for (var k = 0; k < idleButtons.length; k++) {
idleButtons[k].setAttribute(
Expand All @@ -3449,11 +3454,17 @@ <h3 id="naming-ask-title">先认识一下</h3>
for (var m = 0; m < awareButtons.length; m++) {
awareButtons[m].setAttribute(
'aria-pressed',
awareButtons[m].getAttribute('data-petaware') === (snapshot.petAware === false ? 'off' : 'on')
awareButtons[m].getAttribute('data-petaware') === (snapshot.petAware === true ? 'on' : 'off')
? 'true'
: 'false'
);
}
// ⚠️ **升级提示**(官方评审 2026-11-17):旧存档里那个「开」是 1.9.0 的
// 默认值、不是用户选的 ⇒ 升级后已重置为关,并在这里请用户重新打开。
var petAwareResetNote = document.getElementById('petaware-reset-note');
if (petAwareResetNote) {
petAwareResetNote.hidden = snapshot.petAwareReset !== true;
}
// 诊断与看板
renderTracking(snapshot);
renderBoard(state.board);
Expand Down
48 changes: 46 additions & 2 deletions plugins/antianqi/mmx-octopus/miniapp/node/observe.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const TURN_TEXT_SESSIONS = 50;
* dispose: () => void,
* }}
*/
export function createObserve({ context, state, onTaskEvent = null }) {
export function createObserve({ context, state, onTaskEvent = null, boardIntervalMs = BOARD_INTERVAL }) {
// 这几个在 createServer 之前算好:请求处理器会读它们,不能等到后面才初始化。
const agentAvailable = !!context.agent;
const capabilitiesKnown = !!context.capabilities;
Expand Down Expand Up @@ -481,6 +481,10 @@ export function createObserve({ context, state, onTaskEvent = null }) {
*/
function scheduleObserve() {
if (observeStarted || !agentAvailable || context.signal.aborted) return;
// ⚠️ **她知道 MCode 在干什么**这个开关关着 ⇒ **一个跨会话事件都不订阅**。
// (官方插件市场 2026-11-16 评审:关掉就必须真的不采集,
// 不能只是「收了不往提示词里写」。)
if (!state.petAware) return;
observeStarted = true;
// G2:宿主明确不支持 observe —— 直说,不做无意义的退避重试。
if (!observeSupported) {
Expand All @@ -498,14 +502,16 @@ export function createObserve({ context, state, onTaskEvent = null }) {
*/
function scheduleBoard() {
if (boardStarted || !agentAvailable || context.signal.aborted) return;
// ⚠️ **同一个开关**:关着就不列会话 —— 看板本身也是跨会话信息。
if (!state.petAware) return;
boardStarted = true;
// 激活延迟是毫秒级的,1 秒足够越过;太早调用只会拿到一次假的失败。
boardTimer = setTimeout(() => {
if (context.signal.aborted) return;
void refreshBoard();
boardTimer = setInterval(() => {
void refreshBoard();
}, BOARD_INTERVAL);
}, boardIntervalMs);
}, 1000);
}

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

/**
* 「她知道 MCode 在干什么」开关落地:**关 ⇒ 真的不采集**。
*
* ⚠️ **关掉时要做三件事**(官方插件市场 2026-11-16 评审):
* ① 掐断订阅(`observe`)—— 不再收任何跨会话事件;
* ② 停掉看板计时器 —— 不再调 `sessions()` 列会话;
* ③ 清掉已经显示出来的跨会话信息(看板、订阅状态、会话计数)。
* ⚠️ 只在提示词里不拼摘要**不算数** —— 那是「收了不用」,不是「没收」。
*
* @param {boolean} enabled
*/
function setAware(enabled) {
if (enabled) {
// 重新走一遍「排订阅 / 排看板」—— 关过一次之后这两步被跳过过了。
observeStarted = false;
boardStarted = false;
scheduleObserve();
scheduleBoard();
return;
}
stopObserve();
observeStarted = false;
if (boardTimer) {
clearTimeout(boardTimer);
clearInterval(boardTimer);
boardTimer = null;
}
boardStarted = false;
state.setAgentTracking({ subscribed: false, sessions: 0, sessionTitle: null, error: null });
void state.setBoard({ running: [], recent: [] }).catch(() => undefined);
}

/**
* 关停:掐断订阅 + 停掉看板计时器。
*
Expand All @@ -544,6 +587,7 @@ export function createObserve({ context, state, onTaskEvent = null }) {
scheduleBoard,
restartObserve,
stopObserve,
setAware,
listSessions,
runningSince,
dispose,
Expand Down
7 changes: 5 additions & 2 deletions plugins/antianqi/mmx-octopus/miniapp/node/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ function formatDuration(ms) {

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

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