fix: 发布 1.1.48,桌面跟 Web 配置、红队派活与 skill/MCP 按任务选用。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-10-02 17:25:49 +08:00
1 parent b7c14005c3
commit 7a8ba73cd5
12 files changed
+389 -38

No files matched your search

+54 -1
View File
@@ -12,6 +12,7 @@ import {
isRedteamSession,
rewritePromptAssembly,
} from "./identity.js";
import { capabilityProtocolText, CAPABILITY_SECTION } from "./capability-protocol.js";
import { installSubagentRoleCapture, resolveSubagentRoleText } from "./redteam/role-section.js";
import * as rewind from "./rewind.js";
import * as continueRetry from "./continue-retry.js";
@@ -43,6 +44,8 @@ const DEFAULTS = {
refusalRecover: true,
refusalRecoverMax: 2,
refusalRecoverText: "",
// Codex 风格:教模型主动发现 skill / MCP;不改官方注册与工具面。
capabilityProtocol: true,
};
const log = (config, ...args) => {
@@ -191,7 +194,7 @@ async function ensureRestartReady() {
export function registerPromptSections(ctx, config, _injectFile) {
ctx.systemPrompt.section({
name: "dsh-purge",
order: GLOBAL_PROMPT_ORDER,
order: GLOBAL_PROMPT_ORDER + 1,
interpolate: false,
text: (context) => {
if (!injectAllowedNow(config)) return "";
@@ -199,6 +202,23 @@ export function registerPromptSections(ctx, config, _injectFile) {
},
});
if (config.capabilityProtocol !== false) {
ctx.systemPrompt.section({
name: CAPABILITY_SECTION,
order: GLOBAL_PROMPT_ORDER,
interpolate: false,
text: (context) => {
if (!injectAllowedNow(config)) return "";
const redteam = isRedteamSession(context);
return capabilityProtocolText({
redteam,
redteamChild: redteam && context?.agent?.session?.header?.origin === "subagent",
enabled: true,
});
},
});
}
const postPrompt = typeof config.postPrompt === "string" ? config.postPrompt.trim() : "";
if (!postPrompt) return;
if (!Number.isFinite(config.postPromptOrder) || config.postPromptOrder <= GLOBAL_PROMPT_ORDER) {
@@ -247,6 +267,7 @@ function rewriteLiveAssembly(config, assembled, context) {
fallbackInject: inject,
dropMnemon: config.stripMnemon !== false,
dropPurgeAfterFold: false,
capabilityProtocol: config.capabilityProtocol !== false,
context,
roleText: redteam ? resolveSubagentRoleText(context) : "",
});
@@ -354,6 +375,22 @@ function shimNeedsPatch(state) {
async function settleInstalledPatches(config, ctx) {
try { core.rememberUnpackedArchive(); } catch { /* 没有官方安装目录时不必记归档 */ }
try {
const shell = core.alignOfficialShellProfile({ dshHome: process.env.DSH_HOME || "" });
if (shell.changed) {
bootFullQuit = true;
log(config, "official desktop now follows the web profile");
try {
hostctl.scheduleRestart(null, ctx);
} catch (e) {
log(config, "restart after web profile switch failed:", String(e && e.message ? e.message : e));
return "restart-failed";
}
return "full-quit";
}
} catch (e) {
log(config, "align web profile skipped:", String(e && e.message ? e.message : e));
}
if (officialUpdate.upgradeMarkerExists(process.execPath)) {
const upgraded = await reapply.reapplyInstalled({ scheduleSwap: false, upgrade: true });
if (!upgraded.ok) {
@@ -486,6 +523,11 @@ async function handlePurgeCommand(rawInput, config) {
if (blocked) return { kind: "error", text: blocked.error };
await core.backupAll(state.ai_base);
const report = await core.applyPatches(state.ai_base);
const shell = core.alignOfficialShellProfile({
dshHome: state.dsh_home || process.env.DSH_HOME || "",
exe: handoff?.exe,
appDir: handoff?.appDir,
});
const shimResult = await core.patchAllShims();
const flash = core.silenceCmdFlash(state.ai_base);
const lines = report.map((r) => {
@@ -497,6 +539,14 @@ async function handlePurgeCommand(rawInput, config) {
lines.push(` · ${dir} → ${typeof st === "object" ? JSON.stringify(st) : st}`);
}
lines.push(` cmd-flash=${flash.entry} phase-1=${flash.phase1} ok=${flash.ok}`);
if (shell.changed || shell.shell?.already || shell.shell?.changed) {
lines.push(
"",
shell.changed
? "官方桌面已改为读取 profiles/web(与 Web 端同一套渠道/插件配置)。"
: "官方桌面已对齐 profiles/web。",
);
}
if (scrubbed.length) {
lines.push("", "Desktop in-bin .bak scrub:");
for (const row of scrubbed) lines.push(` ✓ ${row.dir} → ${row.cleaned.join(", ")}`);
@@ -508,6 +558,9 @@ async function handlePurgeCommand(rawInput, config) {
if (swapped?.renamed || swapped?.pending) {
lines.push("", "补丁已写入。请在设置页点「重启」,客户端会自己重新打开。");
}
} else if (shell.changed) {
lines.push("", "已切换到 profiles/web。请在设置页点「重启」,客户端会自己重新打开。");
try { hostctl.scheduleRestart(null, null); } catch { /* 设置页再点重启即可 */ }
}
return { kind: "success", text: lines.join("\n") };
}