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-capability-refusals-zh.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Capabilities page now says, in a Chinese window, why a pack cannot be saved and why a capability is no longer there: the refusal that carries the child capability name, and the two that carry a capability name or an unapproved stdio MCP name, read Chinese, with the name exactly as the host wrote it ([#3114](https://github.com/ThinkFlowLab/FlyBot/issues/3114)).
9 changes: 8 additions & 1 deletion core/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,14 @@ var HOST_ERRORS = [
// `connector-send` names the notifier's own refusal, and its fallback literal, in the brackets.
[/^Feishu refused the message \((.+)\)$/, "飞书拒收这条消息($1)"],
[/^Pick up to (\d+) apps$/, "最多选 $1 个应用"],
[/^Composio answered (\d+)([\s\S]*)$/, "Composio 返回了 $1$2"]
[/^Composio answered (\d+)([\s\S]*)$/, "Composio 返回了 $1$2"],
// #3114 cut 33: the Capabilities page's three refusals that carry a name. Anchored at both ends
// because the whole host message arrives here (api.js); the name is data and is copied through, so a
// dot, a bracket or a line break in it can never be read as part of the sentence. `stdio` stays as
// the host wrote it: it names the transport the Allow button is about.
[/^Packs can include only saved MCP servers and skills\. (.+) is not one\.$/, "能力包里只能放已保存的 MCP 服务和技能;$1 不是其中之一。"],
[/^No capability named (.+)\.$/, "找不到叫 $1 的能力。"],
[/^No unapproved stdio MCP named (.+)\.$/, "找不到叫 $1 的待批准 stdio MCP 服务。"]
];
var HOST_ZH = {
"Request failed": "请求失败",
Expand Down
7 changes: 7 additions & 0 deletions core/src/client/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,13 @@ const HOST_ERRORS = [
[/^Feishu refused the message \((.+)\)$/, '飞书拒收这条消息($1)'],
[/^Pick up to (\d+) apps$/, '最多选 $1 个应用'],
[/^Composio answered (\d+)([\s\S]*)$/, 'Composio 返回了 $1$2'],
// #3114 cut 33: the Capabilities page's three refusals that carry a name. Anchored at both ends
// because the whole host message arrives here (api.js); the name is data and is copied through, so a
// dot, a bracket or a line break in it can never be read as part of the sentence. `stdio` stays as
// the host wrote it: it names the transport the Allow button is about.
[/^Packs can include only saved MCP servers and skills\. (.+) is not one\.$/, '能力包里只能放已保存的 MCP 服务和技能;$1 不是其中之一。'],
[/^No capability named (.+)\.$/, '找不到叫 $1 的能力。'],
[/^No unapproved stdio MCP named (.+)\.$/, '找不到叫 $1 的待批准 stdio MCP 服务。'],
]
const HOST_ZH = {
'Request failed': '请求失败',
Expand Down
39 changes: 39 additions & 0 deletions core/test/i18n.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,42 @@ test('#1813: the Project board queue states read in Chinese', () => {
// The board keeps emitting the lowercase ids; only the Chinese dictionary changes.
assert.equal(t('running'), 'running')
})

// #3114 cut 33: the Capabilities page's three refusals that carry a name. `(.+)` is the name and
// String.replace copies it through, so a dot or a bracket in a team file's name is data, not syntax.
test('#3114 cut 33: the capability refusals that carry a name read in Chinese, and the name stays as it is', () => {
const off = installLocale(fakeLocale('zh'))
try {
assert.equal(hostText('Packs can include only saved MCP servers and skills. web-search is not one.'),
'能力包里只能放已保存的 MCP 服务和技能;web-search 不是其中之一。')
assert.equal(hostText('No capability named web-search.'), '找不到叫 web-search 的能力。')
assert.equal(hostText('No unapproved stdio MCP named web-search.'), '找不到叫 web-search 的待批准 stdio MCP 服务。')
// A name is whatever the team file holds, so a dot or a bracket is copied and never parsed.
assert.equal(hostText('No capability named a.b.'), '找不到叫 a.b 的能力。')
assert.equal(hostText('No capability named a(b).'), '找不到叫 a(b) 的能力。')
// The one shape that cannot be told from a name holding ". ": the name is still copied verbatim.
assert.equal(hostText('No capability named web-search. Try again.'), '找不到叫 web-search. Try again 的能力。')
// Sentences this cut leaves in English: no closing full stop, text before the sentence, a line
// break in the name, a pack line without its stop, a stdio line without its stop, and the
// endpoint fallback no caller reaches.
for (const message of [
'No capability named web-search',
'The host said: No capability named web-search.',
'No capability named web-\nsearch.',
'Packs can include only saved MCP servers and skills. web-search is not one',
'No unapproved stdio MCP named web-search',
'Unknown capability operation.',
]) assert.equal(hostText(message), message)
} finally {
off()
}
})

// A window that is not zh gets the host's sentence, not a translation of it (these three have no key).
test('#3114 cut 33: an English window keeps the capability refusals as the host wrote them', () => {
for (const message of [
'Packs can include only saved MCP servers and skills. web-search is not one.',
'No capability named web-search.',
'No unapproved stdio MCP named web-search.',
]) assert.equal(hostText(message), message)
})
32 changes: 32 additions & 0 deletions core/test/settings-error-placement.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,35 @@ test('#3114 cut 31: an English window reads the same form and the same refusals
assert.equal(await refusedForm(raw), raw, `"${raw}" draws exactly as the host wrote it`)
}
})

// #3114 cut 33: a pack refusal names the child capability that is gone; the name is data and is copied untouched.
test('#3114 cut 33: a zh window reads the pack refusal with the child name untouched', async () => {
await inLang('zh', async () => {
assert.equal(await refusedForm('Packs can include only saved MCP servers and skills. web-search is not one.'),
'能力包里只能放已保存的 MCP 服务和技能;web-search 不是其中之一。')
assert.equal(await refusedForm('Packs can include only saved MCP servers and skills. 报告.2026 is not one.'),
'能力包里只能放已保存的 MCP 服务和技能;报告.2026 不是其中之一。')
})
})

// #3114 cut 33: the two refusals a stale row leaves on the same page (another window, or a Bot's own delete_capability), which land in the dialog's own `run`.
test('#3114 cut 33: a zh window reads the stale-row capability refusals where the dialog shows them', async () => {
await inLang('zh', async () => {
const props = { page: 'capabilities', roster, actions, useUpdate: () => ({}) }
let tree = expand(SettingsDialog, props)
const page = all(tree).find(node => node?.type === CapabilitiesPage)
assert.ok(page, 'the dialog draws the Capabilities page')
for (const [raw, chinese] of [
['No capability named web-search.', '找不到叫 web-search 的能力。'],
['No unapproved stdio MCP named web-search.', '找不到叫 web-search 的待批准 stdio MCP 服务。'],
]) {
// api.js translated the host sentence before it threw, so the stub hands over what it threw.
page.props.run(Promise.reject(new Error(hostText(raw))))
await flush()
tree = render(SettingsDialog, props)
const alert = all(tree).find(node => node?.props?.role === 'alert')
assert.ok(alert, `"${raw}" is on screen`)
assert.equal(text(alert), chinese)
}
})
})
50 changes: 48 additions & 2 deletions patches/ds-bot/0001-core-fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2053,7 +2053,7 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js
[/^HTTP (\d+)$/, '请求失败(HTTP $1)'],
[/^GitHub answered (\d+)$/, 'GitHub 返回了 $1'],
[/^Keep the name under (\d+) characters$/, '名字不能超过 $1 个字'],
@@ -872,6 +872,27 @@ const HOST_ERRORS = [
@@ -872,6 +872,34 @@ const HOST_ERRORS = [
[/^No entry in [\s\S]* matches "([\s\S]*)"\.[\s\S]*$/, '找不到「$1」这条记忆'],
[/^"([\s\S]*)" matches (\d+) entries in [\s\S]*$/, '「$1」对应了 $2 条记忆,请说得更具体'],
[/^Memory cannot change now: [\s\S]*$/, '现在不能修改记忆:另一个 dsh 正在使用这个 Bot 团队'],
Expand All @@ -2078,6 +2078,13 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js
+ [/^Feishu refused the message \((.+)\)$/, '飞书拒收这条消息($1)'],
+ [/^Pick up to (\d+) apps$/, '最多选 $1 个应用'],
+ [/^Composio answered (\d+)([\s\S]*)$/, 'Composio 返回了 $1$2'],
+ // #3114 cut 33: the Capabilities page's three refusals that carry a name. Anchored at both ends
+ // because the whole host message arrives here (api.js); the name is data and is copied through, so a
+ // dot, a bracket or a line break in it can never be read as part of the sentence. `stdio` stays as
+ // the host wrote it: it names the transport the Allow button is about.
+ [/^Packs can include only saved MCP servers and skills\. (.+) is not one\.$/, '能力包里只能放已保存的 MCP 服务和技能;$1 不是其中之一。'],
+ [/^No capability named (.+)\.$/, '找不到叫 $1 的能力。'],
+ [/^No unapproved stdio MCP named (.+)\.$/, '找不到叫 $1 的待批准 stdio MCP 服务。'],
]
const HOST_ZH = {
'Request failed': '请求失败',
Expand Down Expand Up @@ -13793,7 +13800,7 @@ diff --git a/test/home-lock.test.js b/test/home-lock.test.js
diff --git a/test/i18n.test.js b/test/i18n.test.js
--- a/test/i18n.test.js
+++ b/test/i18n.test.js
@@ -49,3 +49,18 @@ test('copy follows the DSH language and stays English without a locale service',
@@ -49,3 +49,57 @@ test('copy follows the DSH language and stays English without a locale service',
assert.equal(t('Model'), 'Model')
assert.equal(hostText('A Bot named Writer already exists'), 'A Bot named Writer already exists')
})
Expand All @@ -13812,6 +13819,45 @@ diff --git a/test/i18n.test.js b/test/i18n.test.js
+ // The board keeps emitting the lowercase ids; only the Chinese dictionary changes.
+ assert.equal(t('running'), 'running')
+})
+
+// #3114 cut 33: the Capabilities page's three refusals that carry a name. `(.+)` is the name and
+// String.replace copies it through, so a dot or a bracket in a team file's name is data, not syntax.
+test('#3114 cut 33: the capability refusals that carry a name read in Chinese, and the name stays as it is', () => {
+ const off = installLocale(fakeLocale('zh'))
+ try {
+ assert.equal(hostText('Packs can include only saved MCP servers and skills. web-search is not one.'),
+ '能力包里只能放已保存的 MCP 服务和技能;web-search 不是其中之一。')
+ assert.equal(hostText('No capability named web-search.'), '找不到叫 web-search 的能力。')
+ assert.equal(hostText('No unapproved stdio MCP named web-search.'), '找不到叫 web-search 的待批准 stdio MCP 服务。')
+ // A name is whatever the team file holds, so a dot or a bracket is copied and never parsed.
+ assert.equal(hostText('No capability named a.b.'), '找不到叫 a.b 的能力。')
+ assert.equal(hostText('No capability named a(b).'), '找不到叫 a(b) 的能力。')
+ // The one shape that cannot be told from a name holding ". ": the name is still copied verbatim.
+ assert.equal(hostText('No capability named web-search. Try again.'), '找不到叫 web-search. Try again 的能力。')
+ // Sentences this cut leaves in English: no closing full stop, text before the sentence, a line
+ // break in the name, a pack line without its stop, a stdio line without its stop, and the
+ // endpoint fallback no caller reaches.
+ for (const message of [
+ 'No capability named web-search',
+ 'The host said: No capability named web-search.',
+ 'No capability named web-\nsearch.',
+ 'Packs can include only saved MCP servers and skills. web-search is not one',
+ 'No unapproved stdio MCP named web-search',
+ 'Unknown capability operation.',
+ ]) assert.equal(hostText(message), message)
+ } finally {
+ off()
+ }
+})
+
+// A window that is not zh gets the host's sentence, not a translation of it (these three have no key).
+test('#3114 cut 33: an English window keeps the capability refusals as the host wrote them', () => {
+ for (const message of [
+ 'Packs can include only saved MCP servers and skills. web-search is not one.',
+ 'No capability named web-search.',
+ 'No unapproved stdio MCP named web-search.',
+ ]) assert.equal(hostText(message), message)
+})
diff --git a/test/images.test.js b/test/images.test.js
--- a/test/images.test.js
+++ b/test/images.test.js
Expand Down
11 changes: 9 additions & 2 deletions patches/ds-bot/0008-client-bundle.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ diff --git a/client.js b/client.js
[/^HTTP (\d+)$/, "请求失败(HTTP $1)"],
[/^GitHub answered (\d+)$/, "GitHub 返回了 $1"],
[/^Keep the name under (\d+) characters$/, "名字不能超过 $1 个字"],
@@ -918,7 +918,28 @@ var HOST_ERRORS = [
@@ -918,7 +918,35 @@ var HOST_ERRORS = [
[/^There is no entry (.+)\.$/, "没有第 $1 条"],
[/^No entry in [\s\S]* matches "([\s\S]*)"\.[\s\S]*$/, "找不到「$1」这条记忆"],
[/^"([\s\S]*)" matches (\d+) entries in [\s\S]*$/, "「$1」对应了 $2 条记忆,请说得更具体"],
Expand All @@ -1334,7 +1334,14 @@ diff --git a/client.js b/client.js
+ // `connector-send` names the notifier's own refusal, and its fallback literal, in the brackets.
+ [/^Feishu refused the message \((.+)\)$/, "飞书拒收这条消息($1)"],
+ [/^Pick up to (\d+) apps$/, "最多选 $1 个应用"],
+ [/^Composio answered (\d+)([\s\S]*)$/, "Composio 返回了 $1$2"]
+ [/^Composio answered (\d+)([\s\S]*)$/, "Composio 返回了 $1$2"],
+ // #3114 cut 33: the Capabilities page's three refusals that carry a name. Anchored at both ends
+ // because the whole host message arrives here (api.js); the name is data and is copied through, so a
+ // dot, a bracket or a line break in it can never be read as part of the sentence. `stdio` stays as
+ // the host wrote it: it names the transport the Allow button is about.
+ [/^Packs can include only saved MCP servers and skills\. (.+) is not one\.$/, "能力包里只能放已保存的 MCP 服务和技能;$1 不是其中之一。"],
+ [/^No capability named (.+)\.$/, "找不到叫 $1 的能力。"],
+ [/^No unapproved stdio MCP named (.+)\.$/, "找不到叫 $1 的待批准 stdio MCP 服务。"]
];
var HOST_ZH = {
"Request failed": "请求失败",
Expand Down
32 changes: 32 additions & 0 deletions patches/ds-bot/files/test/settings-error-placement.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,35 @@ test('#3114 cut 31: an English window reads the same form and the same refusals
assert.equal(await refusedForm(raw), raw, `"${raw}" draws exactly as the host wrote it`)
}
})

// #3114 cut 33: a pack refusal names the child capability that is gone; the name is data and is copied untouched.
test('#3114 cut 33: a zh window reads the pack refusal with the child name untouched', async () => {
await inLang('zh', async () => {
assert.equal(await refusedForm('Packs can include only saved MCP servers and skills. web-search is not one.'),
'能力包里只能放已保存的 MCP 服务和技能;web-search 不是其中之一。')
assert.equal(await refusedForm('Packs can include only saved MCP servers and skills. 报告.2026 is not one.'),
'能力包里只能放已保存的 MCP 服务和技能;报告.2026 不是其中之一。')
})
})

// #3114 cut 33: the two refusals a stale row leaves on the same page (another window, or a Bot's own delete_capability), which land in the dialog's own `run`.
test('#3114 cut 33: a zh window reads the stale-row capability refusals where the dialog shows them', async () => {
await inLang('zh', async () => {
const props = { page: 'capabilities', roster, actions, useUpdate: () => ({}) }
let tree = expand(SettingsDialog, props)
const page = all(tree).find(node => node?.type === CapabilitiesPage)
assert.ok(page, 'the dialog draws the Capabilities page')
for (const [raw, chinese] of [
['No capability named web-search.', '找不到叫 web-search 的能力。'],
['No unapproved stdio MCP named web-search.', '找不到叫 web-search 的待批准 stdio MCP 服务。'],
]) {
// api.js translated the host sentence before it threw, so the stub hands over what it threw.
page.props.run(Promise.reject(new Error(hostText(raw))))
await flush()
tree = render(SettingsDialog, props)
const alert = all(tree).find(node => node?.props?.role === 'alert')
assert.ok(alert, `"${raw}" is on screen`)
assert.equal(text(alert), chinese)
}
})
})
Loading