mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 04:30:22 +08:00
回退清队列会等 updateQueue 结束,条目已经不在时不再把宿主打成未处理异常。兜底回退按钮记下时间,轮询不会把同一次回退再打开一遍。开放回合切在最后一个已闭合回合,不再多丢上一轮;等不到结束仍然直接失败。 同时写入 1.1.13 之后已在 master 上的修复:bash 超时补丁不再每次启动多补一个 0,正式版追上的测试版不再列出,phase-1 不再清空 runtime context。 Co-authored-by: Cursor <cursoragent@cursor.com>
55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { planRewind } from "../lib/rewind.js";
|
|
|
|
function user(seq, text) {
|
|
return { seq, type: "user/message", data: { source: { kind: "user" }, content: text } };
|
|
}
|
|
function start(seq) {
|
|
return { seq, type: "turn/start" };
|
|
}
|
|
function end(seq) {
|
|
return { seq, type: "turn/end" };
|
|
}
|
|
|
|
const closed = planRewind([
|
|
start(1), user(2, "Q1"), end(3),
|
|
start(4), user(5, "Q2"), end(6),
|
|
]);
|
|
assert.equal(closed.mode, "fork");
|
|
assert.equal(closed.atSeq, 3);
|
|
assert.equal(closed.text, "Q2");
|
|
|
|
const open = planRewind([
|
|
start(1), user(2, "Q1"), end(3),
|
|
start(4), user(5, "Q2"), end(6),
|
|
start(7), user(8, "Q3"),
|
|
]);
|
|
assert.equal(open.mode, "fork");
|
|
assert.equal(open.atSeq, 6);
|
|
assert.equal(open.text, "Q3");
|
|
|
|
const openWithoutQuestion = planRewind([
|
|
start(1), user(2, "Q1"), end(3),
|
|
start(4), user(5, "Q2"), end(6),
|
|
start(7),
|
|
]);
|
|
assert.equal(openWithoutQuestion.mode, "fork");
|
|
assert.equal(openWithoutQuestion.atSeq, 3);
|
|
assert.equal(openWithoutQuestion.text, "Q2");
|
|
|
|
const oneThenOpen = planRewind([
|
|
start(1), user(2, "Q1"), end(3),
|
|
start(4), user(5, "Q2"),
|
|
]);
|
|
assert.equal(oneThenOpen.mode, "fork");
|
|
assert.equal(oneThenOpen.atSeq, 3);
|
|
assert.equal(oneThenOpen.text, "Q2");
|
|
|
|
const onlyOne = planRewind([
|
|
start(1), user(2, "Q1"), end(3),
|
|
]);
|
|
assert.equal(onlyOne.mode, "blank");
|
|
assert.equal(onlyOne.text, "Q1");
|
|
|
|
console.log("ok: rewind plan");
|