dsh-desktop-enhance 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/lib/client.js +268 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/package.json +14 -12
package/README.md
CHANGED
|
@@ -110,6 +110,12 @@ Web 版(浏览器里打开的那种)键位是 **`Cmd+Shift+.`** —— `Cmd+
|
|
|
110
110
|
|
|
111
111
|
具体安全范围、设置归属与迁移说明见 [远程接入](docs/features/remote-access.md)。
|
|
112
112
|
|
|
113
|
+
### 异常轮次分叉
|
|
114
|
+
|
|
115
|
+
已经报错或停止的轮次,也能在原位置点击 Fork。保留原生操作栏,不增加第二个入口;没有最终答复的轮次会补齐该入口。设置页「会话能力 → 异常轮次分叉」可关闭并恢复原生行为。
|
|
116
|
+
|
|
117
|
+
只支持已保存结束记录的轮次,不处理运行中或损坏记录。**分叉复制对话,不回滚文件和外部操作**。
|
|
118
|
+
|
|
113
119
|
### 子智能体与团队会话模型
|
|
114
120
|
|
|
115
121
|
在输入框原模型位置显示子智能体和团队成员最近请求实际使用的模型与推理档位,只读、不可切换;悬停可查看完整 `provider/model`。普通会话仍使用原生模型选择器。首次自身请求前显示「模型尚未记录」,不把 Fork 继承的父会话模型冒充为子会话模型。设置页「会话能力 → 子会话模型」可单独关闭,恢复原生界面。
|
package/lib/client.js
CHANGED
|
@@ -212,6 +212,10 @@ window.__ModuleLoader__.load({
|
|
|
212
212
|
"folderStatus.done": "未读结束",
|
|
213
213
|
"settings.folderStatus": "文件夹状态",
|
|
214
214
|
"settings.folderStatus.hint": "在折叠文件夹右侧显示活动与未读状态计数",
|
|
215
|
+
"abnormalFork.failed": "分叉失败",
|
|
216
|
+
"abnormalFork.created": "分叉已创建,但后续操作失败;请在侧栏查看",
|
|
217
|
+
"settings.abnormalFork": "异常轮次分叉",
|
|
218
|
+
"settings.abnormalFork.hint": "让已报错或停止的轮次也能从原位置分叉;不处理运行中或未完整记录的轮次",
|
|
215
219
|
"settings.sessionModel": "子会话模型",
|
|
216
220
|
"settings.sessionModel.hint": "在子智能体与团队会话的输入区域只读显示实际模型;关闭后恢复原生界面",
|
|
217
221
|
"settings.sessionInfo": "会话信息",
|
|
@@ -364,6 +368,10 @@ window.__ModuleLoader__.load({
|
|
|
364
368
|
"folderStatus.done": "Unread completion",
|
|
365
369
|
"settings.folderStatus": "Folder status",
|
|
366
370
|
"settings.folderStatus.hint": "Shows activity and unread counts on the right of collapsed folders",
|
|
371
|
+
"abnormalFork.failed": "Fork failed",
|
|
372
|
+
"abnormalFork.created": "The fork was created, but a later operation failed; check the sidebar",
|
|
373
|
+
"settings.abnormalFork": "Fork interrupted turns",
|
|
374
|
+
"settings.abnormalFork.hint": "Enables branching from the original position after a turn fails or is stopped; excludes running or unclosed turns",
|
|
367
375
|
"settings.sessionModel": "Child session model",
|
|
368
376
|
"settings.sessionModel.hint": "Shows the actual model read-only in subagent and team session input areas; disabling restores the native UI",
|
|
369
377
|
"settings.sessionInfo": "Session info",
|
|
@@ -691,6 +699,7 @@ window.__ModuleLoader__.load({
|
|
|
691
699
|
folderStatus: "data-desktop-enhance-off-folder-status",
|
|
692
700
|
sessionInfo: "data-desktop-enhance-off-session-info",
|
|
693
701
|
sessionModel: "data-desktop-enhance-off-session-model",
|
|
702
|
+
abnormalFork: "data-desktop-enhance-off-abnormal-fork",
|
|
694
703
|
toolsManager: "data-desktop-enhance-off-tools-manager",
|
|
695
704
|
skillsManager: "data-desktop-enhance-off-skills-manager"
|
|
696
705
|
};
|
|
@@ -703,6 +712,7 @@ window.__ModuleLoader__.load({
|
|
|
703
712
|
"folderStatus",
|
|
704
713
|
"sessionInfo",
|
|
705
714
|
"sessionModel",
|
|
715
|
+
"abnormalFork",
|
|
706
716
|
"toolsManager",
|
|
707
717
|
"skillsManager"
|
|
708
718
|
];
|
|
@@ -726,6 +736,7 @@ window.__ModuleLoader__.load({
|
|
|
726
736
|
fields: [
|
|
727
737
|
"sessionInfo",
|
|
728
738
|
"sessionModel",
|
|
739
|
+
"abnormalFork",
|
|
729
740
|
"toolsManager",
|
|
730
741
|
"skillsManager"
|
|
731
742
|
]
|
|
@@ -7756,7 +7767,7 @@ window.__ModuleLoader__.load({
|
|
|
7756
7767
|
}
|
|
7757
7768
|
//#endregion
|
|
7758
7769
|
//#region \0dsh-desktop-enhance-css:/Users/lijiechengbj/projects/AI-agents/dsh-desktop-enhance/src/client/remote/styles.css.mjs
|
|
7759
|
-
var styles_css_default$
|
|
7770
|
+
var styles_css_default$2 = "\n[data-desktop-enhance-remote] { display:flex; flex-direction:column; gap:var(--dsh-de-space-section); min-width:0; padding:var(--dsh-de-space-lg); border:1px solid var(--dsh-de-border); border-radius:var(--dsh-de-radius-card); background:var(--dsh-de-surface); }\n[data-desktop-enhance-remote] .de-remote-body,\n[data-desktop-enhance-remote] .de-remote-content { display:flex; flex-direction:column; gap:var(--dsh-de-space-lg); min-width:0; }\n[data-desktop-enhance-remote] h3,\n[data-desktop-enhance-remote] h4,\n[data-desktop-enhance-remote] p { margin:0; }\n[data-desktop-enhance-remote] h3 { font-size:var(--dsh-de-font-heading); font-weight:600; }\n[data-desktop-enhance-remote] h4 { font-size:var(--dsh-de-font-body); font-weight:600; }\n[data-desktop-enhance-remote] p { color:var(--dsh-de-muted); font-size:var(--dsh-de-font-caption); line-height:1.5; overflow-wrap:anywhere; }\n[data-desktop-enhance-remote] [role=\"alert\"] { color:var(--dsh-de-danger); }\n[data-desktop-enhance-remote] .de-remote-heading { display:flex; align-items:center; justify-content:space-between; gap:var(--dsh-de-space-lg); }\n[data-desktop-enhance-remote] .de-remote-heading > div { display:grid; gap:4px; }\n[data-desktop-enhance-remote] .de-remote-port-row,\n[data-desktop-enhance-remote] .de-remote-field,\n[data-desktop-enhance-remote] .de-remote-actions { display:flex; align-items:center; gap:var(--dsh-de-space-md); flex-wrap:wrap; }\n[data-desktop-enhance-remote] .de-remote-field { font-size:var(--dsh-de-font-caption); color:var(--dsh-de-muted); }\n[data-desktop-enhance-remote] .de-remote-pairing,\n[data-desktop-enhance-remote] .de-remote-devices { border-top:1px solid var(--dsh-de-border); padding-top:var(--dsh-de-space-section); }\n[data-desktop-enhance-remote] .de-remote-pairing,\n[data-desktop-enhance-remote] .de-remote-devices { display:grid; gap:var(--dsh-de-space-md); }\n[data-desktop-enhance-remote] input { box-sizing:border-box; width:104px; min-width:0; max-width:100%; min-height:var(--dsh-de-control-height); padding:6px 8px; border:1px solid var(--dsh-de-border); border-radius:var(--dsh-de-radius-control); background:var(--dsh-de-surface); color:var(--dsh-de-text); font:inherit; }\n[data-desktop-enhance-settings] [data-desktop-enhance-remote] button.de-remote-primary { color:var(--dsw-alias-label-primary-bluish); background:var(--dsw-alias-state-business-tertiary); border-color:var(--dsh-de-accent); font-weight:600; }\n[data-desktop-enhance-settings] [data-desktop-enhance-remote] button.de-remote-primary:hover:not(:disabled) { background:var(--dsw-alias-state-business-tertiary); filter:brightness(.96); }\n[data-desktop-enhance-remote] .de-remote-device-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(210px,100%),1fr)); gap:var(--dsh-de-space-md); }\n[data-desktop-enhance-remote] .de-remote-device { min-width:0; display:flex; flex-direction:column; align-items:flex-start; gap:var(--dsh-de-space-sm); padding:var(--dsh-de-space-lg); border:1px solid var(--dsh-de-border); border-radius:var(--dsh-de-radius-card); background:var(--dsh-de-surface); }\n[data-desktop-enhance-remote] .de-remote-device > .de-remote-heading { align-self:stretch; margin-bottom:4px; }\n[data-desktop-enhance-remote] .de-remote-device strong { overflow-wrap:anywhere; }\n[data-desktop-enhance-remote] .de-remote-device-icon { width:28px; height:28px; color:var(--dsh-de-muted); }\n[data-desktop-enhance-remote] .de-remote-badge { border-radius:var(--dsh-de-radius-control); padding:3px 7px; background:var(--dsh-de-hover); font-size:var(--dsh-de-font-caption); color:var(--dsh-de-muted); }\n[data-desktop-enhance-remote] .de-remote-device[data-revoked=\"true\"] { opacity:.65; }\n[data-desktop-enhance-remote] .de-remote-device-footer { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:var(--dsh-de-space-sm); align-self:stretch; margin-top:auto; padding-top:var(--dsh-de-space-md); border-top:1px solid var(--dsh-de-border); color:var(--dsh-de-muted); font-size:var(--dsh-de-font-caption); }\n[data-desktop-enhance-settings] [data-desktop-enhance-remote] button.de-remote-revoke { padding:4px 0; color:var(--dsh-de-danger); background:transparent; border-color:transparent; font-size:var(--dsh-de-font-caption); }\n[data-desktop-enhance-remote] .de-remote-empty { padding:var(--dsh-de-space-section); border:1px dashed var(--dsh-de-border); border-radius:var(--dsh-de-radius-card); }\n@media (max-width:600px) {\n [data-desktop-enhance-remote] .de-remote-device-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--dsh-de-space-sm); }\n [data-desktop-enhance-remote] .de-remote-device { padding:var(--dsh-de-space-md); }\n}\n@media (max-width:360px) { [data-desktop-enhance-remote] .de-remote-device-grid { grid-template-columns:1fr; } }\n";
|
|
7760
7771
|
//#endregion
|
|
7761
7772
|
//#region src/shared/session-model.ts
|
|
7762
7773
|
const SESSION_MODEL_PROJECTION = "desktop-enhance.session-model";
|
|
@@ -7789,8 +7800,262 @@ window.__ModuleLoader__.load({
|
|
|
7789
7800
|
}, h("span", { className: "de-session-model-name" }, caption), model?.reasoningEffort ? h("span", { className: "de-session-model-effort" }, model.reasoningEffort) : null);
|
|
7790
7801
|
}
|
|
7791
7802
|
//#endregion
|
|
7803
|
+
//#region \0dsh-desktop-enhance-css:/Users/lijiechengbj/projects/AI-agents/dsh-desktop-enhance/src/client/session-model/styles.css.mjs
|
|
7804
|
+
var styles_css_default$1 = ":root[data-desktop-enhance-off-session-model] [data-desktop-enhance-session-model] { display: none !important; }\n\n\n:root:not([data-desktop-enhance-off-session-model]) [data-desktop-enhance-session-model] {\n display: flex;\n align-items: center;\n gap: 4px;\n min-width: 0;\n max-width: min(360px, 45cqw);\n height: 28px;\n padding: 0 4px 0 8px;\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n font-weight: 400;\n line-height: 20px;\n}\n.de-session-model-name,\n.de-session-model-effort {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.de-session-model-effort { flex-shrink: 1000; }\n.de-readonly-model-composer {\n border: 0.5px solid var(--dsw-alias-border-l1);\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-secondary);\n margin: 0 24px 20px;\n padding: 10px 16px;\n font-size: 13px;\n line-height: 20px;\n}\n.de-readonly-model-notice {\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n gap: 8px;\n}\n.de-readonly-model-notice strong { color: var(--dsw-alias-label-primary); font-weight: 510; }\n.de-readonly-model-row { display: flex; justify-content: flex-end; margin-top: 8px; }\n";
|
|
7805
|
+
//#endregion
|
|
7806
|
+
//#region src/client/abnormal-fork/model.ts
|
|
7807
|
+
function abnormalBoundary(turn) {
|
|
7808
|
+
const end = turn.end;
|
|
7809
|
+
const tail = turn.data.get("turn-tail");
|
|
7810
|
+
if (turn.status !== "closed" || !end || !Number.isSafeInteger(end.data?.turn) || end.data.turn < 1 || !Number.isSafeInteger(end.seq) || end.seq < 0 || tail?.turn !== end.data.turn || tail.seq !== end.seq) return null;
|
|
7811
|
+
if (![
|
|
7812
|
+
"error",
|
|
7813
|
+
"aborted",
|
|
7814
|
+
"interrupted",
|
|
7815
|
+
"max-tokens"
|
|
7816
|
+
].includes(end.data.reason?.kind)) return null;
|
|
7817
|
+
return end.seq;
|
|
7818
|
+
}
|
|
7819
|
+
function createForkAction(services, sessionId, atSeq, allowed, publish) {
|
|
7820
|
+
let state = { busy: false };
|
|
7821
|
+
let live = true;
|
|
7822
|
+
const emit = () => {
|
|
7823
|
+
if (live) publish(state);
|
|
7824
|
+
};
|
|
7825
|
+
return {
|
|
7826
|
+
async run() {
|
|
7827
|
+
if (!live || !allowed() || state.busy || state.created) return;
|
|
7828
|
+
state = { busy: true };
|
|
7829
|
+
emit();
|
|
7830
|
+
try {
|
|
7831
|
+
const id = await services.fork({
|
|
7832
|
+
sessionId,
|
|
7833
|
+
atSeq,
|
|
7834
|
+
increaseTitle: true,
|
|
7835
|
+
onCreated(id) {
|
|
7836
|
+
state = {
|
|
7837
|
+
...state,
|
|
7838
|
+
created: id
|
|
7839
|
+
};
|
|
7840
|
+
}
|
|
7841
|
+
});
|
|
7842
|
+
state = {
|
|
7843
|
+
busy: false,
|
|
7844
|
+
created: id
|
|
7845
|
+
};
|
|
7846
|
+
if (live && allowed()) services.openSession(id);
|
|
7847
|
+
} catch (error) {
|
|
7848
|
+
const rpcError = error !== null && typeof error === "object" && "rpcError" in error ? error.rpcError : null;
|
|
7849
|
+
const created = rpcError?.code === "session/workspace-attach-failed" ? rpcError.details?.sessionId : void 0;
|
|
7850
|
+
state = {
|
|
7851
|
+
...state,
|
|
7852
|
+
...typeof created === "string" && created !== "" ? { created } : {},
|
|
7853
|
+
busy: false,
|
|
7854
|
+
error: error instanceof Error ? error.message : String(error)
|
|
7855
|
+
};
|
|
7856
|
+
}
|
|
7857
|
+
emit();
|
|
7858
|
+
},
|
|
7859
|
+
dispose() {
|
|
7860
|
+
live = false;
|
|
7861
|
+
}
|
|
7862
|
+
};
|
|
7863
|
+
}
|
|
7864
|
+
//#endregion
|
|
7865
|
+
//#region src/client/abnormal-fork/dom.ts
|
|
7866
|
+
const OWNED = "data-desktop-enhance-abnormal-fork-button";
|
|
7867
|
+
function takeNativeFork(root, label, run, isDisabled) {
|
|
7868
|
+
const originals = new Map();
|
|
7869
|
+
const refresh = () => {
|
|
7870
|
+
for (const [button, original] of originals) {
|
|
7871
|
+
if (button.getAttribute("data-unavailable") === "true") continue;
|
|
7872
|
+
button.removeAttribute(OWNED);
|
|
7873
|
+
if (original.title === null) button.removeAttribute("title");
|
|
7874
|
+
else button.setAttribute("title", original.title);
|
|
7875
|
+
originals.delete(button);
|
|
7876
|
+
}
|
|
7877
|
+
const row = root.querySelector(":scope > [data-clock=\"end\"]");
|
|
7878
|
+
for (const child of Array.from(row?.children ?? [])) {
|
|
7879
|
+
if (!(child instanceof globalThis.HTMLButtonElement) || child.getAttribute("aria-label") !== label || child.getAttribute("data-unavailable") !== "true") continue;
|
|
7880
|
+
if (!originals.has(child)) originals.set(child, {
|
|
7881
|
+
disabled: child.getAttribute("aria-disabled"),
|
|
7882
|
+
described: child.getAttribute("aria-describedby"),
|
|
7883
|
+
title: child.getAttribute("title")
|
|
7884
|
+
});
|
|
7885
|
+
child.setAttribute(OWNED, "");
|
|
7886
|
+
const desired = isDisabled() ? "true" : "false";
|
|
7887
|
+
if (child.getAttribute("aria-disabled") !== desired) child.setAttribute("aria-disabled", desired);
|
|
7888
|
+
child.removeAttribute("aria-describedby");
|
|
7889
|
+
child.setAttribute("title", label);
|
|
7890
|
+
}
|
|
7891
|
+
};
|
|
7892
|
+
const onClick = (event) => {
|
|
7893
|
+
const target = event.target instanceof globalThis.Element ? event.target.closest("button") : null;
|
|
7894
|
+
if (!target || !originals.has(target) || target.getAttribute("data-unavailable") !== "true") return;
|
|
7895
|
+
event.preventDefault();
|
|
7896
|
+
event.stopPropagation();
|
|
7897
|
+
if (!isDisabled()) run();
|
|
7898
|
+
};
|
|
7899
|
+
const suppressUnavailableTooltip = (event) => {
|
|
7900
|
+
const target = event.target instanceof globalThis.Element ? event.target.closest("button") : null;
|
|
7901
|
+
if (target && originals.has(target) && target.getAttribute("data-unavailable") === "true") event.stopPropagation();
|
|
7902
|
+
};
|
|
7903
|
+
const tooltipEvents = [
|
|
7904
|
+
"mouseover",
|
|
7905
|
+
"pointerover",
|
|
7906
|
+
"focusin"
|
|
7907
|
+
];
|
|
7908
|
+
for (const name of tooltipEvents) root.addEventListener(name, suppressUnavailableTooltip, true);
|
|
7909
|
+
root.addEventListener("click", onClick, true);
|
|
7910
|
+
const observer = new globalThis.MutationObserver(refresh);
|
|
7911
|
+
observer.observe(root, {
|
|
7912
|
+
childList: true,
|
|
7913
|
+
subtree: true,
|
|
7914
|
+
attributes: true,
|
|
7915
|
+
attributeFilter: [
|
|
7916
|
+
"aria-disabled",
|
|
7917
|
+
"aria-describedby",
|
|
7918
|
+
"data-unavailable"
|
|
7919
|
+
]
|
|
7920
|
+
});
|
|
7921
|
+
refresh();
|
|
7922
|
+
return () => {
|
|
7923
|
+
observer.disconnect();
|
|
7924
|
+
root.removeEventListener("click", onClick, true);
|
|
7925
|
+
for (const name of tooltipEvents) root.removeEventListener(name, suppressUnavailableTooltip, true);
|
|
7926
|
+
for (const [button, original] of originals) {
|
|
7927
|
+
button.removeAttribute(OWNED);
|
|
7928
|
+
if (original.title === null) button.removeAttribute("title");
|
|
7929
|
+
else button.setAttribute("title", original.title);
|
|
7930
|
+
if (button.getAttribute("data-unavailable") !== "true") continue;
|
|
7931
|
+
const attributes = [["aria-disabled", original.disabled], ["aria-describedby", original.described]];
|
|
7932
|
+
for (const [key, value] of attributes) if (value === null) button.removeAttribute(key);
|
|
7933
|
+
else button.setAttribute(key, value);
|
|
7934
|
+
}
|
|
7935
|
+
};
|
|
7936
|
+
}
|
|
7937
|
+
//#endregion
|
|
7938
|
+
//#region src/client/abnormal-fork/index.ts
|
|
7939
|
+
const SLOT = "conversation.chat.turnTail";
|
|
7940
|
+
function installAbnormalFork(ctx, settings, t) {
|
|
7941
|
+
const tNative = ctx.locale.bind("chat");
|
|
7942
|
+
function Controls({ turn, sessionId, boundary, useAccess }) {
|
|
7943
|
+
const allowed = useAccess("session/fork");
|
|
7944
|
+
const root = React.useRef(null);
|
|
7945
|
+
const [state, setState] = React.useState({ busy: false });
|
|
7946
|
+
const current = React.useRef({
|
|
7947
|
+
allowed,
|
|
7948
|
+
state
|
|
7949
|
+
});
|
|
7950
|
+
current.current = {
|
|
7951
|
+
allowed,
|
|
7952
|
+
state
|
|
7953
|
+
};
|
|
7954
|
+
const action = React.useRef(null);
|
|
7955
|
+
const noClosing = turn.data.get("turn-tail")?.closing === null;
|
|
7956
|
+
React.useEffect(() => {
|
|
7957
|
+
const next = createForkAction({
|
|
7958
|
+
fork: (options) => {
|
|
7959
|
+
const sessions = ctx.get("sessions");
|
|
7960
|
+
if (!sessions) throw new Error("sessions service unavailable");
|
|
7961
|
+
return sessions.fork(options);
|
|
7962
|
+
},
|
|
7963
|
+
openSession: (id) => {
|
|
7964
|
+
const workspace = ctx.get("uiWorkspace");
|
|
7965
|
+
if (!workspace) throw new Error("uiWorkspace service unavailable");
|
|
7966
|
+
workspace.openSession(id);
|
|
7967
|
+
}
|
|
7968
|
+
}, sessionId, boundary, () => current.current.allowed && settings.get().value?.abnormalFork !== false, setState);
|
|
7969
|
+
action.current = next;
|
|
7970
|
+
return () => {
|
|
7971
|
+
next.dispose();
|
|
7972
|
+
action.current = null;
|
|
7973
|
+
};
|
|
7974
|
+
}, [sessionId, boundary]);
|
|
7975
|
+
const run = () => {
|
|
7976
|
+
action.current?.run();
|
|
7977
|
+
};
|
|
7978
|
+
const disabled = () => !current.current.allowed || current.current.state.busy || !!current.current.state.created;
|
|
7979
|
+
const label = tNative("message.branch");
|
|
7980
|
+
React.useLayoutEffect(() => {
|
|
7981
|
+
if (!allowed || !root.current || noClosing) return;
|
|
7982
|
+
const tail = root.current.closest("[data-turn-tail]");
|
|
7983
|
+
if (!tail || tail.getAttribute("data-turn-tail") !== String(turn.end?.data.turn)) return;
|
|
7984
|
+
return takeNativeFork(tail, label, run, disabled);
|
|
7985
|
+
}, [
|
|
7986
|
+
allowed,
|
|
7987
|
+
turn,
|
|
7988
|
+
noClosing,
|
|
7989
|
+
label,
|
|
7990
|
+
state.busy,
|
|
7991
|
+
state.created
|
|
7992
|
+
]);
|
|
7993
|
+
if (!allowed) return null;
|
|
7994
|
+
return h("div", {
|
|
7995
|
+
ref: root,
|
|
7996
|
+
"data-desktop-enhance-abnormal-fork": ""
|
|
7997
|
+
}, noClosing ? h("div", { "data-desktop-enhance-abnormal-fork-actions": "" }, h("button", {
|
|
7998
|
+
type: "button",
|
|
7999
|
+
"data-desktop-enhance-abnormal-fork-new": "",
|
|
8000
|
+
"aria-label": label,
|
|
8001
|
+
title: label,
|
|
8002
|
+
disabled: disabled(),
|
|
8003
|
+
onClick: run
|
|
8004
|
+
}, h("svg", {
|
|
8005
|
+
width: 16,
|
|
8006
|
+
height: 16,
|
|
8007
|
+
viewBox: "0 0 16 16",
|
|
8008
|
+
fill: "none",
|
|
8009
|
+
stroke: "currentColor",
|
|
8010
|
+
strokeWidth: 1,
|
|
8011
|
+
"aria-hidden": true
|
|
8012
|
+
}, h("path", { d: "M1.01503 8.0001L5.6964 8.0001C6.41913 8.0001 6.78049 8.0001 7.12115 7.91951C7.4232 7.84804 7.71233 7.73014 7.97821 7.57C8.27809 7.38939 8.5364 7.13669 9.05303 6.63129L11.3281 4.40564" }), h("path", { d: "M1.01221 7.9999L5.6964 7.9999C6.41913 7.9999 6.78049 7.9999 7.12115 8.08049C7.4232 8.15196 7.71233 8.26986 7.97821 8.43C8.27809 8.61061 8.5364 8.86331 9.05303 9.36871L11.3281 11.5944" }), h("circle", {
|
|
8013
|
+
cx: 12.4502,
|
|
8014
|
+
cy: 3.3079,
|
|
8015
|
+
r: 1.56962
|
|
8016
|
+
}), h("circle", {
|
|
8017
|
+
cx: 12.4502,
|
|
8018
|
+
cy: 12.6921,
|
|
8019
|
+
r: 1.56962
|
|
8020
|
+
})))) : null, state.error ? h("div", {
|
|
8021
|
+
role: "alert",
|
|
8022
|
+
"data-desktop-enhance-abnormal-fork-error": ""
|
|
8023
|
+
}, `${t(state.created ? "abnormalFork.created" : "abnormalFork.failed")}: ${state.error}`) : null);
|
|
8024
|
+
}
|
|
8025
|
+
function Contribution(props) {
|
|
8026
|
+
const boundary = abnormalBoundary(props.turn);
|
|
8027
|
+
if (boundary === null) return null;
|
|
8028
|
+
return h(Controls, {
|
|
8029
|
+
...props,
|
|
8030
|
+
boundary,
|
|
8031
|
+
key: `${props.sessionId}:${boundary}`
|
|
8032
|
+
});
|
|
8033
|
+
}
|
|
8034
|
+
return ctx.slots.inject(SLOT, () => {
|
|
8035
|
+
let remove;
|
|
8036
|
+
const sync = () => {
|
|
8037
|
+
if (settings.get().value?.abnormalFork === false) {
|
|
8038
|
+
remove?.();
|
|
8039
|
+
remove = void 0;
|
|
8040
|
+
} else if (!remove) remove = ctx.slots.register({
|
|
8041
|
+
name: SLOT,
|
|
8042
|
+
id: "desktop-enhance.abnormal-fork",
|
|
8043
|
+
order: 100,
|
|
8044
|
+
locale: NS,
|
|
8045
|
+
inject: (sessionId) => ({ sessionId })
|
|
8046
|
+
}, Contribution);
|
|
8047
|
+
};
|
|
8048
|
+
const stop = settings.subscribe(sync);
|
|
8049
|
+
sync();
|
|
8050
|
+
return () => {
|
|
8051
|
+
stop();
|
|
8052
|
+
remove?.();
|
|
8053
|
+
};
|
|
8054
|
+
});
|
|
8055
|
+
}
|
|
8056
|
+
//#endregion
|
|
7792
8057
|
//#region src/client/index.tsx
|
|
7793
|
-
const PLUGIN_STYLESHEET = enhance_css_default + "\n" + tabs_css_default + "\n" + styles_css_default$1 + "\n:root[data-desktop-enhance-off-
|
|
8058
|
+
const PLUGIN_STYLESHEET = enhance_css_default + "\n" + tabs_css_default + "\n" + styles_css_default$2 + "\n" + styles_css_default$1 + "\n\n:root:not([data-desktop-enhance-off-abnormal-fork]) [data-desktop-enhance-abnormal-fork-button] {\n cursor: pointer;\n opacity: 1;\n}\n:root:not([data-desktop-enhance-off-abnormal-fork]) [data-desktop-enhance-abnormal-fork-button][aria-disabled=\"true\"] {\n cursor: default;\n opacity: .45;\n}\n[data-desktop-enhance-abnormal-fork] { display: contents; }\n[data-desktop-enhance-abnormal-fork-actions] {\n display: flex;\n align-items: center;\n gap: 8px;\n height: calc(28px + var(--dsh-content-font-delta, 0px));\n}\n[data-desktop-enhance-abnormal-fork-new] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: calc(28px + var(--dsh-content-font-delta, 0px));\n height: calc(28px + var(--dsh-content-font-delta, 0px));\n padding: 6px;\n border: none;\n border-radius: var(--dsw-radius-sm);\n background: transparent;\n color: var(--dsw-alias-label-tertiary);\n cursor: pointer;\n}\n[data-desktop-enhance-abnormal-fork-new] svg {\n width: calc(17px + var(--dsh-content-font-delta, 0px));\n height: calc(17px + var(--dsh-content-font-delta, 0px));\n}\n[data-desktop-enhance-abnormal-fork-new]:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n}\n[data-desktop-enhance-abnormal-fork-new]:focus-visible {\n outline: 2px solid var(--dsw-alias-state-business-primary);\n outline-offset: 2px;\n}\n[data-desktop-enhance-abnormal-fork-new]:disabled { opacity: .45; cursor: default; }\n[data-desktop-enhance-abnormal-fork-error] {\n color: var(--dsw-alias-label-primary);\n font-size: var(--dsh-content-font-size-secondary, 13px);\n}\n";
|
|
7794
8059
|
const inject = [
|
|
7795
8060
|
"slots",
|
|
7796
8061
|
"locale",
|
|
@@ -7832,6 +8097,7 @@ window.__ModuleLoader__.load({
|
|
|
7832
8097
|
value: void 0,
|
|
7833
8098
|
writable: true
|
|
7834
8099
|
});
|
|
8100
|
+
ctx.effect(() => installAbnormalFork(ctx, settings, t), "desktop-enhance: abnormal turn fork");
|
|
7835
8101
|
ctx.effect(() => {
|
|
7836
8102
|
let dispose;
|
|
7837
8103
|
const sync = () => {
|
package/lib/index.d.ts
CHANGED
|
@@ -186,6 +186,7 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
|
186
186
|
folderStatus: Schema<boolean, boolean, "volatile-defined">;
|
|
187
187
|
sessionInfo: Schema<boolean, boolean, "volatile-defined">;
|
|
188
188
|
sessionModel: Schema<boolean, boolean, "volatile-defined">;
|
|
189
|
+
abnormalFork: Schema<boolean, boolean, "volatile-defined">;
|
|
189
190
|
toolsManager: Schema<boolean, boolean, "volatile-defined">;
|
|
190
191
|
skillsManager: Schema<boolean, boolean, "volatile-defined">;
|
|
191
192
|
suggestModel: Schema<string, string, "volatile-defined">;
|
|
@@ -204,6 +205,7 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
|
204
205
|
folderStatus: Schema<boolean, boolean, "volatile-defined">;
|
|
205
206
|
sessionInfo: Schema<boolean, boolean, "volatile-defined">;
|
|
206
207
|
sessionModel: Schema<boolean, boolean, "volatile-defined">;
|
|
208
|
+
abnormalFork: Schema<boolean, boolean, "volatile-defined">;
|
|
207
209
|
toolsManager: Schema<boolean, boolean, "volatile-defined">;
|
|
208
210
|
skillsManager: Schema<boolean, boolean, "volatile-defined">;
|
|
209
211
|
suggestModel: Schema<string, string, "volatile-defined">;
|
package/lib/index.js
CHANGED
|
@@ -2529,6 +2529,7 @@ const Config = Schema.object({
|
|
|
2529
2529
|
folderStatus: Schema.boolean().default(true).volatile(),
|
|
2530
2530
|
sessionInfo: Schema.boolean().default(true).volatile(),
|
|
2531
2531
|
sessionModel: Schema.boolean().default(true).volatile(),
|
|
2532
|
+
abnormalFork: Schema.boolean().default(true).volatile(),
|
|
2532
2533
|
toolsManager: Schema.boolean().default(true).volatile(),
|
|
2533
2534
|
skillsManager: Schema.boolean().default(true).volatile(),
|
|
2534
2535
|
suggestModel: Schema.string().default("").volatile(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-desktop-enhance",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "DSH Desktop 界面增强:页内查找(Cmd+F)、轮次编号、上下文压缩行常显、建议、每步耗时、折叠文件夹状态计数、会话信息(含上下文注入 C1 视图)、工具管理、Skill 管理、独立远程接入与手机体验。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"icon": "./icon.svg",
|
|
@@ -32,6 +32,18 @@
|
|
|
32
32
|
"icon.svg",
|
|
33
33
|
"cordis.patch.yml"
|
|
34
34
|
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsdown",
|
|
37
|
+
"dev": "tsdown --watch",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"test": "node --test tests/*.test.mjs",
|
|
40
|
+
"test:isolation": "./tools/test-isolation.sh",
|
|
41
|
+
"verify": "pnpm typecheck && pnpm build && pnpm test && pnpm test:isolation",
|
|
42
|
+
"prepack": "pnpm build",
|
|
43
|
+
"prepublishOnly": "pnpm verify",
|
|
44
|
+
"release:patch": "npm version patch && pnpm publish",
|
|
45
|
+
"release:minor": "npm version minor && pnpm publish"
|
|
46
|
+
},
|
|
35
47
|
"publishConfig": {
|
|
36
48
|
"access": "public"
|
|
37
49
|
},
|
|
@@ -50,15 +62,5 @@
|
|
|
50
62
|
"@types/react": "^18.3.31",
|
|
51
63
|
"tsdown": "0.23.0",
|
|
52
64
|
"typescript": "5.9.3"
|
|
53
|
-
},
|
|
54
|
-
"scripts": {
|
|
55
|
-
"build": "tsdown",
|
|
56
|
-
"dev": "tsdown --watch",
|
|
57
|
-
"typecheck": "tsc --noEmit",
|
|
58
|
-
"test": "node --test tests/*.test.mjs",
|
|
59
|
-
"test:isolation": "./tools/test-isolation.sh",
|
|
60
|
-
"verify": "pnpm typecheck && pnpm build && pnpm test && pnpm test:isolation",
|
|
61
|
-
"release:patch": "npm version patch && pnpm publish",
|
|
62
|
-
"release:minor": "npm version minor && pnpm publish"
|
|
63
65
|
}
|
|
64
|
-
}
|
|
66
|
+
}
|