fix(#84+#86): denial stream 用 compact chunk + 补丁 42 升级 plainConfig

#84: denialStream 之前打 type:text-chunks 带 .chunks 字段,
但宿主 firstRunMemberTime 认的是 .texts —— 字段错配继续炸。
改成逐 chunk 包成 { type:"chunk", time, chunk } 走单条路径。

#86: 补丁 42 register/commitLegacy 两个 validate 前漏 plainConfig,
cosmokit volatile 字段作为 live 对象引用灌进 validate,日志爆红。
两处 replace 加 plainConfig 包裹;markers 改成 #86 新串,
再加两条升级 pattern 匹配老用户已清洗、缺 plainConfig 的产物,
确保 skipIfMarked 短路后老用户也能走升级补齐。
This commit is contained in:
叫我小杨同学 committed 2026-10-09 15:47:04 +08:00
1 parent f8de7686e9
commit 704eee142b
2 files changed
+34 -14

No files matched your search

+12 -11
View File
@@ -477,21 +477,22 @@ function denialChunks() {
}
/** 宿主持久化只要 Accumulator 紧致记录;裸 chunk 会让 firstRunMemberTime 读 undefined.length(#84)。
* 改为合并成一条 text-chunks 批记录,带 .length / .text,配合 firstRunMemberTime 的字段期望。 */
* 审查「4.1 才是正解」: 每个 chunk 包成 { type: "chunk", time, chunk },走 compact chunk
* 单条路径,避免批记录 (text-chunks 需要 .texts 字段而不是 .chunks) 字段名错配再次崩溃。 */
function denialStream(now = Date.now()) {
const time0 = Number.isSafeInteger(now) ? now : Date.now();
const chunks = denialChunks();
const record = {
type: "text-chunks",
time: time0,
chunks,
length: chunks.length,
text: DENIAL,
};
if (!COMPACT_STREAM_TYPES.has(record.type)) {
throw new TypeError(`denial stream must use compact Assistant records, got ${record.type}`);
const records = chunks.map((chunk, i) => ({
type: "chunk",
time: time0 + i,
chunk,
}));
for (const record of records) {
if (!COMPACT_STREAM_TYPES.has(record.type)) {
throw new TypeError(`denial stream must use compact Assistant records, got ${record.type}`);
}
}
return [record];
return records;
}
async function appendDenial(session, turn, step) {