summrise-agent 1.2.456 → 1.2.457

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 (2) hide show
  1. package/bin/summrise.js +29 -4
  2. package/package.json +1 -1
package/bin/summrise.js CHANGED
@@ -337,11 +337,29 @@ function desktopTaskPs(installQ) {
337
337
  /** Ask whether the shell is up, and start it if it is not — printing ONE WORD the caller
338
338
  * can trust: `already-running`, `started`, or `not-started`. A command that says "ok"
339
339
  * without distinguishing those three is how an operator ends up staring at a desktop
340
- * wondering whether anything happened. Pure; the CLI runs it. */
340
+ * wondering whether anything happened.
341
+ *
342
+ * TWO THINGS MEASURED ON THE DEVICE, both of which made the first version of this wrong:
343
+ *
344
+ * 1. `powershell -File '<path>'` DOES NOT WORK. The single quotes are for PowerShell's own
345
+ * strings; at the cmd layer they are literal characters, so PowerShell received a path
346
+ * with quotes in it and answered "不支持给定路径的格式" (the path format is not
347
+ * supported). Double quotes are what `-File` wants, and `psq()` — which escapes for a
348
+ * PS string — is the wrong tool here. The same mistake sat in `setup`, unnoticed because
349
+ * the task had been registered by hand.
350
+ *
351
+ * 2. DO NOT RE-REGISTER THE TASK TO START IT. `Register-ScheduledTask` needs the user's
352
+ * principal as `DOMAIN\user`, and a shell running as a service account has no such
353
+ * mapping: from a PTY running as systemprofile the device answered "帐户名与安全标识间
354
+ * 无任何映射完成 … UserId" while the task itself was Ready. The task already carries the
355
+ * right principal — it is `setup` that creates it — so starting it is all that is needed,
356
+ * and registering is reserved for the case where it is genuinely absent. */
341
357
  function desktopStartPs(installQ) {
342
358
  return [
343
359
  `if (Get-Process electron -ErrorAction SilentlyContinue) { Write-Output 'already-running'; exit 0 }`,
344
- `& powershell -NoProfile -ExecutionPolicy Bypass -File '${installQ}\\scripts\\ensure-desktop.ps1'`,
360
+ `$t = Get-ScheduledTask -TaskName SummriseDesktop -ErrorAction SilentlyContinue`,
361
+ `if (-not $t) { & powershell -NoProfile -ExecutionPolicy Bypass -File "${installQ}\\scripts\\register-desktop-task.ps1" }`,
362
+ `Start-ScheduledTask -TaskName SummriseDesktop -ErrorAction SilentlyContinue`,
345
363
  `Start-Sleep -Seconds 3`,
346
364
  `if (Get-Process electron -ErrorAction SilentlyContinue) { Write-Output 'started' } else { Write-Output 'not-started'; exit 1 }`,
347
365
  ].join("; ");
@@ -1775,7 +1793,11 @@ const commands = {
1775
1793
  try {
1776
1794
  const reg = path.join(SCRIPTS_DIR, "register-desktop-task.ps1");
1777
1795
  fs.writeFileSync(reg, desktopTaskPs(DIR).join("\r\n") + "\r\n");
1778
- sh(`powershell -NoProfile -ExecutionPolicy Bypass -File '${(0, exports.psq)(reg)}'`);
1796
+ sh(
1797
+ // DOUBLE quotes — a cmd-layer argument. The single-quoted version this shipped with
1798
+ // reached PowerShell with the quotes included and died on the device with
1799
+ // "不支持给定路径的格式" (unsupported path format).
1800
+ `powershell -NoProfile -ExecutionPolicy Bypass -File "${reg}"`);
1779
1801
  console.log("setup: SummriseDesktop registered (logon + a 5-minute watchdog) and started");
1780
1802
  }
1781
1803
  catch {
@@ -1996,7 +2018,10 @@ const commands = {
1996
2018
  fs.writeFileSync(reg, desktopTaskPs(DIR).join("\r\n") + "\r\n");
1997
2019
  }
1998
2020
  try {
1999
- sh(`powershell -NoProfile -ExecutionPolicy Bypass -File '${(0, exports.psq)(reg)}'`);
2021
+ // DOUBLE quotes: this is a cmd-layer argument, and `psq()` escapes for a PowerShell
2022
+ // string instead — the single-quoted version reached PowerShell with the quotes still in
2023
+ // it and failed on the device with "unsupported path format". Same fix in `setup` below.
2024
+ sh(`powershell -NoProfile -ExecutionPolicy Bypass -File "${reg}"`);
2000
2025
  }
2001
2026
  catch {
2002
2027
  /* the task may already exist and be healthy; the check below is the verdict */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "summrise-agent",
3
- "version": "1.2.456",
3
+ "version": "1.2.457",
4
4
  "description": "Summrise Agent — Windows device MCP server (terminal/SSH/serial) + panel. Self-hosted npm distribution.",
5
5
  "//build": "唯一构建路径:在本目录执行 npm run build。它是自包含的:经 npm exec 按需拉取 typescript@5,无需预装任何 node_modules(干净检出可跑;旧脚本引用 ../summrise-desktop-electron/node_modules/.bin/tsc,干净检出必 ENOENT)。必须用 npm exec --package … -- tsc 的形式:npx 会吃掉传给 tsc 的 -p/--outDir 等参数(round-435:npx 写法从未真正跑通过)。先编 electron TS(--noCheck 纯 emit,与 release.yml 一致)同步两处 src/*.js,再编 src/summrise.ts 到 bin/summrise.js 并校验 round-298 标记(弱 oracle,只证某次构建发生,新鲜性由 publish-release.sh 的 tsc 重编 + cmp 门保证)。",
6
6
  "bin": {