mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-30 08:30:22 +08:00
release: 1.1.68
Co-authored-by: Cursor <cursoragent@cursor.com> #92 技能块标量 description;#93 红队更新路径与 GitHub 回落;#94 桌面 CLI unpacked 回退;#95 拆除 refusal-recover;#96 bash 等待迁回 60s。注入置顶,capability 改名,用户 prompt 一律 followup,默认关闭自动继续。
This commit is contained in:
1 parent
723b276e6f
commit
eb9af6b8fa
26 files changed
+1730
-1371
No files matched your search
@@ -271,6 +271,19 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
||||
"rules.reset.confirm": "还原全局指令文件?规则库会保留。",
|
||||
"rules.empty": "暂无规则",
|
||||
"rules.pick": "选择规则",
|
||||
"policy.title": "工作区策略",
|
||||
"policy.strict": "严格",
|
||||
"policy.fallback": "空位兜底",
|
||||
"policy.always": "总是允许",
|
||||
"policy.hint": "严格:永远剥 AGENTS.md / CLAUDE.md;空位兜底:提示词框为空时才用;总是允许:保留 DSH 原生行为",
|
||||
"cwd.title": "本地规则(当前目录)",
|
||||
"cwd.empty": "当前目录没有 AGENTS.md / CLAUDE.md",
|
||||
"cwd.rescan": "重新扫描",
|
||||
"cwd.hint": "只有提示词框为空时,被勾选的本地文件才作为兜底注入;提示词框一旦非空就不会用这些文件。",
|
||||
"cwd.scope.cwd": "当前目录",
|
||||
"cwd.scope.ancestor": "上级",
|
||||
"cwd.scope.root": "项目根",
|
||||
"cwd.no.workspace": "DSH 尚未选过工作目录,请先在 DSH 里开始一次任务再回来。",
|
||||
"pill.current": "当前",
|
||||
"btn.use": "启用",
|
||||
"btn.inUse": "当前",
|
||||
@@ -599,6 +612,19 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
||||
"rules.reset.confirm": "Restore global instruction files? The rule library is kept.",
|
||||
"rules.empty": "No rules",
|
||||
"rules.pick": "Select a rule",
|
||||
"policy.title": "Workspace policy",
|
||||
"policy.strict": "Strict",
|
||||
"policy.fallback": "Fallback",
|
||||
"policy.always": "Always on",
|
||||
"policy.hint": "Strict: always strip AGENTS.md / CLAUDE.md. Fallback: use workspace files only when the prompt box is empty. Always on: keep DSH default behavior.",
|
||||
"cwd.title": "Local rules (current folder)",
|
||||
"cwd.empty": "No AGENTS.md / CLAUDE.md in this folder",
|
||||
"cwd.rescan": "Rescan",
|
||||
"cwd.hint": "Checked files are injected only when the prompt box is empty. A non-empty prompt box always wins.",
|
||||
"cwd.scope.cwd": "cwd",
|
||||
"cwd.scope.ancestor": "ancestor",
|
||||
"cwd.scope.root": "project root",
|
||||
"cwd.no.workspace": "DSH has not opened a workspace yet. Start a task in DSH first, then come back.",
|
||||
"pill.current": "On",
|
||||
"btn.use": "Enable",
|
||||
"btn.inUse": "On",
|
||||
@@ -891,6 +917,25 @@ body[data-ds-dark-theme] .dshp-restart-card .dshp-btn-primary,body[data-ds-dark-
|
||||
.dshp-editor{display:flex;flex-direction:column;gap:10px;min-width:0;border:1px solid var(--dshp-line);border-radius:8px;background:var(--dshp-bg);padding:12px;min-height:320px}
|
||||
.dshp-editor .dshp-area{flex:1;min-height:240px}
|
||||
.dshp-editor-empty{flex:1;display:flex;align-items:center;justify-content:center;color:var(--dshp-mute);font-size:13px;min-height:160px}
|
||||
.dshp-block{padding:14px 0;border-top:1px solid var(--dshp-line)}
|
||||
.dshp-block-head{display:flex;align-items:center;gap:10px;margin:0 0 8px}
|
||||
.dshp-block-head h4{margin:0;font-family:var(--dshp-display);font-size:14px;font-weight:500;flex:1;color:var(--dshp-ink)}
|
||||
.dshp-block-hint{margin:8px 0 0;font-size:12px;line-height:1.55;color:var(--dshp-mute)}
|
||||
.dshp-policy-row{display:flex;align-items:center;gap:10px}
|
||||
.dshp-policy-row>label{font-size:12px;color:var(--dshp-mute);flex:0 0 auto}
|
||||
.dshp-cwd-path{margin:0 0 8px;font-family:var(--dshp-mono);font-size:11px;color:var(--dshp-mute);word-break:break-all;line-height:1.5}
|
||||
.dshp-cwd-list{display:flex;flex-direction:column;border:1px solid var(--dshp-line);border-radius:8px;background:var(--dshp-bg);overflow:hidden}
|
||||
.dshp-cwd-item{display:flex;align-items:flex-start;gap:10px;padding:10px 12px;border-bottom:1px solid var(--dshp-line);cursor:pointer;margin:0}
|
||||
.dshp-cwd-item:last-child{border-bottom:0}
|
||||
.dshp-cwd-item:hover{background:var(--dshp-fill)}
|
||||
.dshp-cwd-item.is-on{background:var(--dshp-accent-soft)}
|
||||
.dshp-cwd-item input{margin:3px 0 0;flex:0 0 auto}
|
||||
.dshp-cwd-main{flex:1;min-width:0}
|
||||
.dshp-cwd-name{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-family:var(--dshp-display);font-size:13.5px;line-height:1.35;color:var(--dshp-ink)}
|
||||
.dshp-cwd-badge{font-family:var(--dshp-mono);font-size:10px;letter-spacing:.04em;text-transform:uppercase;padding:1px 7px;border-radius:99px;border:1px solid var(--dshp-line);color:var(--dshp-mute);line-height:1.6}
|
||||
.dshp-cwd-size{font-family:var(--dshp-mono);font-size:11px;color:var(--dshp-mute)}
|
||||
.dshp-cwd-sub{margin-top:3px;font-family:var(--dshp-mono);font-size:11px;color:var(--dshp-mute);word-break:break-all}
|
||||
.dshp-cwd-prev{margin-top:4px;font-size:11px;line-height:1.5;color:var(--dshp-mute);max-height:34px;overflow:hidden}
|
||||
@keyframes dshp-pulse{0%{background-position:200% 0}100%{background-position:-200% 0}}
|
||||
@media (max-width:640px){.dshp-metrics{grid-template-columns:1fr}.dshp-ruleitem{flex-wrap:wrap}.dshp-rule-ops{width:100%;justify-content:flex-end}}
|
||||
@media (prefers-reduced-motion:reduce){.dshp-btn,.dshp-bar>i{transition:none}.dshp-skel{animation:none}}
|
||||
@@ -907,7 +952,7 @@ body[data-ds-dark-theme] .dshp-restart-card .dshp-btn-primary,body[data-ds-dark-
|
||||
.dshp-dock-tab.on{color:var(--dsw-alias-label-primary,var(--dshp-ink,#f2f2f2));font-weight:600;border-bottom-color:var(--dsw-alias-brand-primary,#6dbf8c);background:transparent}
|
||||
.dshp-dock-body{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column;background:transparent;border-radius:0 0 12px 12px}
|
||||
.dshp-dock-body .dshp-root{max-width:none;height:100%;flex:1;min-height:0;overflow:auto;background:transparent!important;--dshp-bg:transparent;--dshp-paper:color-mix(in srgb,var(--dshp-ink) 7%,transparent);--dshp-fill:color-mix(in srgb,var(--dshp-ink) 6%,transparent);--dshp-line:color-mix(in srgb,var(--dshp-ink) 20%,transparent);--dshp-accent-soft:color-mix(in srgb,var(--dshp-accent) 22%,transparent)}
|
||||
.dshp-dock-body .dshp-panel,.dshp-dock-body .dshp-metric,.dshp-dock-body .dshp-group,.dshp-dock-body .dshp-editor,.dshp-dock-body .dshp-active,.dshp-dock-body .dshp-ask,.dshp-dock-body .dshp-create,.dshp-dock-body .dshp-rulelist,.dshp-dock-body .dshp-table,.dshp-dock-body .dshp-ruleitem{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#f7f4ee) 74%,transparent)!important;border-color:color-mix(in srgb,var(--dsw-alias-brand-primary,#6d8f78) 32%,transparent)!important;color:var(--dshp-ink)!important;box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 32%,transparent);backdrop-filter:blur(16px) saturate(1.3);-webkit-backdrop-filter:blur(16px) saturate(1.3)}
|
||||
.dshp-dock-body .dshp-panel,.dshp-dock-body .dshp-metric,.dshp-dock-body .dshp-group,.dshp-dock-body .dshp-editor,.dshp-dock-body .dshp-active,.dshp-dock-body .dshp-ask,.dshp-dock-body .dshp-create,.dshp-dock-body .dshp-rulelist,.dshp-dock-body .dshp-table,.dshp-dock-body .dshp-ruleitem,.dshp-dock-body .dshp-cwd-list,.dshp-dock-body .dshp-cwd-item{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#f7f4ee) 74%,transparent)!important;border-color:color-mix(in srgb,var(--dsw-alias-brand-primary,#6d8f78) 32%,transparent)!important;color:var(--dshp-ink)!important;box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 32%,transparent);backdrop-filter:blur(16px) saturate(1.3);-webkit-backdrop-filter:blur(16px) saturate(1.3)}
|
||||
.dshp-dock-body .dshp-field,.dshp-dock-body .dshp-area{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#fff) 88%,transparent)!important;color:var(--dshp-ink)!important;border-color:color-mix(in srgb,var(--dsw-alias-border-l1,#8a8478) 72%,transparent)!important}
|
||||
.dshp-dock-body select.dshp-field,.dshp-dock-body .dshp-field.dshp-ver{background:var(--dsw-alias-bg-layer-1,#fff)!important;color:var(--dshp-ink)!important;color-scheme:inherit}
|
||||
.dshp-dock[data-theme="white"] select.dshp-field option,.dshp-dock[data-theme="white"] .dshp-field.dshp-ver option{background:#fff;color:#16140f}
|
||||
@@ -2016,7 +2061,9 @@ body:not([data-ds-dark-theme]) .dshp-auth-ops button.primary{background:var(--ds
|
||||
|
||||
const loadStatus = useCallback(() => {
|
||||
const tr = tRef.current;
|
||||
rulesApi("status")
|
||||
let cwd = "";
|
||||
try { cwd = clientCurrentCwd(); } catch { /* ignore */ }
|
||||
rulesApi("status", cwd ? { cwd: cwd } : undefined)
|
||||
.then((d) => {
|
||||
if (d && d.ok) setSt(d);
|
||||
else {
|
||||
@@ -2123,6 +2170,10 @@ body:not([data-ds-dark-theme]) .dshp-auth-ops button.primary{background:var(--ds
|
||||
});
|
||||
}
|
||||
|
||||
const policyValue = (st && typeof st.workspace_policy === "string") ? st.workspace_policy : "fallback";
|
||||
const policyOptions = (st && Array.isArray(st.workspace_policies) && st.workspace_policies.length) ? st.workspace_policies : ["fallback", "strict", "always"];
|
||||
const cwdCandidates = (st && Array.isArray(st.cwd_candidates)) ? st.cwd_candidates : [];
|
||||
const cwdValue = (st && typeof st.cwd === "string") ? st.cwd : "";
|
||||
return h("section", { className: "dshp-panel", "aria-label": t("rules.title") },
|
||||
h("div", { className: "dshp-head" },
|
||||
h("h3", { className: "dshp-title" }, t("rules.title")),
|
||||
@@ -2140,6 +2191,60 @@ body:not([data-ds-dark-theme]) .dshp-auth-ops button.primary{background:var(--ds
|
||||
}, t("rules.reset")),
|
||||
),
|
||||
),
|
||||
h("div", { className: "dshp-block" },
|
||||
h("div", { className: "dshp-policy-row" },
|
||||
h("label", { htmlFor: "dshp-policy-select" }, t("policy.title")),
|
||||
h("select", {
|
||||
id: "dshp-policy-select",
|
||||
className: "dshp-field",
|
||||
value: policyValue,
|
||||
disabled: busy || !st,
|
||||
onChange: (e) => doPost("set-policy", { policy: e.target.value }),
|
||||
}, policyOptions.map((p) => h("option", { key: p, value: p }, t("policy." + p)))),
|
||||
),
|
||||
h("p", { className: "dshp-block-hint" }, t("policy.hint")),
|
||||
),
|
||||
h("div", { className: "dshp-block" },
|
||||
h("div", { className: "dshp-block-head" },
|
||||
h("h4", null, t("cwd.title")),
|
||||
h(Btn, {
|
||||
tiny: true,
|
||||
disabled: busy,
|
||||
onClick: () => {
|
||||
let cwd = cwdValue;
|
||||
if (!cwd) { try { cwd = clientCurrentCwd(); } catch { /* ignore */ } }
|
||||
doPost("scan-cwd", cwd ? { cwd: cwd } : {});
|
||||
},
|
||||
}, t("cwd.rescan")),
|
||||
),
|
||||
cwdValue ? h("p", { className: "dshp-cwd-path" }, cwdValue) : null,
|
||||
(!st || !cwdValue)
|
||||
? h("p", { className: "dshp-empty" }, t("cwd.no.workspace"))
|
||||
: (cwdCandidates.length === 0
|
||||
? h("p", { className: "dshp-empty" }, t("cwd.empty"))
|
||||
: h("div", { className: "dshp-cwd-list" }, cwdCandidates.map((item) => h("label", {
|
||||
key: item.path,
|
||||
className: "dshp-cwd-item" + (item.selected ? " is-on" : ""),
|
||||
},
|
||||
h("input", {
|
||||
type: "checkbox",
|
||||
checked: Boolean(item.selected),
|
||||
disabled: busy,
|
||||
onChange: (e) => doPost("toggle-cwd", { path: item.path, enabled: e.target.checked }),
|
||||
}),
|
||||
h("div", { className: "dshp-cwd-main" },
|
||||
h("div", { className: "dshp-cwd-name" },
|
||||
h("span", null, item.name),
|
||||
h("span", { className: "dshp-cwd-badge" }, t("cwd.scope." + (item.scope || "cwd"))),
|
||||
h("span", { className: "dshp-cwd-size" }, formatSize(item.size || 0)),
|
||||
),
|
||||
h("div", { className: "dshp-cwd-sub" }, item.path),
|
||||
item.preview ? h("div", { className: "dshp-cwd-prev" }, item.preview) : null,
|
||||
),
|
||||
)))),
|
||||
h("p", { className: "dshp-block-hint" }, t("cwd.hint")),
|
||||
),
|
||||
h("div", { className: "dshp-block" },
|
||||
h("div", { className: "dshp-split" },
|
||||
h("div", { className: "dshp-rulelist" },
|
||||
h("div", { className: "dshp-rulebody" }, list),
|
||||
@@ -2199,6 +2304,7 @@ body:not([data-ds-dark-theme]) .dshp-auth-ops button.primary{background:var(--ds
|
||||
] : h("div", { className: "dshp-editor-empty" }, t("rules.pick")),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7905,6 +8011,45 @@ body[data-ds-dark-theme] .dshp-rewind-item span{color:var(--dsw-alias-label-tert
|
||||
return "";
|
||||
}
|
||||
|
||||
function readSessionCwd(sess) {
|
||||
if (!sess || typeof sess !== "object") return "";
|
||||
try {
|
||||
const pv = sess.projectionValues;
|
||||
if (pv && typeof pv.cwd === "string" && pv.cwd.trim()) return pv.cwd.trim();
|
||||
} catch { /* ignore */ }
|
||||
try {
|
||||
if (typeof sess.cwd === "string" && sess.cwd.trim()) return sess.cwd.trim();
|
||||
} catch { /* ignore */ }
|
||||
try {
|
||||
const header = sess.header;
|
||||
if (header && typeof header.cwd === "string" && header.cwd.trim()) return header.cwd.trim();
|
||||
} catch { /* ignore */ }
|
||||
return "";
|
||||
}
|
||||
|
||||
function clientCurrentCwd() {
|
||||
try {
|
||||
const sessions = rewindSessions || (rewindHost && rewindHost.sessions);
|
||||
if (!sessions) return "";
|
||||
const sid = currentSessionId(sessions);
|
||||
if (!sid) return "";
|
||||
try {
|
||||
const snap = typeof sessions.list?.getSnapshot === "function" ? sessions.list.getSnapshot() : null;
|
||||
const sess = snap && snap.byId ? snap.byId[sid] : null;
|
||||
const found = readSessionCwd(sess);
|
||||
if (found) return found;
|
||||
} catch { /* ignore */ }
|
||||
try {
|
||||
const actx = typeof sessions.scope === "function" ? sessions.scope(sid) : undefined;
|
||||
const face = typeof sessions.sessionOf === "function" ? sessions.sessionOf(actx) : undefined;
|
||||
const faceSnap = face && typeof face.getSnapshot === "function" ? face.getSnapshot() : face;
|
||||
const found = readSessionCwd(faceSnap);
|
||||
if (found) return found;
|
||||
} catch { /* ignore */ }
|
||||
} catch { /* ignore */ }
|
||||
return "";
|
||||
}
|
||||
|
||||
function isRedteamModeActive() {
|
||||
try {
|
||||
const sessions = rewindSessions || (rewindHost && rewindHost.sessions);
|
||||
|
||||
Reference in new issue
Block a user