@floless/app 0.141.0 → 0.141.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.
package/launch.mjs CHANGED
@@ -393,7 +393,7 @@ export function taskkillArgs(pid, { tree = true } = {}) {
393
393
  // launch.mjs) in the command line — our supervisor runs `node … launch.mjs supervise`.
394
394
  // The packaged exe (unique FlolessApp.exe) passes no scriptMatch — its match is exact.
395
395
  export function killSupervisor({ tree = true } = {}) {
396
- if (!isWin) return;
396
+ if (!isWin) return [];
397
397
  const isNpmChannel = /^node(\.exe)?$/i.test(basename(process.execPath));
398
398
  const scriptMatch = isNpmChannel ? basename(fileURLToPath(import.meta.url)) : undefined; // 'launch.mjs'
399
399
  // MSIX-container case: the uninstaller running INSIDE the container sees its own
@@ -412,6 +412,37 @@ export function killSupervisor({ tree = true } = {}) {
412
412
  // parseProcessList, and avoiding the shell rules out any injection entirely.
413
413
  try { execFileSync('taskkill', taskkillArgs(pid, { tree }), { stdio: 'ignore', windowsHide: true }); } catch { /* already gone */ }
414
414
  }
415
+ // The pids it FOUND (and tried to kill) — an empty list means no supervisor was running.
416
+ // stopSupervisorVerified reads that to prove the watchdog is really gone.
417
+ return pids;
418
+ }
419
+
420
+ // "Stop FloLess" (POST /api/app/stop) must not leave a watchdog behind that respawns the server a
421
+ // few seconds later — that would make the menu item look broken. So: kill the supervisor (tree:false,
422
+ // exactly as /api/update/apply does — THIS serve is its child and exits on its own afterwards), then
423
+ // re-enumerate within a bounded window, re-killing on every tick, until nothing matches. Resolves
424
+ // true only when the last enumeration found no supervisor; false means one survived and the caller
425
+ // must keep the server running and say so. Outside the packaged exe there is no autostart
426
+ // supervisor (the npm/dev channel never wires one), so the check is skipped rather than paying a
427
+ // process enumeration for nothing. `kill`/`sleep`/`now` are injectable for the unit test.
428
+ export async function stopSupervisorVerified({
429
+ kill,
430
+ windowMs = 3000,
431
+ pollMs = 500,
432
+ sleep = (ms) => new Promise((r) => setTimeout(r, ms)),
433
+ now = Date.now,
434
+ } = {}) {
435
+ if (!kill) {
436
+ if (!isWin || !isPackagedDistributionExe()) return true;
437
+ kill = () => killSupervisor({ tree: false });
438
+ }
439
+ let found = kill();
440
+ const deadline = now() + windowMs;
441
+ while (found.length > 0 && now() < deadline) {
442
+ await sleep(pollMs);
443
+ found = kill();
444
+ }
445
+ return found.length === 0;
415
446
  }
416
447
 
417
448
  // cmdTeardown — stop floless.app's live footprint in the ONLY safe order (Codex B1/B2/S2):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.141.0",
3
+ "version": "0.141.1",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {