Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
468b0cebec | ||
|
|
f2ef7655dd | ||
|
|
6aa0d3dce4 | ||
|
|
b917f0e0ed | ||
|
|
1b053e5577 |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "dsh-worktable",
|
||||
"description": "工作台:DSH 侧边栏的 agent 级项目容器,收纳如 TravelAtlas 等自装项目",
|
||||
"version": "0.5.3-local.7",
|
||||
"version": "0.5.3-local.10",
|
||||
"entry": {
|
||||
"name": "dsh-worktable",
|
||||
"inject": []
|
||||
|
||||
+67
-19
@@ -7986,7 +7986,10 @@ var css = xterm_default + "\n" + [
|
||||
".dsh-wt_layout:hover{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}",
|
||||
".dsh-wt_layout[data-on=true]{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}",
|
||||
".dsh-wt_layout[data-on=true] .dsh-wt_layoutName{color:var(--dsw-alias-state-accent-primary,#4f8ef7)}",
|
||||
".dsh-wt_layoutIcon{flex:none;font-size:15px}",
|
||||
".dsh-wt_layoutIcon{flex:none;font-size:15px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px}",
|
||||
// 内联 SVG 图标:跟随文字色,两平台渲染一致(emoji 依赖系统字体,形状/配色不统一)
|
||||
".dsh-wt_layoutSvg{width:15px;height:15px;display:block;flex:none;color:var(--dsw-alias-label-secondary,#9aa4b2)}",
|
||||
".dsh-wt_layout[data-on=true] .dsh-wt_layoutSvg{color:var(--dsw-alias-state-accent-primary,#4f8ef7)}",
|
||||
".dsh-wt_layoutText{flex:1;min-width:0;display:flex;flex-direction:column;gap:0}",
|
||||
".dsh-wt_layoutName{font-size:12px;font-weight:400;line-height:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
||||
// 箭头与项目名同一行高 + 字面中心对齐;› 墨迹在字面框内偏下,整体上移 1px 使视觉居中
|
||||
@@ -8404,7 +8407,11 @@ var css = xterm_default + "\n" + [
|
||||
".dsh-wt_updateBtn svg{width:12px;height:12px;flex:none}",
|
||||
".dsh-wt_updateBadge svg{width:12px;height:12px;flex:none}",
|
||||
".dsh-wt_updateBtn:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.06))}",
|
||||
".dsh-wt_updateBtnCopy{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:rgba(79,142,247,.18);color:#cfe0ff}",
|
||||
// 「复制 AI 提示词」主按钮:原来用 rgba(...,.18) 半透明底 + 浅蓝字,在实际主题上
|
||||
// 对比度极低(截图里几乎看不见)。改为实心强调色 + 白字,hover/active 明确反馈。
|
||||
".dsh-wt_updateBtnCopy{border-color:transparent;background:var(--dsw-alias-state-accent-primary,#4f8ef7);color:#fff;font-weight:600}",
|
||||
".dsh-wt_updateBtnCopy:hover{background:var(--dsw-alias-state-accent-primary-hover,#3f7de0);color:#fff}",
|
||||
".dsh-wt_updateBtnCopy:active{transform:translateY(.5px)}",
|
||||
".dsh-wt_updateHint{font-size:10.5px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}",
|
||||
".dsh-wt_versionRow{margin-top:8px;padding-top:8px;border-top:1px solid var(--dsw-alias-border-l1,#262b36);display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}",
|
||||
".dsh-wt_updateToggle{display:flex;align-items:center;gap:6px;cursor:pointer;user-select:none}",
|
||||
@@ -8659,6 +8666,7 @@ var zh = {
|
||||
"update.available": "\u65B0\u7248\u672C\u53EF\u7528",
|
||||
"update.current": "\u5F53\u524D\u7248\u672C",
|
||||
"update.copyAi": "\u590D\u5236 AI \u63D0\u793A\u8BCD",
|
||||
"update.copyFailed": "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u547D\u4EE4",
|
||||
"update.skip": "\u5FFD\u7565\u6B64\u7248\u672C",
|
||||
"update.autoCheck": "\u81EA\u52A8\u68C0\u67E5\u66F4\u65B0",
|
||||
"update.checkNow": "\u7ACB\u5373\u68C0\u67E5",
|
||||
@@ -8896,6 +8904,7 @@ var en = {
|
||||
"update.available": "New version available",
|
||||
"update.current": "Current version",
|
||||
"update.copyAi": "Copy AI prompt",
|
||||
"update.copyFailed": "Copy failed, select the command manually",
|
||||
"update.skip": "Skip this version",
|
||||
"update.autoCheck": "Auto-check updates",
|
||||
"update.checkNow": "Check now",
|
||||
@@ -8967,10 +8976,17 @@ function hostPreviewUrl(path, surface = {
|
||||
if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("Unsupported Host preview protocol");
|
||||
return url.href;
|
||||
}
|
||||
var UPDATE_TGZ = "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.7/dsh-worktable.tgz";
|
||||
function worktableUpgrade(protocol = typeof location === "undefined" ? "http:" : location.protocol) {
|
||||
var UPDATE_BASE = "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download";
|
||||
function upgradeCommandFor(tag, protocol = typeof location === "undefined" ? "http:" : location.protocol) {
|
||||
const desktop = protocol === "dsh-app:";
|
||||
const command = "dsh plugin --profile " + (desktop ? "desktop" : "web") + ' add "' + UPDATE_TGZ + '"';
|
||||
const clean = String(tag || "").trim().replace(/^v/, "");
|
||||
const t = clean ? "v" + clean : "";
|
||||
const url = t ? UPDATE_BASE + "/" + t + "/dsh-worktable.tgz" : UPDATE_BASE + "/";
|
||||
return "dsh plugin --profile " + (desktop ? "desktop" : "web") + ' add "' + url + '"';
|
||||
}
|
||||
function worktableUpgrade(tag, protocol = typeof location === "undefined" ? "http:" : location.protocol) {
|
||||
const desktop = protocol === "dsh-app:";
|
||||
const command = upgradeCommandFor(tag, protocol);
|
||||
const prompt = desktop ? "\u5E2E\u6211\u5347\u7EA7 dsh-worktable\u3002\u6211\u5F53\u524D\u4F7F\u7528\u5B98\u65B9\u684C\u9762\u7AEF\uFF1A\u5148\u5B9A\u4F4D\u8BE5\u684C\u9762\u7AEF\u81EA\u5E26\u7684 dsh CLI \u5E76\u51C6\u5907\u66F4\u65B0\uFF0C\u518D\u63D0\u9192\u6211\u5B8C\u6574\u9000\u51FA\u684C\u9762\u7AEF\u3002\u786E\u8BA4\u9000\u51FA\u540E\u4F7F\u7528\u8BE5 CLI \u6267\u884C " + command + "\u3002\u4E0D\u8981\u4F7F\u7528\u7F51\u9875\u7AEF CLI\uFF0C\u4E0D\u8981\u4FEE\u6539 web profile\uFF0C\u4E0D\u8981\u81EA\u52A8\u6740\u8FDB\u7A0B\u6216\u91CD\u542F\uFF1B\u5B8C\u6210\u540E\u63D0\u9192\u6211\u624B\u52A8\u91CD\u65B0\u6253\u5F00\u684C\u9762\u7AEF\u3002" : "\u5E2E\u6211\u5347\u7EA7 dsh-worktable\uFF1A\u6267\u884C " + command + "\uFF0C\u5B8C\u6210\u540E\u63D0\u9192\u6211\u91CD\u542F dsh web \u5E76\u5237\u65B0\u9875\u9762";
|
||||
return { command, prompt, desktop };
|
||||
}
|
||||
@@ -9200,9 +9216,8 @@ 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.7";
|
||||
var UPDATE_HOST = "https://gitea.ququclean.com";
|
||||
var UPDATE_REPO = "xiaoqu/dsh-worktable";
|
||||
var LOCAL_VERSION = false ? "dev" : "0.5.3-local.10";
|
||||
var UPDATE_API = "/api/worktable/update-check";
|
||||
var K_UPDATE_CHECK = "dsh.worktable.updateCheck.v1";
|
||||
var K_LAST_CHECK = "dsh.worktable.lastUpdateCheck.v1";
|
||||
var K_SKIP = "dsh.worktable.skipVersion.v1";
|
||||
@@ -9306,7 +9321,7 @@ async function checkUpdate(force = false) {
|
||||
const ctrl = new AbortController();
|
||||
const timer2 = setTimeout(() => ctrl.abort(), 8e3);
|
||||
try {
|
||||
const r = await fetch(UPDATE_HOST + "/api/v1/repos/" + UPDATE_REPO + "/releases/latest", { headers: { Accept: "application/json" }, cache: "no-store", signal: ctrl.signal });
|
||||
const r = await fetch(UPDATE_API, { headers: { Accept: "application/json" }, cache: "no-store", signal: ctrl.signal });
|
||||
if (r.ok) d = await r.json();
|
||||
else if (r.status === 403 || r.status === 404) break;
|
||||
} catch {
|
||||
@@ -17362,7 +17377,6 @@ function boxPayload(x0, y0, x1, y1) {
|
||||
}
|
||||
return { primary, line, candidates, limited, src };
|
||||
}
|
||||
var { prompt: UPGRADE_AI } = worktableUpgrade();
|
||||
async function copyTextSafe(text2) {
|
||||
try {
|
||||
if (navigator.clipboard?.writeText) {
|
||||
@@ -18643,7 +18657,8 @@ function ConsolePane() {
|
||||
};
|
||||
const [updCopied, setUpdCopied] = (0, import_react2.useState)(false);
|
||||
const onCopyUpgrade = async () => {
|
||||
const ok = await copyTextSafe(UPGRADE_AI);
|
||||
const { prompt } = worktableUpgrade(updInfo?.latest ?? LOCAL_VERSION);
|
||||
const ok = await copyTextSafe(prompt);
|
||||
if (ok) {
|
||||
setUpdCopied(true);
|
||||
window.setTimeout(() => setUpdCopied(false), 2200);
|
||||
@@ -20871,9 +20886,8 @@ function flushHostSave() {
|
||||
|
||||
// src/client/index.tsx
|
||||
var import_jsx_runtime3 = require("react/jsx-runtime");
|
||||
var UPDATE_HOST2 = "https://gitea.ququclean.com";
|
||||
var UPDATE_REPO2 = "xiaoqu/dsh-worktable";
|
||||
var { command: UPGRADE_CMD, prompt: UPGRADE_AI2, desktop: DESKTOP_HOST } = worktableUpgrade();
|
||||
var UPDATE_API2 = "/api/worktable/update-check";
|
||||
var DESKTOP_HOST = typeof location !== "undefined" && location.protocol === "dsh-app:";
|
||||
var ICON_SYNC = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { viewBox: "0 0 16 16", "aria-hidden": true, children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", d: "M1.5 8a6.5 6.5 0 0 1 11.1-4.6L14.5 5" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", d: "M14.5 1.5V5h-3.5" }),
|
||||
@@ -20885,6 +20899,26 @@ var ICON_SPARK = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { viewBox:
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12.6 11.2l.5 1.3 1.3.5-1.3.5-.5 1.3-.5-1.3-1.3-.5 1.3-.5z", fill: "currentColor" })
|
||||
] });
|
||||
async function copyText(text2) {
|
||||
try {
|
||||
if (navigator.clipboard?.writeText && window.isSecureContext !== false) {
|
||||
await navigator.clipboard.writeText(text2);
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
try {
|
||||
const ta = document.createElement("textarea");
|
||||
ta.value = text2;
|
||||
ta.setAttribute("readonly", "");
|
||||
ta.style.cssText = "position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none";
|
||||
document.body.appendChild(ta);
|
||||
ta.select();
|
||||
ta.setSelectionRange(0, ta.value.length);
|
||||
const ok = typeof document.execCommand === "function" ? document.execCommand("copy") : false;
|
||||
document.body.removeChild(ta);
|
||||
if (ok) return true;
|
||||
} catch {
|
||||
}
|
||||
try {
|
||||
if (navigator.clipboard?.writeText) {
|
||||
await navigator.clipboard.writeText(text2);
|
||||
@@ -21290,6 +21324,11 @@ async function ensureSessionModel(sessionId) {
|
||||
}
|
||||
var CONSOLE_ID = "wt-console";
|
||||
var CONSOLE_ICON = "\u{1F5A5}\uFE0F";
|
||||
var ICON_CONSOLE = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { className: "dsh-wt_layoutSvg", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "1.6", y: "2.2", width: "12.8", height: "8.6", rx: "1.5", stroke: "currentColor", strokeWidth: "1.3" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5.2 13.4h5.6", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 10.8v2.6", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })
|
||||
] });
|
||||
function specHasConsoleTab(spec) {
|
||||
return !!spec?.main?.[0]?.tabs?.some((t) => t.content?.kind === "builtin" && t.content.type === "console");
|
||||
}
|
||||
@@ -21772,6 +21811,7 @@ function WorktableSection(props) {
|
||||
const updateInfo = newerUpdateInfo(rawUpdateInfo);
|
||||
const [updateCheckOn, setUpdateCheckOn] = (0, import_react3.useState)(() => localStorage.getItem("dsh.worktable.updateCheck.v1") !== "0");
|
||||
const [updateCopied, setUpdateCopied] = (0, import_react3.useState)(false);
|
||||
const [updateCopyFailed, setUpdateCopyFailed] = (0, import_react3.useState)(false);
|
||||
const [updateStatus, setUpdateStatus] = (0, import_react3.useState)("idle");
|
||||
const updateCheckingRef = (0, import_react3.useRef)(false);
|
||||
const updateAliveRef = (0, import_react3.useRef)(true);
|
||||
@@ -21796,7 +21836,7 @@ function WorktableSection(props) {
|
||||
const ctrl = new AbortController();
|
||||
const timer2 = setTimeout(() => ctrl.abort(), 8e3);
|
||||
try {
|
||||
const r = await fetch(UPDATE_HOST2 + "/api/v1/repos/" + UPDATE_REPO2 + "/releases/latest", { headers: { Accept: "application/json" }, cache: "no-store", signal: ctrl.signal });
|
||||
const r = await fetch(UPDATE_API2, { headers: { Accept: "application/json" }, cache: "no-store", signal: ctrl.signal });
|
||||
if (r.ok) d = await r.json();
|
||||
else if (r.status === 403 || r.status === 404) break;
|
||||
} catch {
|
||||
@@ -21832,11 +21872,19 @@ function WorktableSection(props) {
|
||||
(0, import_react3.useEffect)(() => {
|
||||
if (updateCheckOn) void checkUpdates();
|
||||
}, [updateCheckOn, checkUpdates]);
|
||||
const upgrade = (0, import_react3.useMemo)(
|
||||
() => worktableUpgrade(updateInfo?.latest ?? LOCAL_VERSION),
|
||||
[updateInfo?.latest]
|
||||
);
|
||||
const copyUpgradeAi = async () => {
|
||||
const ok = await copyText(UPGRADE_AI2);
|
||||
const ok = await copyText(upgrade.prompt);
|
||||
if (ok) {
|
||||
setUpdateCopyFailed(false);
|
||||
setUpdateCopied(true);
|
||||
setTimeout(() => setUpdateCopied(false), 2200);
|
||||
} else {
|
||||
setUpdateCopyFailed(true);
|
||||
setTimeout(() => setUpdateCopyFailed(false), 3e3);
|
||||
}
|
||||
};
|
||||
const skipUpdate = () => {
|
||||
@@ -23465,9 +23513,9 @@ function WorktableSection(props) {
|
||||
updateInfo.latest
|
||||
] }),
|
||||
updateInfo.notes && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_updateNotes", children: updateInfo.notes }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_updateCmd", children: UPGRADE_CMD }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_updateCmd", children: upgrade.command }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dsh-wt_updateBtns", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dsh-wt_updateBtn dsh-wt_updateBtnCopy", onClick: () => void copyUpgradeAi(), children: updateCopied ? "\u2713 " + t("update.copied") : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dsh-wt_updateBtn dsh-wt_updateBtnCopy", onClick: () => void copyUpgradeAi(), children: updateCopied ? "\u2713 " + t("update.copied") : updateCopyFailed ? "\u26A0 " + t("update.copyFailed") : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
||||
ICON_SPARK,
|
||||
" ",
|
||||
t("update.copyAi")
|
||||
@@ -24048,7 +24096,7 @@ function WorktableSection(props) {
|
||||
title: t("console.name"),
|
||||
onClick: (e) => clickConsoleCard(e.currentTarget),
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutIcon", children: CONSOLE_ICON }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutIcon", children: ICON_CONSOLE }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutText", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutName", children: t("console.name") }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
||||
"span",
|
||||
|
||||
+30
-1
@@ -382,7 +382,7 @@ function resolveDshHomeSafe() {
|
||||
cachedDshHome = baseDshHome();
|
||||
return cachedDshHome;
|
||||
}
|
||||
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.7";
|
||||
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.10";
|
||||
var name = "dsh-worktable";
|
||||
var inject = ["webServer", "sessions"];
|
||||
var HEALTH_PATH = "/api/worktable/health";
|
||||
@@ -743,6 +743,35 @@ function apply(ctx) {
|
||||
json(res, 200, { plugin: "dsh-worktable", version: PLUGIN_VERSION, ok: true });
|
||||
}
|
||||
});
|
||||
register({
|
||||
kind: "exact",
|
||||
path: "/api/worktable/update-check",
|
||||
handler: async (_req, res) => {
|
||||
const upstream = "https://gitea.ququclean.com/api/v1/repos/xiaoqu/dsh-worktable/releases/latest";
|
||||
const ctrl = new AbortController();
|
||||
const timer = setTimeout(() => ctrl.abort(), 8e3);
|
||||
try {
|
||||
const r = await fetch(upstream, {
|
||||
headers: { Accept: "application/json", "user-agent": "dsh-worktable/" + PLUGIN_VERSION },
|
||||
signal: ctrl.signal
|
||||
});
|
||||
if (!r.ok) {
|
||||
json(res, 502, { error: "upstream status " + r.status });
|
||||
return;
|
||||
}
|
||||
const d = await r.json();
|
||||
json(res, 200, {
|
||||
tag_name: typeof d?.tag_name === "string" ? d.tag_name : "",
|
||||
body: typeof d?.body === "string" ? d.body : "",
|
||||
html_url: typeof d?.html_url === "string" ? d.html_url : ""
|
||||
});
|
||||
} catch (err) {
|
||||
json(res, 502, { error: "upstream unreachable: " + String(err?.message ?? err) });
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
});
|
||||
register({
|
||||
kind: "exact",
|
||||
path: "/api/worktable/file",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "dsh-worktable",
|
||||
"description": "工作台 Worktable:DeepSeek Harness 侧边栏的 agent 级项目容器(应用抽屉)",
|
||||
"version": "0.5.3-local.7",
|
||||
"version": "0.5.3-local.10",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Aisland-SJL/dsh-worktable.git",
|
||||
|
||||
@@ -37,12 +37,21 @@ export function hostPreviewUrl(
|
||||
|
||||
/** Keep update instructions on the active profile; Desktop must use its bundled CLI. */
|
||||
// 本仓发布在自建 Gitea:它不支持 GitHub 的 /releases/latest/download 简写,
|
||||
// 安装命令必须带具体 tag。这里给固定 tag(随发布更新),避免给出 404 的命令。
|
||||
const UPDATE_TGZ = 'https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.7/dsh-worktable.tgz'
|
||||
// 安装命令必须带具体 tag。tag 由调用方传入(等于检查到的新版本),
|
||||
// 不再写死当前版本——否则「有新版本」提示里给的却是自己这一版的地址。
|
||||
const UPDATE_BASE = 'https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download'
|
||||
|
||||
export function worktableUpgrade(protocol = typeof location === 'undefined' ? 'http:' : location.protocol) {
|
||||
export function upgradeCommandFor(tag: string, protocol = typeof location === 'undefined' ? 'http:' : location.protocol): string {
|
||||
const desktop = protocol === 'dsh-app:'
|
||||
const command = 'dsh plugin --profile ' + (desktop ? 'desktop' : 'web') + ' add "' + UPDATE_TGZ + '"'
|
||||
const clean = String(tag || '').trim().replace(/^v/, '')
|
||||
const t = clean ? 'v' + clean : ''
|
||||
const url = t ? UPDATE_BASE + '/' + t + '/dsh-worktable.tgz' : UPDATE_BASE + '/'
|
||||
return 'dsh plugin --profile ' + (desktop ? 'desktop' : 'web') + ' add "' + url + '"'
|
||||
}
|
||||
|
||||
export function worktableUpgrade(tag: string, protocol = typeof location === 'undefined' ? 'http:' : location.protocol) {
|
||||
const desktop = protocol === 'dsh-app:'
|
||||
const command = upgradeCommandFor(tag, protocol)
|
||||
const prompt = desktop
|
||||
? '帮我升级 dsh-worktable。我当前使用官方桌面端:先定位该桌面端自带的 dsh CLI 并准备更新,再提醒我完整退出桌面端。确认退出后使用该 CLI 执行 ' + command + '。不要使用网页端 CLI,不要修改 web profile,不要自动杀进程或重启;完成后提醒我手动重新打开桌面端。'
|
||||
: '帮我升级 dsh-worktable:执行 ' + command + ',完成后提醒我重启 dsh web 并刷新页面'
|
||||
|
||||
@@ -33,9 +33,11 @@ type DockMode = 'footer' | 'float'
|
||||
// ── 更新检查(客户端直连本仓 Gitea Releases API,只读 GET;失败静默)──
|
||||
// 本仓是内部补丁分发仓:上游只发官方版(无本地补丁),
|
||||
// 查上游既看不到本仓版本,国内网络也常失败。
|
||||
const UPDATE_HOST = 'https://gitea.ququclean.com'
|
||||
const UPDATE_REPO = 'xiaoqu/dsh-worktable'
|
||||
const { command: UPGRADE_CMD, prompt: UPGRADE_AI, desktop: DESKTOP_HOST } = worktableUpgrade()
|
||||
// 走宿主中转:页面来源是随机端口 127.0.0.1,直连 Gitea 跨源且无 CORS 头会被拦截
|
||||
const UPDATE_API = '/api/worktable/update-check'
|
||||
// 升级命令必须在「检测到新版本」后按该版本生成(见下方 upgrade 系列 useMemo),
|
||||
// 不能用模块级常量——否则提示里给的是当前已装版本的地址。
|
||||
const DESKTOP_HOST = typeof location !== 'undefined' && location.protocol === 'dsh-app:'
|
||||
// 更新提示图标(手绘 SVG,避免 emoji 跨平台渲染差异)
|
||||
const ICON_SYNC = (
|
||||
<svg viewBox="0 0 16 16" aria-hidden>
|
||||
@@ -51,10 +53,33 @@ const ICON_SPARK = (
|
||||
<path d="M12.6 11.2l.5 1.3 1.3.5-1.3.5-.5 1.3-.5-1.3-1.3-.5 1.3-.5z" fill="currentColor" />
|
||||
</svg>
|
||||
)
|
||||
/**
|
||||
* 复制文案:优先 Clipboard API;不可用(webview 非安全上下文、权限未授予、
|
||||
* 或 API 存在但调用被拒)时回退到 execCommand('copy'),再不行用隐藏 textarea + 选区。
|
||||
* 只返回 true 表示「文本确实进了剪贴板」,避免按钮显示 ✓ 却什么都没复制。
|
||||
*/
|
||||
async function copyText(text: string): Promise<boolean> {
|
||||
try {
|
||||
if (navigator.clipboard?.writeText && window.isSecureContext !== false) {
|
||||
await navigator.clipboard.writeText(text)
|
||||
return true
|
||||
}
|
||||
} catch { /* 继续降级 */ }
|
||||
try {
|
||||
const ta = document.createElement('textarea')
|
||||
ta.value = text
|
||||
ta.setAttribute('readonly', '')
|
||||
ta.style.cssText = 'position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none'
|
||||
document.body.appendChild(ta)
|
||||
ta.select()
|
||||
ta.setSelectionRange(0, ta.value.length)
|
||||
const ok = typeof document.execCommand === 'function' ? document.execCommand('copy') : false
|
||||
document.body.removeChild(ta)
|
||||
if (ok) return true
|
||||
} catch { /* 继续降级 */ }
|
||||
try {
|
||||
if (navigator.clipboard?.writeText) { await navigator.clipboard.writeText(text); return true }
|
||||
} catch { /* fallthrough */ }
|
||||
} catch { /* 全部失败 */ }
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -566,6 +591,20 @@ async function ensureSessionModel(sessionId: string): Promise<void> {
|
||||
const CONSOLE_ID = 'wt-console'
|
||||
const CONSOLE_ICON = '🖥️'
|
||||
|
||||
/**
|
||||
* 控制室图标:内联 SVG 替代 emoji。
|
||||
* emoji 的渲染完全取决于系统字体(Windows Segoe UI Emoji / macOS Apple Color Emoji
|
||||
* 形状与配色都不同),同一份代码在不同机器上长得不一样,看起来也偏旧。
|
||||
* 用 currentColor 描边图标可跟随主题色,两平台一致。
|
||||
*/
|
||||
const ICON_CONSOLE = (
|
||||
<svg className="dsh-wt_layoutSvg" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
||||
<rect x="1.6" y="2.2" width="12.8" height="8.6" rx="1.5" stroke="currentColor" strokeWidth="1.3" />
|
||||
<path d="M5.2 13.4h5.6" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" />
|
||||
<path d="M8 10.8v2.6" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" />
|
||||
</svg>
|
||||
)
|
||||
|
||||
/** 控制室布局是否健全:主窗格首格存在 console 类型标签(旧版关标签的坏存档没有它) */
|
||||
function specHasConsoleTab(spec: LayoutSpec | undefined): boolean {
|
||||
return !!spec?.main?.[0]?.tabs?.some((t) => t.content?.kind === 'builtin' && t.content.type === 'console')
|
||||
@@ -1078,6 +1117,7 @@ function WorktableSection(props: any) {
|
||||
const updateInfo = newerUpdateInfo(rawUpdateInfo)
|
||||
const [updateCheckOn, setUpdateCheckOn] = useState<boolean>(() => localStorage.getItem('dsh.worktable.updateCheck.v1') !== '0')
|
||||
const [updateCopied, setUpdateCopied] = useState(false)
|
||||
const [updateCopyFailed, setUpdateCopyFailed] = useState(false)
|
||||
const [updateStatus, setUpdateStatus] = useState<'idle' | 'checking' | 'uptodate' | 'failed'>('idle')
|
||||
const updateCheckingRef = useRef(false)
|
||||
const updateAliveRef = useRef(true)
|
||||
@@ -1097,7 +1137,7 @@ function WorktableSection(props: any) {
|
||||
const ctrl = new AbortController()
|
||||
const timer = setTimeout(() => ctrl.abort(), 8000) // 单次 8s 超时,计入下一轮重试
|
||||
try {
|
||||
const r = await fetch(UPDATE_HOST + '/api/v1/repos/' + UPDATE_REPO + '/releases/latest', { headers: { Accept: 'application/json' }, cache: 'no-store', signal: ctrl.signal })
|
||||
const r = await fetch(UPDATE_API, { headers: { Accept: 'application/json' }, cache: 'no-store', signal: ctrl.signal })
|
||||
if (r.ok) d = await r.json() as { tag_name?: string; body?: string; html_url?: string }
|
||||
else if (r.status === 403 || r.status === 404) break // 限流/不存在:不再重试
|
||||
} catch { /* 网络抖动/超时:下一轮重试 */ }
|
||||
@@ -1117,9 +1157,22 @@ function WorktableSection(props: any) {
|
||||
}
|
||||
}, [])
|
||||
useEffect(() => { if (updateCheckOn) void checkUpdates() }, [updateCheckOn, checkUpdates])
|
||||
// 升级命令/提示按「检测到的新版本」生成:给出的是要装的版本,而不是当前已装版本。
|
||||
const upgrade = useMemo(
|
||||
() => worktableUpgrade(updateInfo?.latest ?? LOCAL_VERSION),
|
||||
[updateInfo?.latest],
|
||||
)
|
||||
const copyUpgradeAi = async () => {
|
||||
const ok = await copyText(UPGRADE_AI)
|
||||
if (ok) { setUpdateCopied(true); setTimeout(() => setUpdateCopied(false), 2200) }
|
||||
const ok = await copyText(upgrade.prompt)
|
||||
if (ok) {
|
||||
setUpdateCopyFailed(false)
|
||||
setUpdateCopied(true)
|
||||
setTimeout(() => setUpdateCopied(false), 2200)
|
||||
} else {
|
||||
// 复制失败要让用户看见,否则就是「点了没反应」
|
||||
setUpdateCopyFailed(true)
|
||||
setTimeout(() => setUpdateCopyFailed(false), 3000)
|
||||
}
|
||||
}
|
||||
const skipUpdate = () => {
|
||||
if (updateInfo) {
|
||||
@@ -2735,10 +2788,10 @@ function buildCustomLayoutPrompt(req: string): string {
|
||||
<div className="dsh-wt_updateHead"><span className="dsh-wt_updateDot" />{t('update.available')} · v{updateInfo.latest}</div>
|
||||
<div className="dsh-wt_updateVers">{t('update.current')} v{LOCAL_VERSION} → v{updateInfo.latest}</div>
|
||||
{updateInfo.notes && <div className="dsh-wt_updateNotes">{updateInfo.notes}</div>}
|
||||
<div className="dsh-wt_updateCmd">{UPGRADE_CMD}</div>
|
||||
<div className="dsh-wt_updateCmd">{upgrade.command}</div>
|
||||
<div className="dsh-wt_updateBtns">
|
||||
<button type="button" className="dsh-wt_updateBtn dsh-wt_updateBtnCopy" onClick={() => void copyUpgradeAi()}>
|
||||
{updateCopied ? '✓ ' + t('update.copied') : <>{ICON_SPARK} {t('update.copyAi')}</>}
|
||||
{updateCopied ? '✓ ' + t('update.copied') : updateCopyFailed ? '⚠ ' + t('update.copyFailed') : <>{ICON_SPARK} {t('update.copyAi')}</>}
|
||||
</button>
|
||||
<button type="button" className="dsh-wt_updateBtn" onClick={skipUpdate}>{t('update.skip')}</button>
|
||||
</div>
|
||||
@@ -3241,7 +3294,7 @@ function buildCustomLayoutPrompt(req: string): string {
|
||||
title={t('console.name')}
|
||||
onClick={(e) => clickConsoleCard(e.currentTarget as HTMLElement)}
|
||||
>
|
||||
<span className="dsh-wt_layoutIcon">{CONSOLE_ICON}</span>
|
||||
<span className="dsh-wt_layoutIcon">{ICON_CONSOLE}</span>
|
||||
<span className="dsh-wt_layoutText">
|
||||
<span className="dsh-wt_layoutName">{t('console.name')}</span>
|
||||
</span>
|
||||
|
||||
@@ -230,6 +230,7 @@ export const zh = {
|
||||
'update.available': '新版本可用',
|
||||
'update.current': '当前版本',
|
||||
'update.copyAi': '复制 AI 提示词',
|
||||
'update.copyFailed': '复制失败,请手动选中命令',
|
||||
'update.skip': '忽略此版本',
|
||||
'update.autoCheck': '自动检查更新',
|
||||
'update.checkNow': '立即检查',
|
||||
@@ -472,6 +473,7 @@ export const en = {
|
||||
'update.available': 'New version available',
|
||||
'update.current': 'Current version',
|
||||
'update.copyAi': 'Copy AI prompt',
|
||||
'update.copyFailed': 'Copy failed, select the command manually',
|
||||
'update.skip': 'Skip this version',
|
||||
'update.autoCheck': 'Auto-check updates',
|
||||
'update.checkNow': 'Check now',
|
||||
|
||||
@@ -492,8 +492,8 @@ function boxPayload(x0: number, y0: number, x1: number, y1: number): { primary:
|
||||
return { primary, line, candidates, limited, src }
|
||||
}
|
||||
|
||||
/** 更新方法:复制给 AI 的升级指令(插件不自更新;升级由用户或其 Agent 执行 + 重启) */
|
||||
const { prompt: UPGRADE_AI } = worktableUpgrade()
|
||||
/** 更新方法:复制给 AI 的升级指令(插件不自更新;升级由用户或其 Agent 执行 + 重启)。
|
||||
* 命令按「检测到的新版本」生成 —— 见下方 onCopyUpgrade 里的 worktableUpgrade(tag)。 */
|
||||
|
||||
async function copyTextSafe(text: string): Promise<boolean> {
|
||||
try { if (navigator.clipboard?.writeText) { await navigator.clipboard.writeText(text); return true } } catch {}
|
||||
@@ -1764,7 +1764,9 @@ function ConsolePane() {
|
||||
}
|
||||
const [updCopied, setUpdCopied] = useState(false)
|
||||
const onCopyUpgrade = async () => {
|
||||
const ok = await copyTextSafe(UPGRADE_AI)
|
||||
// 按检测到的新版本生成命令;没有新版本时退回当前版本(保持原有可复制行为)
|
||||
const { prompt } = worktableUpgrade(updInfo?.latest ?? LOCAL_VERSION)
|
||||
const ok = await copyTextSafe(prompt)
|
||||
if (ok) { setUpdCopied(true); window.setTimeout(() => setUpdCopied(false), 2200) }
|
||||
}
|
||||
const onSkipVersion = () => {
|
||||
|
||||
@@ -234,7 +234,10 @@ export const css = xtermCss + '\n' + [
|
||||
'.dsh-wt_layout:hover{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}',
|
||||
'.dsh-wt_layout[data-on=true]{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}',
|
||||
'.dsh-wt_layout[data-on=true] .dsh-wt_layoutName{color:var(--dsw-alias-state-accent-primary,#4f8ef7)}',
|
||||
'.dsh-wt_layoutIcon{flex:none;font-size:15px}',
|
||||
'.dsh-wt_layoutIcon{flex:none;font-size:15px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px}',
|
||||
// 内联 SVG 图标:跟随文字色,两平台渲染一致(emoji 依赖系统字体,形状/配色不统一)
|
||||
'.dsh-wt_layoutSvg{width:15px;height:15px;display:block;flex:none;color:var(--dsw-alias-label-secondary,#9aa4b2)}',
|
||||
'.dsh-wt_layout[data-on=true] .dsh-wt_layoutSvg{color:var(--dsw-alias-state-accent-primary,#4f8ef7)}',
|
||||
'.dsh-wt_layoutText{flex:1;min-width:0;display:flex;flex-direction:column;gap:0}',
|
||||
'.dsh-wt_layoutName{font-size:12px;font-weight:400;line-height:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
||||
// 箭头与项目名同一行高 + 字面中心对齐;› 墨迹在字面框内偏下,整体上移 1px 使视觉居中
|
||||
@@ -653,7 +656,11 @@ export const css = xtermCss + '\n' + [
|
||||
'.dsh-wt_updateBtn svg{width:12px;height:12px;flex:none}',
|
||||
'.dsh-wt_updateBadge svg{width:12px;height:12px;flex:none}',
|
||||
'.dsh-wt_updateBtn:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.06))}',
|
||||
'.dsh-wt_updateBtnCopy{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:rgba(79,142,247,.18);color:#cfe0ff}',
|
||||
// 「复制 AI 提示词」主按钮:原来用 rgba(...,.18) 半透明底 + 浅蓝字,在实际主题上
|
||||
// 对比度极低(截图里几乎看不见)。改为实心强调色 + 白字,hover/active 明确反馈。
|
||||
'.dsh-wt_updateBtnCopy{border-color:transparent;background:var(--dsw-alias-state-accent-primary,#4f8ef7);color:#fff;font-weight:600}',
|
||||
'.dsh-wt_updateBtnCopy:hover{background:var(--dsw-alias-state-accent-primary-hover,#3f7de0);color:#fff}',
|
||||
'.dsh-wt_updateBtnCopy:active{transform:translateY(.5px)}',
|
||||
'.dsh-wt_updateHint{font-size:10.5px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}',
|
||||
'.dsh-wt_versionRow{margin-top:8px;padding-top:8px;border-top:1px solid var(--dsw-alias-border-l1,#262b36);display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}',
|
||||
'.dsh-wt_updateToggle{display:flex;align-items:center;gap:6px;cursor:pointer;user-select:none}',
|
||||
|
||||
@@ -3,8 +3,9 @@ declare const __WT_VERSION__: string
|
||||
export const LOCAL_VERSION = typeof __WT_VERSION__ === 'undefined' ? 'dev' : __WT_VERSION__
|
||||
// 本仓是内部补丁分发仓,更新源必须是自己的 Gitea,而不是上游 GitHub:
|
||||
// 上游只发布官方版(无本地补丁),查它既看不到本仓版本,国内网络也常失败。
|
||||
const UPDATE_HOST = 'https://gitea.ququclean.com'
|
||||
const UPDATE_REPO = 'xiaoqu/dsh-worktable'
|
||||
// 走宿主中转(/api/worktable/update-check):页面来源是随机端口的 127.0.0.1,
|
||||
// 直连 Gitea 属跨源且 Gitea 无 CORS 头,浏览器会拦截请求。
|
||||
const UPDATE_API = '/api/worktable/update-check'
|
||||
|
||||
export type UpdateStatus = 'idle' | 'checking' | 'uptodate' | 'failed'
|
||||
export type UpdateInfo = { latest: string; notes: string; url: string }
|
||||
@@ -95,7 +96,7 @@ export async function checkUpdate(force = false): Promise<{ status: UpdateStatus
|
||||
const ctrl = new AbortController()
|
||||
const timer = setTimeout(() => ctrl.abort(), 8000)
|
||||
try {
|
||||
const r = await fetch(UPDATE_HOST + '/api/v1/repos/' + UPDATE_REPO + '/releases/latest', { headers: { Accept: 'application/json' }, cache: 'no-store', signal: ctrl.signal })
|
||||
const r = await fetch(UPDATE_API, { headers: { Accept: 'application/json' }, cache: 'no-store', signal: ctrl.signal })
|
||||
if (r.ok) d = (await r.json()) as { tag_name?: string; body?: string; html_url?: string }
|
||||
else if (r.status === 403 || r.status === 404) break
|
||||
} catch { /* 网络抖动/超时:下一轮重试 */ }
|
||||
|
||||
@@ -368,6 +368,36 @@ export function apply(ctx: Context) {
|
||||
},
|
||||
})
|
||||
|
||||
// 更新检查中转:客户端页面来源是 http://127.0.0.1:<随机端口>,直接 fetch
|
||||
// 自建 Gitea 属跨源请求;Gitea 不返回 Access-Control-Allow-Origin,浏览器会拦截
|
||||
// (表现为「立即检查」无反应 / 「上次检查未成功」)。改由宿主服务端代取,同源无 CORS。
|
||||
register({
|
||||
kind: 'exact',
|
||||
path: '/api/worktable/update-check',
|
||||
handler: async (_req: any, res: any) => {
|
||||
const upstream = 'https://gitea.ququclean.com/api/v1/repos/xiaoqu/dsh-worktable/releases/latest'
|
||||
const ctrl = new AbortController()
|
||||
const timer = setTimeout(() => ctrl.abort(), 8000)
|
||||
try {
|
||||
const r = await fetch(upstream, {
|
||||
headers: { Accept: 'application/json', 'user-agent': 'dsh-worktable/' + PLUGIN_VERSION },
|
||||
signal: ctrl.signal,
|
||||
})
|
||||
if (!r.ok) { json(res, 502, { error: 'upstream status ' + r.status }); return }
|
||||
const d: any = await r.json()
|
||||
json(res, 200, {
|
||||
tag_name: typeof d?.tag_name === 'string' ? d.tag_name : '',
|
||||
body: typeof d?.body === 'string' ? d.body : '',
|
||||
html_url: typeof d?.html_url === 'string' ? d.html_url : '',
|
||||
})
|
||||
} catch (err: any) {
|
||||
json(res, 502, { error: 'upstream unreachable: ' + String(err?.message ?? err) })
|
||||
} finally {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// 本地文件读取(资源管理器点击 .html 后浏览器标签内打开)
|
||||
register({
|
||||
kind: 'exact',
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
> 每条标注日期、动机、落点与验证方式。改动在 `01_content/src/`,经 `npm run build`
|
||||
> 产出 `lib/`;发布物由 `npm run pack`(`01_content/release-prep.mjs`)生成。
|
||||
|
||||
当前版本:**0.5.3-local.7**(2026-12-02)
|
||||
产物:`01_content/dist/v0.5.3-local.7/dsh-worktable.tgz`,485166 字节,
|
||||
sha256 `8c30d35f7b01a2242a311f36d5474c2764fef903049fbbbc3f2c14dfad126bec`
|
||||
当前版本:**0.5.3-local.10**(2026-12-02)
|
||||
产物:`01_content/dist/v0.5.3-local.10/dsh-worktable.tgz`,486219 字节,
|
||||
sha256 `2ff7d45a3ea1d0d2344a72f313439be7dacdf52a9e4c9317ba11b54e1f58945f`
|
||||
|
||||
---
|
||||
|
||||
@@ -156,6 +156,16 @@ fetch('https://api.github.com/repos/Aisland-SJL/dsh-worktable/releases/latest')
|
||||
|
||||
**测试**:`04_test/sidebar-popup.test.mjs` 的 `releaseUrl` 断言同步改为新 API 地址。
|
||||
|
||||
**0.5.3-local.8 修正(2026-12-02)**:直连 Gitea API 仍不通 —— 页面来源是
|
||||
`http://127.0.0.1:<随机端口>`,请求 `https://gitea.ququclean.com/api/...` 属跨源,
|
||||
而 **Gitea 不返回 `Access-Control-Allow-Origin`**,浏览器直接拦截 fetch
|
||||
(表现为「立即检查」无反应、长期显示「上次检查未成功」)。
|
||||
|
||||
改为**宿主中转**:`src/index.ts` 新增 `/api/worktable/update-check` 路由,
|
||||
由服务端(Node,无 CORS 约束)代取 Gitea 的 `releases/latest`,客户端只请求同源路径。
|
||||
该路由沿既有约定**需要鉴权**(`request-auth.test.mjs` 要求除 health/preview-static 外
|
||||
所有路由都必须拒绝未鉴权请求)。
|
||||
|
||||
**版本比较无需改动**:`cmpVer('v0.5.2-local.6', '0.5.3-local.5') = -1`,
|
||||
core 段 0.5.2 < 0.5.3 已能正确判定「有新版」。
|
||||
|
||||
|
||||
@@ -38,14 +38,19 @@ test('Unknown stream protocols are rejected', () => {
|
||||
})
|
||||
|
||||
test('Web update instructions retain the web profile', () => {
|
||||
const { command, prompt, desktop } = worktableUpgrade('https:')
|
||||
const { command, prompt, desktop } = worktableUpgrade('0.5.3-local.10', 'https:')
|
||||
assert.equal(desktop, false)
|
||||
assert.match(command, /--profile web add/)
|
||||
assert.match(prompt, /重启 dsh web/)
|
||||
// 命令必须指向「要装的版本」,不能是当前已装版本(否则提示与命令自相矛盾)
|
||||
assert.match(command, /\/releases\/download\/v0\.5\.3-local\.10\/dsh-worktable\.tgz/)
|
||||
const older = worktableUpgrade('0.5.3-local.9', 'https:').command
|
||||
assert.match(older, /v0\.5\.3-local\.9/)
|
||||
assert.doesNotMatch(older, /v0\.5\.3-local\.10/)
|
||||
})
|
||||
|
||||
test('Desktop update instructions require its bundled CLI and manual restart', () => {
|
||||
const { command, prompt, desktop } = worktableUpgrade('dsh-app:')
|
||||
const { command, prompt, desktop } = worktableUpgrade('0.5.3-local.10', 'dsh-app:')
|
||||
assert.equal(desktop, true)
|
||||
assert.match(command, /--profile desktop add/)
|
||||
assert.doesNotMatch(command, /--profile web/)
|
||||
|
||||
@@ -305,7 +305,7 @@ function testConsolePresentation() {
|
||||
|
||||
async function testUpdatePresentation() {
|
||||
// 更新源是本仓 Gitea(内部补丁分发仓),不是上游 GitHub
|
||||
const releaseUrl = 'https://gitea.ququclean.com/api/v1/repos/xiaoqu/dsh-worktable/releases/latest'
|
||||
const releaseUrl = '/api/worktable/update-check'
|
||||
for (const outcome of ['older', 'same', 'forbidden', 'invalid', 'invalid-prefix', 'skip']) {
|
||||
let response = { status: 200, tag: 'v9.0.0' }
|
||||
let requests = 0
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> ## 📦 本仓库是内部补丁分发仓,不是上游源码仓
|
||||
>
|
||||
> 上游:<https://github.com/Aisland-SJL/dsh-worktable> | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.7`)。
|
||||
> 上游:<https://github.com/Aisland-SJL/dsh-worktable> | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.10`)。
|
||||
> 下面从「Screenshots」开始的全部内容是上游 README 原文;本地改动逐条记录见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md)。
|
||||
|
||||
### 要不要装
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
### 安装
|
||||
|
||||
当前版本 **v0.5.3-local.7**:
|
||||
当前版本 **v0.5.3-local.10**:
|
||||
|
||||
```bash
|
||||
dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.7/dsh-worktable.tgz"
|
||||
dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.10/dsh-worktable.tgz"
|
||||
```
|
||||
|
||||
- **桌面端:先完全退出 Slark,再执行命令**,装完手动重开;不要在宿主运行时安装。
|
||||
- `--profile web` 按你自己的 profile 名字改。
|
||||
- 资产 `dsh-worktable.tgz`,485166 字节,sha256:
|
||||
`8c30d35f7b01a2242a311f36d5474c2764fef903049fbbbc3f2c14dfad126bec`
|
||||
- 资产 `dsh-worktable.tgz`,486219 字节,sha256:
|
||||
`2ff7d45a3ea1d0d2344a72f313439be7dacdf52a9e4c9317ba11b54e1f58945f`
|
||||
(下载后可 `Get-FileHash dsh-worktable.tgz -Algorithm SHA256` 核对)
|
||||
- 声明兼容的 DSH 版本:`0.2.0-rc.2` / `0.2.1-rc.3` / `0.2.1-rc.5` / `0.2.2-alpha.2`。
|
||||
宿主不在这个列表里时,安装会被兼容性检查直接拒绝并回滚。
|
||||
@@ -50,7 +50,7 @@ dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/r
|
||||
|
||||
### 升级与回退
|
||||
|
||||
- 装上 `0.5.3-local.7` 后,插件不会提示升级到 0.5.1。
|
||||
- 装上 `0.5.3-local.10` 后,插件不会提示升级到 0.5.1。
|
||||
- 上游发布 0.5.2 及以上时插件会提示升级;**一旦升级就回到没有补丁的状态**,重启又会丢数据。新版本需要把补丁重新合并(改动清单见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md))。
|
||||
- 回退官方版:
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user