mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 12:00:22 +08:00
fix: 发布 1.1.65,截图报告与默认提示词
接入上游截图登记和六段报告,默认提示词按当前文稿重新加密。缺外部工具或密钥时技能仍可加载。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ed676bcb11
commit
2bf8bfb618
20 files changed
+1616
-753
No files matched your search
+6
-101
@@ -8,6 +8,7 @@ import * as reapply from "./reapply.js";
|
||||
import * as officialUpdate from "./official-update.js";
|
||||
import {
|
||||
GLOBAL_PROMPT_ORDER,
|
||||
adaptInjectForMinimalPreset,
|
||||
isMnemonPluginMessage,
|
||||
isRedteamSession,
|
||||
installAssembleGuard,
|
||||
@@ -73,26 +74,6 @@ function currentContinueConfig() {
|
||||
return continueRetry.mergeConfig(continuePluginCfg, savedContinueSettings);
|
||||
}
|
||||
|
||||
function continueStatusPayload(ctx, sessionId) {
|
||||
const cfg = currentContinueConfig();
|
||||
const agent = sessionId ? continueRetry.resolveAgent(ctx, sessionId) : null;
|
||||
if (agent && continueRuntime) return continueRuntime.status(agent);
|
||||
return {
|
||||
ok: true,
|
||||
sessionId: sessionId || "",
|
||||
canContinue: false,
|
||||
reason: "",
|
||||
userAbort: false,
|
||||
retryUsed: 0,
|
||||
continueUsed: 0,
|
||||
retryMax: cfg.retryMax,
|
||||
continueMax: cfg.continueMax,
|
||||
autoRetry: cfg.autoRetry,
|
||||
autoContinue: cfg.autoContinue,
|
||||
continueText: cfg.continueText,
|
||||
};
|
||||
}
|
||||
|
||||
function watchWebTreeReady(ctx) {
|
||||
// 必须挂在 connection 上再 await,与官方打印 URL 同一时刻。
|
||||
// apply() 里立刻 await 会在后续入口尚未入树时提前结束,session.list 仍是空的。
|
||||
@@ -182,6 +163,7 @@ function injectAllowedNow(config) {
|
||||
/** 提示词框自改 > prompt-inject.md > 加密默认(见 rules.resolveInjectText)。 */
|
||||
function refreshHungOperator(dshHome = core.findDshHome()) {
|
||||
const home = dshHome || core.findDshHome();
|
||||
try { core.syncPromptInjectOnDiskSync(home); } catch { /* 同步失败仍按 resolve 走 */ }
|
||||
const resolved = rules.resolveInjectText(home);
|
||||
core.hangOperatorPrompt(resolved.text);
|
||||
return resolved;
|
||||
@@ -250,7 +232,8 @@ export function registerPromptSections(ctx, config, _injectFile) {
|
||||
interpolate: false,
|
||||
text: (context) => {
|
||||
if (!injectAllowedNow(config)) return "";
|
||||
return readInjectFallback(context);
|
||||
// 标准、极简都注入同一份正文。极简只改工具句,不决定注不注入。
|
||||
return adaptInjectForMinimalPreset(readInjectFallback(context), context);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1167,19 +1150,6 @@ function applyHostHooks(ctx, cfg) {
|
||||
};
|
||||
},
|
||||
});
|
||||
// commands.register({
|
||||
// name: "continue",
|
||||
// description: "异常停止或中断后发送继续(计入继续次数)",
|
||||
// input: { hint: "继续当前异常停止的会话" },
|
||||
// handler: async (invocation) => {
|
||||
// const sessionId = rewind.invocationSessionId(invocation);
|
||||
// const agent = continueRetry.resolveAgent(ctx, sessionId);
|
||||
// if (!agent || !continueRuntime) return { kind: "error", text: "当前会话不能继续" };
|
||||
// const result = continueRuntime.continueNow(agent);
|
||||
// if (!result.ok) return { kind: "error", text: result.error };
|
||||
// return { kind: "success", text: `已发送继续(${result.used}/${result.max})` };
|
||||
// },
|
||||
// });
|
||||
}
|
||||
|
||||
if (ctx.tools) {
|
||||
@@ -1462,73 +1432,6 @@ function installWebServer(ctx, cfg) {
|
||||
response.end();
|
||||
},
|
||||
}, "dsh-purge: rewind");
|
||||
// registerPluginRoute({
|
||||
// kind: "exact",
|
||||
// path: "/dsh-purge/continue",
|
||||
// handler: async (request, response) => {
|
||||
// if (request.method === "GET") {
|
||||
// try {
|
||||
// const url = new URL(request.url, "http://127.0.0.1");
|
||||
// const sessionId = String(url.searchParams.get("sessionId") || "").trim();
|
||||
// sendJson(response, 200, continueStatusPayload(ctx, sessionId));
|
||||
// } catch (e) {
|
||||
// sendJson(response, 500, { ok: false, error: String(e) });
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// if (request.method === "POST") {
|
||||
// try {
|
||||
// const body = await readJsonBody(request);
|
||||
// const sessionId = String(body?.sessionId || "").trim();
|
||||
// if (!sessionId) {
|
||||
// sendJson(response, 400, { ok: false, error: "需要 sessionId" });
|
||||
// return;
|
||||
// }
|
||||
// const agent = continueRetry.resolveAgent(ctx, sessionId);
|
||||
// if (!agent || !continueRuntime) {
|
||||
// sendJson(response, 409, { ok: false, error: "当前会话不能继续" });
|
||||
// return;
|
||||
// }
|
||||
// const result = continueRuntime.continueNow(agent, { force: Boolean(body?.force) });
|
||||
// sendJson(response, result.ok ? 200 : 409, result);
|
||||
// } catch (e) {
|
||||
// sendJson(response, 500, { ok: false, error: String(e) });
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// response.writeHead(405, { allow: "GET, POST" });
|
||||
// response.end();
|
||||
// },
|
||||
// }, "dsh-purge: continue");
|
||||
// registerPluginRoute({
|
||||
// kind: "exact",
|
||||
// path: "/dsh-purge/continue/settings",
|
||||
// handler: async (request, response) => {
|
||||
// if (request.method === "GET") {
|
||||
// try {
|
||||
// sendJson(response, 200, { ok: true, ...currentContinueConfig() });
|
||||
// } catch (e) {
|
||||
// sendJson(response, 500, { ok: false, error: String(e) });
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// if (request.method === "POST") {
|
||||
// try {
|
||||
// const body = await readJsonBody(request);
|
||||
// savedContinueSettings = await continueRetry.saveSettings(core.findDshHome(), {
|
||||
// ...currentContinueConfig(),
|
||||
// ...body,
|
||||
// });
|
||||
// sendJson(response, 200, { ok: true, ...currentContinueConfig() });
|
||||
// } catch (e) {
|
||||
// sendJson(response, 500, { ok: false, error: String(e) });
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// response.writeHead(405, { allow: "GET, POST" });
|
||||
// response.end();
|
||||
// },
|
||||
// }, "dsh-purge: continue settings");
|
||||
registerPluginRoute({
|
||||
kind: "exact",
|
||||
path: "/dsh-purge/update",
|
||||
@@ -1759,6 +1662,8 @@ function installWebServer(ctx, cfg) {
|
||||
if (request.method === "GET") {
|
||||
try {
|
||||
const home = core.findDshHome();
|
||||
try { core.syncPromptInjectOnDiskSync(home); } catch { /* ignore */ }
|
||||
refreshHungOperator(home);
|
||||
const ui = await core.readOverrideForUi(home);
|
||||
sendJson(response, 200, { ok: true, ...ui, ...injectSnapshot(home) });
|
||||
} catch (e) {
|
||||
|
||||
Reference in new issue
Block a user