Forbid bilingual glosses in forced reply language.

Stop English replies from keeping Chinese parentheticals like failure (失联).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-15 20:52:03 +08:00
parent 91f2e9a5c8
commit 8360c2e4fc
4 changed files with 19 additions and 4 deletions

View file

@ -1342,12 +1342,14 @@ function replyInstruction(setting) {
if (normalized === REPLY_LANGUAGE_DEFAULT)
return "";
const meta = REPLY_META[normalized];
const noGloss = normalized === "en" ? 'Never add Chinese glosses or bilingual parentheses such as "communication failure (失联)" or "alarm (告警)"; use one English wording only.' : 'Never add English glosses or bilingual parentheses such as "失联 (communication failure)" or "告警 (alarm)"; use one Chinese wording only.';
return [
"## Reply language requirement (mandatory)",
`The operator set Netx Ops reply language to ${meta.native} (${meta.name}).`,
`You MUST write the entire final reply in ${meta.name} only.`,
`Do not switch to the user's language even if they write in Chinese, English, or any other language.`,
"This includes titles, bullet labels (Result / Evidence / Next may stay as English keywords), explanations, summaries, warnings, and error text.",
noGloss,
"Keep code, commands, file paths, API names, host names, UUIDs, and proper nouns unchanged.",
'This rule outranks persona wording such as "follow the user language" and outranks language hints in the user message.'
].join(" ");
@ -1357,9 +1359,11 @@ function replyReminder(setting) {
if (normalized === REPLY_LANGUAGE_DEFAULT)
return "";
const meta = REPLY_META[normalized];
const noGloss = normalized === "en" ? "No Chinese words or (中文) glosses in the answer." : "No English glosses like (English term) in the answer.";
return [
`[Reply language] Mandatory: write your entire final answer in ${meta.native} (${meta.name}).`,
"Do not answer in the user's language. Code/paths/host names stay original."
noGloss,
"Code/paths/host names stay original."
].join(" ");
}

View file

@ -1,6 +1,6 @@
{
"name": "dsh-netxops",
"version": "0.1.32",
"version": "0.1.33",
"description": "DeepSeek Harness Netx Ops: ops/topology + IM delivery + session export + knowledge-base MANIFEST/_skills + localSkills",
"license": "MIT",
"type": "module",

View file

@ -134,12 +134,16 @@ export function replyInstruction(setting: string | undefined | null): string {
const normalized = normalizeReplyLanguage(setting)
if (normalized === REPLY_LANGUAGE_DEFAULT) return ''
const meta = REPLY_META[normalized]
const noGloss = normalized === 'en'
? 'Never add Chinese glosses or bilingual parentheses such as "communication failure (失联)" or "alarm (告警)"; use one English wording only.'
: 'Never add English glosses or bilingual parentheses such as "失联 (communication failure)" or "告警 (alarm)"; use one Chinese wording only.'
return [
'## Reply language requirement (mandatory)',
`The operator set Netx Ops reply language to ${meta.native} (${meta.name}).`,
`You MUST write the entire final reply in ${meta.name} only.`,
`Do not switch to the user's language even if they write in Chinese, English, or any other language.`,
'This includes titles, bullet labels (Result / Evidence / Next may stay as English keywords), explanations, summaries, warnings, and error text.',
noGloss,
'Keep code, commands, file paths, API names, host names, UUIDs, and proper nouns unchanged.',
'This rule outranks persona wording such as "follow the user language" and outranks language hints in the user message.',
].join(' ')
@ -153,8 +157,12 @@ export function replyReminder(setting: string | undefined | null): string {
const normalized = normalizeReplyLanguage(setting)
if (normalized === REPLY_LANGUAGE_DEFAULT) return ''
const meta = REPLY_META[normalized]
const noGloss = normalized === 'en'
? 'No Chinese words or (中文) glosses in the answer.'
: 'No English glosses like (English term) in the answer.'
return [
`[Reply language] Mandatory: write your entire final answer in ${meta.native} (${meta.name}).`,
'Do not answer in the user\'s language. Code/paths/host names stay original.',
noGloss,
'Code/paths/host names stay original.',
].join(' ')
}

View file

@ -50,11 +50,14 @@ test('replyInstruction is empty for follow-user and forces otherwise', () => {
assert.equal(replyInstruction('follow-user'), '')
assert.match(replyInstruction('en'), /English/)
assert.match(replyInstruction('en'), /Do not switch to the user's language/)
assert.match(replyInstruction('en'), /Never add Chinese glosses/)
assert.match(replyInstruction('zh'), /简体中文/)
assert.match(replyInstruction('zh'), /Never add English glosses/)
})
test('replyReminder is empty for follow-user and reminds otherwise', () => {
assert.equal(replyReminder('follow-user'), '')
assert.match(replyReminder('en'), /Mandatory/)
assert.match(replyReminder('en'), /English/)
assert.match(replyReminder('en'), /No Chinese words/)
assert.match(replyReminder('zh'), /No English glosses/)
})