femo-plugin 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/NOTICE +8 -0
- package/README.md +12 -1
- package/docs/ActiveRoadmaps/Func/345/201/234/346/255/242/350/257/255/344/271/211-/351/201/227/345/274/203/346/216/245/347/273/255-/346/226/275/345/267/245/346/270/205/345/215/225.md +91 -0
- package/docs/ActiveRoadmaps//345/217/214user/346/226/275/345/267/245/346/270/205/345/215/225.md +326 -0
- package/docs/Specs//346/212/225/345/275/261/344/270/255/345/277/203/350/241/214/345/215/217/350/256/256.md +616 -569
- package/femo2host/AGENTS.md +1 -1
- package/femo2host/femoGenConnector/engine-client.mjs +7 -2
- package/femo2host/femoGenConnector/file-dialogs.mjs +108 -2
- package/femo2host/femoToolcall/chronica.py +99 -19
- package/femo2host/femo_api.py +14 -1
- package/femo2host/host/actor-core.d.mts +25 -0
- package/femo2host/host/actor-core.mjs +72 -0
- package/femo2host/host/cast-core.d.mts +3 -0
- package/femo2host/host/cast-core.mjs +14 -0
- package/femo2host/host/daemon-client.mjs +59 -10
- package/femo2host/host/hub-render-core.d.mts +2 -0
- package/femo2host/host/hub-render-core.mjs +6 -2
- package/femo2host/host/run-state-core.d.mts +4 -0
- package/femo2host/host/run-state-core.mjs +4 -0
- package/femo2host/host/speech-core.mjs +11 -4
- package/femo2host/host/tools-core.d.mts +11 -0
- package/femo2host/host/tools-core.mjs +39 -0
- package/femo2host/mailbox.py +630 -545
- package/femo2host/projectionCenter/app.css +61 -0
- package/femo2host/projectionCenter/composer.mjs +233 -20
- package/femo2host/projectionCenter/identity.mjs +131 -0
- package/femo2host/projectionCenter/index.html +55 -1
- package/femo2host/projectionCenter/main.mjs +231 -35
- package/femo2host/projectionCenter/panels.mjs +108 -16
- package/femo2host/projectionCenter/render.mjs +813 -695
- package/femo2host/projectionCenter/state.mjs +30 -0
- package/femo2host/projectionCenter/util.mjs +28 -0
- package/femo2host/projection_hub.py +1796 -230
- package/femo2host/python/femo_bridge.py +303 -33
- package/femo2host/python/femo_daemon.py +1528 -1209
- package/femo2host/python/mirror_window.py +237 -0
- package/femoBridges/ContextExample.py +113 -71
- package/femoCompiler/AGENTS.md +1 -0
- package/femoCompiler/FEMO_parser.py +2641 -2567
- package/femoCompiler/FEMO_runtime.py +217 -44
- package/femoCompiler/FEMO_scope_resolver.py +26 -12
- package/femoCompiler/block_collector.py +24 -27
- package/femoCompiler/db_utils.py +560 -503
- package/femoCompiler/femoAsync.py +466 -436
- package/femoCompiler/func_registry.py +74 -0
- package/femoCompiler/protocol.py +127 -127
- package/femoCompiler/save_dialog.py +497 -446
- package/femoExamples/AI/350/201/212/345/244/251/345/256/244/AI/350/201/212/345/244/251/345/256/244-/345/270/246agent/347/211/210.femo +229 -142
- package/femoExamples/AI/350/201/212/345/244/251/345/256/244/random_wait_time.py +91 -2
- package/femoExamples/LuxFiat/luxfiat-loop.femo +0 -1
- package/femoExamples/LuxFiat/luxfiat-simple.femo +23 -24
- package/femoExamples/debug/347/245/236/345/231/250/debug/347/245/236/345/231/250.femo +221 -222
- package/femoExamples/discussion.femo +72 -72
- package/femoExamples//347/213/274/344/272/272/346/235/200//347/213/274/344/272/272/346/235/200-/350/255/246/351/225/277/347/211/210-9/344/272/272/351/242/204/345/245/263/347/214/216.femo +1 -2
- package/femoExamples//347/213/274/344/272/272/346/235/200//347/213/274/344/272/272/346/235/200-/350/255/246/351/225/277/347/211/210.femo +1 -2
- package/femoExamples//347/213/274/344/272/272/346/235/200//347/213/274/344/272/272/346/235/200.femo +1 -2
- package/femoExamples//350/260/201/346/230/257/345/215/247/345/272/225//350/260/201/346/230/257/345/215/247/345/272/225-/350/217/234/345/270/202/345/234/272/345/261/200.femo +1 -1
- package/femoExamples//350/260/201/346/230/257/345/215/247/345/272/225//350/260/201/346/230/257/345/215/247/345/272/225.femo +1 -1
- package/femoGen/document_ch.html +1 -0
- package/femoGen/document_en.html +1 -0
- package/femoGen/index.html +1 -0
- package/femoGen/intro_ch.html +1 -0
- package/femoGen/intro_en.html +1 -0
- package/femoGen/package.json +7 -0
- package/femoGen/public/femo-logo-slogan.svg +5 -0
- package/femoGen/public/femo-logo.svg +6 -1
- package/femoGen/src/femoParser.jsx +14 -0
- package/hostAdapter/dshAdapter/host/femo-skill.ts +23 -10
- package/hostAdapter/dshAdapter/host/routes/projection-input.ts +3 -0
- package/hostAdapter/dshAdapter/lib/client.js +20 -2
- package/hostAdapter/dshAdapter/lib/client.js.map +2 -2
- package/hostAdapter/dshAdapter/lib/main.js +161 -18
- package/hostAdapter/dshAdapter/lib/main.js.map +3 -3
- package/hostAdapter/dshAdapter/package.json +11 -1
- package/hostAdapter/webAdapter/console/index.html +13 -4
- package/hostAdapter/webAdapter/extension/background.js +16 -5
- package/hostAdapter/webAdapter/extension/seat-agent-core.js +836 -791
- package/hostAdapter/webAdapter/extension/sidepanel/actors.mjs +101 -0
- package/hostAdapter/webAdapter/extension/sidepanel/main.mjs +81 -20
- package/hostAdapter/webAdapter/extension/sidepanel/reconnect.mjs +33 -0
- package/hostAdapter/webAdapter/extension/sidepanel/run-control.mjs +22 -11
- package/hostAdapter/webAdapter/extension/sidepanel/seats.mjs +6 -20
- package/hostAdapter/webAdapter/extension/sidepanel.html +31 -8
- package/hostAdapter/webAdapter/native/install-native-host.mjs +1 -0
- package/hostAdapter/webAdapter/native/register-core.mjs +69 -28
- package/hostAdapter/webAdapter/native/web-launcher.sh +37 -0
- package/hostAdapter/webAdapter/package.json +7 -0
- package/hostAdapter/webAdapter/readme.md +51 -10
- package/hostAdapter/webAdapter/server/bridge.mjs +1 -1
- package/hostAdapter/webAdapter/server/runtime.mjs +51 -5
- package/hostAdapter/webAdapter/server/seats.mjs +11 -6
- package/hostAdapter/webAdapter/server/service.mjs +108 -15
- package/hostAdapter/webAdapter/shared/seats-core.mjs +31 -6
- package/hostAdapter/webAdapter/sites/chat.deepseek.com/SITE.md +7 -0
- package/hostAdapter/webAdapter/sites/chat.deepseek.com/content.js +83 -68
- package/hostAdapter/webAdapter/sites/chatglm.cn/inject.js +76 -4
- package/hostAdapter/webAdapter/sites/chatgpt.com/SITE.md +7 -1
- package/hostAdapter/webAdapter/sites/chatgpt.com/content.js +37 -5
- package/hostAdapter/webAdapter/sites/chatgpt.com/inject.js +40 -4
- package/hostAdapter/webAdapter/start-service.command +16 -0
- package/hostAdapter/webAdapter/tests/chatgpt-input.test.mjs +58 -0
- package/hostAdapter/webAdapter/tests/chatgpt-parser.test.mjs +37 -0
- package/hostAdapter/webAdapter/tests/deepseek-sanitize.test.mjs +68 -0
- package/hostAdapter/webAdapter/tests/runtime.test.mjs +42 -0
- package/hostAdapter/webAdapter/tests/seats-core.test.mjs +37 -1
- package/hostAdapter/webAdapter/tests/smoke-service.mjs +261 -232
- package/hostAdapter/zcodeAdapter/runtime/speech-collect.mjs +6 -0
- package/hostAdapter/zcodeAdapter/skills/femo/SKILL.md +3 -0
- package/hostAdapter/zcodeAdapter/tests/unbound-actors.test.mjs +51 -0
- package/package.json +7 -1
- package//350/257/255/346/263/225/346/226/207/346/241/243.md +1224 -1202
|
@@ -34,14 +34,36 @@ if (globalThis.__femoSeatInjected === chrome.runtime.id) {
|
|
|
34
34
|
globalThis.__femoSeatInjected = chrome.runtime.id;
|
|
35
35
|
|
|
36
36
|
/** 输入框候选:真页盘点实证的 #prompt-textarea(ProseMirror 可编辑 DIV)打头,
|
|
37
|
-
*
|
|
38
|
-
* textarea,会被排除)。
|
|
37
|
+
* form 作用域内的 contenteditable 殿后,textarea 收底——都按「可见尺寸」过滤
|
|
38
|
+
* (页上藏着一个不可见的 fallback textarea,会被排除)。
|
|
39
|
+
*
|
|
40
|
+
* 【裸 contenteditable / role=textbox 候选除名(2026-10-14 j2736 实案定谳)】
|
|
41
|
+
* Canvas(「写作」面板)的文档编辑器也是裸 contenteditable DIV,且 DOM 序在
|
|
42
|
+
* composer 之前——面板一开,宽泛兜底抢先命中画布编辑器,派工全文被
|
|
43
|
+
* selectAll+insertText 整段灌进写作文档(页面随即上报
|
|
44
|
+
* /backend-api/conversation/message/writing-blocks),composer 一直空着、
|
|
45
|
+
* 发送钮候选全无,15s 重试循环反复重写画布。修法=候选一律作用域进
|
|
46
|
+
* composer(id 锚 / form[class*=composer] / textarea),画布编辑器结构性
|
|
47
|
+
* 不可能被选中;画布开着而 composer 缺席时 waitForInput 到点响亮失败并附
|
|
48
|
+
* 页面盘点(盘点顺带拍下画布编辑器真身,供下一轮取证转正)——绝不往
|
|
49
|
+
* 写作文档里灌字。 */
|
|
39
50
|
const INPUT_CANDIDATES = [
|
|
40
51
|
'#prompt-textarea',
|
|
41
52
|
'form[class*="composer"] [contenteditable="true"]',
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
// 2026-10-20/21 实证(j2740 _47/_63/_71,service.log):上游 2026-10-09 前后
|
|
54
|
+
// 改版——#prompt-textarea id 消失,composer 本体变成裸 ProseMirror DIV(占位
|
|
55
|
+
// 文案"询问 ChatGPT"),旧三条候选全落空 → 席位被误判休眠 → 每回合 30s 静默
|
|
56
|
+
// reload(10-15 起 98 次 / 10-20 起 52 次)。挂属性锚:ChatGPT 站内只此一家
|
|
57
|
+
// 措辞,Canvas 编辑器(占位文案"开始写作",10-14 j2736 盘点实证)结构性
|
|
58
|
+
// 不会误中。_71 教训:盘点仪表此前把 placeholder 与 aria-label 混报成一个
|
|
59
|
+
// 字段,属性真身未判别——两种属性都钉(双锚),仪表已改区分来源(ph:/aria:)。
|
|
60
|
+
'div.ProseMirror[placeholder="询问 ChatGPT"]',
|
|
61
|
+
'div.ProseMirror[aria-label="询问 ChatGPT"]',
|
|
62
|
+
// 【textarea 兜底除名(2026-10-21 17:5x 实案定谳)】隐藏 textarea #pending-
|
|
63
|
+
// conversation-input 在冷加载头 20s 是页上唯一"可用"的输入元素——候选扫描
|
|
64
|
+
// 每拍必先撞它,原生 setter 写入 React 状态不认账(发送钮 disabled),白写
|
|
65
|
+
// 一轮还污染回合账;aria 锚的 ProseMirror 实测 ~22s 才可用,由 inputWaitMs
|
|
66
|
+
// =45s 全等覆盖,不再需要它殿后。
|
|
45
67
|
];
|
|
46
68
|
|
|
47
69
|
/** 发送钮候选:composer 提交钮类名(真页按钮快照实证)打头,常见特征兜底。 */
|
|
@@ -84,6 +106,16 @@ FemoSeatCore.createSeatAgent({
|
|
|
84
106
|
sendCandidates: SEND_CANDIDATES,
|
|
85
107
|
domReplySelector: REPLY_SELECTOR, // 领养收尾的 DOM 全文(历史渲染的完整回复)
|
|
86
108
|
domBusySelector: BUSY_SELECTOR, // 生成中指示(发送钮变身的 stop 钮)
|
|
109
|
+
writeMode: 'paste', // 2026-10-21 17:5x 实案:execCommand 写入后发送钮 disabled(状态
|
|
110
|
+
// 管线不认账——千问 2026-10-03 同款签名「字进得了框、状态不认账、发送钮
|
|
111
|
+
// 永远灰」)。改走 paste 事件管线:ProseMirror 原生吃粘贴,状态同步、钮亮。
|
|
112
|
+
inputWaitMs: 45_000, // 冷加载 ProseMirror ~22s 才可用(textarea 除名后全等它),20s 等不起
|
|
113
|
+
rev: '20261021c-composer-paste', // 版本指纹:上线日志打「站点包版本」——改码后此行不变=浏览器缓存旧码
|
|
114
|
+
clearHiddenTextareaOnReply: true, // 2026-10-20:textarea 兜底命中 #pending-conversation-input
|
|
115
|
+
// 发车后,写入的文本会残留在框里(React 状态不认原生 setter+input 写入,
|
|
116
|
+
// 发送靠占位文本进 DOM 序触发)——下一回合 findInput 逐候选扫描会先撞见
|
|
117
|
+
// 非空 textarea,把 composer 已就绪的回合拖到 20s 超时(j2740 _47 后 11 轮
|
|
118
|
+
// 连发实锤)。交卷成功后清场,旗标开给骨架。
|
|
87
119
|
sendFailNote: '发送失败:输入框未清空且未见生成启动(发送姿势待定型——盘点见日志)',
|
|
88
120
|
noReplyNote: '回复已结束但网络闸没有收到正文(流格式变了?照 SITE.md 取证法复查)',
|
|
89
121
|
logTitleCalibration: true,
|
|
@@ -38,6 +38,12 @@
|
|
|
38
38
|
* {p:"",o:"patch",v:[…]} 里(旧协议是顶层 append 帧);③ 批补丁带过正文后
|
|
39
39
|
* 长回复以裸值帧续发(旧代码批补丁后清粘性=裸帧全丢)。解析器三处已跟进;
|
|
40
40
|
* 残余未知帧型由流内取证仪表(裸帧/批补丁逐条留痕)下一轮定谳。
|
|
41
|
+
*
|
|
42
|
+
* 2026-10-13 全文翻倍定谳(j2735_10/j2734_24 账本+流取证):上游「合并消息」
|
|
43
|
+
* 会把同一块正文以批补丁与顶层 append 两种帧形各投一遍(内容逐字相同、紧邻
|
|
44
|
+
* 交替),页面按补丁语义幂等只渲染一遍,纯旁听的解析器两路都收=全文交错翻
|
|
45
|
+
* 倍——GPT 自己页面正常、引擎收到的是坏的。修法=双路去重闸(dedupGate,
|
|
46
|
+
* 见 makeParser 内注释),进话前逐字比对滑动窗。
|
|
41
47
|
*/
|
|
42
48
|
(() => {
|
|
43
49
|
if (window.__webNetGate) return; // 脚本被重复注入时静默退出
|
|
@@ -120,6 +126,32 @@
|
|
|
120
126
|
let stickyParts0 = false; // 上一条指针指向 parts/0(裸 v 帧沿用它)
|
|
121
127
|
let sawData = false;
|
|
122
128
|
|
|
129
|
+
// ── 双路去重闸(2026-10-13 j2735_10 全文翻倍定谳)──────────────────
|
|
130
|
+
// 上游「合并消息多路写」协议(j2735_10 实帧取证):同一条流里,同一块正文
|
|
131
|
+
// 以**两种帧形各投一遍**——批补丁内 append(/message/content/parts/0 子
|
|
132
|
+
// 操作)与顶层 append({p:"/message/content/parts/0",o:"append"})。两路
|
|
133
|
+
// 内容完全相同(进话帧/批补丁留痕逐字对照)、紧邻交替——页面上只渲染一遍
|
|
134
|
+
// (JSON 补丁幂等应用于同一棵文档树),纯旁听的解析器两路都收=全文交错
|
|
135
|
+
// 翻倍(账本实锤:引擎收到的就是坏的,与投影中心/hub 无关)。健康回合两
|
|
136
|
+
// 路从不并存(直方图 top=0 或 batch=0),坏回合 top≈batch(j2735_10:
|
|
137
|
+
// top×46 + batch×47;j2734_24:top×9 + batch×13)。
|
|
138
|
+
// 修法:指数滑动窗逐字比对——新块的尾窗与已收字尾对齐即判重投,吞掉不进
|
|
139
|
+
// 话(正常续写与已收字无公共前后缀,零误伤);落位新消息重开一轮时窗口
|
|
140
|
+
// 随 content 重置。窗口 256 字 > 实测最大重投块(113 字)留 2 倍余量。
|
|
141
|
+
// 极小概率的真续写误吞(续写开头恰与尾部重复)不丢内容:那块正文已在话
|
|
142
|
+
// 里出现过,最终文本语义等价。
|
|
143
|
+
const DEDUP_WINDOW = 256;
|
|
144
|
+
let tailWin = '';
|
|
145
|
+
let dedupDropped = 0;
|
|
146
|
+
/** 返回 true = 重投吞掉;false = 新内容,进话并把窗口滑到最新尾。 */
|
|
147
|
+
function dedupGate(incoming) {
|
|
148
|
+
if (!incoming) return false;
|
|
149
|
+
const probe = incoming.slice(-DEDUP_WINDOW);
|
|
150
|
+
if (probe && tailWin.endsWith(probe)) { dedupDropped += incoming.length; return true; }
|
|
151
|
+
tailWin = (tailWin + incoming).slice(-DEDUP_WINDOW);
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
|
|
123
155
|
// ── 取证仪表(纯记账;取证行走 gate-log 通道,≤340 字/行)────────
|
|
124
156
|
const stats = { lines: 0, bytes: 0, shapes: {}, samples: {}, msgAdds: 0, logged: 0, stickyClears: 0, bareLogged: 0, batchLogged: 0 };
|
|
125
157
|
let rawHead = '';
|
|
@@ -145,6 +177,7 @@
|
|
|
145
177
|
dumped = true;
|
|
146
178
|
log('流头取证', rawHead || '(空)');
|
|
147
179
|
log('流尾取证', rawTail || '(空)');
|
|
180
|
+
if (dedupDropped) log('双路去重', `本流吞掉重影 ${dedupDropped} 字(批补丁与顶层 append 双投,2026-10-13 闸)`);
|
|
148
181
|
const hist = Object.entries(stats.shapes).sort((a, b) => b[1] - a[1]).map(([k, n]) => `${k}×${n}`).join(';');
|
|
149
182
|
log('帧型直方图', `共 ${stats.lines} 行 data / ${stats.bytes} 字节 / ${Object.keys(stats.shapes).length} 型:${hist || '(无)'}`);
|
|
150
183
|
for (const [shape, sample] of Object.entries(stats.samples)) log(`样本[${shape}]`, sample);
|
|
@@ -163,6 +196,7 @@
|
|
|
163
196
|
// 后续追加接着长,不再把开头几个字扔掉。
|
|
164
197
|
const seedParts0 = inAssistantText && typeof msg?.content?.parts?.[0] === 'string' ? msg.content.parts[0] : '';
|
|
165
198
|
if (inAssistantText) content = seedParts0;
|
|
199
|
+
tailWin = content.slice(-DEDUP_WINDOW); // 落位重开/换消息=窗口重置(重影只在单回合流内)
|
|
166
200
|
stickyParts0 = false;
|
|
167
201
|
stats.msgAdds += 1;
|
|
168
202
|
if (inAssistantText && stats.msgAdds <= 10) { // 消息落位明细:parts0len 是「整包 replace 流」的指纹
|
|
@@ -189,7 +223,7 @@
|
|
|
189
223
|
if (sub?.p === '/message/status' && sub?.o === 'replace' && typeof sub?.v === 'string'
|
|
190
224
|
&& sub.v.startsWith('finished_')) finished = true;
|
|
191
225
|
if (inAssistantText && sub?.p === '/message/content/parts/0' && sub?.o === 'append'
|
|
192
|
-
&& typeof sub?.v === 'string') { content += sub.v; batchAppended = true; }
|
|
226
|
+
&& typeof sub?.v === 'string' && !dedupGate(sub.v)) { content += sub.v; batchAppended = true; }
|
|
193
227
|
}
|
|
194
228
|
// 新协议(2026-10-08 定谳):正文追加住在批补丁里(旧协议是顶层 append
|
|
195
229
|
// 帧)——批补丁带过正文,紧随的裸值帧就该沿用它的指针继续进话;没带
|
|
@@ -204,6 +238,7 @@
|
|
|
204
238
|
: p === '/message/content/parts/0';
|
|
205
239
|
if (onParts0) {
|
|
206
240
|
if (!inAssistantText) return; // 指针在别家消息上,不进话
|
|
241
|
+
if (dedupGate(v)) return; // 双路重投(批补丁路已收过同一块)吞掉,不进话
|
|
207
242
|
content += v;
|
|
208
243
|
if (stats.logged < 8) { // 进话帧留痕(封顶 8 帧,健康流不刷屏;坏流里它就是「哪一帧进了话」的直接答案)
|
|
209
244
|
stats.logged += 1;
|
|
@@ -249,6 +284,7 @@
|
|
|
249
284
|
get content() { return content.trim(); },
|
|
250
285
|
get finished() { return finished; },
|
|
251
286
|
get sawData() { return sawData; },
|
|
287
|
+
get dedupDropped() { return dedupDropped; },
|
|
252
288
|
feedLine(line) {
|
|
253
289
|
const t = line.trim();
|
|
254
290
|
if (!t.startsWith('data:')) return; // event: 行不管(补丁语义看载荷就够)
|
|
@@ -334,12 +370,12 @@
|
|
|
334
370
|
close() {
|
|
335
371
|
if (buf.trim()) parser.feedLine(buf);
|
|
336
372
|
try { parser.dumpForensics(); } catch { /* 仪表不干扰收话 */ }
|
|
337
|
-
emit({ phase: 'completed', thinking: parser.thinking, content: parser.content, finished: parser.finished, ts: Date.now() });
|
|
373
|
+
emit({ phase: 'completed', thinking: parser.thinking, content: parser.content, finished: parser.finished, dedupDropped: parser.dedupDropped, ts: Date.now() });
|
|
338
374
|
},
|
|
339
375
|
}))
|
|
340
376
|
.catch(() => {
|
|
341
377
|
try { parser.dumpForensics(); } catch { /* 仪表不干扰收话 */ }
|
|
342
|
-
emit({ phase: 'completed', thinking: parser.thinking, content: parser.content, finished: parser.finished, ts: Date.now() });
|
|
378
|
+
emit({ phase: 'completed', thinking: parser.thinking, content: parser.content, finished: parser.finished, dedupDropped: parser.dedupDropped, ts: Date.now() });
|
|
343
379
|
});
|
|
344
380
|
return new Response(keep, { status: res.status, statusText: res.statusText, headers: res.headers });
|
|
345
381
|
}
|
|
@@ -395,7 +431,7 @@
|
|
|
395
431
|
xhr.addEventListener('loadend', () => {
|
|
396
432
|
if (buf.trim()) parser.feedLine(buf);
|
|
397
433
|
try { parser.dumpForensics(); } catch { /* 仪表不干扰收话 */ }
|
|
398
|
-
emit({ phase: 'completed', thinking: parser.thinking, content: parser.content, finished: parser.finished, ts: Date.now() });
|
|
434
|
+
emit({ phase: 'completed', thinking: parser.thinking, content: parser.content, finished: parser.finished, dedupDropped: parser.dedupDropped, ts: Date.now() });
|
|
399
435
|
});
|
|
400
436
|
}
|
|
401
437
|
} catch { /* 闸绝不干扰页面本体 */ }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# FEMO web seat - local service launcher for macOS(start-service.cmd 的 mac 同款).
|
|
3
|
+
# Double-click in Finder (opens Terminal) or run from anywhere.
|
|
4
|
+
#
|
|
5
|
+
# Data root (2026-09-25 user decision): FEMO_DATA_DIR stays UNSET by default,
|
|
6
|
+
# so the bridge uses <femoRoot>/user_data - the SAME world as dsh/zcode hosts
|
|
7
|
+
# (one projection hub, one mailbox, one soul library, one cast ledger).
|
|
8
|
+
# WARNING: do NOT set FEMO_DATA_DIR=user_data; setting the var switches every
|
|
9
|
+
# path to the user_data/femo/ subtree - a parallel world cut off from prod.
|
|
10
|
+
# For isolated testing, uncomment the next line:
|
|
11
|
+
# export WEB_SANDBOX=1
|
|
12
|
+
cd "$(dirname "$0")" || exit 1
|
|
13
|
+
node server/service.mjs
|
|
14
|
+
# cmd 版 pause 的对应物:服务退出后停一拍,双击打开的 Terminal 窗口不闪退
|
|
15
|
+
printf '\n[本地服务已退出] 按回车键关闭本窗口…'
|
|
16
|
+
read -r _
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// chatgpt-input.test.mjs — chatgpt.com 输入框候选回归锁(2026-10-20 composer 改版实案)。
|
|
2
|
+
// 实案:上游 10-09 前后摘掉 #prompt-textarea id,三条旧候选全落空 → 席位被误判
|
|
3
|
+
// 休眠,每回合 30s 静默 reload(10-15 起 98 次)。本锁钉死三件事:
|
|
4
|
+
// ① 候选链有 placeholder 属性锚且殿后顺序正确(textarea 兜底不抢跑);
|
|
5
|
+
// ② 骨架交卷清理挂旗标 clearHiddenTextareaOnReply、三个收口都调用;
|
|
6
|
+
// ③ Canvas 编辑器(placeholder="开始写作")结构性不进候选链。
|
|
7
|
+
import { test } from 'node:test';
|
|
8
|
+
import assert from 'node:assert/strict';
|
|
9
|
+
import { readFileSync } from 'node:fs';
|
|
10
|
+
import { join, dirname } from 'node:path';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
|
|
13
|
+
const ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const contentJs = readFileSync(join(ROOT, 'sites/chatgpt.com/content.js'), 'utf8');
|
|
15
|
+
const coreJs = readFileSync(join(ROOT, 'extension/seat-agent-core.js'), 'utf8');
|
|
16
|
+
|
|
17
|
+
test('chatgpt 候选链:placeholder 属性锚在 textarea 之前(2026-10-20 改版适配)', () => {
|
|
18
|
+
const m = contentJs.match(/const INPUT_CANDIDATES = \[([\s\S]*?)\];/);
|
|
19
|
+
assert.ok(m, 'INPUT_CANDIDATES 存在');
|
|
20
|
+
const body = m[1];
|
|
21
|
+
// 选择器本体断言前剥离注释行(注释里的 Canvas 占位符是取证对照素材,不参与)
|
|
22
|
+
const codeOnly = body.split('\n').filter(l => !l.trim().startsWith('//')).join('\n');
|
|
23
|
+
const idxPlaceholder = body.indexOf('div.ProseMirror[placeholder="询问 ChatGPT"]');
|
|
24
|
+
const idxComposerForm = body.indexOf('form[class*="composer"]');
|
|
25
|
+
const idxId = body.indexOf("'#prompt-textarea'");
|
|
26
|
+
assert.ok(idxId >= 0, '保留 #prompt-textarea 旧锚(兼容未改版客户端)');
|
|
27
|
+
assert.ok(idxComposerForm >= 0, '保留 form composer 兜底');
|
|
28
|
+
assert.ok(idxPlaceholder > idxComposerForm, 'placeholder 锚在 form composer 之后');
|
|
29
|
+
// 2026-10-21 17:5x 实案定谳:textarea 兜底除名(冷加载头 20s 抢先命中、写入
|
|
30
|
+
// React 不认账、白写污染回合账;ProseMirror ~22s 可用由 inputWaitMs=45s 覆盖)。
|
|
31
|
+
assert.ok(!/^\s*'textarea',/m.test(codeOnly), 'textarea 候选已除名(除名裁决入册)');
|
|
32
|
+
assert.ok(!codeOnly.includes('开始写作'), '候选链选择器本体不许出现 Canvas 编辑器占位符');
|
|
33
|
+
// paste 管线 + 冷加载等待(同案裁决)
|
|
34
|
+
assert.ok(contentJs.includes("writeMode: 'paste'"), '写入管线=paste(execCommand 状态不认账实案)');
|
|
35
|
+
assert.ok(contentJs.includes('inputWaitMs'), '冷加载等待上限站点可调(ProseMirror ~22s 可用)');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('chatgpt 候选链:实案注释在册(改版日期与 Canvas 甄别入册)', () => {
|
|
39
|
+
assert.ok(contentJs.includes('2026-10-20'), '注释带实案日期');
|
|
40
|
+
assert.ok(contentJs.includes('开始写作'), '注释里点名 Canvas 占位符供下轮取证对照');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('骨架:clearFallbackTextarea 存在且交卷收口都调用(旗标控制)', () => {
|
|
44
|
+
assert.ok(coreJs.includes('function clearFallbackTextarea()'), '清理函数本体');
|
|
45
|
+
assert.ok(coreJs.includes('site.clearHiddenTextareaOnReply'), '旗标读取(骨架零站点事实,站点包开关)');
|
|
46
|
+
const defAt = coreJs.indexOf('function clearFallbackTextarea()');
|
|
47
|
+
const calls = [...coreJs.matchAll(/clearFallbackTextarea\(\);/g)].map(m => m.index);
|
|
48
|
+
assert.ok(calls.length >= 3, `交卷收口清理调用 ≥3 处,实际 ${calls.length}`);
|
|
49
|
+
for (const at of calls) assert.ok(at > defAt, '调用在定义之后');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('骨架边界:清理函数不写任何站名、无旗标直接放行(站点事实只在站点包)', () => {
|
|
53
|
+
const fnStart = coreJs.indexOf('function clearFallbackTextarea()');
|
|
54
|
+
const fnEnd = coreJs.indexOf('\n }', fnStart);
|
|
55
|
+
const body = coreJs.slice(fnStart, fnEnd);
|
|
56
|
+
assert.ok(!/chatgpt|deepseek|doubao|kimi|grok|qianwen|chatglm|aistudio/i.test(body), '函数体零站名');
|
|
57
|
+
assert.ok(body.includes('if (!site.clearHiddenTextareaOnReply) return;'), '无旗标直接放行');
|
|
58
|
+
});
|
|
@@ -159,3 +159,40 @@ test('新协议二刀(j2726 20:00 实帧):裸数组信封 {"v":[…]} 扛
|
|
|
159
159
|
'裸数组信封扛的正文主体不能丢');
|
|
160
160
|
assert.equal(p.finished, true, '裸数组里的 status replace 也算结束信号');
|
|
161
161
|
});
|
|
162
|
+
|
|
163
|
+
test('双路重投去重(2026-10-13 j2735_10 全文翻倍实帧):批补丁与顶层 append 同文交替只进话一遍', () => {
|
|
164
|
+
const p = makeParser();
|
|
165
|
+
const lines = [
|
|
166
|
+
// 落位(旧协议形状:parts[0] 空串)
|
|
167
|
+
'data: {"v":{"message":{"id":"d1","author":{"role":"assistant","name":null,"metadata":{}},"content":{"content_type":"text","parts":[""]},"status":"in_progress"}}}',
|
|
168
|
+
// 同一块正文先批补丁投一遍……
|
|
169
|
+
'data: {"p":"","o":"patch","v":[{"p":"/message/update_time","o":"replace","v":1},{"p":"/message/content/parts/0","o":"append","v":"@GPT:猫猫,这次 DeepSeek 真有"}]}',
|
|
170
|
+
// ……再顶层 append 投一遍(j2735_10 实帧:两路同文紧邻交替,页面幂等只渲染一遍)
|
|
171
|
+
'data: {"p":"/message/content/parts/0","o":"append","v":"@GPT:猫猫,这次 DeepSeek 真有"}',
|
|
172
|
+
// 下一块照旧双投(批补丁 → 顶层)
|
|
173
|
+
'data: {"p":"","o":"patch","v":[{"p":"/message/content/parts/0","o":"append","v":"年表和 Part 1"}]}',
|
|
174
|
+
'data: {"p":"/message/content/parts/0","o":"append","v":"年表和 Part 1"}',
|
|
175
|
+
// 纯批补丁(单路)与纯顶层(单路)各来一块——去重闸不许误伤
|
|
176
|
+
'data: {"p":"","o":"patch","v":[{"p":"/message/content/parts/0","o":"append","v":",只走一路的块"}]}',
|
|
177
|
+
'data: {"p":"/message/content/parts/0","o":"append","v":",顶层单路也照收"}',
|
|
178
|
+
// 正常续写首尾同文(新内容恰与已收尾重复的字面情况:已在话里=语义等价,吞了不丢)
|
|
179
|
+
'data: {"p":"/message/content/parts/0","o":"append","v":",顶层单路也照收"}',
|
|
180
|
+
'data: {"type":"message_stream_complete"}',
|
|
181
|
+
];
|
|
182
|
+
for (const l of lines) p.feedLine(l);
|
|
183
|
+
assert.equal(p.content, '@GPT:猫猫,这次 DeepSeek 真有年表和 Part 1,只走一路的块,顶层单路也照收',
|
|
184
|
+
'双投块只进话一遍,单路块不误伤');
|
|
185
|
+
assert.ok(p.dedupDropped >= ('@GPT:猫猫,这次 DeepSeek 真有' + '年表和 Part 1').length, '去重量有账可查');
|
|
186
|
+
assert.equal(p.finished, true);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
test('双路重投去重:落位新消息重开一轮时窗口重置,跨消息不误吞', () => {
|
|
190
|
+
const p = makeParser();
|
|
191
|
+
const lines = [
|
|
192
|
+
'data: {"v":{"message":{"id":"a","author":{"role":"assistant"},"content":{"content_type":"text","parts":["第一轮收尾语"]}}}}',
|
|
193
|
+
// 新消息落位(新协议:自带首段)——首段与上一轮尾同文也不许吞
|
|
194
|
+
'data: {"v":{"message":{"id":"b","author":{"role":"assistant"},"content":{"content_type":"text","parts":["第一轮收尾语"]}}}}',
|
|
195
|
+
];
|
|
196
|
+
for (const l of lines) p.feedLine(l);
|
|
197
|
+
assert.equal(p.content, '第一轮收尾语', '新落位重开一轮,窗口随 content 重置');
|
|
198
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* deepseek-sanitize.test.mjs — DeepSeek 交卷净化(免责尾注)回归锁(2026-10-20)。
|
|
3
|
+
*
|
|
4
|
+
* 实证(j2740):DeepSeek 服务端把「本回答由 AI 生成,内容仅供参考,请仔细甄别」
|
|
5
|
+
* 直接追加在正文 SSE 流末尾——不剥就被当正式回答上墙、进引擎上下文(剧本 AI
|
|
6
|
+
* 自己都在把它当 injection 噪声)。锁四件事:
|
|
7
|
+
* ① 尾注只认「末尾锚定」:结尾的声明连前导空行一起剥;正文里讨论这句话、
|
|
8
|
+
* 末尾不是它的场合一律不动;
|
|
9
|
+
* ② 无空格变体容错(\s*);纯尾注=空(走既有的空回复降级路径);
|
|
10
|
+
* ③ 函数与正则从 content.js 源码现抽(抄副本会漂移)——改名/删除即测试红;
|
|
11
|
+
* ④ 座席骨架确实接了这只口(seat-agent-core.js 经 site.sanitizeReply 调用),
|
|
12
|
+
* 且机器层不含尾注原文(网站事实不住站点包外,与 site-boundary 同向)。
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { test } from 'node:test';
|
|
16
|
+
import assert from 'node:assert/strict';
|
|
17
|
+
import { readFileSync } from 'node:fs';
|
|
18
|
+
import { join, dirname } from 'node:path';
|
|
19
|
+
import { fileURLToPath } from 'node:url';
|
|
20
|
+
|
|
21
|
+
const ADAPTER_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
22
|
+
const SRC = readFileSync(join(ADAPTER_ROOT, 'sites', 'chat.deepseek.com', 'content.js'), 'utf8');
|
|
23
|
+
const CORE = readFileSync(join(ADAPTER_ROOT, 'extension', 'seat-agent-core.js'), 'utf8');
|
|
24
|
+
|
|
25
|
+
const TRAILER = '本回答由 AI 生成,内容仅供参考,请仔细甄别';
|
|
26
|
+
|
|
27
|
+
/** 从源码里按名字抽函数定义(括号配对找收尾)——姿势照 doubao-parser.test.mjs。 */
|
|
28
|
+
function extractFn(src, name) {
|
|
29
|
+
const start = src.indexOf(`function ${name}(`);
|
|
30
|
+
assert.ok(start >= 0, `源码里找不到 function ${name}`);
|
|
31
|
+
let i = src.indexOf('{', start);
|
|
32
|
+
let depth = 0;
|
|
33
|
+
for (let j = i; j < src.length; j++) {
|
|
34
|
+
if (src[j] === '{') depth += 1;
|
|
35
|
+
else if (src[j] === '}') { depth -= 1; if (depth === 0) { i = j; break; } }
|
|
36
|
+
}
|
|
37
|
+
return src.slice(start, i + 1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const RE_LINE = SRC.match(/const REPLY_TRAILER_RE = (\/[\s\S]+?\/)\s*;/)?.[1];
|
|
41
|
+
assert.ok(RE_LINE, 'content.js 里找不到 REPLY_TRAILER_RE 正则字面量');
|
|
42
|
+
const { sanitizeReply } = new Function(
|
|
43
|
+
`const REPLY_TRAILER_RE = ${RE_LINE};\n${extractFn(SRC, 'sanitizeReply')}\nreturn { sanitizeReply };`,
|
|
44
|
+
)();
|
|
45
|
+
|
|
46
|
+
test('尾注剥除:结尾的声明连前导空行一起剥', () => {
|
|
47
|
+
assert.equal(sanitizeReply('正文完。\n\n' + TRAILER), '正文完。');
|
|
48
|
+
assert.equal(sanitizeReply(TRAILER), '', '纯尾注=空');
|
|
49
|
+
assert.equal(sanitizeReply('正文完。\n\n' + TRAILER + '\n'), '正文完。', '尾注后的尾随空白一起剥');
|
|
50
|
+
assert.equal(sanitizeReply('本回答由AI生成,内容仅供参考,请仔细甄别'), '', '无空格变体也认(\\s* 容错)');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('末尾锚定:末尾不是尾注的一律不动', () => {
|
|
54
|
+
assert.equal(sanitizeReply('正常回答,没有尾注'), '正常回答,没有尾注');
|
|
55
|
+
assert.equal(sanitizeReply(TRAILER + '是官网尾注'), TRAILER + '是官网尾注', '尾注后还有正文=不动');
|
|
56
|
+
assert.equal(sanitizeReply('开头引用「' + TRAILER + '」这句尾注,后面还有话。'), '开头引用「' + TRAILER + '」这句尾注,后面还有话。');
|
|
57
|
+
assert.equal(sanitizeReply(''), '');
|
|
58
|
+
assert.equal(sanitizeReply(undefined), 'undefined 不该出现' && '', 'undefined 归一为空串');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('装配接线:content.js 必须把 sanitizeReply 交给座席骨架', () => {
|
|
62
|
+
assert.ok(/createSeatAgent\(\{[\s\S]*?\n\s*sanitizeReply,/.test(SRC), 'content.js 的 createSeatAgent 配置里要有 sanitizeReply');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('机器层接线:座席骨架经 site.sanitizeReply 通用口调用,且不含尾注原文', () => {
|
|
66
|
+
assert.ok(CORE.includes('site.sanitizeReply'), 'seat-agent-core.js 必须经 site.sanitizeReply 调用(零网站事实)');
|
|
67
|
+
assert.ok(!CORE.includes('仔细甄别'), '尾注原文不许住进机器层(站点包外零网站事实)');
|
|
68
|
+
});
|
|
@@ -960,3 +960,45 @@ test('runtime: model_id 落账——交卷信封带 web:<站点名>;席位无
|
|
|
960
960
|
assert.ok(speech2, '无 site 席位照常交卷');
|
|
961
961
|
assert.equal(speech2.args.body.model_id, undefined, '无 site 不伪造 model_id(信封不带该栏)');
|
|
962
962
|
});
|
|
963
|
+
|
|
964
|
+
// ── 续跑代际(2026-10-11 j2731 实案锁)────────────────────────────────
|
|
965
|
+
test('runtime: 按停中止不落「已交卷」账——续跑重发的同号拍照常派工', async () => {
|
|
966
|
+
// 实案:用户按停 → abortAll 把在飞回合记成「已交卷」→ 续跑后引擎重建
|
|
967
|
+
// Runtime、拍号从 0 重计、重发同号请求 → 连吃「双来路迟到拍」dedup →
|
|
968
|
+
// 引擎在节点上永等。中止 ≠ 交卷:一个字节没交的回合不许进防重账。
|
|
969
|
+
const { rt, sent, bridge } = makeRuntime({ resolveSeat: async () => SEAT });
|
|
970
|
+
rt.seats.upsertTabs('connA', [SEAT]);
|
|
971
|
+
const brief = { job_id: 8, wait_key: 'j8:ai_[AI发言]_1', node_name: 'AI发言', actor_name: 'wolf-seer', actor_info: { soul: 'wolf-seer' }, blocks: { prompt: '发言' } };
|
|
972
|
+
const first = await rt.dispatchActorRequest(brief);
|
|
973
|
+
assert.equal(first.accepted, true);
|
|
974
|
+
// 用户按停:中止在飞回合(停下信号事件现场)
|
|
975
|
+
bridge.onEvent('flow_paused', { job_id: 8 });
|
|
976
|
+
assert.equal(rt.stats().inflight, 0, '按停即在飞清空');
|
|
977
|
+
// 续跑:拍号从 0 重计,同号请求重发——必须照常派工
|
|
978
|
+
const again = await rt.dispatchActorRequest(brief);
|
|
979
|
+
assert.equal(again.accepted, true, '中止不落账:同号重发不被误杀');
|
|
980
|
+
assert.equal(sent.length, 2);
|
|
981
|
+
});
|
|
982
|
+
|
|
983
|
+
test('runtime: flow_start 代际重置——清防重账+释放在飞,同代保护不动', async () => {
|
|
984
|
+
const { rt, sent, bridge } = makeRuntime({ resolveSeat: async () => SEAT });
|
|
985
|
+
rt.seats.upsertTabs('connA', [SEAT]);
|
|
986
|
+
const brief = { job_id: 9, wait_key: 'j9:ai_[AI发言]_1', node_name: 'AI发言', actor_name: 'wolf-seer', actor_info: { soul: 'wolf-seer' }, blocks: { prompt: '发言' } };
|
|
987
|
+
await rt.dispatchActorRequest(brief);
|
|
988
|
+
const deliveryId = sent[0].deliveryId;
|
|
989
|
+
// 正常交卷:本代该 id 落「已交卷」防重账
|
|
990
|
+
rt.onSeatReport({ type: 'sent', deliveryId, sessionId: SEAT.sessionId });
|
|
991
|
+
rt.onSeatReport({ type: 'reply', deliveryId, sessionId: SEAT.sessionId, text: '我说完了' });
|
|
992
|
+
await new Promise(r => setTimeout(r, 20));
|
|
993
|
+
// 同一代内重复 → 原保护照旧(第二来路迟到拍丢弃)
|
|
994
|
+
const sameGen = await rt.dispatchActorRequest(brief);
|
|
995
|
+
assert.equal(sameGen.accepted, false);
|
|
996
|
+
assert.equal(sameGen.reason, 'duplicate (already completed)');
|
|
997
|
+
// 续跑:flow_start 落地 → 跨代身份作废,同号新拍照常派工
|
|
998
|
+
bridge.onEvent('flow_start', { job_id: 9 });
|
|
999
|
+
const nextGen = await rt.dispatchActorRequest(brief);
|
|
1000
|
+
assert.equal(nextGen.accepted, true, 'flow_start 已清账:同号新拍可派工');
|
|
1001
|
+
// 别场的账不受牵连
|
|
1002
|
+
const otherJob = await rt.dispatchActorRequest({ ...brief, job_id: 10, wait_key: 'j10:ai_[AI发言]_1' });
|
|
1003
|
+
assert.equal(otherJob.accepted, true);
|
|
1004
|
+
});
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { test } from 'node:test';
|
|
10
10
|
import assert from 'node:assert/strict';
|
|
11
11
|
|
|
12
|
-
import { seatState, offlineRollCall, attendanceRefusal } from '../shared/seats-core.mjs';
|
|
12
|
+
import { seatState, offlineRollCall, attendanceRefusal, actorBindRefusal, actorWarningNotice } from '../shared/seats-core.mjs';
|
|
13
13
|
|
|
14
14
|
test('seatState 四态:忙 > 在线 > 休眠 > 网页未打开', () => {
|
|
15
15
|
assert.deepEqual(seatState({ busy: true, online: true, present: true }), { key: 'run', label: '运行中' });
|
|
@@ -132,3 +132,39 @@ test('总文案:总起一行 + 序号行间空行,每个缺席灵魂一条
|
|
|
132
132
|
assert.ok(items[0].startsWith('1. '), '首条带序号 1');
|
|
133
133
|
assert.ok(items[1].startsWith('2. '), '次条带序号 2');
|
|
134
134
|
});
|
|
135
|
+
|
|
136
|
+
// ── 演员绑定账对账(2026-10-10,用户拍板「以 femo 脚本为先」)────────────────
|
|
137
|
+
// 判据与灵魂不同:多绑(账里有、脚本没有)=error 拦运行;少绑=warning 不拦。
|
|
138
|
+
|
|
139
|
+
test('演员点名:多绑进缺席数组(拦),少绑只走 warning 不拦', () => {
|
|
140
|
+
const actorCheck = {
|
|
141
|
+
errors: ['绑定的演员 @幽灵 不在剧本演员表里——检查名字(演员名带 @,照剧本里写的那样)'],
|
|
142
|
+
warnings: ['演员 @2号 还没绑定——轮到它时按缺员处置'],
|
|
143
|
+
};
|
|
144
|
+
const out = offlineRollCall([], [], actorCheck);
|
|
145
|
+
assert.equal(out.length, 1, '只有多绑那一行进拦行');
|
|
146
|
+
assert.ok(out[0].includes('@幽灵'));
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('演员点名:actorCheck 缺省/空两桶=零影响(灵魂判据零回归)', () => {
|
|
150
|
+
assert.deepEqual(offlineRollCall([], [{ actor: 'AI1', soul: 'ai4', bound: 'web', online: true }]), []);
|
|
151
|
+
assert.deepEqual(offlineRollCall([], [], { errors: [], warnings: [] }), []);
|
|
152
|
+
assert.deepEqual(offlineRollCall([], [], undefined), []);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('演员绑定前拦截:空名/不带 @ 都拦,带 @ 放行', () => {
|
|
156
|
+
assert.equal(actorBindRefusal(''), '先填演员名(带 @,如 @玩家1)');
|
|
157
|
+
assert.equal(actorBindRefusal(' '), '先填演员名(带 @,如 @玩家1)');
|
|
158
|
+
assert.ok(actorBindRefusal('玩家1')?.includes('带 @ 开头'));
|
|
159
|
+
assert.equal(actorBindRefusal('@玩家1'), null);
|
|
160
|
+
assert.equal(actorBindRefusal('@1号'), null);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test('演员少绑提醒总文案:空=空串;有序号行且自带「不拦运行」', () => {
|
|
164
|
+
assert.equal(actorWarningNotice([]), '');
|
|
165
|
+
assert.equal(actorWarningNotice(undefined), '');
|
|
166
|
+
const text = actorWarningNotice(['演员 @1号 还没绑定——轮到它时按缺员处置', '演员 @2号 还没绑定——轮到它时按缺员处置']);
|
|
167
|
+
assert.ok(text.startsWith('演员绑定提醒(不拦运行)'));
|
|
168
|
+
assert.ok(text.includes('1. 演员 @1号'));
|
|
169
|
+
assert.ok(text.includes('2. 演员 @2号'));
|
|
170
|
+
});
|