fix(consult): BUG-950~953 Pass 4 按句放行,无分钟按句丢弃

正文不再整段 hold:闭合句立刻过 Pass 4,无 reject 即发(950)。
无出生分钟改为按句丢弃,全丢才用兜底句(951);该模式日期记 observe(952)。
校正流 token 级 thinking 死链按 P2 删除,测试翻转成否定合同(953)。
This commit is contained in:
jesse-ux
2026-09-18 14:08:45 +08:00
parent 24a6fc9873
commit cd4775aec6
14 changed files with 407 additions and 171 deletions
+6 -16
View File
@@ -5,8 +5,6 @@ import test from "node:test";
import {
mapStreamChunkToActivity,
mapStreamChunkToPhase,
mapStreamChunkToThinking,
toPublicThinkingDelta,
safePublicEvent,
streamToolNames,
} from "../src/lib/rectification-agentic/v9/stream-mapping.ts";
@@ -173,20 +171,12 @@ test("reasoning, raw payloads, provider metadata and step internals never map to
});
test("Chinese thinking stays internal and is never a public stream event", () => {
assert.deepEqual(
mapStreamChunkToThinking(chunk("reasoning-delta", { text: "先核对升学年份。" }) as never),
{ type: "thinking.delta", text: "先核对升学年份。" },
);
assert.equal(
mapStreamChunkToThinking(chunk("reasoning-delta", {
text: "The proposedKind value was rejected",
}) as never),
null,
);
assert.equal(
toPublicThinkingDelta("The proposedKind value was rejected because education is invalid"),
null,
);
// 原值:mapStreamChunkToThinking / toPublicThinkingDelta 把中文 reasoning 收成内部 thinking.delta
// 新值:源码不得存在这两个函数;reasoning-delta 不映射成对外事件;thinking.delta 仍被安全层丢掉
// 原因:BUG-953,死链按 P2 删除,翻转成否定合同
const mapping = readFileSync(new URL("../src/lib/rectification-agentic/v9/stream-mapping.ts", import.meta.url), "utf8");
assert.doesNotMatch(mapping, /function mapStreamChunkToThinking|function toPublicThinkingDelta|InternalThinkingDeltaEvent/);
assert.equal(mapStreamChunkToPhase(chunk("reasoning-delta", { text: "先核对升学年份。" }) as never), null);
assert.equal(safePublicEvent({ type: "thinking.delta", text: "先核对升学年份。" }), null);
assert.equal(safePublicEvent({
type: "thinking.delta",