diff --git a/changelog.d/3129.fixed.md b/changelog.d/3129.fixed.md new file mode 100644 index 000000000..d3d65318a --- /dev/null +++ b/changelog.d/3129.fixed.md @@ -0,0 +1 @@ +Every Chinese sentence on the Workflows page now names the feature 工作流: the empty state, the new, rename and delete buttons and their error toasts, the Workflow graphs tab, the reading hint and the created toast used to print the English word `Workflow` in the middle of Chinese copy whose page header already said 工作流 ([#3129](https://github.com/ThinkFlowLab/FlyBot/issues/3129)). diff --git a/docs/subsystems/workflow.md b/docs/subsystems/workflow.md index f7308c649..77660e9b6 100644 --- a/docs/subsystems/workflow.md +++ b/docs/subsystems/workflow.md @@ -45,7 +45,7 @@ Everything in `plugins/workflow/`: the graph rules, the run store, the matcher, | `plugins/workflow/src/match.js` | Which open card matches a Workflow or a local Bot. | | `plugins/workflow/src/template.js` | Factory delivery/weekly graphs plus `EARLY_END_GUIDANCE` for Claim/Verify/Triage early-end markers; 发布交付流水线 (a parallel branch) and the weekly report, each node with the inputs and outputs that edge carries. | | `plugins/workflow/src/narrate.js` | Progress lines for a step. A live run quotes the Bot reply when present; otherwise delivery-template nodes may use canned copy. A join line is only for a rank of more than one node. | -| `plugins/workflow/client.js` | Sidebar section (with mini-flowcharts), workflow stage (view/control: one card per live run with its own title, node line, segment progress, status chip, and Pause / Resume / Stop; click a card or its Flow button to focus that run in the drawer flowchart; optional aggregate chip when several run or the queue is non-empty — no message composer), assign dialog (scrollable with sticky footer; it selects the first card once the board loads, keeps `Assign` disabled until a card is selected, and shows a failed Tasks load as an error with a `Retry` instead of the empty-board hint, #1457, #1458; the hand-off carries the card's own facts — the assign body sends the card's `brief` verbatim and an explicit empty one when the card holds none, so a run never starts on the title where the card had a work order and a brief an earlier call cached cannot come back (#2495); both of its choice lists draw twelve at a time and a `Show {count} more cards` / `Show {count} more Bots` row says how many they are not showing, expanding to the rest and folding back to `Show less`, so no card or local Bot is out of reach while the default view keeps its length, and a card picked past the twelfth is drawn first once the list is folded again, so the twelve rows never hide the card the button is about to send (#2257), #2244), flowchart drawer (collapsed by default, per-node inspector, fitted to the 400px panel so the graph needs no inner horizontal scroll), and Settings → Workflow graphs (canvas-first with inspector panel). The product UI starts only live runs (assign, ingest). The stage shows the queue and refreshes state while runs are active; a running node uses a breathing border animation. Visual flowcharts replace text chains across all surfaces. Sidebar rows (including factory ids such as `delivery`) support Delete with confirm. A row with live runs draws the number beside the dot and carries the count, with the word `running`, in a visually hidden `.wf-sr` span — the dot and the digit sit inside an `aria-hidden` wrap, so the number alone would be silent to a reader — and its accessible name therefore stays the name its content gives: the lane's name, the `Workflow` badge, its Project and its preview, plus the count; a row-level `aria-label` replaced all of that and made two lanes that share a name read alike (#2222, #2230). The `Workflow` badge itself is drawn through the plugin's dictionary, so a zh window reads 工作流 in the row and in the Hand a task to a Workflow target list while an English window keeps the word (#3102). An idle row draws no dot, no count, no digit and no hidden text, so its name stays its own text. The stage and dialogs portal onto `document.body`; a missing container stays in the section tree. A stage control that fails — a graph save, Reset, Pause, Resume or Stop that throws, rejects, answers `{ok:false}` or does not answer within 10 s — ends on the section's `.wf-err` alert instead of being swallowed, and a success clears the alert. The flowchart's node role sub-label takes its colour from `--bt-ink-2` rather than a hardcoded grey, so it stays readable on every theme's node card (#1495). The drawer's styling reuses the core `--bt-*` tokens and the Bot details drawer's patterns (title, pill tabs, soft pill buttons, bubble-surfaced node cards; accent tints mixed from `--bt-accent`, #1654). The stage lists the tasks the open workflow holds (`heldTasks`; when `heldTaskCount` exceeds that page the rest is a `Show {count} more held tasks` control — a `wf-more` button with `data-more="held"` and `aria-expanded`, whose count is what pressing it reaches past the rows drawn rather than everything the lane holds — that reads the wider page with `heldLimit: 200` and folds back to `Show less`; that page stops at 200, so an unfolded list still short of `heldTaskCount` draws a `wf-held-note` line `Showing {shown} of {count} held tasks`, and neither the count nor the button promises an id it cannot show (#2256, #2260), each with one **Re-match** action that drops that task's claim and matches it again through `workflow/ingest` with `rematch: true` — one board read to hand over the card's fields and one state read after, never a second polling loop (#1647). The drawer's Edit plane keeps one copy of the row geometry: a graph whose parallel cards still fit is the fitted plane (scaled centres, `parallelFrameStyle` frame, one-fold `wirePath`), and one that cannot is laid out in `flowLayout`'s own rows — its cards are those boxes, its dashed frame is that band's frame, and its wires are the `flowWires` routing around them, so a 3+ way step at a 364px drawer keeps its frame inside the panel and no wire crosses a card (#1693). A two-Bot parallel step the fitted plane would squeeze — the drawer's fit leaves the pair 4px apart, with each card's out-port (5px) and remove button (8px) past its right edge under the neighbour — is drawn at that row's `flowLayout` column width (154px at a 364px drawer) on its fitted centres and wires, keeping the 12px row gap and a plane whose drags still commit world coordinates; `parallelFrameStyle` adds the 20px label band above the cards and a 10px pad below them, so the fitted frame encloses every card it names (#1738). | +| `plugins/workflow/client.js` | Sidebar section (with mini-flowcharts), workflow stage (view/control: one card per live run with its own title, node line, segment progress, status chip, and Pause / Resume / Stop; click a card or its Flow button to focus that run in the drawer flowchart; optional aggregate chip when several run or the queue is non-empty — no message composer), assign dialog (scrollable with sticky footer; it selects the first card once the board loads, keeps `Assign` disabled until a card is selected, and shows a failed Tasks load as an error with a `Retry` instead of the empty-board hint, #1457, #1458; the hand-off carries the card's own facts — the assign body sends the card's `brief` verbatim and an explicit empty one when the card holds none, so a run never starts on the title where the card had a work order and a brief an earlier call cached cannot come back (#2495); both of its choice lists draw twelve at a time and a `Show {count} more cards` / `Show {count} more Bots` row says how many they are not showing, expanding to the rest and folding back to `Show less`, so no card or local Bot is out of reach while the default view keeps its length, and a card picked past the twelfth is drawn first once the list is folded again, so the twelve rows never hide the card the button is about to send (#2257), #2244), flowchart drawer (collapsed by default, per-node inspector, fitted to the 400px panel so the graph needs no inner horizontal scroll), and Settings → Workflow graphs (canvas-first with inspector panel). The product UI starts only live runs (assign, ingest). The stage shows the queue and refreshes state while runs are active; a running node uses a breathing border animation. Visual flowcharts replace text chains across all surfaces. Sidebar rows (including factory ids such as `delivery`) support Delete with confirm. A row with live runs draws the number beside the dot and carries the count, with the word `running`, in a visually hidden `.wf-sr` span — the dot and the digit sit inside an `aria-hidden` wrap, so the number alone would be silent to a reader — and its accessible name therefore stays the name its content gives: the lane's name, the `Workflow` badge, its Project and its preview, plus the count; a row-level `aria-label` replaced all of that and made two lanes that share a name read alike (#2222, #2230). The `Workflow` badge itself is drawn through the plugin's dictionary, so a zh window reads 工作流 in the row and in the Hand a task to a Workflow target list while an English window keeps the word (#3102). Every other Chinese sentence that names the feature says 工作流 as well — the empty state, the new, rename and delete buttons and their error toasts, the Workflow graphs tab, the reading hint and the created toast — so one window never mixes the two words; the English keys and copy are unchanged (#3129). An idle row draws no dot, no count, no digit and no hidden text, so its name stays its own text. The stage and dialogs portal onto `document.body`; a missing container stays in the section tree. A stage control that fails — a graph save, Reset, Pause, Resume or Stop that throws, rejects, answers `{ok:false}` or does not answer within 10 s — ends on the section's `.wf-err` alert instead of being swallowed, and a success clears the alert. The flowchart's node role sub-label takes its colour from `--bt-ink-2` rather than a hardcoded grey, so it stays readable on every theme's node card (#1495). The drawer's styling reuses the core `--bt-*` tokens and the Bot details drawer's patterns (title, pill tabs, soft pill buttons, bubble-surfaced node cards; accent tints mixed from `--bt-accent`, #1654). The stage lists the tasks the open workflow holds (`heldTasks`; when `heldTaskCount` exceeds that page the rest is a `Show {count} more held tasks` control — a `wf-more` button with `data-more="held"` and `aria-expanded`, whose count is what pressing it reaches past the rows drawn rather than everything the lane holds — that reads the wider page with `heldLimit: 200` and folds back to `Show less`; that page stops at 200, so an unfolded list still short of `heldTaskCount` draws a `wf-held-note` line `Showing {shown} of {count} held tasks`, and neither the count nor the button promises an id it cannot show (#2256, #2260), each with one **Re-match** action that drops that task's claim and matches it again through `workflow/ingest` with `rematch: true` — one board read to hand over the card's fields and one state read after, never a second polling loop (#1647). The drawer's Edit plane keeps one copy of the row geometry: a graph whose parallel cards still fit is the fitted plane (scaled centres, `parallelFrameStyle` frame, one-fold `wirePath`), and one that cannot is laid out in `flowLayout`'s own rows — its cards are those boxes, its dashed frame is that band's frame, and its wires are the `flowWires` routing around them, so a 3+ way step at a 364px drawer keeps its frame inside the panel and no wire crosses a card (#1693). A two-Bot parallel step the fitted plane would squeeze — the drawer's fit leaves the pair 4px apart, with each card's out-port (5px) and remove button (8px) past its right edge under the neighbour — is drawn at that row's `flowLayout` column width (154px at a 364px drawer) on its fitted centres and wires, keeping the 12px row gap and a plane whose drags still commit world coordinates; `parallelFrameStyle` adds the 20px label band above the cards and a 10px pad below them, so the fitted frame encloses every card it names (#1738). | ## Entry points diff --git a/plugins/workflow/client.js b/plugins/workflow/client.js index 4d3cfae15..62194f017 100644 --- a/plugins/workflow/client.js +++ b/plugins/workflow/client.js @@ -27,9 +27,9 @@ window.__ModuleLoader__.load({ Unassigned: '未归属', 'All Projects': '全部项目', 'Filter by Project': '按项目筛选', - 'No workflows in this Project': '这个项目下还没有 Workflow', - 'Hand a task to a Workflow': '把任务交给 Workflow', - 'A task can go to a Workflow, not only to one Bot. The Workflow then runs each Bot in order, or side by side.': '任务不再只能交给单个 Bot —— 交给 Workflow 后,会按固定流程依次(或并行)交给各个 Bot 执行。', + 'No workflows in this Project': '这个项目下还没有工作流', + 'Hand a task to a Workflow': '把任务交给工作流', + 'A task can go to a Workflow, not only to one Bot. The Workflow then runs each Bot in order, or side by side.': '任务不再只能交给单个 Bot —— 交给工作流后,会按固定流程依次(或并行)交给各个 Bot 执行。', 'Pick a task card': '从 Tasks 看板选择任务卡片', 'Pick who runs it': '选择执行者', Cancel: '取消', @@ -58,13 +58,13 @@ window.__ModuleLoader__.load({ Resume: '继续', Stop: '停止', Progress: '进度', - 'New workflow': '新建 Workflow', + 'New workflow': '新建工作流', Name: '名称', 'Add a Bot': '添加 Bot', Parallel: '与上一步并行', Create: '创建', 'Local Bots': '本机 Bot', - 'No workflows yet.': '还没有 Workflow。', + 'No workflows yet.': '还没有工作流。', 'Waiting for a task': '等待任务', 'A step failed': '有一步失败', '{node} failed': '{node} 失败', @@ -95,7 +95,7 @@ window.__ModuleLoader__.load({ Remove: '移除', 'System prompt': '系统提示词', Save: '保存', - 'Workflow graphs': 'Workflow 图', + 'Workflow graphs': '工作流图', 'Add link': '添加连线', 'This pair already has a {kind} link — replace or delete it first.': '这一对已有一条{kind}连线,请先替换或删除它。', '(linked)': '(已连接)', @@ -122,25 +122,25 @@ window.__ModuleLoader__.load({ 'Inputs and outputs': '输入和输出', Delete: '删除', Rename: '重命名', - 'Delete workflow': '删除 Workflow', - 'Rename workflow': '重命名 Workflow', + 'Delete workflow': '删除工作流', + 'Rename workflow': '重命名工作流', 'Are you sure you want to delete "{name}"? This cannot be undone.': '确定删除「{name}」?此操作无法撤销。', 'No open tasks on the Tasks board.': 'Tasks 看板上没有可分配的任务。', - 'Tasks this workflow holds': '此 Workflow 持有的任务', + 'Tasks this workflow holds': '此工作流持有的任务', 'Re-match': '重新匹配', '{count} more held tasks': '还有 {count} 个持有的任务', 'Could not re-match this task': '无法重新匹配该任务', 'Loading the Tasks board…': '正在读取 Tasks 看板…', 'Could not load the Tasks board.': '无法读取 Tasks 看板。', Retry: '重试', - 'Could not rename this workflow': '无法重命名该 Workflow', - 'Could not delete this workflow': '无法删除该 Workflow', - 'Could not save this workflow': '无法保存该 Workflow', - 'Could not reset this workflow': '无法重置该 Workflow', + 'Could not rename this workflow': '无法重命名该工作流', + 'Could not delete this workflow': '无法删除该工作流', + 'Could not save this workflow': '无法保存该工作流', + 'Could not reset this workflow': '无法重置该工作流', 'Could not pause this run': '无法暂停本次运行', 'Could not resume this run': '无法继续本次运行', 'Could not stop this run': '无法停止本次运行', - 'Reading workflows…': '正在读取 Workflow…', + 'Reading workflows…': '正在读取工作流…', 'Changes are saved automatically': '更改会自动保存', 'Try again': '重试', 'Could not change the model': '无法更改模型', @@ -159,7 +159,7 @@ window.__ModuleLoader__.load({ // before the key existed. 'Task assigned · {task} → {workflow}': '任务已分配 · {task} → {workflow}', 'Queued · {task} ({ahead} ahead)': '排队 · {task}(前面 {ahead} 个)', - 'Workflow "{name}" created · members {members}': 'Workflow「{name}」已创建 · 成员 {members}', + 'Workflow "{name}" created · members {members}': '工作流「{name}」已创建 · 成员 {members}', '⏸ Paused · {task}': '⏸ 已暂停 · {task}', '▶ Resumed · {task}': '▶ 已继续 · {task}', '■ Stopped · {task}': '■ 已停止 · {task}', @@ -174,7 +174,7 @@ window.__ModuleLoader__.load({ '{node} did not take this step ({code}); {total} retries did not land, the run failed.': '{node} 没有接到这一步({code}),重试 {total} 次仍未落地,run 已标记失败。', '{node} step deadline reached ({minutes} min), the run was marked failed.': '{node} 这一步到达 {minutes} 分钟的截止时间,run 已标记失败。', 'Started · {task} · {nodes}': '开始 · {task} · {nodes}', - 'Task {task} entered the workflow; {nodes} claimed it': '任务 {task} 已进入 Workflow,{nodes} 认领', + 'Task {task} entered the workflow; {nodes} claimed it': '任务 {task} 已进入工作流,{nodes} 认领', '{node} failed; went back to {nodes} to retry': '{node} 失败,已返回 {nodes} 重试', '↺ Recovered from failure → {nodes}': '↺ 失败恢复 → {nodes}', '{node} failed this step and stops here.': '{node} 这一步失败了,停在本节点。', diff --git a/plugins/workflow/test/client.test.js b/plugins/workflow/test/client.test.js index cd5e17141..633b7f8aa 100644 --- a/plugins/workflow/test/client.test.js +++ b/plugins/workflow/test/client.test.js @@ -1739,7 +1739,7 @@ test('Chinese labels follow the host Tasks translation', () => { globalThis.__flybot__ = { t: key => (key === 'Tasks' ? '任务' : key) } try { assert.equal(client.tr('Edit'), '编辑') - assert.equal(client.tr('Hand a task to a Workflow'), '把任务交给 Workflow') + assert.equal(client.tr('Hand a task to a Workflow'), '把任务交给工作流') assert.equal(client.tr('Pick a node'), '选择一个节点') assert.equal(client.columnOf({ status: 'working' }), 'in-progress') assert.equal(client.shortId('task-abcdef123456'), '#123456') @@ -1802,6 +1802,43 @@ test('P-784: the same badge in Hand a task to a Workflow reads Chinese too', asy } }) +// #3129: the zh table named the feature `Workflow` inside Chinese sentences while the page header, +// the row badge and the missing-plugin hint already read 工作流 — two vocabularies on one screen. +// These are the keys that carried it, and `tr` is the path a zh window really takes, so the test +// reads the same table the window reads. +const ZH_WORKFLOW_KEYS = [ + 'No workflows in this Project', + 'Hand a task to a Workflow', + 'A task can go to a Workflow, not only to one Bot. The Workflow then runs each Bot in order, or side by side.', + 'New workflow', + 'No workflows yet.', + 'Workflow graphs', + 'Delete workflow', + 'Rename workflow', + 'Tasks this workflow holds', + 'Could not rename this workflow', + 'Could not delete this workflow', + 'Could not save this workflow', + 'Could not reset this workflow', + 'Reading workflows…', + 'Workflow "{name}" created · members {members}', + 'Task {task} entered the workflow; {nodes} claimed it', +] + +test('#3129: no Chinese sentence names the feature in English', () => { + const prev = globalThis.__flybot__ + globalThis.__flybot__ = zhUi + try { + for (const key of ZH_WORKFLOW_KEYS) { + const text = client.tr(key, { name: 'lane', members: 'A, B', task: '#1', nodes: 'A' }) + assert.equal(text.includes('Workflow'), false, `${JSON.stringify(key)} still says Workflow in a Chinese sentence: ${JSON.stringify(text)}`) + assert.ok(text.includes('工作流'), `${JSON.stringify(key)} does not name the feature 工作流: ${JSON.stringify(text)}`) + } + } finally { + globalThis.__flybot__ = prev + } +}) + test('a failed stage graph save is reported, not swallowed', async (t) => { await withUnhandled(async (unhandled) => { const graph = delivery() diff --git a/plugins/workflow/test/timeline-locale.test.js b/plugins/workflow/test/timeline-locale.test.js index 9afe5d784..d14cdc0ba 100644 --- a/plugins/workflow/test/timeline-locale.test.js +++ b/plugins/workflow/test/timeline-locale.test.js @@ -224,7 +224,7 @@ test('the Chinese shell renders the same timeline event lines in Chinese', async const text = await stageText(EVENTS, 'zh') assert.ok(text.includes('任务已分配 · #1489 · Timeline copy → Delivery lane'), `assigned line missing from: ${text}`) assert.ok(text.includes('排队 · #1489 · Timeline copy(前面 2 个)')) - assert.ok(text.includes('Workflow「Delivery lane」已创建 · 成员 Planner, Writer')) + assert.ok(text.includes('工作流「Delivery lane」已创建 · 成员 Planner, Writer')) assert.ok(text.includes('⏸ 已暂停 · #1489 · Timeline copy')) assert.ok(text.includes('▶ 已继续 · #1489 · Timeline copy')) assert.ok(text.includes('■ 已停止 · #1489 · Timeline copy')) @@ -390,7 +390,7 @@ test('a non-live run frame carries an English key and keeps the Chinese text', a assert.ok(text.includes('↺ Run reset')) const zh = await stageText(rows, 'zh') - assert.ok(zh.includes('任务 #1489 Timeline copy 已进入 Workflow,Planner 认领')) + assert.ok(zh.includes('任务 #1489 Timeline copy 已进入工作流,Planner 认领')) assert.ok(zh.includes('Writer 这一步失败了,停在本节点。')) assert.ok(zh.includes('↻ Tester 失败后自动重试 · Coder 已推送快照更新')) assert.ok(zh.includes('✓ 完成 · #1489 · Timeline copy · 6 步'))