From 8360c2e4fcd0ac8a155277353edf57d06e85be5b Mon Sep 17 00:00:00 2001 From: oliver Date: Tue, 15 Sep 2026 20:52:03 +0800 Subject: [PATCH] Forbid bilingual glosses in forced reply language. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stop English replies from keeping Chinese parentheticals like failure (失联). Co-authored-by: Cursor --- lib/index.js | 6 +++++- package.json | 2 +- src/netx/model-language.ts | 10 +++++++++- test/model-language.test.mjs | 5 ++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/index.js b/lib/index.js index 70f435f..36d325e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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(" "); } diff --git a/package.json b/package.json index edf3a27..2b2c34a 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/netx/model-language.ts b/src/netx/model-language.ts index 9d7c67c..b92aaf8 100644 --- a/src/netx/model-language.ts +++ b/src/netx/model-language.ts @@ -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(' ') } diff --git a/test/model-language.test.mjs b/test/model-language.test.mjs index 81af512..fccf3d2 100644 --- a/test/model-language.test.mjs +++ b/test/model-language.test.mjs @@ -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/) })