Compare commits

...
Author SHA1 Message Date
qiudl 329cfd32b5 Merge pull request 'feat(state): 恢复「云状态 + git 历史」能力 (REQ-20261117-0013)' (#3) from feat/REQ-20261117-0013-cloud-state into main 2026-11-18 14:32:39 +08:00
super-agent 05639e8984 feat(state): 恢复「云状态 + git 历史」能力 (REQ-20261117-0013)
背景:qiudl 分支(0.4.9-rc.2,用户原本在用的)有云状态功能——状态落在一个
独立 git 仓(~/Library/Application Support/dsh-worktable-state/),由 launchd
每 5 分钟 commit+push。Gitea 0.5.x 线没有这个功能,只有 DSH_HOME 下的单文件
镜像(worktable-state.json)。升级到 0.5.3 后两处路径不同,用户 14 个工作台
布局在界面上「消失」(数据本身还在那个 git 仓里)。

改法(不移植 976 行云状态代码,改走配置指针):
- 宿主侧 /api/worktable/state 的文件路径改为优先取本机配置
  03_local/local.json 的 cloudStatePath(指向那个 git 仓),未配置时回落到
  DSH_HOME/worktable-state.json(与旧行为一致)
- 新增 localConfigPaths / readLocalConfigField:候选链含环境变量
  DSH_WORKTABLE_LOCAL_DIR、插件根相对 03_local、DSH_HOME/03_local
- 客户端兼容旧 updatedAt 形态:旧线写 ISO 字符串,本线写毫秒数字,两种都认
  (否则指向旧文件后永远判「宿主不比本地新」而不回填)

这样云状态写入自动进 git 仓,每次变更都有提交历史,launchd 继续 push 到远端。

版本 0.5.3-local.2 -> 0.5.3-local.3

验证:build 通过;client-factory-gate 10/10;7 个兼容回归 105/105;
配置解析链在本机实测命中 <DSH_HOME>/03_local/local.json -> 云状态 git 仓路径
2026-11-18 14:32:15 +08:00
qiudl 10c55139b3 Merge pull request 'feat(ui): 收起态 rail 限制图标数量,其余进「⋯」菜单 (REQ-20261117-0013)' (#2) from feat/REQ-20261117-0013-rail-overflow into main 2026-11-18 10:20:00 +08:00
super-agent e94386a8c7 feat(ui): 收起态 rail 限制图标数量,其余进「⋯」菜单 (REQ-20261117-0013)
收起态 rail 原先把控制室、所有项目、所有快捷方式、所有布局四类全平铺,
且 railBox 是 flex-wrap 无上限、无滚动 —— 项目一多就把侧栏堆成一长列图标。

- railItems 只平铺前 RAIL_MAX(8) 个,其余进「⋯」溢出菜单
- 溢出菜单贴右侧浮层,可滚动(max-height 60vh/420px),点条目后自动收起
- 控制室始终在第一位(唯一固定入口),被挤出者按原顺序进菜单
- .dsh-wt_rail 补 position:relative 作为浮层定位基准
- locales 新增 rail.more(zh/en)
- 版本 0.5.3-local.1 -> 0.5.3-local.2

验证:build 通过;client-factory-gate 10/10;7 个兼容回归 105/105;
release-prep 全过(含真实 Chromium split margin 5 场景、sidebar popup、
split anchor dom 14 场景、独立安装 import 断言)
2026-11-18 10:19:29 +08:00
9 changed files with 195 additions and 16 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "dsh-worktable", "name": "dsh-worktable",
"description": "工作台:DSH 侧边栏的 agent 级项目容器,收纳如 TravelAtlas 等自装项目", "description": "工作台:DSH 侧边栏的 agent 级项目容器,收纳如 TravelAtlas 等自装项目",
"version": "0.5.3-local.1", "version": "0.5.3-local.3",
"entry": { "entry": {
"name": "dsh-worktable", "name": "dsh-worktable",
"inject": [] "inject": []
+52 -4
View File
@@ -7761,11 +7761,20 @@ var css = xterm_default + "\n" + [
// 区块整体 // 区块整体
".dsh-wt_section{box-sizing:border-box;display:flex;flex-direction:column;gap:6px;width:100%;padding:0}", ".dsh-wt_section{box-sizing:border-box;display:flex;flex-direction:column;gap:6px;width:100%;padding:0}",
".dsh-wt_float{min-width:176px;max-width:264px;background:var(--dsw-alias-bg-base,#0b0e14);border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:10px;padding:8px;box-shadow:var(--dsw-shadow-lv2,0 8px 24px rgba(0,0,0,.4))}", ".dsh-wt_float{min-width:176px;max-width:264px;background:var(--dsw-alias-bg-base,#0b0e14);border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:10px;padding:8px;box-shadow:var(--dsw-shadow-lv2,0 8px 24px rgba(0,0,0,.4))}",
".dsh-wt_rail{pointer-events:none}", ".dsh-wt_rail{pointer-events:none;position:relative}",
".dsh-wt_railBox{display:flex;flex-wrap:wrap;gap:5px;justify-content:center;padding:5px 3px;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:8px;background:var(--dsw-alias-bg-base,#0b0e14)}", ".dsh-wt_railBox{display:flex;flex-wrap:wrap;gap:5px;justify-content:center;padding:5px 3px;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:8px;background:var(--dsw-alias-bg-base,#0b0e14)}",
".dsh-wt_railBtn{flex:none;width:22px;height:22px;padding:0;display:flex;align-items:center;justify-content:center;border:1px solid var(--dsw-alias-border-l1,#262b36);border-radius:7px;background:var(--dsw-alias-fill-l1,rgba(255,255,255,.03));color:var(--dsw-alias-label-secondary,#9aa4b2);font:inherit;font-size:13px;line-height:1;cursor:pointer;pointer-events:auto}", ".dsh-wt_railBtn{flex:none;width:22px;height:22px;padding:0;display:flex;align-items:center;justify-content:center;border:1px solid var(--dsw-alias-border-l1,#262b36);border-radius:7px;background:var(--dsw-alias-fill-l1,rgba(255,255,255,.03));color:var(--dsw-alias-label-secondary,#9aa4b2);font:inherit;font-size:13px;line-height:1;cursor:pointer;pointer-events:auto}",
".dsh-wt_railBtn:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.08));border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);color:var(--dsw-alias-label-primary,#e6e8eb)}", ".dsh-wt_railBtn:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.08));border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);color:var(--dsw-alias-label-primary,#e6e8eb)}",
".dsh-wt_railIcon{font-size:17px;line-height:22px}", ".dsh-wt_railIcon{font-size:17px;line-height:22px}",
// REQ-20261117-0013:rail 溢出菜单。「⋯」按钮与普通 rail 按钮同尺寸,
// 展开后是一个贴右侧的浮层列表(项目多时不再把 rail 堆成一长列)。
".dsh-wt_railMore{font-size:15px;letter-spacing:1px;color:var(--dsw-alias-label-tertiary,#6e7683)}",
".dsh-wt_railMoreOn{background:var(--dsw-alias-fill-l2,rgba(255,255,255,.09));border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);color:var(--dsw-alias-label-primary,#e6e8eb)}",
".dsh-wt_railMenu{position:absolute;top:100%;left:calc(100% + 6px);z-index:30;display:flex;flex-direction:column;gap:1px;min-width:168px;max-width:260px;max-height:min(60vh,420px);overflow-y:auto;padding:5px;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:8px;background:var(--dsw-alias-bg-base,#0b0e14);box-shadow:var(--dsw-shadow-lv2,0 8px 24px rgba(0,0,0,.4))}",
".dsh-wt_railMenuItem{display:flex;align-items:center;gap:7px;padding:5px 8px;border:none;border-radius:5px;background:transparent;color:var(--dsw-alias-label-primary,#e6e8eb);font:inherit;font-size:12px;line-height:16px;cursor:pointer;text-align:left;pointer-events:auto}",
".dsh-wt_railMenuItem:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.06))}",
".dsh-wt_railMenuIcon{flex:none;width:18px;text-align:center;font-size:13px}",
".dsh-wt_railMenuName{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
// 分隔线 // 分隔线
".dsh-wt_divider{flex:none;height:1px;background:var(--dsw-alias-border-l1,#262b36);margin:2px 0}", ".dsh-wt_divider{flex:none;height:1px;background:var(--dsw-alias-border-l1,#262b36);margin:2px 0}",
// 头部 // 头部
@@ -8410,6 +8419,7 @@ var css = xterm_default + "\n" + [
var zh = { var zh = {
"title": "\u5DE5\u4F5C\u53F0", "title": "\u5DE5\u4F5C\u53F0",
"rail.title": "\u5DE5\u4F5C\u53F0\uFF08\u5C55\u5F00\u4FA7\u8FB9\u680F\u67E5\u770B\uFF09", "rail.title": "\u5DE5\u4F5C\u53F0\uFF08\u5C55\u5F00\u4FA7\u8FB9\u680F\u67E5\u770B\uFF09",
"rail.more": "\u66F4\u591A",
"handle.title": "\u6309\u4F4F\u62D6\u52A8\u4F4D\u7F6E \xB7 \u53CC\u51FB\u590D\u4F4D", "handle.title": "\u6309\u4F4F\u62D6\u52A8\u4F4D\u7F6E \xB7 \u53CC\u51FB\u590D\u4F4D",
"handle.aria": "\u62D6\u52A8\u5DE5\u4F5C\u53F0\u4F4D\u7F6E", "handle.aria": "\u62D6\u52A8\u5DE5\u4F5C\u53F0\u4F4D\u7F6E",
"menu.search": "\u641C\u7D22\u9879\u76EE", "menu.search": "\u641C\u7D22\u9879\u76EE",
@@ -8643,6 +8653,7 @@ var zh = {
var en = { var en = {
"title": "Worktable", "title": "Worktable",
"rail.title": "Worktable (expand sidebar to view)", "rail.title": "Worktable (expand sidebar to view)",
"rail.more": "More",
"handle.title": "Drag to move \xB7 double-click to reset", "handle.title": "Drag to move \xB7 double-click to reset",
"handle.aria": "Drag worktable position", "handle.aria": "Drag worktable position",
"menu.search": "Search projects", "menu.search": "Search projects",
@@ -9164,7 +9175,7 @@ var CHANGELOG_V030 = `\u66F4\u65B0\u516C\u544A \xB7 v0.5.1
\u30103.1 \u6587\u5B57\u4E0E\u7EC6\u8282\u6253\u78E8\u3011\u5168\u5C40\u5B57\u4F53\u4E0E\u5B57\u53F7\u7EDF\u4E00\u4F18\u5316\u3001\u4E0B\u62C9\u9762\u677F\u73BB\u7483\u5316\u4E0E\u5BF9\u9F50\u3001\u83DC\u5355\u70B9\u9009\u540E\u4FDD\u6301\u6253\u5F00\u4FBF\u4E8E\u8FDE\u7EED\u9884\u89C8\u3001\u6309\u94AE\u63CF\u8FB9\u4E0E\u60AC\u505C\u53CD\u9988\u7B49\u4EA4\u4E92\u7EC6\u8282\uFF1B\u540C\u65F6\u4FEE\u590D\u4E86\u591A\u9879\u4F53\u9A8C\u95EE\u9898\uFF08\u7167\u7247\u4E0A\u4F20\u6E05\u6670\u5EA6\u3001\u80CC\u666F\u7F51\u683C\u7EBF\u5728\u7167\u7247\u6A21\u5F0F\u4E0B\u4E0D\u751F\u6548\u3001\u6D45\u8272\u4E3B\u9898\u4E0B\u5DE5\u4F5C\u72B6\u6001\u5149\u6548\u4E0D\u53EF\u89C1\u7B49\uFF09\u3002`; \u30103.1 \u6587\u5B57\u4E0E\u7EC6\u8282\u6253\u78E8\u3011\u5168\u5C40\u5B57\u4F53\u4E0E\u5B57\u53F7\u7EDF\u4E00\u4F18\u5316\u3001\u4E0B\u62C9\u9762\u677F\u73BB\u7483\u5316\u4E0E\u5BF9\u9F50\u3001\u83DC\u5355\u70B9\u9009\u540E\u4FDD\u6301\u6253\u5F00\u4FBF\u4E8E\u8FDE\u7EED\u9884\u89C8\u3001\u6309\u94AE\u63CF\u8FB9\u4E0E\u60AC\u505C\u53CD\u9988\u7B49\u4EA4\u4E92\u7EC6\u8282\uFF1B\u540C\u65F6\u4FEE\u590D\u4E86\u591A\u9879\u4F53\u9A8C\u95EE\u9898\uFF08\u7167\u7247\u4E0A\u4F20\u6E05\u6670\u5EA6\u3001\u80CC\u666F\u7F51\u683C\u7EBF\u5728\u7167\u7247\u6A21\u5F0F\u4E0B\u4E0D\u751F\u6548\u3001\u6D45\u8272\u4E3B\u9898\u4E0B\u5DE5\u4F5C\u72B6\u6001\u5149\u6548\u4E0D\u53EF\u89C1\u7B49\uFF09\u3002`;
// src/client/updateCheck.ts // src/client/updateCheck.ts
var LOCAL_VERSION = false ? "dev" : "0.5.3-local.1"; var LOCAL_VERSION = false ? "dev" : "0.5.3-local.3";
var UPDATE_REPO = "Aisland-SJL/dsh-worktable"; var UPDATE_REPO = "Aisland-SJL/dsh-worktable";
var K_UPDATE_CHECK = "dsh.worktable.updateCheck.v1"; var K_UPDATE_CHECK = "dsh.worktable.updateCheck.v1";
var K_LAST_CHECK = "dsh.worktable.lastUpdateCheck.v1"; var K_LAST_CHECK = "dsh.worktable.lastUpdateCheck.v1";
@@ -21728,6 +21739,7 @@ function WorktableSection(props) {
const [registeredIds, setRegisteredIds] = (0, import_react3.useState)(() => [...registryStore.ids]); const [registeredIds, setRegisteredIds] = (0, import_react3.useState)(() => [...registryStore.ids]);
const [addOpen, setAddOpen] = (0, import_react3.useState)(false); const [addOpen, setAddOpen] = (0, import_react3.useState)(false);
const [viewOptionsOpen, setViewOptionsOpen] = (0, import_react3.useState)(false); const [viewOptionsOpen, setViewOptionsOpen] = (0, import_react3.useState)(false);
const [railMoreOpen, setRailMoreOpen] = (0, import_react3.useState)(false);
const [rawUpdateInfo, setUpdateInfo] = (0, import_react3.useState)(null); const [rawUpdateInfo, setUpdateInfo] = (0, import_react3.useState)(null);
const updateInfo = newerUpdateInfo(rawUpdateInfo); const updateInfo = newerUpdateInfo(rawUpdateInfo);
const [updateCheckOn, setUpdateCheckOn] = (0, import_react3.useState)(() => localStorage.getItem("dsh.worktable.updateCheck.v1") !== "0"); const [updateCheckOn, setUpdateCheckOn] = (0, import_react3.useState)(() => localStorage.getItem("dsh.worktable.updateCheck.v1") !== "0");
@@ -22146,7 +22158,8 @@ function WorktableSection(props) {
return; return;
} }
const host = res.state; const host = res.state;
const hostAt = typeof host?.updatedAt === "number" ? host.updatedAt : 0; const rawAt = host?.updatedAt;
const hostAt = typeof rawAt === "number" ? rawAt : typeof rawAt === "string" ? Number.isFinite(Date.parse(rawAt)) ? Date.parse(rawAt) : 0 : 0;
if (host && hostAt > localAt) { if (host && hostAt > localAt) {
if (host.projects) persistProjects(normalizeProjects(host.projects)); if (host.projects) persistProjects(normalizeProjects(host.projects));
if (host.view) persistView(normalizeView(host.view)); if (host.view) persistView(normalizeView(host.view));
@@ -23784,11 +23797,46 @@ function WorktableSection(props) {
onClick: () => openSplit(l) onClick: () => openSplit(l)
})) }))
]; ];
const RAIL_MAX = 8;
const railShown = railItems.slice(0, RAIL_MAX);
const railOverflow = railItems.slice(RAIL_MAX);
const railStyle = isFloat && railRect ? { position: "fixed", top: float.top, left: railRect.left, width: railRect.width, zIndex: 70 } : bottomInset > 0 ? { marginBottom: bottomInset } : void 0; const railStyle = isFloat && railRect ? { position: "fixed", top: float.top, left: railRect.left, width: railRect.width, zIndex: 70 } : bottomInset > 0 ? { marginBottom: bottomInset } : void 0;
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: rootRef, className: "dsh-wt_section dsh-wt_rail", style: railStyle, children: [ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: rootRef, className: "dsh-wt_section dsh-wt_rail", style: railStyle, children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_divider" }), /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_divider" }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_railBox", children: railItems.length > 0 ? railItems.map((it, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dsh-wt_railBtn", title: it.name, "aria-label": it.name, onClick: it.onClick, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": true, children: it.icon }) }, i)) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_railIcon", children: "\u2261" }) }) /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dsh-wt_railBox", children: [
railItems.length > 0 ? railShown.map((it, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dsh-wt_railBtn", title: it.name, "aria-label": it.name, onClick: it.onClick, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": true, children: it.icon }) }, i)) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_railIcon", children: "\u2261" }),
railOverflow.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"button",
{
type: "button",
className: "dsh-wt_railBtn dsh-wt_railMore" + (railMoreOpen ? " dsh-wt_railMoreOn" : ""),
title: t("rail.more") + "\uFF08" + railOverflow.length + "\uFF09",
"aria-label": t("rail.more"),
"aria-expanded": railMoreOpen,
onClick: () => setRailMoreOpen((v) => !v),
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": true, children: "\u22EF" })
}
)
] }),
railMoreOpen && railOverflow.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_railMenu", role: "menu", children: railOverflow.map((it, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
"button",
{
type: "button",
role: "menuitem",
className: "dsh-wt_railMenuItem",
title: it.name,
onClick: (e) => {
setRailMoreOpen(false);
it.onClick(e);
},
children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_railMenuIcon", "aria-hidden": true, children: it.icon }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_railMenuName", children: it.name })
]
},
i
)) })
] }), ] }),
popupLayer popupLayer
] }); ] });
+34 -3
View File
@@ -225,7 +225,7 @@ function resolveDshHomeSafe() {
cachedDshHome = baseDshHome(); cachedDshHome = baseDshHome();
return cachedDshHome; return cachedDshHome;
} }
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.1"; var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.3";
var name = "dsh-worktable"; var name = "dsh-worktable";
var inject = ["webServer", "sessions"]; var inject = ["webServer", "sessions"];
var HEALTH_PATH = "/api/worktable/health"; var HEALTH_PATH = "/api/worktable/health";
@@ -843,12 +843,43 @@ function apply(ctx) {
} }
} }
}); });
const statePath = () => pathResolve(resolveDshHomeSafe(), "worktable-state.json"); const localConfigPaths = (fileName) => {
const out = [];
const envDir = process.env.DSH_WORKTABLE_LOCAL_DIR;
if (typeof envDir === "string" && envDir.trim()) out.push(pathResolve(envDir.trim(), fileName));
try {
const libDir = dirname(fileURLToPath(import.meta.url));
out.push(pathResolve(libDir, "..", "03_local", fileName));
out.push(pathResolve(libDir, "..", "..", "03_local", fileName));
out.push(pathResolve(libDir, "..", "..", "..", "03_local", fileName));
} catch {
}
try {
const home = resolveDshHomeSafe();
if (typeof home === "string" && home) out.push(pathResolve(home, "03_local", fileName));
} catch {
}
return out;
};
const readLocalConfigField = async (fileName, field) => {
for (const file of localConfigPaths(fileName)) {
try {
const raw = await readFile(file, "utf8");
const parsed = JSON.parse(raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw);
const value = parsed && typeof parsed === "object" ? parsed[field] : void 0;
const text = typeof value === "string" ? value.trim() : "";
if (text) return text;
} catch {
}
}
return null;
};
const statePath = async () => await readLocalConfigField("local.json", "cloudStatePath") ?? pathResolve(resolveDshHomeSafe(), "worktable-state.json");
register({ register({
kind: "exact", kind: "exact",
path: "/api/worktable/state", path: "/api/worktable/state",
handler: async (req, res) => { handler: async (req, res) => {
const file = statePath(); const file = await statePath();
if (req.method === "GET" || req.method === "HEAD") { if (req.method === "GET" || req.method === "HEAD") {
try { try {
const raw = await readFile(file, "utf8"); const raw = await readFile(file, "utf8");
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "dsh-worktable", "name": "dsh-worktable",
"description": "工作台 Worktable:DeepSeek Harness 侧边栏的 agent 级项目容器(应用抽屉)", "description": "工作台 Worktable:DeepSeek Harness 侧边栏的 agent 级项目容器(应用抽屉)",
"version": "0.5.3-local.1", "version": "0.5.3-local.3",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/Aisland-SJL/dsh-worktable.git", "url": "https://github.com/Aisland-SJL/dsh-worktable.git",
+45 -2
View File
@@ -1064,6 +1064,9 @@ function WorktableSection(props: any) {
const [registeredIds, setRegisteredIds] = useState<string[]>(() => [...registryStore.ids]) const [registeredIds, setRegisteredIds] = useState<string[]>(() => [...registryStore.ids])
const [addOpen, setAddOpen] = useState(false) const [addOpen, setAddOpen] = useState(false)
const [viewOptionsOpen, setViewOptionsOpen] = useState(false) const [viewOptionsOpen, setViewOptionsOpen] = useState(false)
// REQ-20261117-0013:收起态 rail 的「更多」菜单。rail 原先把控制室/项目/快捷方式/布局
// 四类全平铺且无数量上限,项目一多就堆满一列;改为只显示前 RAIL_MAX 个,其余进菜单。
const [railMoreOpen, setRailMoreOpen] = useState(false)
// 更新检查:徽标 / 更新卡 / 版本行共用;节流一天一次,忽略按版本号存 localStorage // 更新检查:徽标 / 更新卡 / 版本行共用;节流一天一次,忽略按版本号存 localStorage
const [rawUpdateInfo, setUpdateInfo] = useState<UpdateInfo | null>(null) const [rawUpdateInfo, setUpdateInfo] = useState<UpdateInfo | null>(null)
const updateInfo = newerUpdateInfo(rawUpdateInfo) const updateInfo = newerUpdateInfo(rawUpdateInfo)
@@ -1444,7 +1447,13 @@ function WorktableSection(props: any) {
return return
} }
const host = res.state const host = res.state
const hostAt = typeof host?.updatedAt === 'number' ? host.updatedAt : 0 // REQ-20261117-0013:兼容旧云状态文件的 updatedAt 形态。
// 旧线(qiudl 0.4.x 云状态)写的是 ISO 字符串(如 "2026-11-18T03:50:24.470Z"),
// 本线写毫秒数字。两种都认,否则把状态文件指到那个 git 仓后会永远判「宿主不比本地新」而不回填。
const rawAt: unknown = host?.updatedAt
const hostAt = typeof rawAt === 'number'
? rawAt
: typeof rawAt === 'string' ? (Number.isFinite(Date.parse(rawAt)) ? Date.parse(rawAt) : 0) : 0
if (host && hostAt > localAt) { if (host && hostAt > localAt) {
if (host.projects) persistProjects(normalizeProjects(host.projects)) if (host.projects) persistProjects(normalizeProjects(host.projects))
if (host.view) persistView(normalizeView(host.view)) if (host.view) persistView(normalizeView(host.view))
@@ -3016,6 +3025,11 @@ function buildCustomLayoutPrompt(req: string): string {
onClick: () => openSplit(l), onClick: () => openSplit(l),
})), })),
] ]
// REQ-20261117-0013:收起态 rail 只平铺前 RAIL_MAX 个,其余进「⋯」菜单。
// 控制室永远保留在第一位(它是唯一的固定入口),被挤出去的按原顺序进菜单。
const RAIL_MAX = 8
const railShown = railItems.slice(0, RAIL_MAX)
const railOverflow = railItems.slice(RAIL_MAX)
// 浮动态:fixed 定位到拖前高度(左/宽取折叠列实测几何);停靠态:文档流原位 // 浮动态:fixed 定位到拖前高度(左/宽取折叠列实测几何);停靠态:文档流原位
const railStyle = isFloat && railRect const railStyle = isFloat && railRect
? { position: 'fixed' as const, top: float.top, left: railRect.left, width: railRect.width, zIndex: 70 } ? { position: 'fixed' as const, top: float.top, left: railRect.left, width: railRect.width, zIndex: 70 }
@@ -3026,13 +3040,42 @@ function buildCustomLayoutPrompt(req: string): string {
<div className="dsh-wt_divider" /> <div className="dsh-wt_divider" />
<div className="dsh-wt_railBox"> <div className="dsh-wt_railBox">
{railItems.length > 0 {railItems.length > 0
? railItems.map((it, i) => ( ? railShown.map((it, i) => (
<button key={i} type="button" className="dsh-wt_railBtn" title={it.name} aria-label={it.name} onClick={it.onClick}> <button key={i} type="button" className="dsh-wt_railBtn" title={it.name} aria-label={it.name} onClick={it.onClick}>
<span aria-hidden>{it.icon}</span> <span aria-hidden>{it.icon}</span>
</button> </button>
)) ))
: <span className="dsh-wt_railIcon">≡</span>} : <span className="dsh-wt_railIcon">≡</span>}
{railOverflow.length > 0 && (
<button
type="button"
className={'dsh-wt_railBtn dsh-wt_railMore' + (railMoreOpen ? ' dsh-wt_railMoreOn' : '')}
title={t('rail.more') + '(' + railOverflow.length + ')'}
aria-label={t('rail.more')}
aria-expanded={railMoreOpen}
onClick={() => setRailMoreOpen((v) => !v)}
>
<span aria-hidden>⋯</span>
</button>
)}
</div> </div>
{railMoreOpen && railOverflow.length > 0 && (
<div className="dsh-wt_railMenu" role="menu">
{railOverflow.map((it, i) => (
<button
key={i}
type="button"
role="menuitem"
className="dsh-wt_railMenuItem"
title={it.name}
onClick={(e) => { setRailMoreOpen(false); it.onClick(e) }}
>
<span className="dsh-wt_railMenuIcon" aria-hidden>{it.icon}</span>
<span className="dsh-wt_railMenuName">{it.name}</span>
</button>
))}
</div>
)}
</div> </div>
{popupLayer} {popupLayer}
</> </>
+2
View File
@@ -8,6 +8,7 @@
export const zh = { export const zh = {
'title': '工作台', 'title': '工作台',
'rail.title': '工作台(展开侧边栏查看)', 'rail.title': '工作台(展开侧边栏查看)',
'rail.more': '更多',
'handle.title': '按住拖动位置 · 双击复位', 'handle.title': '按住拖动位置 · 双击复位',
'handle.aria': '拖动工作台位置', 'handle.aria': '拖动工作台位置',
'menu.search': '搜索项目', 'menu.search': '搜索项目',
@@ -246,6 +247,7 @@ export type WorktableKey = keyof typeof zh
export const en = { export const en = {
'title': 'Worktable', 'title': 'Worktable',
'rail.title': 'Worktable (expand sidebar to view)', 'rail.title': 'Worktable (expand sidebar to view)',
'rail.more': 'More',
'handle.title': 'Drag to move · double-click to reset', 'handle.title': 'Drag to move · double-click to reset',
'handle.aria': 'Drag worktable position', 'handle.aria': 'Drag worktable position',
'menu.search': 'Search projects', 'menu.search': 'Search projects',
+10 -1
View File
@@ -7,11 +7,20 @@ export const css = xtermCss + '\n' + [
// 区块整体 // 区块整体
'.dsh-wt_section{box-sizing:border-box;display:flex;flex-direction:column;gap:6px;width:100%;padding:0}', '.dsh-wt_section{box-sizing:border-box;display:flex;flex-direction:column;gap:6px;width:100%;padding:0}',
'.dsh-wt_float{min-width:176px;max-width:264px;background:var(--dsw-alias-bg-base,#0b0e14);border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:10px;padding:8px;box-shadow:var(--dsw-shadow-lv2,0 8px 24px rgba(0,0,0,.4))}', '.dsh-wt_float{min-width:176px;max-width:264px;background:var(--dsw-alias-bg-base,#0b0e14);border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:10px;padding:8px;box-shadow:var(--dsw-shadow-lv2,0 8px 24px rgba(0,0,0,.4))}',
'.dsh-wt_rail{pointer-events:none}', '.dsh-wt_rail{pointer-events:none;position:relative}',
'.dsh-wt_railBox{display:flex;flex-wrap:wrap;gap:5px;justify-content:center;padding:5px 3px;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:8px;background:var(--dsw-alias-bg-base,#0b0e14)}', '.dsh-wt_railBox{display:flex;flex-wrap:wrap;gap:5px;justify-content:center;padding:5px 3px;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:8px;background:var(--dsw-alias-bg-base,#0b0e14)}',
'.dsh-wt_railBtn{flex:none;width:22px;height:22px;padding:0;display:flex;align-items:center;justify-content:center;border:1px solid var(--dsw-alias-border-l1,#262b36);border-radius:7px;background:var(--dsw-alias-fill-l1,rgba(255,255,255,.03));color:var(--dsw-alias-label-secondary,#9aa4b2);font:inherit;font-size:13px;line-height:1;cursor:pointer;pointer-events:auto}', '.dsh-wt_railBtn{flex:none;width:22px;height:22px;padding:0;display:flex;align-items:center;justify-content:center;border:1px solid var(--dsw-alias-border-l1,#262b36);border-radius:7px;background:var(--dsw-alias-fill-l1,rgba(255,255,255,.03));color:var(--dsw-alias-label-secondary,#9aa4b2);font:inherit;font-size:13px;line-height:1;cursor:pointer;pointer-events:auto}',
'.dsh-wt_railBtn:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.08));border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);color:var(--dsw-alias-label-primary,#e6e8eb)}', '.dsh-wt_railBtn:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.08));border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);color:var(--dsw-alias-label-primary,#e6e8eb)}',
'.dsh-wt_railIcon{font-size:17px;line-height:22px}', '.dsh-wt_railIcon{font-size:17px;line-height:22px}',
// REQ-20261117-0013:rail 溢出菜单。「⋯」按钮与普通 rail 按钮同尺寸,
// 展开后是一个贴右侧的浮层列表(项目多时不再把 rail 堆成一长列)。
'.dsh-wt_railMore{font-size:15px;letter-spacing:1px;color:var(--dsw-alias-label-tertiary,#6e7683)}',
'.dsh-wt_railMoreOn{background:var(--dsw-alias-fill-l2,rgba(255,255,255,.09));border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);color:var(--dsw-alias-label-primary,#e6e8eb)}',
'.dsh-wt_railMenu{position:absolute;top:100%;left:calc(100% + 6px);z-index:30;display:flex;flex-direction:column;gap:1px;min-width:168px;max-width:260px;max-height:min(60vh,420px);overflow-y:auto;padding:5px;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-radius:8px;background:var(--dsw-alias-bg-base,#0b0e14);box-shadow:var(--dsw-shadow-lv2,0 8px 24px rgba(0,0,0,.4))}',
'.dsh-wt_railMenuItem{display:flex;align-items:center;gap:7px;padding:5px 8px;border:none;border-radius:5px;background:transparent;color:var(--dsw-alias-label-primary,#e6e8eb);font:inherit;font-size:12px;line-height:16px;cursor:pointer;text-align:left;pointer-events:auto}',
'.dsh-wt_railMenuItem:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.06))}',
'.dsh-wt_railMenuIcon{flex:none;width:18px;text-align:center;font-size:13px}',
'.dsh-wt_railMenuName{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
// 分隔线 // 分隔线
'.dsh-wt_divider{flex:none;height:1px;background:var(--dsw-alias-border-l1,#262b36);margin:2px 0}', '.dsh-wt_divider{flex:none;height:1px;background:var(--dsw-alias-border-l1,#262b36);margin:2px 0}',
// 头部 // 头部
+47 -3
View File
@@ -558,19 +558,63 @@ export function apply(ctx: Context) {
}, },
}) })
/**
* 本机配置候选路径(REQ-20261117-0013:把 qiudl 分支的云状态能力并入本线)。
*
* 查找顺序:环境变量 DSH_WORKTABLE_LOCAL_DIR → <插件根>/03_local → 上两层/上三层 03_local
* → <DSH_HOME>/03_local。个人绝对路径只存在于这些配置文件里,源码与打包产物零出现。
*/
const localConfigPaths = (fileName: string): string[] => {
const out: string[] = []
const envDir = process.env.DSH_WORKTABLE_LOCAL_DIR
if (typeof envDir === 'string' && envDir.trim()) out.push(pathResolve(envDir.trim(), fileName))
try {
const libDir = dirname(fileURLToPath(import.meta.url))
out.push(pathResolve(libDir, '..', '03_local', fileName))
out.push(pathResolve(libDir, '..', '..', '03_local', fileName))
out.push(pathResolve(libDir, '..', '..', '..', '03_local', fileName))
} catch { /* 解析不到就去试 DSH_HOME 兜底 */ }
try {
const home = resolveDshHomeSafe()
if (typeof home === 'string' && home) out.push(pathResolve(home, '03_local', fileName))
} catch { /* DSH_HOME 解析失败就只保留相对链候选 */ }
return out
}
/** 按候选路径读本机配置的一个字符串字段;文件缺失 / 坏 JSON / 字段空 → 试下一个,全落空为 null。 */
const readLocalConfigField = async (fileName: string, field: string): Promise<string | null> => {
for (const file of localConfigPaths(fileName)) {
try {
const raw = await readFile(file, 'utf8')
const parsed = JSON.parse(raw.charCodeAt(0) === 0xFEFF ? raw.slice(1) : raw)
const value = parsed && typeof parsed === 'object' ? (parsed as Record<string, unknown>)[field] : undefined
const text = typeof value === 'string' ? value.trim() : ''
if (text) return text
} catch { /* 继续下一个候选 */ }
}
return null
}
/** /**
* 工作台状态宿主侧镜像(本地补丁)。 * 工作台状态宿主侧镜像(本地补丁)。
* *
* 桌面端宿主以 `--port 0` 启动,端口每次随机,页面来源跟着变;而 localStorage 按来源隔离, * 桌面端宿主以 `--port 0` 启动,端口每次随机,页面来源跟着变;而 localStorage 按来源隔离,
* 于是「新建的项目重启就没了」。这里把项目/视图这份 JSON 落到 DSH_HOME 下的固定文件: * 于是「新建的项目重启就没了」。这里把项目/视图这份 JSON 落到一个固定文件:
* 跨重启、跨端口稳定。客户端启动时比对时间戳决定是否回填(见 client/hostState.ts)。 * 跨重启、跨端口稳定。客户端启动时比对时间戳决定是否回填(见 client/hostState.ts)。
*
* REQ-20261117-0013:路径优先取本机配置 03_local/local.json 的 cloudStatePath
* —— 该文件指向一个独立 git 仓(由外部定时 commit+push),于是「云状态 + git 历史」
* 这份能力随本线一起保留:换机器、清缓存、跨重启都能恢复,且每次写入进版本历史。
* 未配置时回落到 DSH_HOME 下的 worktable-state.json(与旧行为一致)。
*/ */
const statePath = () => pathResolve(resolveDshHomeSafe(), 'worktable-state.json') const statePath = async (): Promise<string> =>
(await readLocalConfigField('local.json', 'cloudStatePath'))
?? pathResolve(resolveDshHomeSafe(), 'worktable-state.json')
register({ register({
kind: 'exact', kind: 'exact',
path: '/api/worktable/state', path: '/api/worktable/state',
handler: async (req: any, res: any) => { handler: async (req: any, res: any) => {
const file = statePath() const file = await statePath()
if (req.method === 'GET' || req.method === 'HEAD') { if (req.method === 'GET' || req.method === 'HEAD') {
try { try {
const raw = await readFile(file, 'utf8') const raw = await readFile(file, 'utf8')
+3 -1
View File
@@ -1,6 +1,6 @@
# 本地补丁:工作台状态镜像到宿主侧 # 本地补丁:工作台状态镜像到宿主侧
基于上游 `Aisland-SJL/dsh-worktable` **v0.5.1**,本地版本号 `0.5.3-local.1`。 基于上游 `Aisland-SJL/dsh-worktable` **v0.5.1**,本地版本号 `0.5.3-local.3`。
## 为什么打这个补丁 ## 为什么打这个补丁
@@ -86,3 +86,5 @@ dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/r
| 0.5.2-local.2 | 兼容声明加入 DSH 0.2.2-alpha.2(宿主升级后安装被拒) | | 0.5.2-local.2 | 兼容声明加入 DSH 0.2.2-alpha.2(宿主升级后安装被拒) |
| 0.5.2-local.6 | 修数据安全:写入按 key 合并 + 读不到不写,修复空状态覆盖镜像 | | 0.5.2-local.6 | 修数据安全:写入按 key 合并 + 读不到不写,修复空状态覆盖镜像 |
| 0.5.3-local.1 | REQ-20261117-0013:单标签窗格隐藏标签栏(原只对控制室生效),关闭入口移到窗格标题条,标题改显示当前标签名 | | 0.5.3-local.1 | REQ-20261117-0013:单标签窗格隐藏标签栏(原只对控制室生效),关闭入口移到窗格标题条,标题改显示当前标签名 |
| 0.5.3-local.2 | REQ-20261117-0013:收起态 rail 限制 8 个图标,其余进「⋯」菜单(原先四类全平铺无上限) |
| 0.5.3-local.3 | REQ-20261117-0013:状态文件路径改为优先取本机 `03_local/local.json` 的 `cloudStatePath`(指向独立 git 仓),恢复「云状态 + git 历史」;客户端兼容旧 ISO 串形态的 updatedAt |