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
1 change: 1 addition & 0 deletions changelog.d/3114-tree-sidebar-zh.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Bot tree's sidebar copy — the Archived Bots group, its status tags, and the reorganization notice's title, Undo/Dismiss buttons, "and N more" line and kept names — now follows the window's language, so a Chinese window no longer reads English there; a window without a translator still reads today's English ([#3114](https://github.com/ThinkFlowLab/FlyBot/issues/3114)).
14 changes: 14 additions & 0 deletions core/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,20 @@ var ZH = {
// Sidebar and account menu
"Bot list": "Bot 列表",
"Bot tree": "Bot 树",
// #3114 cut 19: the Bot tree's sidebar — the Archived Bots group, its status tags, and the
// reorganization notice's title, Undo/Dismiss, "and N more" line and kept names.
"Archived bots": "已归档的 Bot",
"Archived ({count})": "已归档({count})",
"Tree reorganized": "Bot 树已重组",
"Tree reorganization undone": "已撤销 Bot 树重组",
"and {count} more": "还有 {count} 条",
"Kept: {names}": "保留:{names}",
"archived · merged into {name}": "已归档 · 并入 {name}",
archived: "已归档",
retired: "已退役",
idle: "空闲",
"outside the tree": "不在树中",
Undo: "撤销",
"no longer shared": "已不再共享",
"Messages waiting for your approval": "等你批准的消息",
"Waiting for approval": "等待批准",
Expand Down
14 changes: 14 additions & 0 deletions core/src/client/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ const ZH = {
// Sidebar and account menu
'Bot list': 'Bot 列表',
'Bot tree': 'Bot 树',
// #3114 cut 19: the Bot tree's sidebar — the Archived Bots group, its status tags, and the
// reorganization notice's title, Undo/Dismiss, "and N more" line and kept names.
'Archived bots': '已归档的 Bot',
'Archived ({count})': '已归档({count})',
'Tree reorganized': 'Bot 树已重组',
'Tree reorganization undone': '已撤销 Bot 树重组',
'and {count} more': '还有 {count} 条',
'Kept: {names}': '保留:{names}',
'archived · merged into {name}': '已归档 · 并入 {name}',
archived: '已归档',
retired: '已退役',
idle: '空闲',
'outside the tree': '不在树中',
Undo: '撤销',
'no longer shared': '已不再共享',
'Messages waiting for your approval': '等你批准的消息',
'Waiting for approval': '等待批准',
Expand Down
7 changes: 0 additions & 7 deletions core/test/i18n-missing-entries.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,8 @@
"plugins/timeline/client.js:{} waiting",
"plugins/timeline/client.js:{}h {}m",
"plugins/timeline/client.js:{}m {}s",
"plugins/tree/client.js:Archived bots",
"plugins/tree/client.js:No child bots yet. Ask Chief to take on a task and it will create child bots.",
"plugins/tree/client.js:Tree",
"plugins/tree/client.js:Tree reorganization undone",
"plugins/tree/client.js:Tree reorganized#1",
"plugins/tree/client.js:Tree reorganized#2",
"plugins/tree/client.js:Undo",
"plugins/tree/client.js:archived · merged into {}",
"plugins/tree/client.js:outside the tree",
"plugins/workflow/client.js:Names the connectors this run Bot may use: github grants mcp__github__*, composio grants the Composio connector. File and shell access is always full, like a normal Bot, and a node that names no connector gets none.",
"plugins/workflow/client.js:这里填这个节点 Bot 能用的连接器:github 对应 mcp__github__*,composio 对应 Composio 连接器。文件与 shell 权限始终与普通 Bot 相同(完全放开);不填连接器时这个节点一个都拿不到。"
]
Expand Down
4 changes: 2 additions & 2 deletions core/test/i18n-missing-entries.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ test('the widening only adds pins and never admits a glyph', () => {
'plugins/timeline/client.js:Timeline#1',
'plugins/timeline/client.js:Timeline#2',
'plugins/timeline/client.js:Timeline#3',
'plugins/tree/client.js:Tree reorganized#1',
'plugins/tree/client.js:Tree reorganized#2',
'plugins/tree/client.js:Tree',
'plugins/tree/client.js:No child bots yet. Ask Chief to take on a task and it will create child bots.',
]) assert.ok(current.has(entry), `${entry} is pinned`)
for (const pin of current) assert.match(pin, /\p{L}/u, `${pin} names a sentence, not a glyph`)
})
Expand Down
1 change: 0 additions & 1 deletion core/test/i18n-plugins.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"plugins/timeline/client.js:Window",
"plugins/tree/client.js:Bot tree",
"plugins/tree/client.js:Copy invite link",
"plugins/tree/client.js:Dismiss",
"plugins/workflow/client.js:Instructions"
]
}
5 changes: 1 addition & 4 deletions core/test/i18n-template-draws.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@
"plugins/timeline/client.js:busy {} (model {} · tools {}) · no running turn {} · {} turn{}{}{}",
"plugins/timeline/client.js:{} request{} not answered yet.",
"plugins/timeline/client.js:{}: model {}%, tools {}%, no running turn {}%",
"plugins/tree/client.js:Archived ({})",
"plugins/tree/client.js:Collapse {}",
"plugins/tree/client.js:Copy invite link for {}",
"plugins/tree/client.js:Kept: {}",
"plugins/tree/client.js:and {} more"
"plugins/tree/client.js:Copy invite link for {}"
]
}
16 changes: 15 additions & 1 deletion patches/ds-bot/0001-core-fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js
Content: '内容',
'Referenced {labels}': '引用了 {labels}',
', ': '、',
@@ -41,22 +41,93 @@ const ZH = {
@@ -41,22 +41,107 @@ const ZH = {
' and ': '、',
and: '和',
'{count} members': '{count} 位成员',
Expand Down Expand Up @@ -942,6 +942,20 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js
// Sidebar and account menu
'Bot list': 'Bot 列表',
+ 'Bot tree': 'Bot 树',
+ // #3114 cut 19: the Bot tree's sidebar — the Archived Bots group, its status tags, and the
+ // reorganization notice's title, Undo/Dismiss, "and N more" line and kept names.
+ 'Archived bots': '已归档的 Bot',
+ 'Archived ({count})': '已归档({count})',
+ 'Tree reorganized': 'Bot 树已重组',
+ 'Tree reorganization undone': '已撤销 Bot 树重组',
+ 'and {count} more': '还有 {count} 条',
+ 'Kept: {names}': '保留:{names}',
+ 'archived · merged into {name}': '已归档 · 并入 {name}',
+ archived: '已归档',
+ retired: '已退役',
+ idle: '空闲',
+ 'outside the tree': '不在树中',
+ Undo: '撤销',
+ 'no longer shared': '已不再共享',
+ 'Messages waiting for your approval': '等你批准的消息',
+ 'Waiting for approval': '等待批准',
Expand Down
16 changes: 15 additions & 1 deletion patches/ds-bot/0008-client-bundle.patch
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ diff --git a/client.js b/client.js
Content: "内容",
"Referenced {labels}": "引用了 {labels}",
", ": "、",
@@ -78,21 +78,92 @@ var ZH = {
@@ -78,21 +78,106 @@ var ZH = {
" and ": "、",
and: "和",
"{count} members": "{count} 位成员",
Expand Down Expand Up @@ -206,6 +206,20 @@ diff --git a/client.js b/client.js
// Sidebar and account menu
"Bot list": "Bot 列表",
+ "Bot tree": "Bot 树",
+ // #3114 cut 19: the Bot tree's sidebar — the Archived Bots group, its status tags, and the
+ // reorganization notice's title, Undo/Dismiss, "and N more" line and kept names.
+ "Archived bots": "已归档的 Bot",
+ "Archived ({count})": "已归档({count})",
+ "Tree reorganized": "Bot 树已重组",
+ "Tree reorganization undone": "已撤销 Bot 树重组",
+ "and {count} more": "还有 {count} 条",
+ "Kept: {names}": "保留:{names}",
+ "archived · merged into {name}": "已归档 · 并入 {name}",
+ archived: "已归档",
+ retired: "已退役",
+ idle: "空闲",
+ "outside the tree": "不在树中",
+ Undo: "撤销",
+ "no longer shared": "已不再共享",
+ "Messages waiting for your approval": "等你批准的消息",
+ "Waiting for approval": "等待批准",
Expand Down
7 changes: 0 additions & 7 deletions patches/ds-bot/files/test/i18n-missing-entries.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,8 @@
"plugins/timeline/client.js:{} waiting",
"plugins/timeline/client.js:{}h {}m",
"plugins/timeline/client.js:{}m {}s",
"plugins/tree/client.js:Archived bots",
"plugins/tree/client.js:No child bots yet. Ask Chief to take on a task and it will create child bots.",
"plugins/tree/client.js:Tree",
"plugins/tree/client.js:Tree reorganization undone",
"plugins/tree/client.js:Tree reorganized#1",
"plugins/tree/client.js:Tree reorganized#2",
"plugins/tree/client.js:Undo",
"plugins/tree/client.js:archived · merged into {}",
"plugins/tree/client.js:outside the tree",
"plugins/workflow/client.js:Names the connectors this run Bot may use: github grants mcp__github__*, composio grants the Composio connector. File and shell access is always full, like a normal Bot, and a node that names no connector gets none.",
"plugins/workflow/client.js:这里填这个节点 Bot 能用的连接器:github 对应 mcp__github__*,composio 对应 Composio 连接器。文件与 shell 权限始终与普通 Bot 相同(完全放开);不填连接器时这个节点一个都拿不到。"
]
Expand Down
4 changes: 2 additions & 2 deletions patches/ds-bot/files/test/i18n-missing-entries.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ test('the widening only adds pins and never admits a glyph', () => {
'plugins/timeline/client.js:Timeline#1',
'plugins/timeline/client.js:Timeline#2',
'plugins/timeline/client.js:Timeline#3',
'plugins/tree/client.js:Tree reorganized#1',
'plugins/tree/client.js:Tree reorganized#2',
'plugins/tree/client.js:Tree',
'plugins/tree/client.js:No child bots yet. Ask Chief to take on a task and it will create child bots.',
]) assert.ok(current.has(entry), `${entry} is pinned`)
for (const pin of current) assert.match(pin, /\p{L}/u, `${pin} names a sentence, not a glyph`)
})
Expand Down
1 change: 0 additions & 1 deletion patches/ds-bot/files/test/i18n-plugins.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"plugins/timeline/client.js:Window",
"plugins/tree/client.js:Bot tree",
"plugins/tree/client.js:Copy invite link",
"plugins/tree/client.js:Dismiss",
"plugins/workflow/client.js:Instructions"
]
}
5 changes: 1 addition & 4 deletions patches/ds-bot/files/test/i18n-template-draws.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@
"plugins/timeline/client.js:busy {} (model {} · tools {}) · no running turn {} · {} turn{}{}{}",
"plugins/timeline/client.js:{} request{} not answered yet.",
"plugins/timeline/client.js:{}: model {}%, tools {}%, no running turn {}%",
"plugins/tree/client.js:Archived ({})",
"plugins/tree/client.js:Collapse {}",
"plugins/tree/client.js:Copy invite link for {}",
"plugins/tree/client.js:Kept: {}",
"plugins/tree/client.js:and {} more"
"plugins/tree/client.js:Copy invite link for {}"
]
}
35 changes: 22 additions & 13 deletions plugins/tree/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
id: '@flybot/tree',
factory: (require) => {
const { createElement: h, useEffect, useState, useCallback } = require('react')
// The window's translator when the host has one; without it this panel keeps today's English
// word for word, and a placeholder the caller did not pass stays a placeholder (#3114).
const tr = (text, params) => {
const fn = globalThis.__flybot__?.t
if (typeof fn === 'function') {
try { return fn(text, params) } catch { /* fall through to the English */ }
}
return String(text).replace(/\{(\w+)\}/g, (_, key) => (params && key in params ? String(params[key]) : `{${key}}`))
}

// Browser API (the injected flybot service, ds-bot's FlyBotClient): bots() -> [{ id, name, fields: { [plugin]: {...} } }]
// (sync or a Promise) and fields.on('change', fn). It has no on('bot.removed'); removals are picked up
Expand Down Expand Up @@ -225,7 +234,7 @@
return [
{
id: 'copy-invite',
label: 'Copy invite link',
label: tr('Copy invite link'),
visible: can && readOnly !== true,
run: async () => {
const result = await copyInvite(flybot, id, 'link')
Expand Down Expand Up @@ -335,7 +344,7 @@
try { next = typeof flybot.bots === 'function' ? await flybot.bots() : [] } catch { reading = false; return }
reading = false
bots = next ?? []
for (const fn of [...subs]) { try { fn(bots) } catch { /* one subscriber must not stop the feed */ } }

Check warning on line 347 in plugins/tree/client.js

View workflow job for this annotation

GitHub Actions / plugins (tree)

unicorn(no-useless-spread)

Using a spread operator here creates a new array unnecessarily.
if (again) { again = false; void read() }
}
return {
Expand Down Expand Up @@ -433,14 +442,14 @@
function ReorgCard({ run, busy = false, note = null, locked = false, onUndo, onDismiss }) {
const lines = run.summary ?? []
const undone = Boolean(run.undone)
return h('div', { className: 'flybot-reorg', role: 'status', 'aria-label': 'Tree reorganized' },
h('div', { className: 'flybot-reorg-title' }, undone ? 'Tree reorganization undone' : 'Tree reorganized', h('span', { className: 'flybot-reorg-time' }, clock(run.at))),
return h('div', { className: 'flybot-reorg', role: 'status', 'aria-label': tr('Tree reorganized') },
h('div', { className: 'flybot-reorg-title' }, undone ? tr('Tree reorganization undone') : tr('Tree reorganized'), h('span', { className: 'flybot-reorg-time' }, clock(run.at))),
h('ul', { className: 'flybot-reorg-list' }, ...lines.slice(0, NOTICE_LINES).map((line, i) => h('li', { key: i }, line)),
lines.length > NOTICE_LINES ? h('li', { key: 'more' }, `and ${lines.length - NOTICE_LINES} more`) : null),
undone && run.undone.kept?.length ? h('div', { className: 'flybot-reorg-note' }, `Kept: ${run.undone.kept.join('; ')}`) : null,
lines.length > NOTICE_LINES ? h('li', { key: 'more' }, tr('and {count} more', { count: lines.length - NOTICE_LINES })) : null),
undone && run.undone.kept?.length ? h('div', { className: 'flybot-reorg-note' }, tr('Kept: {names}', { names: run.undone.kept.join('; ') })) : null,
locked ? null : h('div', { className: 'flybot-reorg-actions' },
undone ? null : h('button', { type: 'button', className: 'flybot-reorg-btn', disabled: busy, onClick: onUndo }, 'Undo'),
h('button', { type: 'button', className: 'flybot-reorg-btn', disabled: busy, onClick: onDismiss }, 'Dismiss')),
undone ? null : h('button', { type: 'button', className: 'flybot-reorg-btn', disabled: busy, onClick: onUndo }, tr('Undo')),
h('button', { type: 'button', className: 'flybot-reorg-btn', disabled: busy, onClick: onDismiss }, tr('Dismiss'))),
note ? h('div', { className: 'flybot-reorg-note', role: 'alert' }, note) : null)
}
function makeReorgNotice(flybot) {
Expand Down Expand Up @@ -479,11 +488,11 @@
// deleting it stays the owner's own click in the Bot menu).
function statusOf(bot) {
const own = bot?.fields?.['flybot-tree'] ?? {}
if (own.archived) return own.archived.reason === 'merged' && own.archived.intoName ? `archived · merged into ${own.archived.intoName}` : 'archived'
if (own.retired === true) return 'retired'
if (own.idle !== undefined && own.idle !== null) return 'idle'
if (own.archived) return own.archived.reason === 'merged' && own.archived.intoName ? tr('archived · merged into {name}', { name: own.archived.intoName }) : tr('archived')
if (own.retired === true) return tr('retired')
if (own.idle !== undefined && own.idle !== null) return tr('idle')
// A Bot that fits no role group while every matching level is full: the sidebar says so instead of passing it off as Chief's child.
if (bot && bot.isMain !== true && !bot.remote && own.retired !== true && own.parent === undefined && own.treeRole === undefined) return 'outside the tree'
if (bot && bot.isMain !== true && !bot.remote && own.retired !== true && own.parent === undefined && own.treeRole === undefined) return tr('outside the tree')
return null
}
function makeStatusTag(statuses) {
Expand All @@ -506,10 +515,10 @@
})
function ArchivedView({ bots = [], expanded = false, onToggle, openBot }) {
if (bots.length === 0) return null
return h('section', { className: 'flybot-tree flybot-tree-archived', 'aria-label': 'Archived bots' },
return h('section', { className: 'flybot-tree flybot-tree-archived', 'aria-label': tr('Archived bots') },
h('button', { type: 'button', className: 'flybot-tree-head', 'aria-expanded': expanded, onClick: onToggle },
h('span', { className: 'flybot-tree-chev', 'aria-hidden': true }, '▾'),
h('span', { className: 'flybot-tree-title' }, `Archived (${bots.length})`)),
h('span', { className: 'flybot-tree-title' }, tr('Archived ({count})', { count: bots.length }))),
expanded
? h('ul', { className: 'flybot-tree-list', role: 'group' }, bots.map(b => {
const tag = statusOf(b)
Expand Down
Loading
Loading