fix: 发布 1.1.47,演练台环境适配与首次用户须知。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-10-02 13:55:13 +08:00
1 parent 078f402cc0
commit 33baeeef45
13 files changed
+522 -297

No files matched your search

+168 -4
View File
@@ -118,6 +118,11 @@ export function resetPathMemo() {
for (const slot of Object.keys(memo)) memo[slot] = { ready: false, value: null };
}
export function clearDesktopLocateCache() {
try { desktop.clearDesktopLocateCache(); } catch { /* ignore */ }
resetPathMemo();
}
function isFile(fp) {
try {
if (desktop.isAsarSealedPath(fp)) return false;
@@ -1630,12 +1635,30 @@ export function sealedAsarHandoff(input = {}) {
const surface = input.surface ?? detectSurface(input);
if (adapterFor(surface) !== "desktop") return null;
const hinted = input.execPath;
const exe = hinted && desktop.isDesktopExecutable(hinted)
let exe = hinted && desktop.isDesktopExecutable(hinted)
? path.normalize(hinted)
: desktop.findDesktopAppExecutable(input);
if (!exe || !desktop.isOfficialHarnessExecutable(exe)) return null;
const asar = desktop.appAsarPath(exe);
if (!asarArchiveIsFile(asar)) return null;
const resourcesPath = input.resourcesPath ?? process.resourcesPath;
let asar = exe ? desktop.appAsarPath(exe) : "";
if (!asarArchiveIsFile(asar) && resourcesPath) {
const candidate = path.join(path.normalize(resourcesPath), "app.asar");
if (asarArchiveIsFile(candidate)) {
asar = candidate;
if (!exe) {
exe = desktop.findDesktopAppExecutable({ ...input, resourcesPath })
|| (desktop.isDesktopExecutable(process.execPath) ? path.normalize(process.execPath) : "")
|| path.normalize(process.execPath);
}
}
}
if (!exe || !asarArchiveIsFile(asar)) return null;
// 官方密封包:已知 exe 名,或当前进程 resources 里就有 app.asar。
if (
!desktop.isOfficialHarnessExecutable(exe)
&& !(resourcesPath && asarArchiveIsFile(path.join(path.normalize(resourcesPath), "app.asar")))
) {
return null;
}
return { exe, asar, swapAsar: true };
}
@@ -3706,6 +3729,144 @@ const NEW_TOOL_PATCHES = [
],
markers: ["[dsh-purge] guard undefined content"],
},
{
id: 69,
name: "MODEL_STREAM_RELEASE",
layer: "代码",
layer_en: "Code",
desc: "deepseek-flash 恢复官方 in-history,并撤掉会打成 TRANSPORT 的独立连接补丁 / restore official in-history and remove the transport-breaking socket patch",
file: ["llm-deepseek"],
optional: true,
skipIfMarked: true,
forbid: [
"[dsh-purge] one connection per model request",
"[dsh-purge] release model socket",
"[dsh-purge] drop the model socket",
],
replacements: [
{
pattern:
"\t\t\t\tsignal.throwIfAborted();\n" +
"\t\t\t\tconst betas = [...fileIds !== void 0 && fileIds.size > 0 ? [MESSAGES_FILES_BETA] : [], ...body.messages.some((message) => message.content.some((block) => block.type === \"tool_addition\" || block.type === \"tool_removal\")) ? [MESSAGES_TOOL_CHANGES_BETA] : []];\n" +
"\t\t\t\tlet streamAgent; // [dsh-purge] one connection per model request\n" +
"\t\t\t\ttry {\n" +
"\t\t\t\t\tconst undici = await import(\"undici\");\n" +
"\t\t\t\t\tif (typeof undici.Agent === \"function\") streamAgent = new undici.Agent({\n" +
"\t\t\t\t\t\tconnections: 1,\n" +
"\t\t\t\t\t\tpipelining: 0,\n" +
"\t\t\t\t\t\tkeepAliveTimeout: 1,\n" +
"\t\t\t\t\t\tkeepAliveMaxTimeout: 1,\n" +
"\t\t\t\t\t\tallowH2: true\n" +
"\t\t\t\t\t});\n" +
"\t\t\t\t} catch (_noUndici) {}\n" +
"\t\t\t\ttry {\n" +
"\t\t\t\t\tconst response = await fetch(`${messagesApiRoot(connection.baseURL)}/messages`, {\n" +
"\t\t\t\t\t\tmethod: \"POST\",\n" +
"\t\t\t\t\t\tsignal,\n" +
"\t\t\t\t\t\tbody: extensions.payload,\n" +
"\t\t\t\t\t\tredirect: \"error\",\n" +
"\t\t\t\t\t\t...streamAgent ? { dispatcher: streamAgent } : {},\n" +
"\t\t\t\t\t\theaders: {\n" +
"\t\t\t\t\t\t\t...attributionHeaders(),\n" +
"\t\t\t\t\t\t\t\"content-type\": \"application/json\",\n" +
"\t\t\t\t\t\t\t\"accept\": \"text/event-stream\",\n" +
"\t\t\t\t\t\t\t...auth.headers,\n" +
"\t\t\t\t\t\t\t\"anthropic-version\": \"2023-06-01\",\n" +
"\t\t\t\t\t\t\t...betas.length === 0 ? {} : { \"anthropic-beta\": betas.join(\",\") },\n" +
"\t\t\t\t\t\t\t\"x-deepseek-harness-user-id\": this.dependencies.resolveUserId(),\n" +
"\t\t\t\t\t\t\t...options.sessionId === void 0 ? {} : { \"x-deepseek-harness-session-id\": String(options.sessionId) },\n" +
"\t\t\t\t\t\t\t...options.purpose === \"compaction\" ? { \"x-deepseek-harness-compact\": \"1\" } : {}\n" +
"\t\t\t\t\t\t}\n" +
"\t\t\t\t\t});\n" +
"\t\t\t\t\tif (!response.ok) {\n" +
"\t\t\t\t\t\tconst text = await response.text();\n" +
"\t\t\t\t\t\tlet raw;\n" +
"\t\t\t\t\t\ttry {\n" +
"\t\t\t\t\t\t\traw = JSON.parse(text);\n" +
"\t\t\t\t\t\t} catch (_nonJsonGatewayError) {}\n" +
"\t\t\t\t\t\tconst detail = providerErrorDetail(raw);\n" +
"\t\t\t\t\t\tif (await files.retry(detail)) continue;\n" +
"\t\t\t\t\t\tconst failure = providerError(raw, response.status, response.headers);\n" +
"\t\t\t\t\t\tthrow new LlmError(files.errorMessage(response.status, failure.message, detail), failure.code, {\n" +
"\t\t\t\t\t\t\t...failure.failure,\n" +
"\t\t\t\t\t\t\tcause: new Error(text)\n" +
"\t\t\t\t\t\t});\n" +
"\t\t\t\t\t}\n" +
"\t\t\t\t\tawait extensions.accept();\n" +
"\t\t\t\t\tif (response.body === null) throw new LlmError(\"DeepSeek Messages returned no response body\", \"EMPTY_RESPONSE\");\n" +
"\t\t\t\t\tyield* translate(parseSse(response.body, activity), options.model);\n" +
"\t\t\t\t\treturn;\n" +
"\t\t\t\t} finally {\n" +
"\t\t\t\t\ttry {\n" +
"\t\t\t\t\t\tconst closed = streamAgent?.destroy();\n" +
"\t\t\t\t\t\tif (closed && typeof closed.catch === \"function\") closed.catch(() => {});\n" +
"\t\t\t\t\t} catch { /* [dsh-purge] release model socket */ }\n" +
"\t\t\t\t}",
replace:
"\t\t\t\tsignal.throwIfAborted();\n" +
"\t\t\t\tconst betas = [...fileIds !== void 0 && fileIds.size > 0 ? [MESSAGES_FILES_BETA] : [], ...body.messages.some((message) => message.content.some((block) => block.type === \"tool_addition\" || block.type === \"tool_removal\")) ? [MESSAGES_TOOL_CHANGES_BETA] : []];\n" +
"\t\t\t\tconst response = await fetch(`${messagesApiRoot(connection.baseURL)}/messages`, {\n" +
"\t\t\t\t\tmethod: \"POST\",\n" +
"\t\t\t\t\tsignal,\n" +
"\t\t\t\t\tbody: extensions.payload,\n" +
"\t\t\t\t\tredirect: \"error\",\n" +
"\t\t\t\t\theaders: {\n" +
"\t\t\t\t\t\t...attributionHeaders(),\n" +
"\t\t\t\t\t\t\"content-type\": \"application/json\",\n" +
"\t\t\t\t\t\t\"accept\": \"text/event-stream\",\n" +
"\t\t\t\t\t\t...auth.headers,\n" +
"\t\t\t\t\t\t\"anthropic-version\": \"2023-06-01\",\n" +
"\t\t\t\t\t\t...betas.length === 0 ? {} : { \"anthropic-beta\": betas.join(\",\") },\n" +
"\t\t\t\t\t\t\"x-deepseek-harness-user-id\": this.dependencies.resolveUserId(),\n" +
"\t\t\t\t\t\t...options.sessionId === void 0 ? {} : { \"x-deepseek-harness-session-id\": String(options.sessionId) },\n" +
"\t\t\t\t\t\t...options.purpose === \"compaction\" ? { \"x-deepseek-harness-compact\": \"1\" } : {}\n" +
"\t\t\t\t\t}\n" +
"\t\t\t\t});\n" +
"\t\t\t\tif (!response.ok) {\n" +
"\t\t\t\t\tconst text = await response.text();\n" +
"\t\t\t\t\tlet raw;\n" +
"\t\t\t\t\ttry {\n" +
"\t\t\t\t\t\traw = JSON.parse(text);\n" +
"\t\t\t\t\t} catch (_nonJsonGatewayError) {}\n" +
"\t\t\t\t\tconst detail = providerErrorDetail(raw);\n" +
"\t\t\t\t\tif (await files.retry(detail)) continue;\n" +
"\t\t\t\t\tconst failure = providerError(raw, response.status, response.headers);\n" +
"\t\t\t\t\tthrow new LlmError(files.errorMessage(response.status, failure.message, detail), failure.code, {\n" +
"\t\t\t\t\t\t...failure.failure,\n" +
"\t\t\t\t\t\tcause: new Error(text)\n" +
"\t\t\t\t\t});\n" +
"\t\t\t\t}\n" +
"\t\t\t\tawait extensions.accept();\n" +
"\t\t\t\tif (response.body === null) throw new LlmError(\"DeepSeek Messages returned no response body\", \"EMPTY_RESPONSE\");\n" +
"\t\t\t\tyield* translate(parseSse(response.body, activity), options.model);\n" +
"\t\t\t\treturn;",
},
{
pattern:
"\tid: \"deepseek-flash\",\n" +
"\tname: \"DeepSeek-V41-Flash\",\n" +
"\tcontextWindow: DEFAULT_CONTEXT_WINDOW,\n" +
"\tinputModalities: [\"text\", \"image\"],\n" +
"\ttoolUpdate: \"addition-only\"",
replace:
"\tid: \"deepseek-flash\",\n" +
"\tname: \"DeepSeek-V41-Flash\",\n" +
"\tcontextWindow: DEFAULT_CONTEXT_WINDOW,\n" +
"\tinputModalities: [\"text\", \"image\"],\n" +
"\tsystemPromptUpdate: \"in-history\", // [dsh-purge] deepseek-flash keeps in-history\n" +
"\ttoolUpdate: \"addition-only\"",
},
{
pattern:
"\tsystemPromptUpdate: \"in-history\",\n" +
"\ttoolUpdate: \"addition-only\"",
replace:
"\tsystemPromptUpdate: \"in-history\", // [dsh-purge] deepseek-flash keeps in-history\n" +
"\ttoolUpdate: \"addition-only\"",
},
],
markers: ["[dsh-purge] deepseek-flash keeps in-history"],
},
{
id: 56,
name: "REWIND_HIDE_CUT_ONLY",
@@ -4523,6 +4684,9 @@ export function targetFiles(aiBase, dshHome = findDshHome()) {
"deliverables-prompt": allExisting([
...nestedPkg(aiBase, "dsh-client-ui-deliverables", "lib", "index.js"),
]),
"llm-deepseek": allExisting([
...nestedPkg(aiBase, "dsh-llm-deepseek", "lib", "index.js"),
]),
"session": allExisting([
...nestedPkg(aiBase, "dsh-session", "lib", "index.js"),
]),