pi-web-ui 0.112.0 → 0.113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +64 -1
  2. package/README.md +1 -7
  3. package/README.zh-CN.md +1 -7
  4. package/README.zh-TW.md +1 -7
  5. package/bin/pi-web-ui.mjs +423 -50
  6. package/dist/gh-comment-781.md +5 -0
  7. package/dist/server/agent-service-daemon.js +29 -4
  8. package/dist/server/agent-service.js +222 -36
  9. package/dist/server/canvas/canvas-agent-tool.js +2 -0
  10. package/dist/server/canvas/canvas-orchestrator.js +40 -1
  11. package/dist/server/canvas/pstack-skills-data.js +498 -0
  12. package/dist/server/control-socket.js +6 -2
  13. package/dist/server/dispatch-domain-handlers.js +36 -11
  14. package/dist/server/dsh/dsh-agent-service.js +52 -4
  15. package/dist/server/durable/durable-driver.js +37 -98
  16. package/dist/server/durable/durable-event-projector.js +253 -0
  17. package/dist/server/engine-probe.js +35 -11
  18. package/dist/server/files-service.js +72 -8
  19. package/dist/server/index.js +74 -50
  20. package/dist/server/model-admin.js +185 -63
  21. package/dist/server/plugins.js +10 -6
  22. package/dist/server/remote-ssh-service.js +110 -12
  23. package/dist/server/serialize.js +1 -1
  24. package/dist/server/settings-service.js +36 -48
  25. package/dist/server/setup-page.js +632 -0
  26. package/dist/server/skill-discovery.js +361 -59
  27. package/dist/server/skill-maintenance.js +231 -0
  28. package/dist/server/skill-tool.js +32 -3
  29. package/dist/server/soft-cap.js +29 -7
  30. package/dist/server/subagents.js +246 -31
  31. package/dist/server/tool-host-factories.js +2 -0
  32. package/dist/server/tool-manager.js +106 -28
  33. package/dist/server/universal/drivers/claude-code.js +96 -4
  34. package/dist/server/universal/universal-session.js +19 -0
  35. package/dist/server/webui-context.js +6 -6
  36. package/dist/test-artifact.md +9 -0
  37. package/dist/test-preview-modal.md +11 -0
  38. package/dist/test-report.html +20 -0
  39. package/package.json +1 -1
  40. package/plugin-sdk/index.d.ts +17 -3
  41. package/plugins/catalog.json +10 -0
  42. package/web/dist/assets/{TerminalPanel-Dqr1dK28.js → TerminalPanel-Ci55JtJL.js} +2 -2
  43. package/web/dist/assets/index-ByiO9f-N.js +2008 -0
  44. package/web/dist/assets/index-ycGLh4a4.css +1 -0
  45. package/web/dist/index.html +2 -2
  46. package/web/dist/sw.js +1 -1
  47. package/web/dist/assets/index-Dh8BX-lP.js +0 -720
  48. package/web/dist/assets/index-DqrC1I_a.css +0 -1
