mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-12-01 03:10:22 +08:00
fix: 去掉测试版通道,版本号保持 1.1.33
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
7ec51691f7
commit
b74c7f9bea
5 files changed
+33
-96
No files matched your search
@@ -677,7 +677,7 @@ dsh-purge --edit
|
|||||||
purge_status purge_apply purge_revert
|
purge_status purge_apply purge_revert
|
||||||
```
|
```
|
||||||
|
|
||||||
Patched packages load only after a restart. Apply does not restart by itself. Under the patch title, **Stable** and **Beta** are separate: each has its own version list and switch action. A rollback is pinned; click **Update** to return to that channel's tip.
|
Patched packages load only after a restart. Apply does not restart by itself. Under the patch title is the stable release: you can see versions and switch. A rollback is pinned; click **Update** to return to the latest. The beta channel is gone.
|
||||||
|
|
||||||
The composer **Undo** button drops the last turn and puts the last user sentence back in the input. On the main agent you can rewind once or the whole last round (including subagents). After rewind, send only what is in the box now. `/rewind` does the same. The host cannot truncate a session in place, so rewind opens another session for the shortened transcript and removes the old one from the sidebar. Repeating undo does not leave a stack of branches in the list.
|
The composer **Undo** button drops the last turn and puts the last user sentence back in the input. On the main agent you can rewind once or the whole last round (including subagents). After rewind, send only what is in the box now. `/rewind` does the same. The host cannot truncate a session in place, so rewind opens another session for the shortened transcript and removes the old one from the sidebar. Repeating undo does not leave a stack of branches in the list.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -680,7 +680,7 @@ dsh-purge --edit
|
|||||||
purge_status purge_apply purge_revert
|
purge_status purge_apply purge_revert
|
||||||
```
|
```
|
||||||
|
|
||||||
设置页「应用」完成后需要重启才会加载已改的包文件。点「重启」才会重启,不会自动重启。补丁标题下正式版和测试版分开两栏:各自看版本、各自切换;回退后会固定在该版本,要回到该通道最新再点「更新」。
|
设置页「应用」完成后需要重启才会加载已改的包文件。点「重启」才会重启,不会自动重启。补丁标题下是正式版:可以看版本和切换。回退后会固定在该版本,要回到最新再点「更新」。测试版通道已去掉。
|
||||||
|
|
||||||
输入框旁的「回退」会丢掉最近一轮对话,并把上一句填回输入框;聊天里 `/rewind` 同样可用。宿主不能在原会话里截断,所以回退会另开一条承载截断后的内容,并把原来那条从侧边栏移出。多退几次不会在列表里堆出一串分支。
|
输入框旁的「回退」会丢掉最近一轮对话,并把上一句填回输入框;聊天里 `/rewind` 同样可用。宿主不能在原会话里截断,所以回退会另开一条承载截断后的内容,并把原来那条从侧边栏移出。多退几次不会在列表里堆出一串分支。
|
||||||
|
|
||||||
|
|||||||
@@ -1522,7 +1522,6 @@ body[data-ds-dark-theme] .dshp-dock-body .dshp-switch button.is-on{background:#3
|
|||||||
),
|
),
|
||||||
h("div", { className: "dshp-editions" },
|
h("div", { className: "dshp-editions" },
|
||||||
renderEdition("stable"),
|
renderEdition("stable"),
|
||||||
renderEdition("beta"),
|
|
||||||
),
|
),
|
||||||
noticeNode(updateNotice),
|
noticeNode(updateNotice),
|
||||||
),
|
),
|
||||||
@@ -1886,14 +1885,12 @@ body[data-ds-dark-theme] .dshp-dock-body .dshp-switch button.is-on{background:#3
|
|||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
function keepListedVersion(item, ceiling) {
|
function keepListedVersion(item, _ceiling) {
|
||||||
const ver = String((item && (item.version || item.ref)) || "").replace(/^v/i, "");
|
const ver = String((item && (item.version || item.ref || item.id)) || "");
|
||||||
if (/^1\.1\.11-beta/i.test(ver)) return false;
|
if (!item) return false;
|
||||||
if (!item || item.channel !== "beta") return true;
|
if (item.channel === "beta" || item.ref === "beta") return false;
|
||||||
// 与 lib/update.hideListedVersion 一致:测试 tip / beta 分支始终可见(并行通道)。
|
if (/(?:^|[-._])(beta|rc|pre|preview|test)(?:\d|$|[-._])/i.test(ver)) return false;
|
||||||
if (item.ref === "beta" || item.kind === "head" || item.latest) return true;
|
return true;
|
||||||
if (!ceiling) return true;
|
|
||||||
return listedVersionNewer(ver, ceiling);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function preferListed(list, localVer, pin) {
|
function preferListed(list, localVer, pin) {
|
||||||
|
|||||||
+21
-79
@@ -91,8 +91,8 @@ function markAutoUpdateGuard(ref, sha = "") {
|
|||||||
}, null, 2)}\n`, "utf8");
|
}, null, 2)}\n`, "utf8");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function normalizeChannel(value) {
|
export function normalizeChannel(_value) {
|
||||||
return String(value || "").toLowerCase() === "beta" ? "beta" : "stable";
|
return "stable";
|
||||||
}
|
}
|
||||||
|
|
||||||
function isBetaName(name) {
|
function isBetaName(name) {
|
||||||
@@ -136,27 +136,22 @@ export function latestStableVersion(versions) {
|
|||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 正式版已经追上的旧测试版标签不再列出。1.1.11-beta 始终下线。
|
/** 测试通道已下线。beta 分支、测试标签和名称里带 beta/rc/pre 的条目都不再列出。 */
|
||||||
* 正式/测试是并行通道(测试带红队等),beta 分支 tip 始终保留,避免 1.1.25 正式把 1.1.25-beta 整通道藏掉。 */
|
export function hideListedVersion(item, _stableVersion = "") {
|
||||||
export function hideListedVersion(item, stableVersion = "") {
|
|
||||||
if (!item || withdrawnVersion(item)) return true;
|
if (!item || withdrawnVersion(item)) return true;
|
||||||
const beta = item.channel === "beta" || isBetaName(item.version) || isBetaName(item.ref) || isBetaName(item.id);
|
return item.channel === "beta" || isBetaName(item.version) || isBetaName(item.ref) || isBetaName(item.id);
|
||||||
if (!beta) return false;
|
|
||||||
// 并行测试通道 tip:始终可见。
|
|
||||||
if (item.ref === BETA_REF || item.kind === "head") return false;
|
|
||||||
const ceiling = String(stableVersion || "").replace(/^v/i, "");
|
|
||||||
if (!ceiling || isBetaName(ceiling)) return false;
|
|
||||||
const ver = String(item.version || item.ref || item.id || "").replace(/^v/i, "");
|
|
||||||
if (!/^\d+\.\d+/.test(ver)) return false;
|
|
||||||
return !versionIsNewer(ver, ceiling);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function readChannelState() {
|
export function readChannelState() {
|
||||||
const raw = readJson(channelStatePath()) || {};
|
const raw = readJson(channelStatePath()) || {};
|
||||||
return {
|
const stored = String(raw.channel || "").toLowerCase();
|
||||||
channel: normalizeChannel(raw.channel),
|
const pin = typeof raw.pin === "string" ? raw.pin.trim() : "";
|
||||||
pin: typeof raw.pin === "string" ? raw.pin.trim() : "",
|
const state = {
|
||||||
|
channel: "stable",
|
||||||
|
pin: isBetaName(pin) || pin === BETA_REF ? "" : pin,
|
||||||
};
|
};
|
||||||
|
if (stored === "beta" || state.pin !== pin) writeChannelState(state);
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeChannelState(next) {
|
function writeChannelState(next) {
|
||||||
@@ -719,9 +714,8 @@ async function listRemoteVersions() {
|
|||||||
if (next) out.push(next);
|
if (next) out.push(next);
|
||||||
};
|
};
|
||||||
|
|
||||||
const [stableSha, betaSha, tags] = await Promise.all([
|
const [stableSha, tags] = await Promise.all([
|
||||||
remoteHeadSha(STABLE_REF),
|
remoteHeadSha(STABLE_REF),
|
||||||
remoteHeadSha(BETA_REF),
|
|
||||||
listGithubTags(),
|
listGithubTags(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -738,34 +732,6 @@ async function listRemoteVersions() {
|
|||||||
latest: true,
|
latest: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (betaSha) {
|
|
||||||
const version = await remotePackageVersion(betaSha, BETA_REF).catch(() => "");
|
|
||||||
add({
|
|
||||||
id: BETA_REF,
|
|
||||||
ref: BETA_REF,
|
|
||||||
sha: betaSha,
|
|
||||||
version: version || "",
|
|
||||||
channel: "beta",
|
|
||||||
label: `${versionLabel(version, "beta", betaSha)} · 最新`,
|
|
||||||
kind: "head",
|
|
||||||
latest: true,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// API/atom 拿不到 tip 时,仍用 raw/jsDelivr 探一下 beta 分支,避免测试通道整栏空白。
|
|
||||||
const version = await remotePackageVersion("", BETA_REF).catch(() => "");
|
|
||||||
if (version) {
|
|
||||||
add({
|
|
||||||
id: BETA_REF,
|
|
||||||
ref: BETA_REF,
|
|
||||||
sha: "",
|
|
||||||
version,
|
|
||||||
channel: "beta",
|
|
||||||
label: `${versionLabel(version, "beta")} · 最新`,
|
|
||||||
kind: "head",
|
|
||||||
latest: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const tag of tags) {
|
for (const tag of tags) {
|
||||||
if (!withdrawnVersion(tag)) add(tag);
|
if (!withdrawnVersion(tag)) add(tag);
|
||||||
}
|
}
|
||||||
@@ -786,26 +752,21 @@ async function listRemoteVersions() {
|
|||||||
localVer && !isBetaName(localVer) ? { channel: "stable", version: localVer } : null,
|
localVer && !isBetaName(localVer) ? { channel: "stable", version: localVer } : null,
|
||||||
].filter(Boolean));
|
].filter(Boolean));
|
||||||
const visible = withLocal.filter((item) => !hideListedVersion(item, ceiling));
|
const visible = withLocal.filter((item) => !hideListedVersion(item, ceiling));
|
||||||
const betaOpen = visible.some((item) => item.channel === "beta");
|
|
||||||
return {
|
return {
|
||||||
versions: markCurrent(visible, state, localVer, localSha),
|
versions: markCurrent(visible, state, localVer, localSha),
|
||||||
hasBeta: betaOpen,
|
hasBeta: false,
|
||||||
stableSha,
|
stableSha,
|
||||||
betaSha: betaOpen ? betaSha : "",
|
betaSha: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function alignChannelState(state, listed, localRev, localVer) {
|
function alignChannelState(state, listed, localRev, localVer) {
|
||||||
if (state.pin) return state;
|
if (state.pin) return state;
|
||||||
if (listed.betaSha && localRev && sameRev(localRev, listed.betaSha) && state.channel !== "beta") {
|
|
||||||
return writeChannelState({ channel: "beta", pin: "" });
|
|
||||||
}
|
|
||||||
if (listed.stableSha && localRev && sameRev(localRev, listed.stableSha) && state.channel !== "stable") {
|
if (listed.stableSha && localRev && sameRev(localRev, listed.stableSha) && state.channel !== "stable") {
|
||||||
return writeChannelState({ channel: "stable", pin: "" });
|
return writeChannelState({ channel: "stable", pin: "" });
|
||||||
}
|
}
|
||||||
if (!localRev && localVer) {
|
if (!localRev && localVer && state.channel !== "stable") {
|
||||||
const inferred = isBetaName(localVer) ? "beta" : "stable";
|
return writeChannelState({ channel: "stable", pin: "" });
|
||||||
if (inferred !== state.channel) return writeChannelState({ channel: inferred, pin: "" });
|
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
@@ -1134,28 +1095,8 @@ export async function applyUpdate(jobs = planUpdates(), options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function switchChannel(channel, { apply = true } = {}) {
|
export async function switchChannel(channel, { apply = true } = {}) {
|
||||||
|
if (String(channel || "").toLowerCase() === "beta") throw new Error("测试版已下线");
|
||||||
const next = normalizeChannel(channel);
|
const next = normalizeChannel(channel);
|
||||||
if (next === "beta") {
|
|
||||||
const listed = await listRemoteVersions();
|
|
||||||
if (!listed.hasBeta) {
|
|
||||||
const state = readChannelState();
|
|
||||||
const localVer = localVersion();
|
|
||||||
const localRev = (gitOk() ? gitHead(PLUGIN_ROOT) : "") || readStamp();
|
|
||||||
return rememberUpdate({
|
|
||||||
ok: false,
|
|
||||||
error: "还没有测试版",
|
|
||||||
hasBeta: false,
|
|
||||||
localVersion: localVer,
|
|
||||||
versions: listed.versions,
|
|
||||||
lanes: lanesOf(listed, state, localVer, localRev),
|
|
||||||
...channelPublic(state),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!listed.betaSha && apply) {
|
|
||||||
const tag = listed.versions.find((item) => item.channel === "beta" && item.kind === "tag");
|
|
||||||
if (tag) return applyUpdate(planUpdates(), { ref: tag.ref, channel: "beta", pin: false, force: true });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!apply) {
|
if (!apply) {
|
||||||
writeChannelState({ channel: next, pin: "" });
|
writeChannelState({ channel: next, pin: "" });
|
||||||
return checkUpdate();
|
return checkUpdate();
|
||||||
@@ -1199,11 +1140,12 @@ export async function handleUpdateOp(body = {}) {
|
|||||||
const requested = body.ref || currentChannelRef(state);
|
const requested = body.ref || currentChannelRef(state);
|
||||||
const ref = safeUpdateRef(requested);
|
const ref = safeUpdateRef(requested);
|
||||||
if (!ref) throw new Error("未知版本");
|
if (!ref) throw new Error("未知版本");
|
||||||
if (ref !== STABLE_REF && ref !== BETA_REF) {
|
if (ref === BETA_REF || isBetaName(ref)) throw new Error("测试版已下线");
|
||||||
|
if (ref !== STABLE_REF) {
|
||||||
const listed = await listRemoteVersions();
|
const listed = await listRemoteVersions();
|
||||||
if (!listedUpdateRef(ref, listed)) throw new Error("未知版本");
|
if (!listedUpdateRef(ref, listed)) throw new Error("未知版本");
|
||||||
}
|
}
|
||||||
const channel = body.channel || (ref === BETA_REF ? "beta" : ref === STABLE_REF ? "stable" : state.channel);
|
const channel = body.channel === "beta" ? "stable" : (body.channel || (ref === STABLE_REF ? "stable" : state.channel));
|
||||||
return applyUpdate(planUpdates(), { ref, channel, pin: false, force: true });
|
return applyUpdate(planUpdates(), { ref, channel, pin: false, force: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,18 +40,16 @@ const caughtUp = [
|
|||||||
];
|
];
|
||||||
const ceiling = latestStableVersion(caughtUp);
|
const ceiling = latestStableVersion(caughtUp);
|
||||||
assert.equal(ceiling, "1.1.12");
|
assert.equal(ceiling, "1.1.12");
|
||||||
assert.equal(hideListedVersion(caughtUp[2], ceiling), true); // 已追上的旧 beta 标签仍隐藏
|
assert.equal(hideListedVersion(caughtUp[2], ceiling), true);
|
||||||
assert.equal(hideListedVersion(caughtUp[3], ceiling), false); // beta 分支 tip 始终保留(并行通道)
|
assert.equal(hideListedVersion(caughtUp[3], ceiling), true);
|
||||||
assert.equal(hideListedVersion(caughtUp[4], ceiling), false);
|
assert.equal(hideListedVersion(caughtUp[4], ceiling), true);
|
||||||
assert.equal(hideListedVersion({ ref: "v1.1.11-beta.1", version: "1.1.11-beta.1", channel: "beta" }, ""), true);
|
assert.equal(hideListedVersion({ ref: "v1.1.11-beta.1", version: "1.1.11-beta.1", channel: "beta" }, ""), true);
|
||||||
|
|
||||||
const visible = caughtUp.filter((item) => !hideListedVersion(item, ceiling));
|
const visible = caughtUp.filter((item) => !hideListedVersion(item, ceiling));
|
||||||
assert.deepEqual(visible.map((item) => item.ref), ["master", "v1.1.12", "beta", "v1.1.13-beta.1"]);
|
assert.deepEqual(visible.map((item) => item.ref), ["master", "v1.1.12"]);
|
||||||
const staleSha = "423a91614baa747b56749003d054fedb8e725714";
|
const staleSha = "423a91614baa747b56749003d054fedb8e725714";
|
||||||
const shown = markCurrent(visible, { channel: "stable", pin: "" }, "1.1.12", staleSha);
|
const shown = markCurrent(visible, { channel: "stable", pin: "" }, "1.1.12", staleSha);
|
||||||
assert.equal(shown.find((item) => item.ref === "master").current, true);
|
assert.equal(shown.find((item) => item.ref === "master").current, true);
|
||||||
assert.equal(shown.find((item) => item.ref === "v1.1.12").current, false);
|
assert.equal(shown.find((item) => item.ref === "v1.1.12").current, false);
|
||||||
assert.equal(shown.find((item) => item.ref === "beta").current, false);
|
|
||||||
assert.equal(shown.find((item) => item.ref === "v1.1.13-beta.1").current, false);
|
|
||||||
|
|
||||||
console.log("ok: update guards");
|
console.log("ok: update guards");
|
||||||
Reference in new issue
Block a user