local-operator-ui 0.19.7 → 0.20.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 (69) hide show
  1. package/bin/ensure-electron.js +47 -0
  2. package/bin/linux-sandbox.js +27 -18
  3. package/bin/postinstall.js +55 -33
  4. package/out/main/index.js +194 -417
  5. package/out/renderer/assets/{_basePickBy-C411r4Fr.js → _basePickBy-C7yOlBwG.js} +1 -1
  6. package/out/renderer/assets/{_baseUniq-Bt63j3mu.js → _baseUniq-BxWDXUxR.js} +1 -1
  7. package/out/renderer/assets/{agent-details-page-DujEqAzR.js → agent-details-page-DGusXpiv.js} +1 -1
  8. package/out/renderer/assets/{agent-hub-page-C3kMnXTf.js → agent-hub-page-BEy-xjst.js} +1 -1
  9. package/out/renderer/assets/{agents-page-NEQ4hFtm.js → agents-page-VfOUQ-yP.js} +2 -2
  10. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-BqpmUfyo.js → architectureDiagram-IEHRJDOE-358ZDLa0.js} +1 -1
  11. package/out/renderer/assets/{blockDiagram-JOT3LUYC-CnQwEPXO.js → blockDiagram-JOT3LUYC-tzEHVS4j.js} +1 -1
  12. package/out/renderer/assets/{c4Diagram-VJAJSXHY-Dk_OmMLJ.js → c4Diagram-VJAJSXHY-D3tP-CCo.js} +1 -1
  13. package/out/renderer/assets/channel-D37fF6my.js +1 -0
  14. package/out/renderer/assets/{chunk-4BMEZGHF-BdRWhpmN.js → chunk-4BMEZGHF-BKUSTR_S.js} +1 -1
  15. package/out/renderer/assets/{chunk-A2AXSNBT-yHqgRYdq.js → chunk-A2AXSNBT-DvXPJSTp.js} +1 -1
  16. package/out/renderer/assets/{chunk-AEK57VVT-BanBKJ_s.js → chunk-AEK57VVT-iJyV8fDW.js} +1 -1
  17. package/out/renderer/assets/{chunk-D6G4REZN-CuQN5RTN.js → chunk-D6G4REZN-B3DDJ3MU.js} +1 -1
  18. package/out/renderer/assets/{chunk-RZ5BOZE2-C8fBZeNu.js → chunk-RZ5BOZE2-Dbn_07ZJ.js} +1 -1
  19. package/out/renderer/assets/{chunk-XZIHB7SX-6KNcbSfo.js → chunk-XZIHB7SX-ChdMxZnm.js} +1 -1
  20. package/out/renderer/assets/classDiagram-GIVACNV2-CcnNtrPC.js +1 -0
  21. package/out/renderer/assets/classDiagram-v2-COTLJTTW-CcnNtrPC.js +1 -0
  22. package/out/renderer/assets/clone-DPqLvbSr.js +1 -0
  23. package/out/renderer/assets/{compact-pagination-Ovp_kll1.js → compact-pagination-duvMYksr.js} +1 -1
  24. package/out/renderer/assets/{dagre-OKDRZEBW-DzfvIYmf.js → dagre-OKDRZEBW-BuSM1V0w.js} +1 -1
  25. package/out/renderer/assets/{diagram-SSKATNLV-Bpyw0frR.js → diagram-SSKATNLV-39xt9Mcn.js} +1 -1
  26. package/out/renderer/assets/{diagram-VNBRO52H-r7KETc_A.js → diagram-VNBRO52H-Bgyt_DWD.js} +1 -1
  27. package/out/renderer/assets/{erDiagram-Q7BY3M3F-BBPxCrm9.js → erDiagram-Q7BY3M3F-DNfsSD46.js} +1 -1
  28. package/out/renderer/assets/{flowDiagram-4HSFHLVR-Bqfojzvn.js → flowDiagram-4HSFHLVR-DbS8UHwN.js} +1 -1
  29. package/out/renderer/assets/{ganttDiagram-APWFNJXF-Cd7hVnw4.js → ganttDiagram-APWFNJXF-Dxdp2V-6.js} +1 -1
  30. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-Dxoexd6b.js → gitGraphDiagram-7IBYFJ6S-BLrXJPe3.js} +1 -1
  31. package/out/renderer/assets/{graph-DoZ-YflA.js → graph-Cgkq5xQ7.js} +1 -1
  32. package/out/renderer/assets/{icon-DaedMBiD.css → icon-HSrrv8O-.css} +1 -1
  33. package/out/renderer/assets/{index-s958Ss2_.js → index-C4RcIL0i.js} +1 -1
  34. package/out/renderer/assets/{index-DXDWG455.js → index-CLwRuOtJ.js} +47 -47
  35. package/out/renderer/assets/{index-Bvsuxozx.js → index-lEoaSpWQ.js} +1 -1
  36. package/out/renderer/assets/{infoDiagram-PH2N3AL5-B6Q2kq6y.js → infoDiagram-PH2N3AL5-DR6So_J8.js} +1 -1
  37. package/out/renderer/assets/{installer-poO56j69.js → installer-Ck14_4Oh.js} +1 -1
  38. package/out/renderer/assets/{journeyDiagram-U35MCT3I-YvFhqi_4.js → journeyDiagram-U35MCT3I-DubpieGX.js} +1 -1
  39. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-hUPw4d6Q.js → kanban-definition-NDS4AKOZ-BtwsU2Rg.js} +1 -1
  40. package/out/renderer/assets/{layout-DL79cPuU.js → layout-BDeRPl4h.js} +1 -1
  41. package/out/renderer/assets/{legacy-agents-page-Bc9_mRrf.js → legacy-agents-page-ZyBMetf1.js} +1 -1
  42. package/out/renderer/assets/{mermaid.core-DY-qM3jW.js → mermaid.core-d-O-_a6F.js} +5 -5
  43. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BIr3BZFI.js → mindmap-definition-ALO5MXBD-BCZdiKEB.js} +1 -1
  44. package/out/renderer/assets/{page-header-zecAylNs.js → page-header-D-uc8qqA.js} +1 -1
  45. package/out/renderer/assets/{parseISO-DLnRjbkm.js → parseISO-PdZfrqAM.js} +1 -1
  46. package/out/renderer/assets/{pieDiagram-IB7DONF6-DEfXQAHX.js → pieDiagram-IB7DONF6-Bd2e7gHe.js} +1 -1
  47. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DTbs_0uW.js → quadrantDiagram-7GDLP6J5-oypZsih9.js} +1 -1
  48. package/out/renderer/assets/{radar-MK3ICKWK-YpweuwYm.js → radar-MK3ICKWK-c4YagPOX.js} +1 -1
  49. package/out/renderer/assets/{radient-auth-buttons--VhWRhuh.js → radient-auth-buttons-BUlY7XDi.js} +1 -1
  50. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-DV8bmMki.js → requirementDiagram-KVF5MWMF-7UoAwEus.js} +1 -1
  51. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-BpZDUCJV.js → sankeyDiagram-QLVOVGJD-JStPMuRd.js} +1 -1
  52. package/out/renderer/assets/{schedules-page-Co1Ixrkk.js → schedules-page-IjBtVuIo.js} +1 -1
  53. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-B4x4_BhD.js → sequenceDiagram-X6HHIX6F-Lene9gQ-.js} +1 -1
  54. package/out/renderer/assets/{settings-page-yvoJPfPs.js → settings-page-BqJRfztd.js} +1 -1
  55. package/out/renderer/assets/{square-pen-CdJTC74b.js → square-pen-CQEKS3JT.js} +1 -1
  56. package/out/renderer/assets/{stateDiagram-DGXRK772-DHIWQgsa.js → stateDiagram-DGXRK772-umC2tGUK.js} +1 -1
  57. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Cp1tcztr.js +1 -0
  58. package/out/renderer/assets/{timeline-definition-BDJGKUSR-rcUcUcdw.js → timeline-definition-BDJGKUSR-h2KfXqek.js} +1 -1
  59. package/out/renderer/assets/{use-agent-like-mutation-_CPevTyx.js → use-agent-like-mutation-BanZ02f7.js} +1 -1
  60. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-CiY7ytjm.js → xychartDiagram-VJFVF3MP-BOH5ZQcH.js} +1 -1
  61. package/out/renderer/index.html +3 -3
  62. package/out/renderer/installer.html +3 -3
  63. package/package.json +69 -58
  64. package/out/renderer/assets/channel-QDS9FjQE.js +0 -1
  65. package/out/renderer/assets/classDiagram-GIVACNV2-CsOBNtuH.js +0 -1
  66. package/out/renderer/assets/classDiagram-v2-COTLJTTW-CsOBNtuH.js +0 -1
  67. package/out/renderer/assets/clone-BmqcgcfO.js +0 -1
  68. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CQi1jyLr.js +0 -1
  69. /package/out/renderer/assets/{icon-DMNb6cX-.js → icon-RIkwUxL5.js} +0 -0
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Make sure the Electron runtime the BUILD shells out to is on disk.
5
+ *
6
+ * WHY A BUILD NEEDS THE BINARY AT ALL: electron-vite's bytecode step runs the
7
+ * Electron binary from `node_modules/electron/dist` to produce `.jsc` for the
8
+ * exact V8 it will load under — so the build needs a real dist/, and it does
9
+ * not go through `require("electron")`, which is the call that would fetch the
10
+ * runtime on demand. Missing dist/ therefore fails the build with
11
+ * `[vite:bytecode] spawn … ENOENT` rather than downloading anything.
12
+ *
13
+ * WHY THIS EXISTS BESIDE bin/postinstall.js: since Electron 42 the `electron`
14
+ * package has no postinstall, so `node_modules/electron/dist` is absent on a
15
+ * fresh install until something fetches it. bin/postinstall.js fetches it on
16
+ * every platform, which covers `pnpm install`; this script covers the trees
17
+ * that hook cannot reach — `pnpm install --ignore-scripts`, and the common
18
+ * local case of a dist/ deleted or replaced by hand — by running from the
19
+ * `prebuild` hook, before anything reads it. Both call the same
20
+ * ensureElectronDist() so there is one implementation of "what counts as
21
+ * present" and one fetch.
22
+ *
23
+ * It is IDEMPOTENT and cache-backed: with dist/ present this exits in well
24
+ * under a second without touching the network.
25
+ *
26
+ * It FAILS the build when the runtime cannot be fetched, unlike the postinstall
27
+ * (which must never fail an install). There is no way for the build to succeed
28
+ * without it, and a named failure with the one command that fixes it beats the
29
+ * ENOENT this exists to prevent.
30
+ */
31
+
32
+ const path = require("node:path");
33
+ const { ensureElectronDist } = require("./linux-sandbox.js");
34
+
35
+ const packageRoot = path.join(__dirname, "..");
36
+
37
+ if (!ensureElectronDist(packageRoot, { quiet: false })) {
38
+ console.error(
39
+ "local-operator-ui: the Electron runtime is missing from node_modules and could not be fetched.",
40
+ );
41
+ console.error(
42
+ "The build needs it: electron-vite compiles the main bundle to V8 bytecode for that exact runtime (the preload ships as plain JS — bytecode cannot load in an Electron 44 renderer, see electron.vite.config.js).",
43
+ );
44
+ console.error("Fetch it explicitly, then build again:");
45
+ console.error(" npx install-electron --no && pnpm build");
46
+ process.exit(1);
47
+ }
@@ -411,16 +411,31 @@ const exitCodeFor = (code, signal) => {
411
411
  * That is the failure mode this file's whole design is meant to avoid, so it is
412
412
  * recorded here rather than quietly corrected.
413
413
  *
414
+ * That ordering argument is history since Electron 42, and the function is
415
+ * MORE load-bearing for it, not less: the `electron` package no longer runs a
416
+ * postinstall at all, so nothing downloads dist/ during an install any more,
417
+ * while `electron-vite`'s bytecode step spawns the binary straight from
418
+ * `dist/` (never through `require("electron")`, which is the call that would
419
+ * fetch it on demand). See bin/postinstall.js and bin/ensure-electron.js --
420
+ * between them they are the only things that put the runtime on disk.
421
+ *
414
422
  * The fix is to drive Electron's own installer first. It is idempotent and
415
423
  * cache-backed: with a valid dist/ already present it returns in ~0.08s without
416
424
  * touching the network, and npm's later invocation of the same script is then
417
425
  * the no-op instead. It also preserves a setuid bit we have already set
418
426
  * (verified), so the ordering between the two runs does not matter.
419
427
  *
420
- * Returns true when a helper is present afterwards. Every failure degrades to
421
- * false: the install must still succeed (see bin/postinstall.js).
428
+ * Returns true when the Electron runtime itself is present afterwards (keyed on
429
+ * `dist/version`, the marker Electron's own installer uses). Every failure
430
+ * degrades to false: the install must still succeed (see bin/postinstall.js).
431
+ *
432
+ * `quiet` silences the installer, which is what the install path wants -- the
433
+ * download prints a progress bar that would otherwise appear twice in one
434
+ * `npm install`, once from us and once from npm's own run of the same script.
435
+ * The build path passes `quiet: false`, because there the download IS the
436
+ * visible work and a silent multi-minute wait reads as a hang.
422
437
  */
423
- const ensureElectronDist = (packageRoot) => {
438
+ const ensureElectronDist = (packageRoot, { quiet = true } = {}) => {
424
439
  const installer = path.join(
425
440
  packageRoot,
426
441
  "node_modules",
@@ -431,29 +446,23 @@ const ensureElectronDist = (packageRoot) => {
431
446
  return false;
432
447
  }
433
448
  const distDir = path.join(packageRoot, "node_modules", "electron", "dist");
434
- // Key the fast path on the SAME marker electron's own isInstalled() uses
435
- // (dist/version) as well as the helper. Keying on chrome-sandbox alone let a
436
- // partially-extracted dist/ that happens to contain the helper report a
437
- // healthy install, so we would skip the installer that would have repaired it.
438
- if (
439
- fs.existsSync(path.join(distDir, "version")) &&
440
- fs.existsSync(path.join(distDir, "chrome-sandbox"))
441
- ) {
449
+ // The fast path keys on `dist/version` ALONE. It used to also require
450
+ // `dist/chrome-sandbox`, which exists only on Linux, so on macOS and Windows
451
+ // every install re-ran the installer (idempotent, but a 10-minute-bounded
452
+ // spawn per install) and -- now that this function is also what fetches the
453
+ // runtime off Linux -- every build too. `dist/version` is the complete-extraction
454
+ // marker because electron's own isInstalled() reads the same file.
455
+ if (fs.existsSync(path.join(distDir, "version"))) {
442
456
  return true;
443
457
  }
444
- // Inherit nothing on stdout: the download prints a progress bar that would
445
- // otherwise appear twice in the install log, once here and once from npm's
446
- // own run of the same script.
447
458
  const result = spawnSync(process.execPath, [installer], {
448
459
  cwd: path.dirname(installer),
449
- stdio: "ignore",
460
+ stdio: quiet ? "ignore" : "inherit",
450
461
  // A hung download must not hang the install. Ten minutes is generous for a
451
462
  // ~100MB fetch on a slow link and still bounded.
452
463
  timeout: 10 * 60 * 1000,
453
464
  });
454
- return (
455
- result.status === 0 && fs.existsSync(path.join(distDir, "chrome-sandbox"))
456
- );
465
+ return result.status === 0 && fs.existsSync(path.join(distDir, "version"));
457
466
  };
458
467
 
459
468
  module.exports = {
@@ -1,22 +1,36 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * Restore the setuid bit on Electron's chrome-sandbox helper after install.
4
+ * Two install-time duties, one script, because both are "the install did not
5
+ * leave this tree runnable" problems and npm's lifecycle gives us one hook:
5
6
  *
6
- * npm strips setuid bits from package contents by design, so the helper lands
7
- * root:root 0755 and Chromium aborts for a non-root user (issue #91). We fix it
8
- * here because `sudo npm install -g` — the ordinary way to install a global CLI
9
- * — runs this script as root, which is the one moment in the lifecycle where we
10
- * hold the privilege the fix needs.
7
+ * 1. Fetch the Electron runtime. Since Electron 42 the `electron` package has
8
+ * no postinstall that downloads the binary, and `electron-vite`'s bytecode
9
+ * step spawns the binary straight from `dist/` rather than through
10
+ * `require("electron")` (the one call that would fetch it on demand). So
11
+ * without this, a fresh clone or a cold CI runner fails its first
12
+ * `pnpm build` with `[vite:bytecode] spawn ... ENOENT` -- on macOS and
13
+ * Windows too, not only on Linux. bin/ensure-electron.js calls the same
14
+ * helper from the build path, for trees installed with --ignore-scripts or
15
+ * with dist/ removed afterwards.
16
+ *
17
+ * 2. Restore the setuid bit on Electron's chrome-sandbox helper. npm strips
18
+ * setuid bits from package contents by design, so the helper lands
19
+ * root:root 0755 and Chromium aborts for a non-root user (issue #91). We fix
20
+ * it here because `sudo npm install -g` -- the ordinary way to install a
21
+ * global CLI -- runs this script as root, which is the one moment in the
22
+ * lifecycle where we hold the privilege the fix needs. Linux only: the
23
+ * helper does not exist anywhere else.
11
24
  *
12
25
  * THIS SCRIPT MUST NEVER FAIL THE INSTALL. An unprivileged `npm install -g`
13
26
  * (prefix in $HOME), a container without CAP_CHOWN, macOS and Windows where the
14
- * helper does not exist, and an install where the optional Electron download was
15
- * skipped are all normal situations in which the repair cannot happen. Leaving
16
- * the user with no package at all would be a worse defect than the one being
17
- * fixed, so every failure path exits 0. Where the repair does not happen, the
18
- * launcher's post-mortem guidance (bin/local-operator-ui.js) covers it with the
19
- * exact commands.
27
+ * helper does not exist, and an install where the Electron download failed or
28
+ * was skipped are all normal situations. Leaving the user with no package at
29
+ * all would be a worse defect than the one being fixed, so every failure path
30
+ * exits 0. Where the runtime could not be fetched, `bin/ensure-electron.js`
31
+ * fails the build with the exact command instead, and where the repair does not
32
+ * happen the launcher's post-mortem guidance (bin/local-operator-ui.js) covers
33
+ * it.
20
34
  *
21
35
  * It is quiet on success for the same reason npm scripts generally are: the
22
36
  * common case is a working install and noise there trains people to ignore it.
@@ -24,22 +38,6 @@
24
38
 
25
39
  const process = require("node:process");
26
40
 
27
- // Silence is the contract on non-Linux: the helper is a Linux-only artifact, so
28
- // there is nothing to repair and nothing worth printing on a Mac.
29
- //
30
- // LOCAL_OPERATOR_UI_FORCE_POSTINSTALL exists so the test suite can reach the
31
- // repair path on a macOS developer machine and on CI's ubuntu runner alike.
32
- // Without it the only assertion this script's test could make on darwin was
33
- // "exit 0", which it satisfies by returning here before doing anything -- a
34
- // vacuous test that passed while the whole body was mutated away. It is read
35
- // only, never written by us, and namespaced so it cannot be set by accident.
36
- if (
37
- process.platform !== "linux" &&
38
- process.env.LOCAL_OPERATOR_UI_FORCE_POSTINSTALL !== "1"
39
- ) {
40
- process.exit(0);
41
- }
42
-
43
41
  const main = () => {
44
42
  const path = require("node:path");
45
43
  const {
@@ -47,12 +45,36 @@ const main = () => {
47
45
  repairSandboxHelper,
48
46
  } = require("./linux-sandbox.js");
49
47
 
50
- // Do NOT resolve the helper through require("electron"). npm runs this script
51
- // BEFORE electron's own postinstall downloads dist/, so at this point that
52
- // call throws and the helper does not exist yet. ensureElectronDist() drives
53
- // electron's installer first; see the long note on it for the measurements.
48
+ // Fetch BEFORE the platform guard, because the build needs the runtime on
49
+ // every platform and this is the only hook that runs on a plain
50
+ // `pnpm install`. The installer is silent here on purpose: the download
51
+ // prints a progress bar that would otherwise appear twice in one install,
52
+ // once from us and once from npm's own run of the same script.
54
53
  const packageRoot = path.join(__dirname, "..");
55
- if (!ensureElectronDist(packageRoot)) {
54
+ const distReady = ensureElectronDist(packageRoot);
55
+
56
+ // Silence is the contract on non-Linux: the helper is a Linux-only artifact,
57
+ // so with the runtime in place there is nothing left to repair and nothing
58
+ // worth printing on a Mac.
59
+ //
60
+ // LOCAL_OPERATOR_UI_FORCE_POSTINSTALL exists so the test suite can reach the
61
+ // repair path on a macOS developer machine and on CI's ubuntu runner alike.
62
+ // Without it the only assertion this script's test could make on darwin was
63
+ // "exit 0", which it satisfies by returning here before doing anything -- a
64
+ // vacuous test that passed while the whole body was mutated away. It is read
65
+ // only, never written by us, and namespaced so it cannot be set by accident.
66
+ if (
67
+ process.platform !== "linux" &&
68
+ process.env.LOCAL_OPERATOR_UI_FORCE_POSTINSTALL !== "1"
69
+ ) {
70
+ return;
71
+ }
72
+
73
+ // Do NOT resolve the helper through require("electron"): that call fetches
74
+ // the runtime on demand when it is missing, which inside an install is a
75
+ // synchronous download in the wrong place. ensureElectronDist() above is the
76
+ // one that drives electron's installer, on purpose.
77
+ if (!distReady) {
56
78
  // No Electron to repair: optional install skipped, or the download failed.
57
79
  // The launcher reports that case with its own guidance.
58
80
  return;