@@ -206,20 +206,39 @@ export async function probeDsh() {
206
206
  /**
207
207
  * 探测 Claude Code 引擎状态。
208
208
  */
209
- export async function probeClaude() {
209
+ export async function probeClaude(force = false) {
210
210
  const pkgName = ENGINE_PACKAGES.claude.packageName;
211
211
  try {
212
212
  const res = await probeClaudeCode();
213
- return {
214
- id: "claude",
215
- installed: res.installed,
216
- packageName: pkgName,
217
- version: res.version,
218
- };
213
+ if (res.installed) {
214
+ return {
215
+ id: "claude",
216
+ installed: true,
217
+ packageName: pkgName,
218
+ version: res.version,
219
+ };
220
+ }
221
+ }
222
+ catch {
223
+ /* ignore */
224
+ }
225
+ // 降级兜底:某些环境(如 fnm/nvm 目录未生成直接软链,或全局通过 npm 安装了包但 postinstall 尚未就绪)
226
+ // 尝试通过全局包管理器探测是否已安装该包
227
+ try {
228
+ const globalProbe = probeGlobalPackage(pkgName, { refresh: force });
229
+ if (globalProbe.installed) {
230
+ return {
231
+ id: "claude",
232
+ installed: true,
233
+ packageName: pkgName,
234
+ version: globalProbe.version,
235
+ };
236
+ }
219
237
  }
220
238
  catch {
221
- return { id: "claude", installed: false, packageName: pkgName };
239
+ /* ignore */
222
240
  }
241
+ return { id: "claude", installed: false, packageName: pkgName };
223
242
  }
224
243
  /**
225
244
  * 探测 Pi Durable 引擎状态。
@@ -258,10 +277,10 @@ export async function probeEngine(id, force = false) {
258
277
  result = await probeDsh();
259
278
  }
260
279
  else if (id === "claude") {
261
- result = await probeClaude();
280
+ result = await probeClaude(force);
262
281
  }
263
282
  else if (id === "durable") {
264
- result = await probeDurable();
283
+ result = await probeDurable(force);
265
284
  }
266
285
  else {
267
286
  result = { id: id, installed: false };
@@ -285,7 +304,12 @@ export async function probeAllEngines(force = false) {
285
304
  if (!force && allFresh && entries.length > 0) {
286
305
  return entries.map(toPublicStatus);
287
306
  }
288
- const [pi, dsh, claude, durable] = await Promise.all([probePi(), probeDsh(), probeClaude(), probeDurable()]);
307
+ const [pi, dsh, claude, durable] = await Promise.all([
308
+ probePi(),
309
+ probeDsh(),
310
+ probeClaude(force),
311
+ probeDurable(force),
312
+ ]);
289
313
  await Promise.all([
290
314
  enrichWithUpdateInfo(pi, force),
291
315
  enrichWithUpdateInfo(dsh, force),
@@ -439,8 +439,8 @@ export class FilesService {
439
439
  }
440
440
  const { join } = await import("node:path");
441
441
  const fsp = await import("node:fs/promises");
442
- const q = query.trim().toLowerCase();
443
- if (!q) {
442
+ const rawQuery = query.trim();
443
+ if (!rawQuery) {
444
444
  this.host.emit({ type: "search_files_result", reqId, ok: true, results: [] });
445
445
  return;
446
446
  }
@@ -453,6 +453,49 @@ export class FilesService {
453
453
  const results = [];
454
454
  let visited = 0;
455
455
  let truncated = false;
456
+ // 1) 优先精确探测输入是否为已存在的绝对路径或相对路径
457
+ const normQuery = rawQuery.replace(/\\/g, "/");
458
+ const q = normQuery.toLowerCase();
459
+ try {
460
+ if (isAbsoluteWirePath(normQuery) ||
461
+ (normQuery.startsWith("~") && (normQuery === "~" || normQuery.startsWith("~/")))) {
462
+ const { homedir } = await import("node:os");
463
+ const home = homedir();
464
+ const targetAbs = normQuery.startsWith("~")
465
+ ? normQuery === "~"
466
+ ? home
467
+ : join(home, normQuery.slice(2))
468
+ : wireToAbs(normQuery);
469
+ const st = await fsp.stat(targetAbs).catch(() => null);
470
+ if (st) {
471
+ const wp = workspacePath(root, targetAbs);
472
+ const wirePath = wp ? wp.rel : targetAbs.split(sep).join("/");
473
+ const baseName = targetAbs.split(/[\\/]/).pop() || wirePath;
474
+ results.push({
475
+ path: wirePath,
476
+ name: baseName,
477
+ type: st.isDirectory() ? "dir" : "file",
478
+ });
479
+ }
480
+ }
481
+ else {
482
+ const directWp = workspacePath(root, normQuery);
483
+ if (directWp) {
484
+ const st = await fsp.stat(directWp.abs).catch(() => null);
485
+ if (st) {
486
+ const baseName = directWp.abs.split(/[\\/]/).pop() || directWp.rel;
487
+ results.push({
488
+ path: directWp.rel,
489
+ name: baseName,
490
+ type: st.isDirectory() ? "dir" : "file",
491
+ });
492
+ }
493
+ }
494
+ }
495
+ }
496
+ catch {
497
+ /* ignore probe failure */
498
+ }
456
499
  const budgetLeft = () => results.length < MAX_RESULTS && visited < MAX_VISITED && Date.now() - start < MAX_MS;
457
500
  // Breadth-first-ish iterative stack; depth cap is a symlink-cycle guard.
458
501
  const walk = async (abs, rel, depth) => {
@@ -487,7 +530,9 @@ export class FilesService {
487
530
  isDir = false; // broken link — treat as file
488
531
  }
489
532
  }
490
- if (d.name.toLowerCase().includes(q)) {
533
+ const childRelLower = childRel.toLowerCase();
534
+ const nameLower = d.name.toLowerCase();
535
+ if ((nameLower.includes(q) || childRelLower.includes(q)) && !results.some((r) => r.path === childRel)) {
491
536
  results.push({
492
537
  path: childRel,
493
538
  name: d.name,
@@ -1760,8 +1805,8 @@ export class FilesService {
1760
1805
  }
1761
1806
  }
1762
1807
  async searchRemoteFiles(rawCwd, query, reqId) {
1763
- const q = query.trim().toLowerCase();
1764
- if (!q) {
1808
+ const rawQuery = query.trim();
1809
+ if (!rawQuery) {
1765
1810
  this.host.emit({ type: "search_files_result", reqId, ok: true, results: [] });
1766
1811
  return;
1767
1812
  }
@@ -1771,17 +1816,36 @@ export class FilesService {
1771
1816
  return;
1772
1817
  }
1773
1818
  try {
1819
+ const normQuery = rawQuery.replace(/\\/g, "/");
1820
+ const q = normQuery.toLowerCase();
1821
+ const results = [];
1822
+ let truncated = false;
1823
+ // 优先精确检查直接目标
1824
+ const target = this.resolveRemoteTarget(rawCwd, normQuery);
1825
+ if (target) {
1826
+ try {
1827
+ const st = await sshSvc.sftpStat(rawCwd, target.abs);
1828
+ const name = posix.basename(target.abs) || target.rel;
1829
+ results.push({
1830
+ path: target.rel,
1831
+ name,
1832
+ type: st.isDirectory ? "dir" : "file",
1833
+ });
1834
+ }
1835
+ catch {
1836
+ /* ignore stat error */
1837
+ }
1838
+ }
1774
1839
  const cmd = `find . -maxdepth 8 \\( -name node_modules -o -name .git -o -name .pi-web \\) -prune -o -print 2>/dev/null | head -n 5000`;
1775
1840
  const res = await sshSvc.execInWorkspace(rawCwd, cmd, { timeoutMs: 8000 });
1776
1841
  const lines = res.stdout.split(/\r?\n/);
1777
- const results = [];
1778
- let truncated = false;
1779
1842
  for (const line of lines) {
1780
1843
  const clean = line.trim().replace(/^\.\//, "");
1781
1844
  if (!clean || clean === ".")
1782
1845
  continue;
1783
1846
  const name = posix.basename(clean);
1784
- if (name.toLowerCase().includes(q)) {
1847
+ if ((name.toLowerCase().includes(q) || clean.toLowerCase().includes(q)) &&
1848
+ !results.some((r) => r.path === clean)) {
1785
1849
  results.push({
1786
1850
  path: clean,
1787
1851
  name,
@@ -19,7 +19,7 @@
19
19
  // MUST be imported before the SDK is loaded so on-disk patches apply cleanly.
20
20
  import "./patch-remote-catalog.js";
21
21
  import "./patch-turn-end-boundary.js";
22
- import { existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
22
+ import { existsSync, mkdirSync, readFileSync, readdirSync, statSync } from "node:fs";
23
23
  import { readFile, stat } from "node:fs/promises";
24
24
  import { createServer, request as proxyRequest } from "node:http";
25
25
  import { createConnection } from "node:net";
@@ -38,7 +38,6 @@ import { WS_MAX_PAYLOAD_BYTES, isAbsoluteWirePath, wireToAbs } from "./files-ser
38
38
  import { httpHostAllowed, isLoopbackHost, hostWithoutPort } from "./host-guard.js";
39
39
  import { registerFileTransferRoutes } from "./file-transfer-routes.js";
40
40
  import { initAttachmentStore, readAttachment } from "./attachment-store.js";
41
- import { isAudioFile, previewKind } from "./text-sniff.js";
42
41
  import { isOfficeFile, OFFICE_MAX_FILE_BYTES, unzipFiles } from "./office-parse.js";
43
42
  import { startControlServer } from "./control-socket.js";
44
43
  import { scheduleUploadCleanup } from "./uploads.js";
@@ -63,6 +62,7 @@ import { initHttpProxy } from "./http-proxy.js";
63
62
  import { globalLspPool } from "./lsp-tool.js";
64
63
  import { buildPiWebTokenCookie, decodeCookieToken, isTlsRequest } from "./auth-cookie.js";
65
64
  import { isLoopbackAddress, loadServerFileConfig, saveServerFileConfig, tokenWarning } from "./server-config.js";
65
+ import { renderSetupHtml } from "./setup-page.js";
66
66
  import { getAppVersion, getPkgRoot } from "./pkg-info.js";
67
67
  import { handleFileMessage, handleScmMessage, handleBgServerMessage, handlePresetAndDshMessage, handleModelAndProviderMessage, handleTerminalMessage, handleSessionLifecycleMessage, handlePlanAndGoalMessage, handleScheduleMessage, handleSettingsMessage, handleInteractiveResponseMessage, handleRemoteSshMessage, } from "./dispatch-domain-handlers.js";
68
68
  import { RemoteSshService, isRemoteWorkspaceUri, serveRemoteWorkspaceFile, setGlobalRemoteSshService, } from "./remote-ssh-service.js";
@@ -232,6 +232,47 @@ if (process.platform === "win32") {
232
232
  process.env.PATH = `${windowsBashDir()}${delimiter}${process.env.PATH ?? ""}`;
233
233
  void ensureWindowsBash();
234
234
  }
235
+ else if (process.platform === "darwin") {
236
+ // macOS launchd 用户代理或 GUI 下,PATH 默认仅 /usr/bin:/bin:/usr/sbin:/sbin。
237
+ // 自动补齐 Homebrew 与常见本地工具目录,确保 claude / git / node 等安装后开箱可用。
238
+ const macPaths = [
239
+ "/opt/homebrew/bin",
240
+ "/usr/local/bin",
241
+ join(homedir(), ".local", "bin"),
242
+ join(homedir(), "Library", "pnpm"),
243
+ join(homedir(), ".bun", "bin"),
244
+ join(homedir(), ".local", "share", "fnm", "current", "bin"),
245
+ ];
246
+ // fnm / nvm 在 macOS 下版本目录自动扫入 PATH
247
+ const fnmVersions = join(homedir(), ".local", "share", "fnm", "node-versions");
248
+ if (existsSync(fnmVersions)) {
249
+ try {
250
+ for (const v of readdirSync(fnmVersions)) {
251
+ macPaths.push(join(fnmVersions, v, "installation", "bin"));
252
+ }
253
+ }
254
+ catch {
255
+ /* ignore */
256
+ }
257
+ }
258
+ const nvmVersions = join(homedir(), ".nvm", "versions", "node");
259
+ if (existsSync(nvmVersions)) {
260
+ try {
261
+ for (const v of readdirSync(nvmVersions)) {
262
+ macPaths.push(join(nvmVersions, v, "bin"));
263
+ }
264
+ }
265
+ catch {
266
+ /* ignore */
267
+ }
268
+ }
269
+ const curParts = (process.env.PATH ?? "").split(delimiter).filter(Boolean);
270
+ const curSet = new Set(curParts);
271
+ const toAdd = macPaths.filter((p) => existsSync(p) && !curSet.has(p));
272
+ if (toAdd.length > 0) {
273
+ process.env.PATH = `${toAdd.join(delimiter)}${delimiter}${process.env.PATH ?? ""}`;
274
+ }
275
+ }
235
276
  const app = express();
236
277
  // Host 白名单(防 DNS rebinding,审查 #352):无 token 部署下 HTTP 路由此前
237
278
  // 不校验 Host,恶意网页让自己的域名解析到 127.0.0.1 即可打满全部 API。
@@ -287,54 +328,28 @@ export function setupGate(req, res, next) {
287
328
  return;
288
329
  }
289
330
  }
331
+ // 5. 跨站 Fetch 探测防御(Sec-Fetch-Site 防御):
332
+ // 如果是来自外部网站的跨站子资源探测/嵌入(非顶层页面导航),直接拦截。
333
+ // 浏览器地址栏直接输入/回车或者外链跳转到 setup 页时,sec-fetch-site 可能是 cross-site/none,
334
+ // 但其 sec-fetch-dest 是 document / mode 是 navigate;只有跨站的子请求(如 fetch/xhr/image/iframe)才需要阻断。
335
+ const secFetchSite = typeof req.headers["sec-fetch-site"] === "string" ? req.headers["sec-fetch-site"].toLowerCase() : "";
336
+ const secFetchMode = typeof req.headers["sec-fetch-mode"] === "string" ? req.headers["sec-fetch-mode"].toLowerCase() : "";
337
+ if (secFetchSite === "cross-site" && secFetchMode !== "navigate") {
338
+ res.status(403).end("cross-site request to setup rejected");
339
+ return;
340
+ }
290
341
  next();
291
342
  }
292
- const SETUP_PAGE = `<!doctype html><html lang="zh"><head><meta charset="utf-8">
293
- <meta name="viewport" content="width=device-width,initial-scale=1">
294
- <title>pi-web-ui 本地配置</title>
295
- <style>body{font-family:system-ui,sans-serif;max-width:560px;margin:40px auto;padding:0 16px;
296
- background:#16181d;color:#e6e6e6}label{display:block;margin:14px 0 4px;color:#9aa}input{width:100%;
297
- box-sizing:border-box;padding:8px;border-radius:6px;border:1px solid #444;background:#222;color:#eee}
298
- button{margin-top:18px;padding:9px 22px;border:0;border-radius:6px;background:#4c8dff;color:#fff;
299
- font-size:15px;cursor:pointer}.hint{color:#9aa;font-size:13px;margin-top:4px}#msg{margin-top:14px;
300
- white-space:pre-wrap}.warn{color:#e0a63c}.ok{color:#6fbf73}.err{color:#e06c6c}</style></head><body>
301
- <h2>pi-web-ui 本地配置</h2>
302
- <p class="hint">本页只能在本机打开(回环地址)。token 修改立即生效;监听地址 / 端口 /
303
- 白名单保存后需重启服务(<code>pi-web-ui server restart</code>)。命令行旗标与环境变量
304
- 的优先级高于这里的保存值。</p>
305
- <label>访问口令 token(留空 = 清除)</label><input id="token" type="password" autocomplete="new-password">
306
- <div class="hint" id="twarn"></div>
307
- <label>监听地址 host(127.0.0.1 仅本机,0.0.0.0 允许局域网)</label><input id="host">
308
- <label>端口 port</label><input id="port" inputmode="numeric">
309
- <label>Host 白名单(逗号分隔,空 = 关闭严格模式)</label><input id="allowHosts">
310
- <label>额外 Origin 白名单(反代场景,逗号分隔)</label><input id="allowOrigins">
311
- <div><button id="save">保存</button></div>
312
- <div id="msg"></div>
313
- <script>
314
- const $=id=>document.getElementById(id);
315
- const msg=(t,c)=>{const m=$("msg");m.className=c||"";m.textContent=t;};
316
- fetch("/api/setup/status").then(r=>{if(!r.ok)throw new Error(r.status+" "+r.statusText);return r.json();})
317
- .then(s=>{$("host").value=s.host||"";$("port").value=s.port||"";
318
- $("allowHosts").value=s.allowHosts||"";$("allowOrigins").value=s.allowOrigins||"";
319
- $("twarn").textContent=s.tokenSet?("已设置口令"+(s.tokenWarning?":"+s.tokenWarning:"")):"当前未设置口令(本机直连无需口令)";})
320
- .catch(e=>msg("读取状态失败:"+e.message,"err"));
321
- $("save").onclick=()=>{msg("保存中…","");
322
- fetch("/api/setup/save",{method:"POST",headers:{"Content-Type":"application/json"},
323
- body:JSON.stringify({token:$("token").value,host:$("host").value,port:$("port").value,
324
- allowHosts:$("allowHosts").value,allowOrigins:$("allowOrigins").value})})
325
- .then(r=>r.json().then(j=>({st:r.status,j})))
326
- .then(({st,j})=>{if(!j.ok){msg("保存失败:"+(j.error||st),"err");return;}
327
- msg((j.restartRequired?"已保存,token 已生效;host/port/白名单需重启服务后生效。"
328
- :"已保存并生效。")+"\n"+JSON.stringify(j.saved,null,2),"ok");$("token").value="";})
329
- .catch(e=>msg("请求失败:"+e.message,"err"});};
330
- </script></body></html>`;
331
343
  app.get("/setup", setupGate, (_req, res) => {
332
344
  res.setHeader("Content-Type", "text/html; charset=utf-8");
333
- res.end(SETUP_PAGE);
345
+ res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
346
+ res.end(renderSetupHtml());
334
347
  });
335
348
  app.get("/api/setup/status", setupGate, (_req, res) => {
349
+ res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
336
350
  res.json({
337
351
  ok: true,
352
+ token: AUTH_TOKEN,
338
353
  tokenSet: AUTH_TOKEN.length > 0,
339
354
  tokenWarning: AUTH_TOKEN ? tokenWarning(AUTH_TOKEN) : "",
340
355
  host: HOST,
@@ -409,6 +424,15 @@ app.post("/api/setup/save", setupGate, (req, res) => {
409
424
  (body.port !== undefined && body.port !== "" && body.port !== null && Number(body.port) !== PORT) ||
410
425
  (typeof body.allowHosts === "string" && norm(body.allowHosts) !== ALLOW_HOSTS.join(",")) ||
411
426
  (typeof body.allowOrigins === "string" && norm(body.allowOrigins) !== ALLOW_ORIGINS.join(","));
427
+ // 如果设置了新 token,直接给当前回环浏览器下发匹配的 cookie,避免保存后直接 401
428
+ if (AUTH_TOKEN) {
429
+ const secure = isTlsRequest(req);
430
+ res.setHeader("Set-Cookie", buildPiWebTokenCookie(encodeURIComponent(AUTH_TOKEN), 31536000, secure));
431
+ }
432
+ else if (tokenChanged && !AUTH_TOKEN) {
433
+ // 清除了 token,同时清理旧 cookie
434
+ res.setHeader("Set-Cookie", [buildPiWebTokenCookie("", 0, false), buildPiWebTokenCookie("", 0, true)]);
435
+ }
412
436
  res.json({
413
437
  ok: true,
414
438
  tokenApplied: tokenChanged,
@@ -645,7 +669,7 @@ app.get("/api/file", async (req, res) => {
645
669
  const cs = cid ? service.get(cid) : undefined;
646
670
  const root = cs?.cwd ?? CWD;
647
671
  if (isRemoteWorkspaceUri(root)) {
648
- await serveRemoteWorkspaceFile(req, res, root, raw, { isDownload: req.query.download === "1", allowAllTypes: false }, remoteSshService);
672
+ await serveRemoteWorkspaceFile(req, res, root, raw, { isDownload: req.query.download === "1", allowAllTypes: true }, remoteSshService);
649
673
  return;
650
674
  }
651
675
  const absWire = isAbsoluteWirePath(raw);
@@ -662,18 +686,12 @@ app.get("/api/file", async (req, res) => {
662
686
  abs = wp.abs;
663
687
  }
664
688
  const name = basename(abs);
665
- const kind = previewKind(name);
666
689
  const isDownload = req.query.download === "1";
667
690
  // HTML files preview through a sandboxed <iframe> in the file modal
668
691
  // (FilePreview.tsx). They are text as far as previewKind goes, so
669
692
  // allowlist them explicitly here.
670
693
  const lower = name.toLowerCase();
671
694
  const isHtmlPreview = lower.endsWith(".html") || lower.endsWith(".htm") || lower.endsWith(".xhtml");
672
- const isAudioPreview = isAudioFile(name);
673
- if (!isDownload && kind !== "image" && kind !== "video" && !isHtmlPreview && !isAudioPreview) {
674
- res.status(400).end("not a previewable media file");
675
- return;
676
- }
677
695
  const st = await stat(abs);
678
696
  if (!st.isFile()) {
679
697
  res.status(400).end("not a file");
@@ -1753,6 +1771,7 @@ async function confirmPluginInstallHelper(items) {
1753
1771
  // 远程 SSH 连接管理、环境探针与目录浏览服务
1754
1772
  const remoteSshService = new RemoteSshService(DATA_DIR);
1755
1773
  setGlobalRemoteSshService(remoteSshService);
1774
+ pluginMgr.provideService("host", "remoteSsh", remoteSshService);
1756
1775
  // 多引擎多模型多目录画布协作调度器 (Canvas Studio)
1757
1776
  const canvasOrchestrator = new CanvasOrchestrator(CWD, DATA_DIR, (eng) => ensureEngine(eng));
1758
1777
  setCanvasRuntime(canvasOrchestrator);
@@ -3131,7 +3150,12 @@ if (!bootCatalogDisabled) {
3131
3150
  }
3132
3151
  // Local control socket (status / quiesce / unquiesce) — same data dir the
3133
3152
  // CLI uses, so `pi-web-ui server status|quiesce|unquiesce` just works.
3134
- const stopControl = startControlServer({ service, dataDir: DATA_DIR, port: PORT });
3153
+ const stopControl = startControlServer({
3154
+ service,
3155
+ dataDir: DATA_DIR,
3156
+ port: PORT,
3157
+ authToken: () => AUTH_TOKEN,
3158
+ });
3135
3159
  /**
3136
3160
  * Graceful shutdown budget (issue #172): disposeAll() can hang forever on a
3137
3161
  * stuck session runtime / PTY / pending handle, and the process would then