Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/release-notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,27 @@ jobs:
console.error(e.version, ': date must be YYYY-MM-DD, got', JSON.stringify(e.date));
process.exit(1);
}
// #3719 item4: optional bilingual summary + version targeting.
if (e.summaryZh !== undefined && (typeof e.summaryZh !== 'string' || !e.summaryZh.trim())) {
console.error(e.version, ': summaryZh must be a non-empty string when present');
process.exit(1);
}
if (e.summaryZh !== undefined && e.summaryZh.length > 400) {
console.error(e.version, ': summaryZh too long (' + e.summaryZh.length + ' chars, cap 400)');
process.exit(1);
}
if (e.minVersion !== undefined && !semver.valid(e.minVersion)) {
console.error(e.version, ': minVersion must be valid semver, got', JSON.stringify(e.minVersion));
process.exit(1);
}
if (e.maxVersion !== undefined && !semver.valid(e.maxVersion)) {
console.error(e.version, ': maxVersion must be valid semver, got', JSON.stringify(e.maxVersion));
process.exit(1);
}
if (e.minVersion !== undefined && e.maxVersion !== undefined && semver.gt(e.minVersion, e.maxVersion)) {
console.error(e.version, ': minVersion must be <= maxVersion');
process.exit(1);
}
}
"

Expand Down
3 changes: 3 additions & 0 deletions release-notes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Companion package mechanics mirror `advisories/` (#1481):
| date | no | `YYYY-MM-DD` release date |
| tier | yes | `routine` (default) / `recommended` (restart soon, record-only) / `critical` (see below) |
| summary | yes | One user-meaningful line, ≤400 chars, model-written|
| summaryZh | no | Chinese one-liner (≤400 chars) — zh-locale web surfaces pick it; `/acp` text stays English. Unset = every locale uses `summary` |
| minVersion | no | Targeting: only RUNNING versions ≥ this (inclusive) see the entry. Unset = no floor |
| maxVersion | no | Targeting: only RUNNING versions ≤ this (inclusive) see the entry. Unset = no ceiling |

Rules: newest-first, ≤20 entries, no duplicates. **Entries are opt-in since
2026-10-04**: only severe releases get one; ordinary releases ship with NO
Expand Down
5 changes: 4 additions & 1 deletion src/agent/dsh-native-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,14 @@ const SLOW_POLL_INTERVAL_MS = 10000;
// the web UI's own nav terminology (src/web/i18n.ts) so each tab reads like
// the title of the page inside the frame. "connect" stays out: it documents
// how OTHER clients reach this proxy, which makes no sense from inside dsh.
const PAGE_IDS = ["overview", "sessions", "config", "logs"] as const;
const PAGE_IDS = ["overview", "sessions", "config", "logs", "updates"] as const;
type PageId = (typeof PAGE_IDS)[number];
const PAGE_KEYS: Record<PageId, string> = {
overview: "tab_overview",
sessions: "tab_sessions",
config: "tab_config",
logs: "tab_logs",
updates: "tab_updates",
};

// #3816: the exact field a remote user adds to enable the #3373 relay. A
Expand Down Expand Up @@ -358,6 +359,7 @@ const zh: Dict = {
"tab_sessions": "会话",
"tab_config": "配置",
"tab_logs": "日志",
"tab_updates": "版本",
"tab_ctx": "上下文",
"ctx_waiting": "等待首个模型请求…",
"ctx_nodata": "暂无上下文数据——完成一次模型请求后自动刷新。",
Expand All @@ -378,6 +380,7 @@ const en: Dict = {
"tab_sessions": "Sessions",
"tab_config": "Config",
"tab_logs": "Logs",
"tab_updates": "Versions",
"tab_ctx": "Context",
"ctx_waiting": "Waiting for the first model request…",
"ctx_nodata": "No context data yet — refreshes automatically after the first model request.",
Expand Down
20 changes: 14 additions & 6 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { configFile as defaultConfigFile } from "./paths.js";
import { log as loggerLog } from "./logger.js";
import { createAutoRestartHandler } from "./restart.js";
import { checkForUpdate, startAutoUpdate } from "./update.js";
import { registerUpdateActions } from "./server/update-actions.js";
import { startAdvisoryWatcher, getAdvisoryState, advisoryDeferring, advisoryBlocksVersion, advisoryAwaitingFirstCheck } from "./advisory.js";
import { startReleaseNotesWatcher } from "./update-notes.js";
import { resolveProxy } from "./upstream-proxy.js";
Expand Down Expand Up @@ -727,14 +728,16 @@ export async function main(): Promise<void> {

// Start background auto-update after the server is listening so a slow
// registry check never delays startup or races the listen socket.
if (opts.autoUpdate) {
// Resolver reads opts fields per call, so web-UI hot-reload of proxy
// settings (server.ts mutates opts in place) is picked up live (#609).
startAutoUpdate({
// Resolver reads opts fields per call, so web-UI hot-reload of proxy
// settings (server.ts mutates opts in place) is picked up live (#609).
// #3719: one shared options object — the background loop and the web
// 更新/Updates tab's manual actions run on identical throttle/lock/
// proxy/advisory gates.
const updateOpts = {
packageName: PACKAGE_NAME,
currentVersion: VERSION,
autoUpdate: true,
resolveProxy: (url) => resolveProxy(opts.routes, opts.proxy, url, opts.proxyFallback),
resolveProxy: (url: string) => resolveProxy(opts.routes, opts.proxy, url, opts.proxyFallback),
updateTag: opts.updateTag,
// F2 (review): an advisory whose target cannot be resolved on the
// registry must not stall the normal self-update loop forever —
Expand All @@ -761,8 +764,13 @@ export async function main(): Promise<void> {
log: loggerLog,
destroyLingeringSockets: restartForceCloseOf(server),
}),
});
};
// The manual channel is independent of the auto channel: installs whose
// auto-update is off still need the panel's 立即检查/升级 buttons to work.
if (opts.autoUpdate) {
startAutoUpdate(updateOpts);
}
registerUpdateActions(updateOpts);
// #1481: the advisory watcher runs independently of autoUpdate — its whole
// point is to reach installs whose auto-update is off.
if (opts.advisoryCheck) {
Expand Down
10 changes: 10 additions & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function tailLooksTerminal(tail: string, protocol: WireProtocol | "responses"):
/"type"\s*:\s*"response\.(?:completed|failed|incomplete)"/.test(tail);
}
import { degenerateTurnWarning, endsWithDraftClose, requestExpectsProseSummary } from "./degenerate-turn.js";
import { getChangelog, latestChangelog, warmChangelogOnce } from "./web/changelog.js";
import { PANEL_BOX_FOOTER } from "./acp-panel.js";
import { excludeDeadRefRanges } from "./acp-status.js";
import { describeAdvisory, getAdvisoryState } from "./advisory.js";
Expand Down Expand Up @@ -1723,6 +1724,15 @@ export function handlePluginStatus(conversationId: string, res: import("node:htt
if (webUrl !== undefined) {
preFooter.push(`Web UI: ${webUrl}`);
}
// #3719: latest-release pointer — sync cache read only, so the status path
// stays network-free and fast; the web endpoint (and the fire-and-forget
// refresh below) warm the cache. Fail silent: no line until a fetch lands.
const clLatest = latestChangelog();
if (clLatest !== undefined) {
preFooter.push(`changelog: ${clLatest.tag} ${clLatest.url}`);
} else {
warmChangelogOnce(); // once per process; never throws
}
if (panel !== undefined && preFooter.length > 0) {
// Escape $ so advisory text (remote doc content) cannot be read as
// replace() pattern syntax ($&, $\`, $') and corrupt the box lines.
Expand Down
58 changes: 58 additions & 0 deletions src/server/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { handlePluginAttribution, handlePluginCompact, handlePluginFork, handleP
import { parseAgentProviderReport, recordAgentProviders, agentProviderRecipes, sanitizeAgentProviderField } from "../agent-providers.js";
import { defaultLogFile } from "../paths.js";
import { getUpdateVisibility, updateBannerPayload } from "../update-notes.js";
import { installVersionAction, triggerManualCheck, updateActionsAvailable, updateStateSnapshot } from "./update-actions.js";
import { getUnrecognizedPathStats } from "./observability.js";
import { getStore } from "../persist.js";
import { BodyTooLargeError, headerValue, readBody } from "../server.js";
Expand All @@ -31,6 +32,7 @@ import { detectStaleInstall, getLastInstall } from "../update.js";
import { getPlannedUpgrade, getUpdatePolicyState } from "../update-policy.js";
import { PACKAGE_NAME, VERSION, BUILD_COMMIT } from "../version.js";
import { buildBlockContent, buildMessageContent, buildOverview, buildSessionDetail, buildSessionList, buildSessionPage, buildSessionTree, handleConfigGet, handleConfigPut, hiddenEmptyCount, renderUI, type BlockContentView } from "../web/index.js";
import { handleChangelogGet } from "../web/changelog.js";
import { buildSessionReportMd, buildSessionReportSvg } from "../web/report.js";
import { queryLogLines } from "../web/logs-query.js";
import { buildDiagnostics } from "../web/diagnostics.js";
Expand Down Expand Up @@ -294,6 +296,21 @@ export async function handleAdminRoute(req: http.IncomingMessage, res: http.Serv
return;
}
if (req.method === "GET" && req.url === "/__bili/config") return handleConfigGet(res);
// #3719: per-release notes for the panel's changelog section — same
// read-only admin gating as every other /__bili/ GET above (the gates run
// before dispatch). Always answers 200; offline degrades to empty+error.
if (req.method === "GET" && req.url === "/__bili/changelog") return handleChangelogGet(res);
// #3719: dedicated 更新/Updates tab — self-update state plus manual
// check/install actions. Same gating as every /__bili/ route above (the
// gates run before dispatch); an unwired process (autoUpdate off) answers
// the state read normally and the action POSTs with fail-soft error strings.
if (req.method === "GET" && req.url === "/__bili/update/state") {
res.writeHead(200, { "content-type": "application/json" });
res.end(JSON.stringify(await updateStateSnapshot(VERSION)));
return;
}
if (req.method === "POST" && req.url === "/__bili/update/check") return handleUpdateCheck(res);
if (req.method === "POST" && req.url === "/__bili/update/install") return handleUpdateInstall(req, res, log);
if (req.method === "PUT" && req.url === "/__bili/config") {
return handleConfigPut(req, res, () => {
const fresh = loadOptions();
Expand Down Expand Up @@ -835,6 +852,47 @@ function handleConflictsClear(url: string, res: http.ServerResponse, log: (level
res.end(JSON.stringify({ ok: true, cleared }, null, 2));
}

// ---- #3719: web 更新/Updates tab actions ---------------------------------

/** POST /__bili/update/check — force one registry check through the shared
* update options (same lock/throttle/proxy gates as the background loop).
* Always HTTP 200: an unwired process answers {ok:false, error} so the panel
* can show the string verbatim instead of failing the fetch. */
async function handleUpdateCheck(res: http.ServerResponse): Promise<void> {
if (!updateActionsAvailable()) {
res.writeHead(200, { "content-type": "application/json" });
res.end(JSON.stringify({ ok: false, error: "self-update not wired in this process" }, null, 2));
return;
}
res.writeHead(200, { "content-type": "application/json" });
res.end(JSON.stringify(await triggerManualCheck(), null, 2));
}

/** POST /__bili/update/install {"version":"x.y.z"} — pin a specific version
* (upgrade or rollback). Malformed JSON or a version outside plain semver
* characters → 400 like the other POSTs; execution always answers 200
* {ok, error?} with the updater's own result shape. */
async function handleUpdateInstall(req: http.IncomingMessage, res: http.ServerResponse, log: (level: string, msg: string) => void): Promise<void> {
let rawVersion: string | undefined;
try {
const doc: unknown = JSON.parse((await readBody(req)).toString("utf8"));
if (doc && typeof doc === "object" && typeof (doc as { version?: unknown })["version"] === "string") rawVersion = (doc as { version: string })["version"];
} catch {
res.writeHead(400, { "content-type": "application/json" });
res.end(JSON.stringify({ error: 'expected JSON body {"version": "<x.y.z>"}' }, null, 2));
return;
}
const version = rawVersion?.trim();
if (version === undefined || version.length === 0 || !/^[0-9A-Za-z.+-]+$/.test(version)) {
res.writeHead(400, { "content-type": "application/json" });
res.end(JSON.stringify({ error: "version must be plain semver characters (digits, dots, +, -) only" }, null, 2));
return;
}
log("info", `[update] web panel requested install ${version}`);
res.writeHead(200, { "content-type": "application/json" });
res.end(JSON.stringify(await installVersionAction(version), null, 2));
}

// #2861: server-side dismissal of a host-plugin notice (body {"id": string}).
async function handleHostPluginDismiss(req: http.IncomingMessage, res: http.ServerResponse, log: (level: string, msg: string) => void): Promise<void> {
let id = "";
Expand Down
Loading
Loading