helixlife-v5-cli 1.2.2 → 1.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "helixlife-v5-cli",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Helix(vip.helixlife.cn)精细化浏览器自动化命令行工具。",
5
5
  "main": "helix-cli.js",
6
6
  "bin": {
@@ -24,6 +24,48 @@
24
24
  - **对用户回复的门禁**:在 `await fr.getByLabel('页码').inputValue()` 严格等于 `String(N)` 之前,禁止向用户输出「已跳到 / 已切换到 / 已完成第 N 页」等成功表述。验收未通过时如实说明未完成,给出读到的 `inputValue()` 或脚本抛错摘要、已执行步骤与下一步建议。
25
25
  - **禁止误导性归因**:不得以「跨域 iframe / 同源策略导致父页脚本无法访问子 frame」作为**无法自动化跳页**的结论。父页 JS 同源限制不等于 Playwright 无法在 `fr` 上操作阅读器工具栏。若仍失败应报告**未找到 `fr`、定位超时、语言包下 `aria-label` 变更**等可核验原因,并指向 S-25 与 `scripts/chrome-pdf-enumerate-a11y.js`。
26
26
 
27
+ #### 工作台 · 「扩写前言」等章节 AI · Agent 硬门禁(操作前必审 · 与 PDF 跳页同级)
28
+
29
+ **触发词**(任一命中即适用本门禁):用户说 **「扩写 / 精简 / 润色 / 改写 / 重写 / 优化 + 章节名」**(如「扩写前言」「润色 1. 乳腺癌…」),或 **「校对 + 章节」**,或 **writing 页工具 + 章节**(如「翻译 前言」「降重 摘要」)。
30
+
31
+ **语义(最高优先级)**
32
+
33
+ | 用户说法 | 含义 | **绝不是** |
34
+ | --- | --- | --- |
35
+ | 扩写前言 | AI **重写**「前言」节点的**正文内容** | 提纲树 **添加子级** / **添加同级** |
36
+ | 润色 / 精简 / 改写 + 章节 | 同上,改该节文字 | 在树下 **新增条目** |
37
+
38
+ `snapshot` 里出现 `添加子级` 按钮 **不代表** 用户要添加子级;该按钮**仅**在用户明确说「加子标题 / 加一条同级提纲 / 添加子级」时使用。
39
+
40
+ **禁止(违规则视为任务失败,勿向用户报「已完成扩写」)**
41
+
42
+ - `click` → `getByRole('button', { name: '添加子级' })`
43
+ - `click` → `getByRole('button', { name: '添加同级' })`
44
+ - 在 **未** `run-code` 脚本前,对 outline 提纲树手写 `hover` + `click` 猜图标
45
+ - 因 snapshot 里有「添加子级」文案而推断用户要「扩写」
46
+
47
+ **必须(唯一合法第一步)**
48
+
49
+ ```bash
50
+ # ① 定页
51
+ helixlife-v5-cli --raw eval "location.pathname"
52
+
53
+ # ② 统一入口(WorkBuddy 默认只跑这一条;改脚本内 userIntent)
54
+ helixlife-v5-cli run-code --filename=scripts/workbench-jova-dispatch.js
55
+ ```
56
+
57
+ 脚本内按 `pathname` 自动路由;**outline 页**走 `hover → 编辑 → 重新生成`,**绝不**点「添加子级」。若当前页为 proofread / writing,脚本返回应使用的子脚本名,**仍禁止**点「添加子级」。
58
+
59
+ **子脚本(由 dispatch 内部或返回值指定,勿手写 click 提纲树)**
60
+
61
+ | `pathname` | 示例 userIntent | 子脚本 |
62
+ | --- | --- | --- |
63
+ | `…/jova/outline` | `扩写前言` | (dispatch 内直接执行) |
64
+ | `…/jova/proofread` | `校对 前言` | `workbench-jova-proofread-section.js` |
65
+ | `…/jova/writing` | `扩写 前言` / `翻译 前言` | `workbench-jova-writing-tool.js` |
66
+
67
+ 细则与按钮对照表:下文 **WB-1 · 用户说法与脚本路由**。
68
+
27
69
  #### 用户说法映射
28
70
 
29
71
  - **深浅色**:用户说「切换颜色 / 换颜色 / 深色浅色 / 外观主题」等,已登录壳下**一律视为切换深浅色模式**(深色 ⇄ 浅色),见 S-16。
@@ -44,6 +86,7 @@
44
86
  - **定位与多命中**:推荐 `page.locator('main').getByText('部分章节匹配', { exact: true })`;多卡并列时**必须先缩小到目标课程卡片**,避免 strict 或误触(`scripts/hover-partial-chapter-match.js` 的 `cardTitle` 参数可直接用于此场景)。
45
87
  - 自测(2026-05-11):`/edu/search?keywords=…` 课程结果首条 `hover` 后,可见 tooltip 浮层(`helixlife-v5-cli run-code --filename=scripts/hover-partial-chapter-match.js` 返回 `ok: true`,即 `tooltipLikeAfter > tooltipLikeBefore`)。
46
88
  - **数据分析 · 详情页 · 上传文件**:用户说「上传文件 / 上传数据 / 换数据文件 / 导入 csv xlsx」等,且 `pathname` 为 `/analysis/{toolId}` 时,**一律走 D-2 三步弹窗流程**(打开弹窗 → 弹窗内选文件 → 弹窗内「确认」),**禁止**把左侧参数卡片底部「确认」(D-6 生成结果)当成上传确认。细则见下文「上传文件 · Agent 硬门禁」。
89
+ - **工作台 · 扩写/润色/精简/改写 + 章节**(如「扩写前言」):**一律**先 `run-code --filename=scripts/workbench-jova-dispatch.js`(改 `userIntent`),**禁止**点提纲树「添加子级 / 添加同级」。语义是 AI 重写该节正文(outline 上为 **编辑**→重新生成),不是新增子条目。细则见上文「工作台 · 扩写前言等 · Agent 硬门禁」与 WB-1。
47
90
 
48
91
  #### 任务范围与跨域
49
92
 
@@ -155,7 +198,7 @@
155
198
  | 对话 · 新建会话 | S-09 |
156
199
  | 工作站 · 新建任务弹窗 | S-10 |
157
200
  | 工作台 · 进入子工作台 | S-11 |
158
- | 工作台 · 综述全流程(拟定主题→精修) | WB-1 |
201
+ | 工作台 · 综述全流程;**「扩写前言」等必先 dispatch.js,禁止添加子级** | WB-1 |
159
202
  | 工作台 · SCI 论著全流程 | WB-2 |
160
203
  | 工作台 · 国自然基金全流程 | WB-3 |
161
204
  | 工作台 · 临床申请书全流程 | WB-4 |
@@ -394,7 +437,7 @@ div.side-menu--item[to='/edu/courses']
394
437
  | 步骤 | `pathname` | 主要表单项 / 区块 | 底栏主按钮(`getByRole('button', …)`) |
395
438
  | --- | --- | --- | --- |
396
439
  | 拟定主题 | `/workbench/jova/topic` | **生成模式**(三选一,`click` 文案):`短篇`(6000-10000字)、`中篇`(10000-15000字)、`长篇`(>15000字);**示例主题**列表 + `getByText('换一组', { exact: true })`;**综述主题** `getByRole('textbox', { name: '请输入综述主题概要内容' })`(上限 2000 字,界面显示 `0 / 2000`) | `继续编辑本地文档`;`生成提纲` |
397
- | 确认提纲 | `/workbench/jova/outline` | 左侧「论文提纲」树;节点行内为**无文案图标按钮**(增删改,需时用 `generate-locator` 固化,勿记 `e*`) | `返回主题`;`下载提纲`;`生成全文` |
440
+ | 确认提纲 | `/workbench/jova/outline` | 左侧「论文提纲」树;节点 hover 后出现 **编辑**(AI 扩写/润色/精简)与 **添加同级/添加子级**(仅改树结构,**禁止**用于「扩写前言」)。章节 AI 操作 **必须** `run-code` `scripts/workbench-jova-dispatch.js` | `返回主题`;`下载提纲`;`生成全文` |
398
441
  | 初稿校对 | `/workbench/jova/proofread` | 左目录 + 右正文;段落带「请校对本段内容」提示 | `返回提纲`;`下载文档`;`完成校对` |
399
442
  | 初稿精修 | `/workbench/jova/writing` | 左目录 + 中央 `textbox` 富文本;顶栏 **修订模式**(含接受/拒绝修订) | `返回提纲`;`修订模式` 切换钮(文案含 `接受修订` / `拒绝修订`);`新建论文`;`下载文档` |
400
443
 
@@ -407,6 +450,81 @@ div.side-menu--item[to='/edu/courses']
407
450
 
408
451
  **取消全文生成弹窗**:同 dialog 内 `getByRole('button', { name: '取 消' })` 或 `Close`。
409
452
 
453
+ **WB-1 · 用户说法与脚本路由(Agent 硬门禁)**
454
+
455
+ > 用户说「扩写前言」却被做成「添加子级」的根因:**同一动词在不同步骤页含义不同**,且 outline 树按钮默认隐藏(须 hover)。**必须先** `eval location.pathname`,**必须优先** `run-code` 下表脚本,禁止从 snapshot 猜「添加子级」。
456
+
457
+ **0 · 定页(第一步,不可跳过)**
458
+
459
+ > 与上文「工作台 · 扩写前言等 · Agent 硬门禁」一致;**WorkBuddy 默认只执行 `workbench-jova-dispatch.js`**,勿手写 click「添加子级」。
460
+
461
+ ```bash
462
+ helixlife-v5-cli --raw eval "location.pathname"
463
+ helixlife-v5-cli run-code --filename=scripts/workbench-jova-dispatch.js
464
+ ```
465
+
466
+ (改 dispatch 内 `userIntent`;outline 页在 dispatch 内直接完成,禁止点「添加子级」。)
467
+
468
+ **1 · 说法 → 脚本(jova 综述)**
469
+
470
+ | 当前 `pathname` | 用户说法(示例) | 脚本(工作区 `scripts/`) | Agent 改动的变量 |
471
+ | --- | --- | --- | --- |
472
+ | `…/jova/outline` | `扩写前言`、`扩写 前言`、`精简结论`、`润色 1. 乳腺癌…` | **`workbench-jova-dispatch.js`**(推荐)或 `workbench-jova-outline-regenerate-node.js` | `userIntent` / `intent` |
473
+ | `…/jova/proofread` | `校对 前言`、`确认校对`、`AI 改写`、`替换原文` | dispatch 返回 → `workbench-jova-proofread-section.js` | `intent` + `action` |
474
+ | `…/jova/writing` | `扩写 前言`、`翻译 前言`、`润色 摘要`、`降重`、`文献列表` | dispatch 返回 → `workbench-jova-writing-tool.js` | `intent` |
475
+
476
+ 执行:`helixlife-v5-cli run-code --filename=scripts/workbench-jova-dispatch.js`(**首选**)
477
+
478
+ **2 · outline 页:扩写 ≠ 添加子级(反模式)**
479
+
480
+ 确认提纲页左侧为**提纲树**(非正文)。节点行 `aria-label` 含「操作区」;**移入前**行内按钮不可见。移入后出现:
481
+
482
+ | 按钮 | 作用 | 用户何时才会要 |
483
+ | --- | --- | --- |
484
+ | **编辑** | 右侧「重新生成」→ 用户需求(扩写/精简/润色等)→ 一键生成 → 替换 → 保存 | **扩写前言、润色某节**等改**节点文字** |
485
+ | 添加同级 | 树结构新增同级节点 | 用户明确说「加同级提纲」 |
486
+ | **添加子级** | 树结构新增子节点 | 用户明确说「加子标题/子条目」 |
487
+ | 删除 | 删节点 | 用户明确说删除 |
488
+
489
+ **禁止**:将「扩写 / 精简 / 润色 / 改写 + 章节名」映射为「添加子级」或「添加同级」。前者是 **AI 重写该节点正文**(`编辑` 路径),后者只改提纲层级。
490
+
491
+ `outline-regenerate-node.js` 已实现:定位 `[aria-label*="操作区"]` 且首列文案匹配章节 → hover → **编辑**(不点添加子级)。
492
+
493
+ **3 · writing 页:右侧 AI 工具栏**
494
+
495
+ 精修页中央为富文本 `textbox`;**右侧竖栏**文案:校对、文风、润色、降重、翻译、改写、**扩写**、缩写、文献列表。用户「扩写前言」在 **writing** 页时:选章节 → 点栏内 **扩写** → 一键生成(走 `writing-tool.js`),**不是** outline 树操作。
496
+
497
+ | 工具 | 特殊项 |
498
+ | --- | --- |
499
+ | 文风 | `getByRole('textbox', { name: '参考文风' })` **必填** |
500
+ | 文献列表 | 仅打开列表,无一键生成 |
501
+ | 其余 7 项 | 原文内容 + `getByRole('button', { name: '一键生成' })` + 生成结果 + `替换原文` |
502
+
503
+ **4 · 生成后门禁**
504
+
505
+ - 脚本返回 `needsReplaceChoice` 或用户未说「替换原文」:**禁止**自动点「替换原文」。
506
+ - proofread 脚本:用户仅说「校对 xxx」时 **禁止**自动「确认校对」。
507
+ - writing · 文风:`参考文风` 为必填;`writing-tool.js` 会用 `referenceStyle` 或选中段落兜底。
508
+
509
+ **5 · 禁止的低效路径(导致 Agent 数分钟仍失败)**
510
+
511
+ 1. 在 **outline** 页对用户「扩写/润色/精简 + 章节」点「添加子级」或「添加同级」——**永远不对**。
512
+ 2. 不 `eval location.pathname` 就在 **proofread / writing** 页找提纲树「编辑」或「添加子级」。
513
+ 3. 不用 `run-code --filename=scripts/workbench-jova-*.js`,改用手动 `snapshot` + `click` 拼 hover 才出现的图标按钮。
514
+ 4. 同一轮任务内反复 `snapshot` 猜 `e*` ref 定位提纲节点(须脚本内 `aria-label*="操作区"` + 章节文案匹配)。
515
+
516
+ **6 · 执行命令模板**
517
+
518
+ ```bash
519
+ # ① 定页(不可跳过)
520
+ helixlife-v5-cli --raw eval "location.pathname"
521
+
522
+ # ② 按上表改脚本内 intent / action 后执行,示例:
523
+ helixlife-v5-cli run-code --filename=scripts/workbench-jova-outline-regenerate-node.js
524
+ ```
525
+
526
+ 脚本路径相对于**打开浏览器时的工作区根**(helix-cli 仓库即 `scripts/...`)。
527
+
410
528
  ---
411
529
 
412
530
  ##### WB-2:SCI 论著工作台(`sci`)
@@ -487,6 +605,7 @@ div.side-menu--item[to='/edu/courses']
487
605
  **用户说法映射**
488
606
 
489
607
  - 「写综述 / 综述工作台」→ WB-1,`getByText('综述工作台')`。
608
+ - **「扩写前言 / 扩写 前言 / 润色摘要 / 精简结论 / 改写 xxx」**→ **禁止**提纲树「添加子级」;**必须** `run-code --filename=scripts/workbench-jova-dispatch.js`(改 `userIntent`)。见上文硬门禁与 WB-1 §2。
490
609
  - 「SCI / 英文论文 / 论著工作台」→ WB-2,`getByText('SCI论著工作台')`。
491
610
  - 「国自然 / 基金 / 标书」→ WB-3,`getByText('基金工作台')`(**不是**旧称「基金申请书工作台」)。
492
611
  - 「临床申请书 / PICOS / 临床工作台」→ WB-4;面包屑为「临床申请书工作台」。
@@ -0,0 +1,195 @@
1
+ /**
2
+ * 综述工作台(jova)· 统一入口(WorkBuddy 默认只用本脚本)
3
+ *
4
+ * 改 userIntent 一行;自动按 pathname 路由。
5
+ * outline 页「扩写前言」等:本脚本内直接执行(hover → 编辑,禁止添加子级)。
6
+ *
7
+ * 用法:
8
+ * helixlife-v5-cli run-code --filename=scripts/workbench-jova-dispatch.js
9
+ */
10
+ async page => {
11
+ // ── Agent 只改这一行(原样粘贴用户说法,如「扩写前言」)──
12
+ const userIntent = '扩写前言';
13
+ const action = null; // proofread/writing 子流程用;outline 忽略
14
+
15
+ const pathname = new URL(page.url()).pathname;
16
+ const FORBIDDEN_BUTTONS = ['添加子级', '添加同级'];
17
+
18
+ const outlineVerbs = ['扩写', '精简', '改写', '润色', '重写', '优化'];
19
+ const isOutlineVerbIntent = outlineVerbs.some(v => userIntent.trim().startsWith(v));
20
+ const isProofreadIntent = /^校对/.test(userIntent.trim());
21
+
22
+ function parseOutlineIntent(raw) {
23
+ const text = raw.trim();
24
+ for (const verb of outlineVerbs) {
25
+ if (text.startsWith(verb)) {
26
+ const title = text.slice(verb.length).trim();
27
+ if (title) return { nodeTitle: title, userRequirement: verb };
28
+ }
29
+ }
30
+ return { nodeTitle: '前言', userRequirement: text };
31
+ }
32
+
33
+ function normalizeWritingIntent(raw) {
34
+ const text = raw.trim();
35
+ const tools = ['校对', '文风', '润色', '降重', '翻译', '改写', '扩写', '缩写', '文献列表'];
36
+ for (const tool of tools) {
37
+ if (text === tool || text.startsWith(`${tool} `) || text.startsWith(tool)) {
38
+ const sectionTitle = text.slice(tool.length).trim();
39
+ return sectionTitle ? `${tool} ${sectionTitle}` : tool;
40
+ }
41
+ }
42
+ return text;
43
+ }
44
+
45
+ if (!pathname.includes('/workbench/jova/')) {
46
+ return {
47
+ ok: false,
48
+ userIntent,
49
+ pathname,
50
+ forbiddenNeverClick: FORBIDDEN_BUTTONS,
51
+ reason: '当前不在综述工作台 jova 流程页',
52
+ };
53
+ }
54
+
55
+ // ── outline:扩写/润色/精简 + 章节(禁止添加子级)──
56
+ if (pathname.includes('/jova/outline') && isOutlineVerbIntent) {
57
+ const { nodeTitle, userRequirement } = parseOutlineIntent(userIntent);
58
+ const main = page.locator('main');
59
+
60
+ async function resetEditingState() {
61
+ const closeIcons = main.getByRole('img', { name: 'close' });
62
+ for (let i = 0; i < (await closeIcons.count()); i++) {
63
+ const icon = closeIcons.nth(i);
64
+ if (await icon.isVisible()) {
65
+ await icon.click();
66
+ await page.waitForTimeout(400);
67
+ }
68
+ }
69
+ const cancelReplace = main.getByRole('button', { name: '取 消' });
70
+ if ((await cancelReplace.count()) > 0 && (await cancelReplace.first().isVisible())) {
71
+ await cancelReplace.first().click();
72
+ await page.waitForTimeout(400);
73
+ }
74
+ const saveBtn = main.getByRole('button', { name: '保 存' });
75
+ if ((await saveBtn.count()) > 0 && (await saveBtn.first().isVisible())) {
76
+ await saveBtn.first().click();
77
+ await page.waitForTimeout(400);
78
+ }
79
+ }
80
+
81
+ function outlineNode(title) {
82
+ const base = title.replace(/[::]\s*$/, '');
83
+ const titleRe = new RegExp(`^${base.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[::]?$`);
84
+ return main
85
+ .locator('[aria-label*="操作区"]')
86
+ .filter({
87
+ has: page.locator(':scope > *').first().filter({ hasText: titleRe }),
88
+ })
89
+ .first();
90
+ }
91
+
92
+ await resetEditingState();
93
+
94
+ const opArea = outlineNode(nodeTitle);
95
+ if ((await opArea.count()) === 0) {
96
+ return {
97
+ ok: false,
98
+ route: 'outline',
99
+ userIntent,
100
+ nodeTitle,
101
+ userRequirement,
102
+ forbiddenNeverClick: FORBIDDEN_BUTTONS,
103
+ reason: `未找到提纲节点「${nodeTitle}」`,
104
+ };
105
+ }
106
+
107
+ await opArea.hover();
108
+ await page.waitForTimeout(400);
109
+ await opArea.getByRole('button', { name: '编辑' }).click();
110
+
111
+ const regenTitle = main.getByText('重新生成', { exact: true });
112
+ await regenTitle.waitFor({ state: 'visible', timeout: 10000 });
113
+
114
+ const userReqBox = main.getByRole('textbox', { name: '用户需求' });
115
+ await userReqBox.waitFor({ state: 'visible', timeout: 5000 });
116
+ await userReqBox.fill(userRequirement);
117
+
118
+ await main.getByRole('button', { name: '一键生成' }).click();
119
+ const replaceBtn = main.getByRole('button', { name: '替换原文' });
120
+ await replaceBtn.waitFor({ state: 'visible', timeout: 120000 });
121
+ await page.waitForTimeout(800);
122
+
123
+ await replaceBtn.click();
124
+ await main.getByText('是否将本次生成结果替换原文?', { exact: true }).waitFor({ state: 'visible', timeout: 10000 });
125
+ await main.getByRole('button', { name: '确 定' }).click();
126
+ await page.waitForTimeout(800);
127
+
128
+ const saveBtn = main.getByRole('button', { name: '保 存' });
129
+ await saveBtn.waitFor({ state: 'visible', timeout: 10000 });
130
+ await saveBtn.click();
131
+ await page.waitForTimeout(1000);
132
+
133
+ return {
134
+ ok: true,
135
+ route: 'outline',
136
+ userIntent,
137
+ nodeTitle,
138
+ userRequirement,
139
+ clickedButton: '编辑',
140
+ forbiddenNeverClick: FORBIDDEN_BUTTONS,
141
+ message: `已通过「编辑→重新生成」完成「${userRequirement}」节点「${nodeTitle}」(未使用添加子级)。`,
142
+ url: page.url(),
143
+ };
144
+ }
145
+
146
+ // ── proofread / writing:返回子脚本,仍禁止添加子级 ──
147
+ if (pathname.includes('/jova/proofread') || isProofreadIntent) {
148
+ return {
149
+ ok: false,
150
+ route: 'proofread',
151
+ userIntent,
152
+ pathname,
153
+ forbiddenNeverClick: FORBIDDEN_BUTTONS,
154
+ nextScript: 'scripts/workbench-jova-proofread-section.js',
155
+ setIntent: userIntent,
156
+ setAction: action,
157
+ message: '请改 proofread-section.js 的 intent/action 后 run-code;禁止点添加子级。',
158
+ };
159
+ }
160
+
161
+ if (pathname.includes('/jova/writing')) {
162
+ return {
163
+ ok: false,
164
+ route: 'writing',
165
+ userIntent,
166
+ pathname,
167
+ forbiddenNeverClick: FORBIDDEN_BUTTONS,
168
+ nextScript: 'scripts/workbench-jova-writing-tool.js',
169
+ setIntent: normalizeWritingIntent(userIntent),
170
+ setAction: action,
171
+ message: '请改 writing-tool.js 的 intent 后 run-code;writing 页无添加子级按钮。',
172
+ };
173
+ }
174
+
175
+ if (pathname.includes('/jova/outline')) {
176
+ return {
177
+ ok: false,
178
+ route: 'outline',
179
+ userIntent,
180
+ pathname,
181
+ forbiddenNeverClick: FORBIDDEN_BUTTONS,
182
+ nextScript: 'scripts/workbench-jova-outline-regenerate-node.js',
183
+ setIntent: userIntent,
184
+ reason: 'userIntent 未匹配扩写/精简/润色/改写/重写/优化 前缀',
185
+ };
186
+ }
187
+
188
+ return {
189
+ ok: false,
190
+ userIntent,
191
+ pathname,
192
+ forbiddenNeverClick: FORBIDDEN_BUTTONS,
193
+ reason: '当前 jova 步骤页不支持本章 AI 操作(topic/proofread 以外)',
194
+ };
195
+ };
@@ -1,19 +1,23 @@
1
1
  /**
2
- * 综述工作台(jova)· 确认提纲页 · 节点 AI 重新生成
2
+ * 综述工作台(jova)· 确认提纲页(/workbench/jova/outline)· 节点 AI 重新生成
3
3
  *
4
- * 典型场景:用户说「扩写前言」「精简结论」「润色 1. xxx」等。
4
+ * 【页面门禁】仅用于 pathname 含 /workbench/jova/outline;writing 页扩写走 writing-tool.js。
5
+ *
6
+ * 【禁止误判】用户「扩写前言」= 本脚本(hover → 编辑 → 重新生成),绝不是提纲树「添加子级」。
7
+ *
8
+ * 典型场景:用户说「扩写前言」「扩写 前言」「精简结论」「润色 1. xxx」等。
5
9
  *
6
10
  * 流程:
7
- * 悬停提纲节点 → 编辑 填写「用户需求」→「一键生成」
11
+ * 悬停提纲节点 → 编辑(不点添加子级/添加同级)→ 填写「用户需求」→「一键生成」
8
12
  * → 等待「生成结果」→「替换原文」→ Popconfirm「确 定」→「保 存」
9
13
  *
10
- * 用法(仅需改 intent 一行,或显式指定 nodeTitle / userRequirement):
14
+ * 用法(WorkBuddy 请优先用 workbench-jova-dispatch.js;本文件为 outline 子脚本):
11
15
  * helixlife-v5-cli run-code --filename=scripts/workbench-jova-outline-regenerate-node.js
12
16
  *
13
- * intent 解析规则:
14
- * 「扩写前言」 → nodeTitle=前言, userRequirement=扩写
15
- * 「精简结论」 → nodeTitle=结论, userRequirement=精简
16
- * 「润色摘要:」 → nodeTitle=摘要:, userRequirement=润色
17
+ * intent 解析规则(动词与章节可连写或空格):
18
+ * 「扩写前言」「扩写 前言」 → nodeTitle=前言, userRequirement=扩写
19
+ * 「精简结论」 → nodeTitle=结论, userRequirement=精简
20
+ * 「润色摘要:」 → nodeTitle=摘要:, userRequirement=润色
17
21
  * 无法解析时整句作为 userRequirement,nodeTitle 回退为「前言」
18
22
  */
19
23
  async page => {
@@ -26,13 +30,14 @@ async page => {
26
30
 
27
31
  function parseIntent(raw) {
28
32
  const verbs = ['扩写', '精简', '改写', '润色', '重写', '优化'];
33
+ const text = raw.trim();
29
34
  for (const verb of verbs) {
30
- if (raw.startsWith(verb)) {
31
- const title = raw.slice(verb.length).trim();
35
+ if (text.startsWith(verb)) {
36
+ const title = text.slice(verb.length).trim();
32
37
  if (title) return { nodeTitle: title, userRequirement: verb };
33
38
  }
34
39
  }
35
- return { nodeTitle: '前言', userRequirement: raw };
40
+ return { nodeTitle: '前言', userRequirement: text };
36
41
  }
37
42
 
38
43
  const parsed = parseIntent(intent);
@@ -1,5 +1,7 @@
1
1
  /**
2
- * 综述工作台(jova)· 初稿精修页 · 右侧 AI 工具
2
+ * 综述工作台(jova)· 初稿精修页(/workbench/jova/writing)· 右侧 AI 工具
3
+ *
4
+ * 【页面门禁】仅用于 pathname 含 /workbench/jova/writing;outline 页「扩写前言」走 outline-regenerate-node.js。
3
5
  *
4
6
  * 支持工具(右侧栏):校对、文风、润色、降重、翻译、改写、扩写、缩写、文献列表
5
7
  *