cicy-desktop 2.1.332 → 2.1.333

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cicy-desktop",
3
- "version": "2.1.332",
3
+ "version": "2.1.333",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -4,24 +4,23 @@
4
4
  // Homepage window — primary CiCy Desktop window. Singleton; closing it
5
5
  // does NOT quit the app.
6
6
  //
7
- // URL selection: the bundled local file:// SPA by DEFAULT — works offline, fast,
8
- // no remote dependency, no mixed-content concerns when embedding the
9
- // team-assistant webview (the cicy-desktop preload's IPC bridge still attaches).
7
+ // URL selection: the homepage IS the deployed web build
8
+ // (https://desktop.cicy-ai.com the desktop-render Worker). Shipping homepage
9
+ // changes then means deploying the Worker, not shipping a new desktop build.
10
10
  //
11
- // The same SPA is also deployed as the desktop-render Worker on
12
- // https://desktop.cicy-ai.com, which is what makes "ship UI without shipping the
13
- // app" possible. Pointing the homepage at it is OPT-IN, and deliberately not the
14
- // default: the home tab runs homepage-preload, whose bridge is the UNGUARDED
15
- // "rpc" channel (no origin gate, no dangerous-tool gate see utils/rpc-guard),
16
- // because it was only ever loaded from file://. A remote origin on that channel
17
- // gets ungated exec_*/file_* on every desktop, so whoever controls the domain
18
- // controls the fleet. Turn it on per machine with CICY_HOMEPAGE_URL (any URL) or
19
- // prefs.homepageRemote:true (uses REMOTE_HOMEPAGE), and only for an origin you
20
- // trust exactly as much as the bundled bundle itself.
11
+ // The bundled file:// snapshot stays in the package as the FALLBACK: a
12
+ // main-frame load failure, or a load that never commits within 15s (a blank 200
13
+ // from a broken deploy), swaps to it a CDN outage can never leave the app with
14
+ // no homepage. Set CICY_HOMEPAGE_URL to point somewhere else (e.g. a vite dev
15
+ // server), or prefs.homepageRemote:false to pin a machine to the snapshot.
21
16
  //
22
- // Either way the remote load is never a one-way door: a main-frame failure (or a
23
- // load that never commits) falls back to the bundled snapshot, so a CDN outage
24
- // cannot leave the app with no homepage.
17
+ // Note what this grants: the home tab runs homepage-preload, whose bridge is the
18
+ // UNGUARDED "rpc" channel no origin gate, no dangerous-tool gate (see
19
+ // utils/rpc-guard), because it predates the homepage ever being remote. The
20
+ // homepage origin therefore has ungated exec_*/file_* on the machine, so
21
+ // desktop.cicy-ai.com must be treated as first-party code, exactly like the
22
+ // bundle it replaces: whoever can deploy that Worker can run commands on every
23
+ // desktop.
25
24
 
26
25
  const path = require("path");
27
26
  const { BrowserWindow } = require("electron");
@@ -49,10 +48,11 @@ function readHomepagePrefs() {
49
48
  function pickHomepageURL() {
50
49
  const env = String(process.env.CICY_HOMEPAGE_URL || "").trim();
51
50
  if (env) return env;
51
+ // Opt OUT only: an explicit false pins this machine to the bundled snapshot.
52
52
  try {
53
- if (readHomepagePrefs().homepageRemote === true) return REMOTE_HOMEPAGE;
53
+ if (readHomepagePrefs().homepageRemote === false) return LOCAL_URL;
54
54
  } catch {}
55
- return LOCAL_URL;
55
+ return REMOTE_HOMEPAGE;
56
56
  }
57
57
 
58
58
  // Fall back to the bundled snapshot when a remote homepage fails to load or
@@ -54,23 +54,36 @@ function loadPicker() {
54
54
  return mod.exports;
55
55
  }
56
56
 
57
- test("defaults to the bundled file:// snapshot", () => {
57
+ test("defaults to the deployed web build", () => {
58
58
  withHome(() => {
59
- const { pickHomepageURL, LOCAL_URL } = loadPicker();
60
- assert.equal(pickHomepageURL(), LOCAL_URL);
61
- assert.match(pickHomepageURL(), /^file:\/\//);
59
+ const { pickHomepageURL, REMOTE_HOMEPAGE } = loadPicker();
60
+ assert.equal(pickHomepageURL(), REMOTE_HOMEPAGE);
61
+ assert.equal(REMOTE_HOMEPAGE, "https://desktop.cicy-ai.com/");
62
62
  });
63
63
  });
64
64
 
65
- test("prefs.homepageRemote opts in to the deployed Worker", () => {
65
+ test("prefs.homepageRemote:false pins a machine to the bundled snapshot", () => {
66
66
  withHome((home) => {
67
67
  fs.writeFileSync(
68
68
  path.join(home, "cicy-ai", "db", "prefs.json"),
69
- JSON.stringify({ homepageRemote: true })
69
+ JSON.stringify({ homepageRemote: false })
70
70
  );
71
- const { pickHomepageURL, REMOTE_HOMEPAGE } = loadPicker();
72
- assert.equal(pickHomepageURL(), REMOTE_HOMEPAGE);
73
- assert.equal(REMOTE_HOMEPAGE, "https://desktop.cicy-ai.com/");
71
+ const { pickHomepageURL, LOCAL_URL } = loadPicker();
72
+ assert.equal(pickHomepageURL(), LOCAL_URL);
73
+ assert.match(pickHomepageURL(), /^file:\/\//);
74
+ });
75
+ });
76
+
77
+ test("any value other than an explicit false stays on the web build", () => {
78
+ withHome((home) => {
79
+ for (const v of [true, "false", 0, null]) {
80
+ fs.writeFileSync(
81
+ path.join(home, "cicy-ai", "db", "prefs.json"),
82
+ JSON.stringify({ homepageRemote: v })
83
+ );
84
+ const { pickHomepageURL, REMOTE_HOMEPAGE } = loadPicker();
85
+ assert.equal(pickHomepageURL(), REMOTE_HOMEPAGE, `homepageRemote=${JSON.stringify(v)}`);
86
+ }
74
87
  });
75
88
  });
76
89
 
@@ -78,7 +91,7 @@ test("CICY_HOMEPAGE_URL wins over prefs and the default", () => {
78
91
  withHome((home) => {
79
92
  fs.writeFileSync(
80
93
  path.join(home, "cicy-ai", "db", "prefs.json"),
81
- JSON.stringify({ homepageRemote: true })
94
+ JSON.stringify({ homepageRemote: false })
82
95
  );
83
96
  process.env.CICY_HOMEPAGE_URL = "http://127.0.0.1:5173/";
84
97
  try {
@@ -89,11 +102,11 @@ test("CICY_HOMEPAGE_URL wins over prefs and the default", () => {
89
102
  });
90
103
  });
91
104
 
92
- test("a malformed prefs file falls back to local rather than throwing", () => {
105
+ test("a malformed prefs file keeps the default rather than throwing", () => {
93
106
  withHome((home) => {
94
107
  fs.writeFileSync(path.join(home, "cicy-ai", "db", "prefs.json"), "{ not json");
95
- const { pickHomepageURL, LOCAL_URL } = loadPicker();
96
- assert.equal(pickHomepageURL(), LOCAL_URL);
108
+ const { pickHomepageURL, REMOTE_HOMEPAGE } = loadPicker();
109
+ assert.equal(pickHomepageURL(), REMOTE_HOMEPAGE);
97
110
  });
98
111
  });
99
112