diff --git a/00_index/README.md b/00_index/README.md index 0eeea5f..0c3adb1 100644 --- a/00_index/README.md +++ b/00_index/README.md @@ -2,6 +2,7 @@ - [README](../README.md) — 项目概述与目录结构 - [PRD](../02_process/PRD.md) — 需求与设计(含接手分界线 §11) +- [本地改造记录](../02_process/LOCAL-CHANGES.md) — 相对上游的全部本地定制(改侧栏/状态/二级页面前先读) - [兼容与安全](../docs/compatibility-and-security.md) — 当前 0.5.1 范围、接口与隔离限制 - [AGENTS](../AGENTS.md) — 项目规则 - [01_content](../01_content) — 插件包 diff --git a/01_content/dsh.plugin.json b/01_content/dsh.plugin.json index bc952af..3f383eb 100644 --- a/01_content/dsh.plugin.json +++ b/01_content/dsh.plugin.json @@ -1,7 +1,7 @@ { "name": "dsh-worktable", "description": "工作台:DSH 侧边栏的 agent 级项目容器,收纳如 TravelAtlas 等自装项目", - "version": "0.5.3-local.4", + "version": "0.5.3-local.5", "entry": { "name": "dsh-worktable", "inject": [] diff --git a/01_content/lib/client.js b/01_content/lib/client.js index 3829d77..b7a5cb0 100644 --- a/01_content/lib/client.js +++ b/01_content/lib/client.js @@ -8412,7 +8412,25 @@ var css = xterm_default + "\n" + [ ".dsh-wt_updateSwitch{position:relative;width:26px;height:14px;border-radius:999px;background:var(--dsw-alias-state-accent-primary,#4f8ef7);cursor:pointer}", '.dsh-wt_updateSwitch::after{content:"";position:absolute;top:2px;right:2px;width:10px;height:10px;border-radius:50%;background:#fff;transition:right .15s}', ".dsh-wt_updateSwitch[data-off=true]{background:var(--dsw-alias-border-l1,#333a48)}", - ".dsh-wt_updateSwitch[data-off=true]::after{right:14px}" + ".dsh-wt_updateSwitch[data-off=true]::after{right:14px}", + // 二级页面:缩进 + 左侧引导折线 + ".dsh-wt_layoutSub{margin-left:20px;border-style:dashed;position:relative;height:30px!important}", + ".dsh-wt_layoutSub .dsh-wt_layoutName{font-size:11.5px;color:var(--dsw-alias-label-secondary,#9aa4b2)}", + '.dsh-wt_layoutSub::before{content:"";position:absolute;left:-12px;top:-11px;bottom:50%;width:9px;border-left:1.5px solid var(--dsw-alias-border-l2,#3a4150);border-bottom:1.5px solid var(--dsw-alias-border-l2,#3a4150);border-bottom-left-radius:6px;pointer-events:none}', + // 折叠按钮:固定在最右(› 箭头右侧),无边框无底色;所有项目卡都占这个位置(无子页面的用 ghost 占位) + ".dsh-wt_foldBtn{position:absolute;right:0px;top:50%;transform:translateY(-50%);z-index:3;display:inline-flex;align-items:center;justify-content:center;width:16px;height:18px;border-radius:4px;font-size:11px;line-height:1;cursor:pointer;color:var(--dsw-alias-label-secondary,#9aa4b2)}", + ".dsh-wt_foldBtn:hover{color:var(--dsw-alias-label-primary,#e6e8eb)}", + ".dsh-wt_foldBtnGhost{cursor:default;pointer-events:none}", + ".dsh-wt_layoutHasKids .dsh-wt_layoutArrow{margin-right:0}", + ".dsh-wt_manageRowSub{margin-left:20px}", + // DS Bot 侧栏元素隐藏(迁移自「改 ds-bot/client.js 插 return null」的做法)。 + // 动机:ds-bot 是随应用升级的 .bundled-plugins tgz 安装,升级/重装必丢改; + // 改为由本插件注入 CSS,只要工作台装着,ds-bot 随便升级都不丢。 + // 注意:nav.bt-home-nav 必须带 nav 标签选择器 —— BotHome 错误面板有同名 div,不能误伤。 + '[data-slot="sidebar.footer.action"] .bt-return{display:none!important}', + '[data-testid="duet-transcript-toggle"]{display:none!important}', + "nav.bt-home-nav{display:none!important}", + ".bt-connect-wrap{display:none!important}" ].join("\n"); // src/client/locales.ts @@ -8471,6 +8489,9 @@ var zh = { "manage.deleteLayout": "\u5220\u9664\u5E03\u5C40", "manage.deleteProject": "\u5220\u9664\u9879\u76EE", "manage.changeView": "\u53D8\u66F4\u89C6\u56FE", + "manage.addPage": "\u65B0\u589E\u4E8C\u7EA7\u9875\u9762", + "tree.fold": "\u6298\u53E0\u4E8C\u7EA7\u9875\u9762", + "tree.expand": "\u5C55\u5F00\u4E8C\u7EA7\u9875\u9762", "viewPick.title": "\u9009\u62E9\u65B0\u89C6\u56FE\uFF08\u5185\u5BB9\u7A97\u81EA\u52A8\u8FC1\u5165\uFF09", "confirm.title": "\u5220\u9664\u9879\u76EE", "confirm.cancel": "\u53D6\u6D88", @@ -8705,6 +8726,9 @@ var en = { "manage.deleteLayout": "Delete layout", "manage.deleteProject": "Delete project", "manage.changeView": "Change layout", + "manage.addPage": "Add sub page", + "tree.fold": "Collapse sub pages", + "tree.expand": "Expand sub pages", "viewPick.title": "Pick a new layout (panes migrate automatically)", "confirm.title": "Delete project", "confirm.cancel": "Cancel", @@ -9175,7 +9199,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`; // src/client/updateCheck.ts -var LOCAL_VERSION = false ? "dev" : "0.5.3-local.4"; +var LOCAL_VERSION = false ? "dev" : "0.5.3-local.5"; var UPDATE_REPO = "Aisland-SJL/dsh-worktable"; var K_UPDATE_CHECK = "dsh.worktable.updateCheck.v1"; var K_LAST_CHECK = "dsh.worktable.lastUpdateCheck.v1"; @@ -19460,7 +19484,7 @@ function FileViewer(props) { const ext = (props.path.split(".").pop() || "").toLowerCase(); const fileUrl = "/api/worktable/file?path=" + encodeURIComponent(props.path); if (ext === "pdf") { - return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("iframe", { className: "dsh-wt_paneFrame", src: fileUrl, title: basenameOf2(props.path) }); + return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("iframe", { className: "dsh-wt_paneFrame", src: fileUrl, title: basenameOf2(props.path), allowFullScreen: true }); } if (IMAGE_EXTS.test("." + ext)) { return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-wt_imgView", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { src: fileUrl, alt: basenameOf2(props.path) }) }); @@ -21052,6 +21076,7 @@ function normalizeView(raw) { orderBy, dock: p.dock === "float" ? "float" : "footer", floatTop: typeof p.floatTop === "number" ? p.floatTop : null, + foldedProjects: Array.isArray(p.foldedProjects) ? p.foldedProjects.filter((x) => typeof x === "string") : [], consoleTheme: p.consoleTheme === "dark" || p.consoleTheme === "light" || p.consoleTheme === "system" ? p.consoleTheme : "system", consoleCols: typeof p.consoleCols === "number" && p.consoleCols >= 1 && p.consoleCols <= 5 ? Math.round(p.consoleCols) : 3, consoleShape: p.consoleShape === "circle" ? "circle" : "square", @@ -22938,7 +22963,28 @@ function WorktableSection(props) { }; const removeLayout = (id) => { invalidateWidgetProject(id); - persistProjects((prev) => ({ ...prev, layouts: prev.layouts.filter((l) => l.id !== id) })); + persistProjects((prev) => ({ + ...prev, + layouts: prev.layouts.filter((l) => l.id !== id).map((l) => l.parentId === id ? { ...l, parentId: void 0 } : l) + })); + }; + const addSubPage = (parent) => { + const parentName = projects.nameOverrides[parent.id] ?? parent.title; + const child = buildLayout("2h", parentName + " \xB7 \u65B0\u9875\u9762"); + child.parentId = parent.id; + const folder = projects.folders[parent.id]; + persistProjects((prev) => ({ + ...prev, + layouts: [...prev.layouts, child], + folders: folder ? { ...prev.folders, [child.id]: folder } : prev.folders + })); + invalidatePickState(); + openSplit(child); + reportUsed(child.id); + }; + const toggleFold = (id) => { + const folded = view.foldedProjects ?? []; + persistView({ foldedProjects: folded.includes(id) ? folded.filter((x) => x !== id) : [...folded, id] }); }; const applyLayoutChange = (id, presetId) => { invalidateWidgetProject(id); @@ -23146,6 +23192,28 @@ function WorktableSection(props) { const paneTitles = [...l.top ?? [], ...l.main].map((p) => p.title).join(" "); return (l.title + " " + paneTitles).toLowerCase().includes(queryLower); }); + const layoutTree = (0, import_react3.useMemo)(() => { + const visIds = new Set(visibleLayouts.map((l) => l.id)); + const kids = /* @__PURE__ */ new Map(); + const roots = []; + for (const l of visibleLayouts) { + if (l.parentId && visIds.has(l.parentId)) { + const arr = kids.get(l.parentId) ?? []; + arr.push(l); + kids.set(l.parentId, arr); + } else roots.push(l); + } + const ord = (a, b) => effectiveOrder.indexOf(a.id) - effectiveOrder.indexOf(b.id); + const out = []; + for (const r of [...roots].sort(ord)) { + const cs = (kids.get(r.id) ?? []).sort(ord); + out.push({ node: r, depth: 0, hasKids: cs.length > 0 }); + if (!(view.foldedProjects ?? []).includes(r.id)) { + for (const c of cs) out.push({ node: c, depth: 1, hasKids: false }); + } + } + return out; + }, [visibleLayouts, effectiveOrder, view.foldedProjects]); const isFloat = float != null; const floatStyle = isFloat ? { position: "fixed", @@ -23488,6 +23556,16 @@ function WorktableSection(props) { /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RenameInput, { initial: display, placeholder: t("manage.renamePh"), onCommit: (v) => renameProject(id, v) }), /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dsh-wt_manageBtn", title: isHidden ? t("manage.show") : t("manage.hide"), onClick: () => toggleHidden(id), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(EyeIcon, { closed: isHidden }) }), /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dsh-wt_manageBtn", title: t("manage.changeView"), onClick: () => setViewPickFor(id), children: "\u{1F9E9}" }), + layout && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( + "button", + { + type: "button", + className: "dsh-wt_manageBtn", + title: t("manage.addPage"), + onClick: () => addSubPage(layout), + children: "\uFF0B" + } + ), /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( "button", { @@ -23990,54 +24068,71 @@ function WorktableSection(props) { } ), renderProjectSlot ? renderProjectSlot("sidebar.worktable.project", ownerProps) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_empty", children: t("empty") }), - visibleLayouts.map((l) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)( - "button", - { - type: "button", - className: "dsh-wt_layout", - "data-on": activeSplitId === l.id ? "true" : "false", - style: { order: effectiveOrder.indexOf(l.id) + 1e3, position: "relative" }, - onClick: () => { - openSplit(l); - reportUsed(l.id); + layoutTree.map(({ node: l, depth, hasKids }, ti) => { + const folded = (view.foldedProjects ?? []).includes(l.id); + return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)( + "button", + { + type: "button", + className: "dsh-wt_layout" + (depth === 1 ? " dsh-wt_layoutSub" : "") + (hasKids ? " dsh-wt_layoutHasKids" : ""), + "data-on": activeSplitId === l.id ? "true" : "false", + style: { order: ti + 1e3, position: "relative" }, + onClick: () => { + openSplit(l); + reportUsed(l.id); + }, + children: [ + /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( + "span", + { + className: "dsh-wt_layoutIcon dsh-wt_iconPick", + role: "button", + tabIndex: 0, + title: t("icons.change"), + onClick: (e) => { + e.stopPropagation(); + openIconPick("layout", l.id, e.currentTarget); + }, + children: l.icon ?? "\u{1F9F1}" + } + ), + /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutText", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutName", children: projects.nameOverrides[l.id] ?? l.title }) }), + /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( + "span", + { + className: "dsh-wt_bindBtn", + role: "button", + tabIndex: 0, + "data-bound": bindNotifyMap[l.id] ?? (projects.bindings[l.id] ? "true" : "false"), + "data-tip": projects.bindings[l.id] ? t("bind.tipBound", { name: boundSessionTitle(projects.bindings[l.id]) }) + (bindNotifyMap[l.id] === "busy" ? t("bind.tipBusy") : bindNotifyMap[l.id] === "done" ? t("bind.tipDone") : bindNotifyMap[l.id] === "need" ? t("bind.tipNeed") : "") : t("bind.tipUnbound"), + "aria-label": projects.bindings[l.id] ? t("bind.tipBound", { name: boundSessionTitle(projects.bindings[l.id]) }) : t("bind.tipUnbound"), + onClick: (e) => { + e.stopPropagation(); + openBindPick(l.id, e.currentTarget); + }, + children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_bindCircles", "aria-hidden": true }) + } + ), + hasKids ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( + "span", + { + className: "dsh-wt_foldBtn" + (folded ? " dsh-wt_foldBtnOff" : ""), + role: "button", + tabIndex: 0, + title: folded ? t("tree.expand") : t("tree.fold"), + onClick: (e) => { + e.stopPropagation(); + toggleFold(l.id); + }, + children: folded ? "\u25B8" : "\u25BE" + } + ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_foldBtn dsh-wt_foldBtnGhost", "aria-hidden": true }), + /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutArrow", "aria-hidden": true, children: "\u203A" }) + ] }, - children: [ - /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( - "span", - { - className: "dsh-wt_layoutIcon dsh-wt_iconPick", - role: "button", - tabIndex: 0, - title: t("icons.change"), - onClick: (e) => { - e.stopPropagation(); - openIconPick("layout", l.id, e.currentTarget); - }, - children: l.icon ?? "\u{1F9F1}" - } - ), - /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutText", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutName", children: projects.nameOverrides[l.id] ?? l.title }) }), - /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( - "span", - { - className: "dsh-wt_bindBtn", - role: "button", - tabIndex: 0, - "data-bound": bindNotifyMap[l.id] ?? (projects.bindings[l.id] ? "true" : "false"), - "data-tip": projects.bindings[l.id] ? t("bind.tipBound", { name: boundSessionTitle(projects.bindings[l.id]) }) + (bindNotifyMap[l.id] === "busy" ? t("bind.tipBusy") : bindNotifyMap[l.id] === "done" ? t("bind.tipDone") : bindNotifyMap[l.id] === "need" ? t("bind.tipNeed") : "") : t("bind.tipUnbound"), - "aria-label": projects.bindings[l.id] ? t("bind.tipBound", { name: boundSessionTitle(projects.bindings[l.id]) }) : t("bind.tipUnbound"), - onClick: (e) => { - e.stopPropagation(); - openBindPick(l.id, e.currentTarget); - }, - children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_bindCircles", "aria-hidden": true }) - } - ), - /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutArrow", "aria-hidden": true, children: "\u203A" }) - ] - }, - l.id - )) + l.id + ); + }) ] }), visibleShortcuts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_shortcuts", children: visibleShortcuts.map((s) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)( "a", diff --git a/01_content/lib/index.js b/01_content/lib/index.js index 5e97075..9bd01db 100644 --- a/01_content/lib/index.js +++ b/01_content/lib/index.js @@ -247,112 +247,112 @@ function injectThemeBridge(html, external = false) { } // template/dshell.css -var dshell_default = `/* dsh-worktable \u539F\u751F\u76AE\u80A4 \xB7 DSH \u8BBE\u8BA1\u7CFB\u7EDF\u7EC4\u4EF6\u5E93 - \u7528\u6CD5\uFF1A - \u989C\u8272\u4E00\u5F8B\u8D70 DSH \u4E3B\u9898\u53D8\u91CF\uFF08--dsw-alias-*\uFF09\uFF0C\u81EA\u52A8\u9002\u914D\u660E\u6697\u4E3B\u9898\u3002 - \u4E3B\u9898\u6765\u6E90\u4F18\u5148\u7EA7\uFF1A - 1) \u5DE5\u4F5C\u53F0\u5185\uFF1A\u4E3B\u9898\u6865\uFF08\u7AD9\u70B9\u8DEF\u7531\u81EA\u52A8\u6CE8\u5165\uFF0C\u6216\u663E\u5F0F\u5F15 /api/worktable/template/theme.js\uFF09 - \u628A\u5BBF\u4E3B body \u4E0A\u7684 --dsw-*/--dsh-*/--ds-* \u955C\u50CF\u6210\u9875\u9762\u5185\u8054\u6837\u5F0F \u2192 \u8DDF\u968F DSH \u7684 \u6D45\u8272/\u6DF1\u8272/\u8DDF\u968F\u7CFB\u7EDF\uFF1B - 2) \u72EC\u7ACB\u6253\u5F00\uFF1A\u7528\u4E0B\u9762 :root \u7684\u515C\u5E95\uFF0C\u5E76\u6309\u7CFB\u7EDF\u6DF1\u6D45\u8272\u5207\u6362\u3002 - \u6CE8\u610F\uFF1A\u4E0D\u8981\u5728\u8FD9\u91CC\u5199\u6B7B\u6DF1\u8272\uFF08\u65E7\u7248 :root{color-scheme:dark} \u4F1A\u8BA9\u6240\u6709\u9875\u9762\u9501\u6B7B\u6DF1\u8272\uFF0C - 2026-11 \u4ECE 0.5.x \u7EBF\u6062\u590D\u65F6\u518D\u6B21\u8E29\u5230\uFF0CREQ-20261117-0013 \u4E00\u5E76\u4FEE\u6389\uFF09\u3002 */ -:root { - color-scheme: light dark; - --dsw-alias-bg-base: #ffffff; - --dsw-alias-fill-l1: rgba(16, 24, 40, .03); - --dsw-alias-border-l1: #e4e7ec; - --dsw-alias-border-l2: #d0d5dd; - --dsw-alias-label-primary: #101828; - --dsw-alias-label-secondary: #475467; - --dsw-alias-label-tertiary: #98a2b3; - --dsw-alias-state-accent-primary: #2f6feb; -} -@media (prefers-color-scheme: dark) { - :root { - --dsw-alias-bg-base: #0b0e14; - --dsw-alias-fill-l1: rgba(255, 255, 255, .02); - --dsw-alias-border-l1: #262b36; - --dsw-alias-border-l2: #3a4150; - --dsw-alias-label-primary: #e6e8eb; - --dsw-alias-label-secondary: #9aa4b2; - --dsw-alias-label-tertiary: #6b7280; - --dsw-alias-state-accent-primary: #4f8ef7; - } -} -* { box-sizing: border-box; } -html, body { margin: 0; padding: 0; } -body { - background: var(--dsw-alias-bg-base, #0b0e14); - color: var(--dsw-alias-label-primary, #e6e8eb); - font-family: var(--dsw-font-family, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif); - font-size: 13px; - line-height: 1.6; -} -.dshell { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; min-height: 100%; } -/* \u6587\u5B57\u5C42\u7EA7 */ -.dshell-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--dsw-alias-label-primary, #e6e8eb); } -.dshell-sub { margin: 0; font-size: 12px; color: var(--dsw-alias-label-secondary, #9aa4b2); } -.dshell-muted { color: var(--dsw-alias-label-tertiary, #6b7280); font-size: 11.5px; } -/* \u5361\u7247 */ -.dshell-card { border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 10px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); padding: 12px 14px; } -.dshell-card + .dshell-card { margin-top: 10px; } -/* \u6309\u94AE\uFF08\u7EFF\u8272\u4E3B\u6309\u94AE / \u5E7D\u7075\u6309\u94AE / \u5371\u9669\uFF09 */ -.dshell-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid transparent; background: #3fb950; color: #0b0e14; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; } -.dshell-btn:hover { filter: brightness(1.08); } -.dshell-btnGhost { background: transparent; border-color: var(--dsw-alias-border-l1, #262b36); color: var(--dsw-alias-label-secondary, #9aa4b2); } -.dshell-btnGhost:hover { color: var(--dsw-alias-label-primary, #e6e8eb); border-color: var(--dsw-alias-border-l2, #3a4150); } -.dshell-btnDanger { background: transparent; border-color: #f85149; color: #f85149; } -/* \u72B6\u6001\u5FBD\u6807\uFF08\u5706\u70B9 + \u6587\u5B57\uFF1B\u7EFF=\u5DF2\u5B8C\u6210 \u9EC4=\u5F85\u529E/\u5F85\u53D1\u5E03 \u7070=\u672A\u5F00\u59CB\uFF09 */ -.dshell-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--dsw-alias-border-l1, #262b36); font-size: 11.5px; color: var(--dsw-alias-label-secondary, #9aa4b2); background: var(--dsw-alias-fill-l1, rgba(255,255,255,.03)); } -.dshell-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-label-tertiary, #6b7280); } -.dshell-badgeDone { color: #3fb950; border-color: rgba(63,185,80,.4); } -.dshell-badgeDone::before { background: #3fb950; box-shadow: 0 0 5px #3fb950; } -.dshell-badgeWait { color: #d29922; border-color: rgba(210,153,34,.4); } -.dshell-badgeWait::before { background: #d29922; box-shadow: 0 0 5px #d29922; } -.dshell-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dsw-alias-label-tertiary, #6b7280); } -.dshell-dotDone { background: #3fb950; box-shadow: 0 0 5px #3fb950; } -.dshell-dotWait { background: #d29922; box-shadow: 0 0 5px #d29922; } -/* \u6807\u7B7E\u9875 */ -.dshell-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--dsw-alias-border-l1, #262b36); } -.dshell-tab { padding: 7px 12px; font-size: 12.5px; color: var(--dsw-alias-label-secondary, #9aa4b2); cursor: pointer; border: none; background: none; font: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px; } -.dshell-tabOn { color: var(--dsw-alias-label-primary, #e6e8eb); border-bottom-color: var(--dsw-alias-state-accent-primary, #4f8ef7); } -/* \u5217\u8868 */ -.dshell-list { display: flex; flex-direction: column; gap: 6px; } -.dshell-listItem { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 8px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); cursor: pointer; } -.dshell-listItem:hover { border-color: var(--dsw-alias-border-l2, #3a4150); background: var(--dsw-alias-fill-l1, rgba(255,255,255,.05)); } -.dshell-listItemTitle { font-size: 12.5px; color: var(--dsw-alias-label-primary, #e6e8eb); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } -.dshell-listItemMeta { flex: none; font-size: 11px; color: var(--dsw-alias-label-tertiary, #6b7280); } -/* \u7F51\u683C / \u7EDF\u8BA1 */ -.dshell-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; } -.dshell-stat { padding: 10px 12px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 10px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); } -.dshell-statLabel { font-size: 11px; color: var(--dsw-alias-label-secondary, #9aa4b2); } -.dshell-statValue { font-size: 20px; font-weight: 600; color: var(--dsw-alias-label-primary, #e6e8eb); } -.dshell-statDelta { font-size: 11px; color: #3fb950; } -/* \u8FDB\u5EA6\u6761 */ -.dshell-progress { height: 6px; border-radius: 3px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.06)); overflow: hidden; } -.dshell-progressBar { height: 100%; border-radius: 3px; background: #3fb950; } -/* \u8F93\u5165 */ -.dshell-input, .dshell-textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 8px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.03)); color: var(--dsw-alias-label-primary, #e6e8eb); font: inherit; font-size: 12.5px; outline: none; } -.dshell-input:focus, .dshell-textarea:focus { border-color: var(--dsw-alias-state-accent-primary, #4f8ef7); } -/* \u8868\u683C */ -.dshell-table { width: 100%; border-collapse: collapse; font-size: 12px; } -.dshell-table th, .dshell-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--dsw-alias-border-l1, #262b36); } -.dshell-table th { color: var(--dsw-alias-label-secondary, #9aa4b2); font-weight: 500; } -/* \u952E\u503C\u5BF9 */ -.dshell-kv { display: flex; flex-direction: column; gap: 6px; } -.dshell-kvRow { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; } -.dshell-kvKey { color: var(--dsw-alias-label-secondary, #9aa4b2); } -.dshell-kvValue { color: var(--dsw-alias-label-primary, #e6e8eb); text-align: right; } -/* \u5206\u5272\u7EBF */ -.dshell-divider { height: 1px; background: var(--dsw-alias-border-l1, #262b36); margin: 6px 0; } -/* \u6EDA\u52A8\u6761 */ -::-webkit-scrollbar { width: 10px; height: 10px; } -::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 5px; } -::-webkit-scrollbar-track { background: transparent; } +var dshell_default = `/* dsh-worktable \u539F\u751F\u76AE\u80A4 \xB7 DSH \u8BBE\u8BA1\u7CFB\u7EDF\u7EC4\u4EF6\u5E93\r + \u7528\u6CD5\uFF1A\r + \u989C\u8272\u4E00\u5F8B\u8D70 DSH \u4E3B\u9898\u53D8\u91CF\uFF08--dsw-alias-*\uFF09\uFF0C\u81EA\u52A8\u9002\u914D\u660E\u6697\u4E3B\u9898\u3002\r + \u4E3B\u9898\u6765\u6E90\u4F18\u5148\u7EA7\uFF1A\r + 1) \u5DE5\u4F5C\u53F0\u5185\uFF1A\u4E3B\u9898\u6865\uFF08\u7AD9\u70B9\u8DEF\u7531\u81EA\u52A8\u6CE8\u5165\uFF0C\u6216\u663E\u5F0F\u5F15 /api/worktable/template/theme.js\uFF09\r + \u628A\u5BBF\u4E3B body \u4E0A\u7684 --dsw-*/--dsh-*/--ds-* \u955C\u50CF\u6210\u9875\u9762\u5185\u8054\u6837\u5F0F \u2192 \u8DDF\u968F DSH \u7684 \u6D45\u8272/\u6DF1\u8272/\u8DDF\u968F\u7CFB\u7EDF\uFF1B\r + 2) \u72EC\u7ACB\u6253\u5F00\uFF1A\u7528\u4E0B\u9762 :root \u7684\u515C\u5E95\uFF0C\u5E76\u6309\u7CFB\u7EDF\u6DF1\u6D45\u8272\u5207\u6362\u3002\r + \u6CE8\u610F\uFF1A\u4E0D\u8981\u5728\u8FD9\u91CC\u5199\u6B7B\u6DF1\u8272\uFF08\u65E7\u7248 :root{color-scheme:dark} \u4F1A\u8BA9\u6240\u6709\u9875\u9762\u9501\u6B7B\u6DF1\u8272\uFF0C\r + 2026-11 \u4ECE 0.5.x \u7EBF\u6062\u590D\u65F6\u518D\u6B21\u8E29\u5230\uFF0CREQ-20261117-0013 \u4E00\u5E76\u4FEE\u6389\uFF09\u3002 */\r +:root {\r + color-scheme: light dark;\r + --dsw-alias-bg-base: #ffffff;\r + --dsw-alias-fill-l1: rgba(16, 24, 40, .03);\r + --dsw-alias-border-l1: #e4e7ec;\r + --dsw-alias-border-l2: #d0d5dd;\r + --dsw-alias-label-primary: #101828;\r + --dsw-alias-label-secondary: #475467;\r + --dsw-alias-label-tertiary: #98a2b3;\r + --dsw-alias-state-accent-primary: #2f6feb;\r +}\r +@media (prefers-color-scheme: dark) {\r + :root {\r + --dsw-alias-bg-base: #0b0e14;\r + --dsw-alias-fill-l1: rgba(255, 255, 255, .02);\r + --dsw-alias-border-l1: #262b36;\r + --dsw-alias-border-l2: #3a4150;\r + --dsw-alias-label-primary: #e6e8eb;\r + --dsw-alias-label-secondary: #9aa4b2;\r + --dsw-alias-label-tertiary: #6b7280;\r + --dsw-alias-state-accent-primary: #4f8ef7;\r + }\r +}\r +* { box-sizing: border-box; }\r +html, body { margin: 0; padding: 0; }\r +body {\r + background: var(--dsw-alias-bg-base, #0b0e14);\r + color: var(--dsw-alias-label-primary, #e6e8eb);\r + font-family: var(--dsw-font-family, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif);\r + font-size: 13px;\r + line-height: 1.6;\r +}\r +.dshell { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; min-height: 100%; }\r +/* \u6587\u5B57\u5C42\u7EA7 */\r +.dshell-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--dsw-alias-label-primary, #e6e8eb); }\r +.dshell-sub { margin: 0; font-size: 12px; color: var(--dsw-alias-label-secondary, #9aa4b2); }\r +.dshell-muted { color: var(--dsw-alias-label-tertiary, #6b7280); font-size: 11.5px; }\r +/* \u5361\u7247 */\r +.dshell-card { border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 10px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); padding: 12px 14px; }\r +.dshell-card + .dshell-card { margin-top: 10px; }\r +/* \u6309\u94AE\uFF08\u7EFF\u8272\u4E3B\u6309\u94AE / \u5E7D\u7075\u6309\u94AE / \u5371\u9669\uFF09 */\r +.dshell-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid transparent; background: #3fb950; color: #0b0e14; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }\r +.dshell-btn:hover { filter: brightness(1.08); }\r +.dshell-btnGhost { background: transparent; border-color: var(--dsw-alias-border-l1, #262b36); color: var(--dsw-alias-label-secondary, #9aa4b2); }\r +.dshell-btnGhost:hover { color: var(--dsw-alias-label-primary, #e6e8eb); border-color: var(--dsw-alias-border-l2, #3a4150); }\r +.dshell-btnDanger { background: transparent; border-color: #f85149; color: #f85149; }\r +/* \u72B6\u6001\u5FBD\u6807\uFF08\u5706\u70B9 + \u6587\u5B57\uFF1B\u7EFF=\u5DF2\u5B8C\u6210 \u9EC4=\u5F85\u529E/\u5F85\u53D1\u5E03 \u7070=\u672A\u5F00\u59CB\uFF09 */\r +.dshell-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--dsw-alias-border-l1, #262b36); font-size: 11.5px; color: var(--dsw-alias-label-secondary, #9aa4b2); background: var(--dsw-alias-fill-l1, rgba(255,255,255,.03)); }\r +.dshell-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-label-tertiary, #6b7280); }\r +.dshell-badgeDone { color: #3fb950; border-color: rgba(63,185,80,.4); }\r +.dshell-badgeDone::before { background: #3fb950; box-shadow: 0 0 5px #3fb950; }\r +.dshell-badgeWait { color: #d29922; border-color: rgba(210,153,34,.4); }\r +.dshell-badgeWait::before { background: #d29922; box-shadow: 0 0 5px #d29922; }\r +.dshell-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dsw-alias-label-tertiary, #6b7280); }\r +.dshell-dotDone { background: #3fb950; box-shadow: 0 0 5px #3fb950; }\r +.dshell-dotWait { background: #d29922; box-shadow: 0 0 5px #d29922; }\r +/* \u6807\u7B7E\u9875 */\r +.dshell-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--dsw-alias-border-l1, #262b36); }\r +.dshell-tab { padding: 7px 12px; font-size: 12.5px; color: var(--dsw-alias-label-secondary, #9aa4b2); cursor: pointer; border: none; background: none; font: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px; }\r +.dshell-tabOn { color: var(--dsw-alias-label-primary, #e6e8eb); border-bottom-color: var(--dsw-alias-state-accent-primary, #4f8ef7); }\r +/* \u5217\u8868 */\r +.dshell-list { display: flex; flex-direction: column; gap: 6px; }\r +.dshell-listItem { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 8px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); cursor: pointer; }\r +.dshell-listItem:hover { border-color: var(--dsw-alias-border-l2, #3a4150); background: var(--dsw-alias-fill-l1, rgba(255,255,255,.05)); }\r +.dshell-listItemTitle { font-size: 12.5px; color: var(--dsw-alias-label-primary, #e6e8eb); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\r +.dshell-listItemMeta { flex: none; font-size: 11px; color: var(--dsw-alias-label-tertiary, #6b7280); }\r +/* \u7F51\u683C / \u7EDF\u8BA1 */\r +.dshell-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }\r +.dshell-stat { padding: 10px 12px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 10px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); }\r +.dshell-statLabel { font-size: 11px; color: var(--dsw-alias-label-secondary, #9aa4b2); }\r +.dshell-statValue { font-size: 20px; font-weight: 600; color: var(--dsw-alias-label-primary, #e6e8eb); }\r +.dshell-statDelta { font-size: 11px; color: #3fb950; }\r +/* \u8FDB\u5EA6\u6761 */\r +.dshell-progress { height: 6px; border-radius: 3px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.06)); overflow: hidden; }\r +.dshell-progressBar { height: 100%; border-radius: 3px; background: #3fb950; }\r +/* \u8F93\u5165 */\r +.dshell-input, .dshell-textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 8px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.03)); color: var(--dsw-alias-label-primary, #e6e8eb); font: inherit; font-size: 12.5px; outline: none; }\r +.dshell-input:focus, .dshell-textarea:focus { border-color: var(--dsw-alias-state-accent-primary, #4f8ef7); }\r +/* \u8868\u683C */\r +.dshell-table { width: 100%; border-collapse: collapse; font-size: 12px; }\r +.dshell-table th, .dshell-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--dsw-alias-border-l1, #262b36); }\r +.dshell-table th { color: var(--dsw-alias-label-secondary, #9aa4b2); font-weight: 500; }\r +/* \u952E\u503C\u5BF9 */\r +.dshell-kv { display: flex; flex-direction: column; gap: 6px; }\r +.dshell-kvRow { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }\r +.dshell-kvKey { color: var(--dsw-alias-label-secondary, #9aa4b2); }\r +.dshell-kvValue { color: var(--dsw-alias-label-primary, #e6e8eb); text-align: right; }\r +/* \u5206\u5272\u7EBF */\r +.dshell-divider { height: 1px; background: var(--dsw-alias-border-l1, #262b36); margin: 6px 0; }\r +/* \u6EDA\u52A8\u6761 */\r +::-webkit-scrollbar { width: 10px; height: 10px; }\r +::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 5px; }\r +::-webkit-scrollbar-track { background: transparent; }\r `; // template/dshell.html -var dshell_default2 = '\n\n\n\n \n \n \n \u6211\u7684\u7A97\u53E3\n \n\n\n
\n \n

\u7A97\u53E3\u6807\u9898

\n

\u4E00\u53E5\u8BDD\u8BF4\u660E\u8FD9\u4E2A\u7A97\u53E3\u505A\u4EC0\u4E48\u3002

\n\n \n
\n \u5DF2\u5B8C\u6210\n \u8FDB\u884C\u4E2D\n \u672A\u5F00\u59CB\n
\n\n \n
\n \n \n \n
\n\n \n
\n
\n
\u603B\u6570
\n
128
\n
+12.4%
\n
\n
\n
\u8FDB\u884C\u4E2D
\n
7
\n
\n
\n
\u5DF2\u5B8C\u6210
\n
121
\n
\n
\n\n \n
\n
\n \u6761\u76EE\u4E00\uFF1A\u793A\u4F8B\u5185\u5BB9\u6807\u9898\n \u6628\u5929\n
\n
\n \u6761\u76EE\u4E8C\uFF1A\u793A\u4F8B\u5185\u5BB9\u6807\u9898\n \u5DF2\u53D1\u5E03\n
\n
\n\n \n
\n

\u8BE6\u60C5

\n
\n
\u5B57\u6BB5 A\u503C A
\n
\u5B57\u6BB5 B\u503C B
\n
\n
\n
\n
\n\n \n
\n \n \n
\n
\n\n\n'; +var dshell_default2 = '\r\n\r\n\r\n\r\n \r\n \r\n \r\n \u6211\u7684\u7A97\u53E3\r\n \r\n\r\n\r\n
\r\n \r\n

\u7A97\u53E3\u6807\u9898

\r\n

\u4E00\u53E5\u8BDD\u8BF4\u660E\u8FD9\u4E2A\u7A97\u53E3\u505A\u4EC0\u4E48\u3002

\r\n\r\n \r\n
\r\n \u5DF2\u5B8C\u6210\r\n \u8FDB\u884C\u4E2D\r\n \u672A\u5F00\u59CB\r\n
\r\n\r\n \r\n
\r\n \r\n \r\n \r\n
\r\n\r\n \r\n
\r\n
\r\n
\u603B\u6570
\r\n
128
\r\n
+12.4%
\r\n
\r\n
\r\n
\u8FDB\u884C\u4E2D
\r\n
7
\r\n
\r\n
\r\n
\u5DF2\u5B8C\u6210
\r\n
121
\r\n
\r\n
\r\n\r\n \r\n
\r\n
\r\n \u6761\u76EE\u4E00\uFF1A\u793A\u4F8B\u5185\u5BB9\u6807\u9898\r\n \u6628\u5929\r\n
\r\n
\r\n \u6761\u76EE\u4E8C\uFF1A\u793A\u4F8B\u5185\u5BB9\u6807\u9898\r\n \u5DF2\u53D1\u5E03\r\n
\r\n
\r\n\r\n \r\n
\r\n

\u8BE6\u60C5

\r\n
\r\n
\u5B57\u6BB5 A\u503C A
\r\n
\u5B57\u6BB5 B\u503C B
\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n
\r\n \r\n \r\n
\r\n
\r\n\r\n\r\n'; // src/index.ts function baseDshHome() { @@ -382,7 +382,7 @@ function resolveDshHomeSafe() { cachedDshHome = baseDshHome(); return cachedDshHome; } -var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.4"; +var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.5"; var name = "dsh-worktable"; var inject = ["webServer", "sessions"]; var HEALTH_PATH = "/api/worktable/health"; @@ -651,20 +651,35 @@ function apply(ctx) { } })(); }; - const register = (route, publicAsset = false) => ctx.effect(() => webServer.register({ - ...route, - handler: async (req, res) => { - if (!publicAsset && route.path !== HEALTH_PATH) { - const rejected = await requestRejection(ctx, req); - if (rejected !== void 0) { - if (route.path === "/api/worktable/state") stateLog("REJECT " + req.method + " -> " + rejected); - json(res, rejected, { error: rejectionText(rejected) }); - return; + const register = (route, publicAsset = false) => { + let dispose; + try { + dispose = webServer.register({ + ...route, + handler: async (req, res) => { + if (!publicAsset && route.path !== HEALTH_PATH) { + const rejected = await requestRejection(ctx, req); + if (rejected !== void 0) { + if (route.path === "/api/worktable/state") stateLog("REJECT " + req.method + " -> " + rejected); + json(res, rejected, { error: rejectionText(rejected) }); + return; + } + } + return route.handler(req, res); } + }); + } catch (err) { + if (String(err).includes("duplicate")) { + ctx.logger?.warn("[dsh-worktable] \u8DEF\u7531\u5DF2\u88AB\u5360\u7528\uFF08\u70ED\u91CD\u8F7D\u6CC4\u6F0F\u81EA\u4FDD\uFF09\uFF0C\u8DF3\u8FC7: " + route?.path); + return; } - return route.handler(req, res); + throw err; } - }), "dsh-worktable: " + route.path); + try { + ctx.effect(() => dispose, "dsh-worktable: " + route.path); + } catch { + } + }; register({ kind: "exact", path: "/api/worktable/preview", diff --git a/01_content/package-lock.json b/01_content/package-lock.json index 14c8243..57fdfca 100644 --- a/01_content/package-lock.json +++ b/01_content/package-lock.json @@ -1,12 +1,12 @@ { "name": "dsh-worktable", - "version": "0.5.1", + "version": "0.5.3-local.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dsh-worktable", - "version": "0.5.1", + "version": "0.5.3-local.4", "license": "MIT", "devDependencies": { "esbuild": "^0.25.0", @@ -15,7 +15,7 @@ "xterm": "^5.3.0" }, "engines": { - "dsh": "0.2.0-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.5", + "dsh": "0.2.0-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.5 || 0.2.2-alpha.2", "node": ">=22" }, "peerDependencies": { diff --git a/01_content/package.json b/01_content/package.json index cc2ad29..bc44539 100644 --- a/01_content/package.json +++ b/01_content/package.json @@ -1,7 +1,7 @@ { "name": "dsh-worktable", "description": "工作台 Worktable:DeepSeek Harness 侧边栏的 agent 级项目容器(应用抽屉)", - "version": "0.5.3-local.4", + "version": "0.5.3-local.5", "repository": { "type": "git", "url": "https://github.com/Aisland-SJL/dsh-worktable.git", diff --git a/01_content/release-prep.mjs b/01_content/release-prep.mjs index 6312177..a796d6b 100644 --- a/01_content/release-prep.mjs +++ b/01_content/release-prep.mjs @@ -110,7 +110,9 @@ const tgz = join(work, 'pack', packedName) console.log('[release-prep] packed: ' + packedName) // ---------- 4. 结构清单断言(精确到文件,不含源码/映射) ---------- -const listTar = spawnSync('tar', ['-tzf', tgz], { encoding: 'utf8' }) +// Windows: GNU tar 会把 "C:\..." 的盘符当成 rsh 远端主机(Cannot connect to C), +// 必须 --force-local 才能在 win32 上列包;POSIX 上该选项也有,可无条件传。 +const listTar = spawnSync('tar', ['--force-local', '-tzf', tgz], { encoding: 'utf8' }) if (listTar.status !== 0) { console.error('[release-prep] FAIL: tar -tzf'); process.exit(1) } const entries = listTar.stdout.split(/\r?\n/).filter(Boolean) const EXPECTED = [ diff --git a/01_content/src/client/index.tsx b/01_content/src/client/index.tsx index efd5d83..2097a5e 100644 --- a/01_content/src/client/index.tsx +++ b/01_content/src/client/index.tsx @@ -61,6 +61,8 @@ type ViewState = { orderBy: OrderBy dock: DockMode floatTop: number | null + /** 折叠中的项目 id(这些项目不展开显示其二级页面;缺省 = 全部展开)*/ + foldedProjects?: string[] /** 控制室面板主题:dark/light/system(system = 跟随宿主 color-scheme,即 DSH 深色/白色/跟随系统设置) */ consoleTheme?: 'dark' | 'light' | 'system' /** 控制室每行显示项目数(1-5,默认 3)*/ @@ -328,6 +330,7 @@ function normalizeView(raw: any): ViewState { orderBy, dock: p.dock === 'float' ? 'float' : 'footer', floatTop: typeof p.floatTop === 'number' ? p.floatTop : null, + foldedProjects: Array.isArray(p.foldedProjects) ? p.foldedProjects.filter((x: unknown): x is string => typeof x === 'string') : [], consoleTheme: p.consoleTheme === 'dark' || p.consoleTheme === 'light' || p.consoleTheme === 'system' ? p.consoleTheme : 'system', consoleCols: typeof p.consoleCols === 'number' && p.consoleCols >= 1 && p.consoleCols <= 5 ? Math.round(p.consoleCols) : 3, consoleShape: p.consoleShape === 'circle' ? 'circle' : 'square', @@ -2242,7 +2245,35 @@ function buildCustomLayoutPrompt(req: string): string { const removeLayout = (id: string) => { invalidateWidgetProject(id) - persistProjects((prev) => ({ ...prev, layouts: prev.layouts.filter((l) => l.id !== id) })) + // 二级页面:删父项目不级联删子页面 —— 子页面提升为顶级,避免误删用户内容 + persistProjects((prev) => ({ + ...prev, + layouts: prev.layouts + .filter((l) => l.id !== id) + .map((l) => (l.parentId === id ? { ...l, parentId: undefined } : l)), + })) + } + + // ── 二级页面:挂在某个项目下的独立布局页(仅一级)── + const addSubPage = (parent: LayoutSpec) => { + const parentName = projects.nameOverrides[parent.id] ?? parent.title + const child = buildLayout('2h', parentName + ' · 新页面') + child.parentId = parent.id + const folder = projects.folders[parent.id] + persistProjects((prev) => ({ + ...prev, + layouts: [...prev.layouts, child], + folders: folder ? { ...prev.folders, [child.id]: folder } : prev.folders, + })) + invalidatePickState() + openSplit(child) + reportUsed(child.id) + } + + /** 折叠/展开某个项目的二级页面列表 */ + const toggleFold = (id: string) => { + const folded = view.foldedProjects ?? [] + persistView({ foldedProjects: folded.includes(id) ? folded.filter((x) => x !== id) : [...folded, id] }) } // ── 变更视图:所有项目通用。布局项目 = 重建其布局条目;入驻项目 = 建立/更新视图覆盖。 @@ -2476,6 +2507,30 @@ function buildCustomLayoutPrompt(req: string): string { const paneTitles = [...(l.top ?? []), ...l.main].map((p) => p.title).join(' ') return (l.title + ' ' + paneTitles).toLowerCase().includes(queryLower) }) + /** 侧栏树:父项目 + 其二级页面(仅一级嵌套;父项目不可见时子页面按顶级显示)*/ + const layoutTree = useMemo(() => { + const visIds = new Set(visibleLayouts.map((l) => l.id)) + const kids = new Map() + const roots: LayoutSpec[] = [] + for (const l of visibleLayouts) { + if (l.parentId && visIds.has(l.parentId)) { + const arr = kids.get(l.parentId) ?? [] + arr.push(l) + kids.set(l.parentId, arr) + } else roots.push(l) + } + const ord = (a: LayoutSpec, b: LayoutSpec) => effectiveOrder.indexOf(a.id) - effectiveOrder.indexOf(b.id) + const out: { node: LayoutSpec; depth: 0 | 1; hasKids: boolean }[] = [] + for (const r of [...roots].sort(ord)) { + const cs = (kids.get(r.id) ?? []).sort(ord) + out.push({ node: r, depth: 0, hasKids: cs.length > 0 }) + if (!(view.foldedProjects ?? []).includes(r.id)) { + for (const c of cs) out.push({ node: c, depth: 1, hasKids: false }) + } + } + return out + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [visibleLayouts, effectiveOrder, view.foldedProjects]) const isFloat = float != null const floatStyle = isFloat @@ -2740,6 +2795,14 @@ function buildCustomLayoutPrompt(req: string): string { + {layout && ( + + )} - ))} + ) + })} {visibleShortcuts.length > 0 && ( diff --git a/01_content/src/client/locales.ts b/01_content/src/client/locales.ts index 1f9e6de..f296bcf 100644 --- a/01_content/src/client/locales.ts +++ b/01_content/src/client/locales.ts @@ -60,6 +60,9 @@ export const zh = { 'manage.deleteLayout': '删除布局', 'manage.deleteProject': '删除项目', 'manage.changeView': '变更视图', + 'manage.addPage': '新增二级页面', + 'tree.fold': '折叠二级页面', + 'tree.expand': '展开二级页面', 'viewPick.title': '选择新视图(内容窗自动迁入)', 'confirm.title': '删除项目', 'confirm.cancel': '取消', @@ -299,6 +302,9 @@ export const en = { 'manage.deleteLayout': 'Delete layout', 'manage.deleteProject': 'Delete project', 'manage.changeView': 'Change layout', + 'manage.addPage': 'Add sub page', + 'tree.fold': 'Collapse sub pages', + 'tree.expand': 'Expand sub pages', 'viewPick.title': 'Pick a new layout (panes migrate automatically)', 'confirm.title': 'Delete project', 'confirm.cancel': 'Cancel', diff --git a/01_content/src/client/split.tsx b/01_content/src/client/split.tsx index d66a662..abec0e7 100644 --- a/01_content/src/client/split.tsx +++ b/01_content/src/client/split.tsx @@ -70,6 +70,8 @@ export type LayoutSpec = { chatFullHeight?: boolean /** 顶行首次打开时高度占可用高度比例(0~1;0.5 = 上下等分);拖动后由存档值覆盖 */ topHeightRatio?: number + /** 二级页面:挂在某项目下的独立布局页(仅一级嵌套;缺省 = 顶级项目) */ + parentId?: string } type Geom = { left: number; top: number; right: number; bottom: number } @@ -2479,7 +2481,7 @@ function FileViewer(props: { path: string }) { const ext = (props.path.split('.').pop() || '').toLowerCase() const fileUrl = '/api/worktable/file?path=' + encodeURIComponent(props.path) if (ext === 'pdf') { - return