import assert from "node:assert/strict"; import test from "node:test"; import { acceptThinkStepText } from "../src/lib/think-step-gate.ts"; const INCIDENT_ENGLISH = [ "The a for 2026-09-09 (, per). The is a - an, not a.", 'The be "" or "timing" - is a/trend.', 'Let me use: [""]. "timing"? Let me run-jyotish-.', ].join(" "); test("incident English salad never reaches the public think channel", () => { assert.equal(acceptThinkStepText(INCIDENT_ENGLISH), null); }); test("pure Chinese thinking is unchanged", () => { const chinese = "先对照今日过境。再分开适合推进的事。"; assert.equal(acceptThinkStepText(chinese), chinese); }); test("CJK sentences are accepted whole; English words are not stripped", () => { // 原值:删掉 ≥4 字母英文词,留下「今日趋势 可以推进。」 // 新值:整句接受,或整句丢弃,绝不就地删词 // 原因:BUG-942 / 任务书 P3,正则只能当门不能当刀。 assert.equal( acceptThinkStepText("今日趋势 timing 可以推进。"), "今日趋势 timing 可以推进。", ); }); test("English-only process narration is dropped even without a terminator", () => { assert.equal(acceptThinkStepText("The proposedKind value was rejected"), null); }); test("an unterminated fragment is dropped rather than rewritten", () => { assert.equal(acceptThinkStepText("先看事业宫的结构"), null); assert.equal(acceptThinkStepText("先看事业宫的结构。"), "先看事业宫的结构。"); });