summrise-agent 1.2.456 → 1.2.458
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.
- package/bin/summrise.js +44 -18
- package/package.json +1 -1
package/bin/summrise.js
CHANGED
|
@@ -334,17 +334,35 @@ function desktopTaskPs(installQ) {
|
|
|
334
334
|
`Start-ScheduledTask -TaskName SummriseDesktop`,
|
|
335
335
|
];
|
|
336
336
|
}
|
|
337
|
-
/**
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
337
|
+
/** The desktop shell's START script, as a file — NOT a `-Command` string.
|
|
338
|
+
*
|
|
339
|
+
* WHY A FILE, and this is the third thing the device taught us: the CLI spawns with
|
|
340
|
+
* `shell: true`, so every command goes through cmd.exe, and **cmd treats `&` as a command
|
|
341
|
+
* separator**. The PowerShell call operator `&` therefore split the command in half, the
|
|
342
|
+
* `$t` assignment never ran, and the command fell through to re-registering the task —
|
|
343
|
+
* which then failed on the service account's principal. One metacharacter, two unrelated
|
|
344
|
+
* looking failures. `powershell -File "<path>"` has no metacharacters to mangle, and the
|
|
345
|
+
* operator can READ what the command does.
|
|
346
|
+
*
|
|
347
|
+
* Prints ONE WORD the CLI can trust: `already-running`, `started`, or `not-started`.
|
|
348
|
+
* Pure; the CLI writes it and runs it. unit-tested. */
|
|
341
349
|
function desktopStartPs(installQ) {
|
|
342
350
|
return [
|
|
343
|
-
`
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
351
|
+
"# written by `summrise desktop` -- ask for the window, or say it is already there.",
|
|
352
|
+
"$ErrorActionPreference = 'Stop'",
|
|
353
|
+
"if (Get-Process electron -ErrorAction SilentlyContinue) { Write-Output 'already-running'; exit 0 }",
|
|
354
|
+
"# DO NOT RE-REGISTER THE TASK TO START IT. Register-ScheduledTask needs the interactive",
|
|
355
|
+
"# user's principal as DOMAIN\\user, and a shell running as a service account has no such",
|
|
356
|
+
"# mapping -- the device answered \"No mapping between account names and security IDs was",
|
|
357
|
+
"# done ... UserId\" from a PTY running as systemprofile, while the task itself was Ready.",
|
|
358
|
+
"# The task already carries the right principal -- `summrise setup` creates it -- so starting",
|
|
359
|
+
"# it is all that is needed.",
|
|
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",
|
|
363
|
+
"Start-Sleep -Seconds 3",
|
|
364
|
+
"if (Get-Process electron -ErrorAction SilentlyContinue) { Write-Output 'started' } else { Write-Output 'not-started'; exit 1 }",
|
|
365
|
+
];
|
|
348
366
|
}
|
|
349
367
|
// exported: agent bind port plumbing (custom-port installs). server.port
|
|
350
368
|
// out of <dir>/config.yaml (first `port:` under top-level `server:`),
|
|
@@ -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(
|
|
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 "unsupported
|
|
1799
|
+
// path format" for a path that was perfectly valid.
|
|
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 {
|
|
@@ -1983,7 +2005,7 @@ const commands = {
|
|
|
1983
2005
|
//
|
|
1984
2006
|
// WHY IT EXISTS. The shell is normally started by the SummriseDesktop task, but the LAUNCHER
|
|
1985
2007
|
// dies with the console that started it — measured twice on 2026-09-23, both times arriving
|
|
1986
|
-
// as "electron
|
|
2008
|
+
// as "the electron window is gone again" — and until now there was no command to ask for it, only a .ps1 path
|
|
1987
2009
|
// an operator had to know. Idempotent by construction (the task's ensure-desktop.ps1 exits
|
|
1988
2010
|
// when electron is alive, so a running shell is never disturbed), and it distinguishes the
|
|
1989
2011
|
// three outcomes. "ok" without saying WHICH is how an operator ends up staring at a desktop.
|
|
@@ -1995,13 +2017,17 @@ const commands = {
|
|
|
1995
2017
|
// writes, from the same builder, so the two cannot drift.
|
|
1996
2018
|
fs.writeFileSync(reg, desktopTaskPs(DIR).join("\r\n") + "\r\n");
|
|
1997
2019
|
}
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2020
|
+
// THE START SCRIPT GOES IN A FILE, AND ONLY IT DECIDES WHETHER TO REGISTER. Spawning with
|
|
2021
|
+
// `shell: true` means cmd.exe, and **cmd splits a command on `&`** — the PowerShell call
|
|
2022
|
+
// operator in the middle of this logic cut the command in half on the device, so the `$t`
|
|
2023
|
+
// assignment never ran and it fell through to re-registering a task that already existed,
|
|
2024
|
+
// which then failed on the service account's principal. Two failures, one metacharacter.
|
|
2025
|
+
const start = path.join(SCRIPTS_DIR, "desktop-start.ps1");
|
|
2026
|
+
fs.writeFileSync(start, desktopStartPs(DIR).join("\r\n") + "\r\n");
|
|
2027
|
+
// The register script is WRITTEN here (a machine that never ran setup still gets a working
|
|
2028
|
+
// task, from the same builder setup uses) but NOT run: desktop-start.ps1 runs it only when
|
|
2029
|
+
// the task is genuinely missing.
|
|
2030
|
+
const r = (0, child_process_1.spawnSync)("powershell", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", start], { encoding: "utf8", shell: true });
|
|
2005
2031
|
const out = String(r.stdout || "").trim();
|
|
2006
2032
|
if (out.endsWith("already-running")) {
|
|
2007
2033
|
console.log("desktop: the Summrise shell is ALREADY RUNNING (look for the window, or the tray icon)");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "summrise-agent",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.458",
|
|
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": {
|