cicy-desktop 2.1.235 → 2.1.237

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 (139) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +4 -0
  3. package/README.md +68 -305
  4. package/assets/my_teams.png +0 -0
  5. package/assets/team.png +0 -0
  6. package/bin/cicy-desktop +2 -4
  7. package/generate-openapi.js +3 -0
  8. package/jest.config.js +3 -0
  9. package/jest.setup.global.js +3 -0
  10. package/jest.teardown.global.js +3 -0
  11. package/package.json +10 -13
  12. package/scripts/build-homepage.cjs +3 -0
  13. package/scripts/sync-runtime-deps.cjs +3 -0
  14. package/src/app-updater.js +3 -0
  15. package/src/backends/auth-email.js +3 -0
  16. package/src/backends/auth-loopback.js +3 -0
  17. package/src/backends/homepage-preload.js +3 -0
  18. package/src/backends/homepage-window.js +3 -0
  19. package/src/backends/ipc.js +3 -0
  20. package/src/backends/local-teams.js +3 -0
  21. package/src/backends/open-external.js +3 -0
  22. package/src/backends/poller.js +3 -0
  23. package/src/backends/registry.js +3 -0
  24. package/src/backends/sidecar-ipc.js +3 -0
  25. package/src/backends/updater.js +3 -0
  26. package/src/backends/webview-preload.js +3 -0
  27. package/src/backends/window-manager.js +3 -0
  28. package/src/backends/window-tracker.js +3 -0
  29. package/src/chrome/chrome-cdp-client.js +3 -0
  30. package/src/chrome/chrome-launcher.js +3 -0
  31. package/src/chrome/debugger-port-resolver.js +3 -0
  32. package/src/chrome/runtime-registry.js +3 -0
  33. package/src/cloud/cloud-client.js +3 -0
  34. package/src/cluster/local-agent-registry.js +3 -0
  35. package/src/cluster/remote-executor.js +3 -0
  36. package/src/cluster/types.js +3 -0
  37. package/src/cluster/worker-client.js +3 -0
  38. package/src/cluster/worker-identity.js +3 -0
  39. package/src/config.js +3 -0
  40. package/src/extension/inject.js +3 -0
  41. package/src/i18n/index.js +3 -0
  42. package/src/main-old.js +3 -0
  43. package/src/main.js +3 -0
  44. package/src/master/agent-index.js +3 -0
  45. package/src/master/chrome-config.js +3 -0
  46. package/src/master/master-admin-routes.js +3 -0
  47. package/src/master/master-main.js +3 -0
  48. package/src/master/master-metrics.js +3 -0
  49. package/src/master/master-routes.js +3 -0
  50. package/src/master/master-token-manager.js +3 -0
  51. package/src/master/session-affinity-store.js +3 -0
  52. package/src/master/task-scheduler.js +3 -0
  53. package/src/master/task-store.js +3 -0
  54. package/src/master/worker-inventory.js +3 -0
  55. package/src/master/worker-registry.js +3 -0
  56. package/src/preload-rpc.js +3 -0
  57. package/src/profiles/profile-store.js +3 -0
  58. package/src/profiles/trusted-origins-store.js +3 -0
  59. package/src/server/args-parser.js +3 -0
  60. package/src/server/chrome-management-routes.js +3 -0
  61. package/src/server/chrome-proxy-routes.js +3 -0
  62. package/src/server/electron-setup.js +3 -0
  63. package/src/server/express-app.js +8 -19
  64. package/src/server/logging.js +3 -0
  65. package/src/server/mcp-server.js +3 -0
  66. package/src/server/tool-catalog.js +3 -0
  67. package/src/server/tool-executor.js +3 -0
  68. package/src/server/tool-registry.js +3 -0
  69. package/src/server/ui-routes.js +3 -0
  70. package/src/server/worker-observability-routes.js +3 -0
  71. package/src/sidecar/cicy-code.js +3 -0
  72. package/src/sidecar/colima-docker.js +3 -0
  73. package/src/sidecar/docker.js +3 -0
  74. package/src/sidecar/host-mihomo.js +3 -0
  75. package/src/sidecar/localbin.js +3 -0
  76. package/src/sidecar/mirrors.js +3 -0
  77. package/src/sidecar/native.js +3 -0
  78. package/src/sidecar/net-detect.js +3 -0
  79. package/src/sidecar/runtime.js +3 -0
  80. package/src/sidecar/version.js +3 -0
  81. package/src/sidecar/wsl-docker.js +3 -0
  82. package/src/tabbrowser/newtab-protocol.js +3 -0
  83. package/src/tabbrowser/tab-shell-preload.js +3 -0
  84. package/src/tools/account-tools.js +3 -0
  85. package/src/tools/automation-tools.js +3 -0
  86. package/src/tools/cdp-tools.js +3 -0
  87. package/src/tools/chrome-tools.js +3 -0
  88. package/src/tools/clipboard-tools.js +3 -0
  89. package/src/tools/desktop-snapshot-tools.js +3 -0
  90. package/src/tools/device-tools.js +3 -0
  91. package/src/tools/download-tools.js +3 -0
  92. package/src/tools/exec-js.js +3 -0
  93. package/src/tools/exec-tools.js +3 -0
  94. package/src/tools/file-tools.js +3 -0
  95. package/src/tools/hook-chatgpt.js +3 -0
  96. package/src/tools/hook-gemini.js +3 -0
  97. package/src/tools/index.js +3 -0
  98. package/src/tools/ipc-bridge.js +3 -0
  99. package/src/tools/list-tools.js +3 -0
  100. package/src/tools/ping.js +3 -0
  101. package/src/tools/r-reset.js +3 -0
  102. package/src/tools/screenshot-tools.js +3 -0
  103. package/src/tools/system-tools.js +3 -0
  104. package/src/tools/tab-browser-tools.js +3 -0
  105. package/src/tools/window-tools.js +3 -0
  106. package/src/tray.js +3 -0
  107. package/src/utils/app-icon.js +3 -0
  108. package/src/utils/auth.js +3 -0
  109. package/src/utils/brand-host-electron.js +3 -0
  110. package/src/utils/cdp-utils.js +3 -0
  111. package/src/utils/context-menu-options.js +3 -0
  112. package/src/utils/cookie-logins.js +3 -0
  113. package/src/utils/desktop-snapshot.js +3 -0
  114. package/src/utils/download-manager.js +3 -0
  115. package/src/utils/global-json.js +3 -0
  116. package/src/utils/ip-probe.js +3 -0
  117. package/src/utils/process-utils.js +3 -0
  118. package/src/utils/rpc-audit.js +3 -0
  119. package/src/utils/rpc-guard.js +3 -0
  120. package/src/utils/snapshot-utils.js +3 -0
  121. package/src/utils/window-monitor.js +3 -0
  122. package/src/utils/window-registry.js +3 -0
  123. package/src/utils/window-state.js +3 -0
  124. package/src/utils/window-thumbnails.js +3 -0
  125. package/src/utils/window-utils.js +3 -0
  126. package/workers/render/package-lock.json +1 -0
  127. package/workers/render/package.json +2 -1
  128. package/workers/render/src/App.jsx +3 -0
  129. package/workers/render/src/main.jsx +3 -0
  130. package/workers/render/src/mdLite.js +3 -0
  131. package/workers/render/src/termsText.js +3 -0
  132. package/workers/render/vite.config.js +3 -0
  133. package/CLAUDE.md +0 -615
  134. package/bin/cicy-rpc +0 -13
  135. package/dev-app-update.yml +0 -3
  136. package/src/cli/rpc.js +0 -356
  137. package/src/ui-react-dist/assets/index-IWkApOSk.css +0 -1
  138. package/src/ui-react-dist/assets/index-jGZoL6K1.js +0 -154
  139. package/src/ui-react-dist/index.html +0 -13
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ CiCy Desktop
2
+ Copyright 2026 CiCy AI
3
+
4
+ This product includes software developed by CiCy AI (https://cicy-ai.com).
package/README.md CHANGED
@@ -1,49 +1,29 @@
1
1
  # CiCy Desktop
2
2
 
3
- CiCy Desktop is an Electron-based desktop automation worker with a small cluster control plane.
3
+ CiCy Desktop is an Electron-based desktop automation worker with a small cluster
4
+ control plane. It exposes ~100+ system tools — Chrome/CDP control, in-page
5
+ JavaScript, screenshots, clipboard, file ops, shell/node/python exec, system
6
+ info — over MCP and HTTP, plus a homepage UI for managing local and remote
7
+ teams. The `cicy-code` sidecar daemon is acquired at runtime (`npx cicy-code` on
8
+ mac/linux, Docker-in-WSL on Windows), not bundled.
4
9
 
5
- The project now has **two separate CLIs**:
10
+ ## Screenshots
6
11
 
7
- - `cicy` / `cicy-desktop`: start, stop, inspect, and manage the local desktop/cluster lifecycle
8
- - `cicy-rpc`: call worker RPC tools such as `ping`, `tools`, `open_window`, and `exec_js`
12
+ The homepage your teams (the local sidecar, private-cloud teams, and custom
13
+ remote nodes), each a card you open as a tab:
9
14
 
10
- If you remember the old unified CLI model, that is no longer the current behavior.
15
+ ![CiCy Desktop homepage team list](assets/my_teams.png)
11
16
 
12
- ## CLI split
17
+ A team opened as a tab — the agent roster on the left, a live conversation on
18
+ the right:
13
19
 
14
- ### `cicy` / `cicy-desktop`
15
- Use this for local desktop/cluster management only:
20
+ ![CiCy Desktop team workspace](assets/team.png)
16
21
 
17
- ```bash
18
- cicy start
19
- cicy stop
20
- cicy status
21
- cicy restart
22
- cicy logs
23
- ```
24
-
25
- Equivalent alias:
26
-
27
- ```bash
28
- cicy-desktop start
29
- ```
30
-
31
- Notes:
32
- - `npm start` runs the same desktop lifecycle entrypoint
33
- - `cicy --json` / `cicy -j` is not supported
34
- - RPC/tool commands moved to `cicy-rpc`
22
+ ## CLI — `cicy-desktop`
35
23
 
36
- ### `cicy-rpc`
37
- Use this for RPC/tool calls only:
38
-
39
- ```bash
40
- cicy-rpc init
41
- cicy-rpc tools
42
- cicy-rpc tools open_window
43
- cicy-rpc ping
44
- cicy-rpc open_window url=https://example.com
45
- cicy-rpc --json get_window_info win_id=1
46
- ```
24
+ `cicy-desktop` launches the Electron app — `npm start` and `npx cicy-desktop` run
25
+ the same entrypoint. Self-update with `cicy-desktop --update`; `--version` and
26
+ `--help` print info.
47
27
 
48
28
  ## Run (end users, no clone)
49
29
 
@@ -51,317 +31,100 @@ First run launches the Electron app and drops a desktop shortcut (Windows
51
31
  `.lnk` / macOS `.app` / Linux `.desktop`, all with the CiCy icon); double-click
52
32
  it afterwards.
53
33
 
54
- **CN needs the electron mirror.** A fresh machine has no cached electron
55
- binary, so electron's postinstall would hit GitHub releases and fail. Point
56
- `ELECTRON_MIRROR` + the npm registry at npmmirror.
34
+ **CN needs the electron mirror.** A fresh machine has no cached electron binary,
35
+ so electron's postinstall would otherwise hit GitHub releases and fail — point
36
+ `ELECTRON_MIRROR` and the npm registry at npmmirror.
57
37
 
58
- ### Windows — global install (NOT npx)
38
+ ### Windows — global install (not npx)
59
39
 
60
- npx's libnpmexec lock false-positives as `ECOMPROMISED` / "Lock compromised" on
61
- Windows boxes with realtime antivirus (Defender touches `node_modules` mtimes
62
- mid-install → the lock heartbeat aborts). `npm i -g` has no such lock, so
63
- Windows installs globally and launches the global bin:
40
+ npx's libnpmexec lock false-positives as "Lock compromised" on Windows boxes
41
+ with realtime antivirus (Defender touches `node_modules` mtimes mid-install).
42
+ `npm i -g` has no such lock:
64
43
 
65
44
  ```cmd
66
45
  cmd /c "set ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/&& npm i -g cicy-desktop --registry=https://registry.npmmirror.com&& cicy-desktop"
67
46
  ```
68
47
 
69
- Re-run the same line to update. The generated `.lnk` runs the global
70
- `cicy-desktop` bin (no npx).
48
+ Re-run the same line to update.
71
49
 
72
50
  ### macOS / Linux — npx
73
51
 
74
- npx's lock works fine here:
75
-
76
52
  ```bash
77
53
  ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm_config_registry=https://registry.npmmirror.com npx -y cicy-desktop
78
54
  ```
79
55
 
80
56
  Outside CN (or once electron is cached) a plain `npx -y cicy-desktop` is enough.
81
57
 
82
- ## Quick start (development)
83
-
84
- ### 1. Install
58
+ ## Develop
85
59
 
86
60
  ```bash
87
61
  git clone git@github.com:cicy-ai/cicy-desktop.git
88
62
  cd cicy-desktop
89
63
  npm install
90
- ```
91
-
92
- ### 2. Start the local desktop worker
93
-
94
- ```bash
95
- cicy start
96
- # or
97
64
  npm start
98
65
  ```
99
66
 
100
- ### 3. Initialize RPC config
101
-
102
- ```bash
103
- cicy-rpc init
104
- ```
105
-
106
- This creates `~/global.json` if it does not exist.
67
+ Config lives in `~/cicy-ai/global.json` (API token, gateway key, node list). The
68
+ worker reads its `Authorization: Bearer <token>` from there.
107
69
 
108
- ### 4. Verify connectivity
70
+ ### Homepage UI (`workers/render`)
109
71
 
110
- ```bash
111
- cicy-rpc ping
112
- ```
72
+ The desktop homepage — team cards, tabs, everything the user sees — is a Vite +
73
+ React app in `workers/render/`. The Electron main process loads a **prebuilt
74
+ snapshot** from `src/backends/homepage-react/` (a `file://` SPA: works offline,
75
+ no mixed-content issues embedding the team webview). Source and snapshot are two
76
+ different things — `scripts/build-homepage.cjs` (run on every `build:*` /
77
+ publish) rebuilds the snapshot so it never lags behind `workers/render/`.
113
78
 
114
- ### 5. Inspect available tools
79
+ Build ship the snapshot:
115
80
 
116
81
  ```bash
117
- cicy-rpc tools
118
- cicy-rpc tools open_window
119
- ```
120
-
121
- ### 6. Open a page
122
-
123
- ```bash
124
- cicy-rpc open_window url=https://example.com
125
- ```
126
-
127
- ## Homepage renderer (`workers/render`)
128
-
129
- The cicy-desktop homepage UI lives in `workers/render` — a Vite + React app that
130
- the Electron main process loads into the primary BrowserWindow.
131
-
132
- ### Where it's served from
133
-
134
- - **All platforms (Win/Mac/Linux)**: local
135
- `file:///.../src/backends/homepage-react/index.html` (a synced copy of
136
- `workers/render/dist/`). `pickHomepageURL()` returns this unconditionally —
137
- the bundled `file://` SPA works offline, is fast, and lets the homepage
138
- embed the HTTP team-assistant webview without mixed-content issues.
139
- - **Dev**: set `CICY_HOMEPAGE_URL=http://localhost:8173` to load the live
140
- vite dev server instead. See "Dev workflow" below.
141
-
142
- ### Build → ship layout
143
-
144
- ```bash
145
- # build the SPA
146
82
  cd workers/render && npm run build
147
- # copy into the file:// SPA folder cicy-desktop's main process loads from
148
83
  rsync -av --delete dist/ ../../src/backends/homepage-react/
149
84
  ```
150
85
 
151
- ### Dev workflow
152
-
153
- Vite runs **on Mac**. Source edits happen on Linux and are rsynced over —
154
- Linux itself never serves the SPA. There used to be a Linux-runs-Vite +
155
- `ssh -R` tunnel option; it was dropped because the tunnel silently dropped
156
- mid-session and the resulting blank page wasted hours.
157
-
158
- ```bash
159
- # On Linux: sync source to Mac
160
- rsync -avz --delete \
161
- --exclude=node_modules --exclude=dist --exclude=.git \
162
- ~/projects/cicy-desktop/ mac:~/projects/cicy-desktop/
163
-
164
- # On Mac: start Vite + run source-mode Electron
165
- ssh mac
166
- cd ~/projects/cicy-desktop/workers/render
167
- npm install # first time only
168
- npm run dev # serves http://localhost:8173
169
-
170
- # In another shell on Mac
171
- cd ~/projects/cicy-desktop
172
- pkill -f "MacOS/CiCy Desktop" 2>/dev/null # stop any installed .app first
173
- bash -c 'set -a; . ./.env.dev; set +a; npm start'
174
- # .env.dev sets CICY_HOMEPAGE_URL=http://localhost:8173 so Electron loads
175
- # the Vite bundle (HMR enabled) instead of the bundled file:// one.
176
- ```
177
-
178
- Now edit `workers/render/src/App.jsx` on Linux → `rsync` to Mac →
179
- Vite HMR picks it up instantly. No Electron restart for React/CSS edits.
180
-
181
- > **Fallback**: if `CICY_HOMEPAGE_URL` is set but unreachable (Vite not
182
- > started, port conflict), `homepage-window.js` falls back to the bundled
183
- > `file://` SPA so the window never stays blank.
86
+ Fast dev loop (React/CSS HMR, no Electron restart): run Vite and source-mode
87
+ Electron with `CICY_HOMEPAGE_URL=http://localhost:8173` set (via `.env.dev`).
88
+ `src/backends/homepage-window.js` falls back to the bundled `file://` SPA if that
89
+ URL is unreachable, so the window never stays blank. Full platform/loop details
90
+ (Mac fast loop, Windows packaged, the three reload classes) are in the worker's
91
+ `CLAUDE.md`.
184
92
 
185
- `src/backends/homepage-window.js` URL priority:
186
- 1. `CICY_HOMEPAGE_URL` env (dev override) → falls back to `file://` on load failure
187
- 2. All platforms → bundled `file://src/backends/homepage-react/index.html`
93
+ ## Calling tools
188
94
 
189
- ### Shipping SPA changes to Windows (hotpatch)
190
-
191
- Windows loads the same local `file://` SPA as Mac/Linux — the running
192
- npm-global install reads `src/backends/homepage-react/`. So shipping a SPA
193
- change = sync the files, **not** redeploy a Worker (there is no remote
194
- homepage Worker for Windows anymore):
195
-
196
- ```bash
197
- # build + mirror into the file:// folder
198
- cd workers/render && npm run build
199
- rsync -av --delete dist/ ../../src/backends/homepage-react/
200
- # package backend + SPA and push to the Windows box
201
- cd ../.. && tar czf /tmp/cicy-hotpatch.tgz src build bin package.json
202
- scp /tmp/cicy-hotpatch.tgz win:'C:/Users/Administrator/cicy-hotpatch.tgz'
203
- ssh win 'cd /d "C:\Users\Administrator\AppData\Roaming\npm\node_modules\cicy-desktop" && tar -xzf C:\Users\Administrator\cicy-hotpatch.tgz'
204
- # relaunch in the *interactive* session (session 0 can't paint a GUI window)
205
- ssh win 'schtasks /run /tn StartElectron'
206
- ```
95
+ The worker dispatches its tools three ways:
207
96
 
208
- The `StartElectron` scheduled task is set to "interactive only" so the
209
- relaunched window appears on the user's RDP desktop. `bin/cicy-desktop`
210
- always opens `--remote-debugging-port=9221`, so verify the reload over CDP.
211
-
212
- ## Canonical config
213
-
214
- `cicy-rpc` reads `~/global.json`.
215
-
216
- Use this format:
217
-
218
- ```json
219
- {
220
- "api_token": "your-default-token",
221
- "cicyDesktopNodes": {
222
- "local": {
223
- "api_token": "",
224
- "base_url": "http://localhost:8101"
225
- },
226
- "windows": {
227
- "api_token": "your-windows-token",
228
- "base_url": "http://windows-host:8101"
229
- }
230
- }
231
- }
232
- ```
97
+ - **In-page (IPC):** `window.electronRPC(toolName, args)` the bridge injected
98
+ into trusted BrowserWindows.
99
+ - **HTTP (REST):** `POST /rpc/:toolName` with `Authorization: Bearer <token>` —
100
+ served by the master, which forwards to the selected worker. `401
101
+ Unauthorized` means the token is wrong or missing.
102
+ - **From an agent:** the `agent-desktop` / `agent-electron` / `agent-chrome`
103
+ skills drive a connected client over WebSocket
104
+ (`agent-desktop rpc <tool>`, `agent-desktop exec …`, etc.).
233
105
 
234
- Rules:
235
- - `cicyDesktopNodes.<name>.base_url` is the worker base URL
236
- - `cicyDesktopNodes.<name>.api_token` overrides the top-level `api_token` for that node
237
- - `CICY_NODE=<name>` selects the target node
238
- - default node is `local`
106
+ Discover tools at runtime:
239
107
 
240
- Example:
108
+ - `list_tools` meta-tool (`electronRPC("list_tools")` / `agent-desktop rpc list_tools`)
109
+ - `GET /openapi.json` (browsable at `/docs`)
241
110
 
242
- ```bash
243
- CICY_NODE=windows cicy-rpc get_windows
244
- ```
245
-
246
- ## Main workflows
247
-
248
- ### Local lifecycle management
249
-
250
- ```bash
251
- cicy start
252
- cicy status
253
- cicy logs
254
- ```
255
-
256
- ### Local tool calls
257
-
258
- ```bash
259
- cicy-rpc ping
260
- cicy-rpc tools
261
- cicy-rpc open_window url=https://example.com
262
- cicy-rpc get_window_info win_id=1
263
- cicy-rpc --json get_window_info win_id=1
264
- ```
265
-
266
- ### Remote or multi-node tool calls
267
-
268
- ```bash
269
- CICY_NODE=windows cicy-rpc ping
270
- CICY_NODE=windows cicy-rpc get_windows
271
- CICY_NODE=windows cicy-rpc open_window url=https://example.com
272
- ```
273
-
274
- ## What the worker can do
275
-
276
- The worker exposes automation tools for:
277
-
278
- - browser window lifecycle and navigation
279
- - page interaction through CDP
280
- - JavaScript execution inside pages
281
- - screenshots, downloads, and clipboard operations
282
- - system window control and system information
283
- - worker/master cluster coordination
284
-
285
- For the exact tool list, use:
286
-
287
- ```bash
288
- cicy-rpc tools
289
- ```
111
+ The worker exposes automation for: browser window lifecycle and navigation, CDP
112
+ page interaction, in-page JavaScript, screenshots / downloads / clipboard,
113
+ system window control and system info, and worker/master cluster coordination.
290
114
 
291
115
  ## Architecture
292
116
 
293
- Current source of truth in code:
294
-
295
- - worker/server entry: `src/main.js:1`
296
- - RPC CLI: `src/cli/rpc.js:1`
297
- - desktop lifecycle CLI: `bin/cicy-desktop:1`
298
- - tool implementations: `src/tools/*`
299
-
300
- At a high level:
301
- - the **worker** dispatches tools two ways: in-process via `ipcMain.handle("rpc", …)` (`src/main.js`, what `window.electronRPC(tool, args)` rides) and over HTTP. The full, live tool index is `GET /openapi.json` (browse at `/docs`); call `list_tools` to enumerate from the RPC/IPC side.
302
- - REST tool invocation (`POST /rpc/:toolName`, used by `cicy-rpc`) is served by the **master** (`src/master/master-routes.js`), which forwards to the selected worker.
303
- - RPC routes are protected by auth and return `401 Unauthorized` when the token is wrong or missing
304
- - the desktop CLI starts a local master + worker cluster and provides status/log management
305
-
306
- ## Authentication
307
-
308
- RPC requests use the token loaded from `~/global.json`.
309
-
310
- - CLI calls made through `cicy-rpc` send `Authorization: Bearer <token>`
311
- - worker routes return `401 Unauthorized` if auth fails
312
- - per-node token comes from `cicyDesktopNodes.<name>.api_token`, falling back to top-level `api_token`
313
-
314
- ## Troubleshooting
315
-
316
- ### `fetch failed`
317
- Usually means the target node is unreachable.
318
-
319
- Check:
320
-
321
- ```bash
322
- cicy status
323
- cicy-rpc ping
324
- CICY_NODE=windows cicy-rpc ping
325
- ```
326
-
327
- If needed, verify the node's `base_url` in `~/global.json`.
328
-
329
- ### `HTTP 401 Unauthorized`
330
- Usually means the URL is correct but the token is wrong.
331
-
332
- Check:
333
- - `api_token`
334
- - `cicyDesktopNodes.<name>.api_token`
335
- - `cicyDesktopNodes.<name>.base_url`
336
-
337
- Then retry:
338
-
339
- ```bash
340
- cicy-rpc ping
341
- ```
342
-
343
- ### Window opened but page is not ready yet
344
- Query the window state and wait for loading to finish:
345
-
346
- ```bash
347
- cicy-rpc get_window_info win_id=1
348
- ```
349
-
350
- For remote nodes:
351
-
352
- ```bash
353
- CICY_NODE=windows cicy-rpc get_window_info win_id=1
354
- ```
355
-
356
- ## Documentation
357
-
358
- Use the root README as the entrypoint, then go deeper here:
117
+ - worker/server entry `src/main.js`
118
+ - desktop lifecycle CLI — `bin/cicy-desktop`
119
+ - tool implementations `src/tools/*`
120
+ - master (routes `POST /rpc/:toolName` to workers) — `src/master/master-routes.js`
121
+ - homepage source `workers/render/` → built into `src/backends/homepage-react/`
359
122
 
360
- - [CLI split and usage](./skills/cicy-cli/README.md)
361
- - [RPC CLI details](./packages/cicy-rpc/README.md)
362
- - [REST API notes](./docs/REST-API.md)
363
- - [Desktop service skill](./skills/cicy-desktop-service/README.md)
123
+ The **worker** dispatches tools in-process via `ipcMain.handle("rpc", …)` (what
124
+ `window.electronRPC` rides) and over HTTP; the live tool index is
125
+ `GET /openapi.json`. The desktop CLI starts a local master + worker cluster and
126
+ manages status/logs.
364
127
 
365
128
  ## License
366
129
 
367
- MIT
130
+ [Apache-2.0](./LICENSE).
Binary file
Binary file
package/bin/cicy-desktop CHANGED
@@ -268,7 +268,7 @@ for (let i = 0; i < args.length; i++) {
268
268
  } else if (arg === "-v" || arg === "--version") {
269
269
  showVersion = true;
270
270
  } else if (arg === "-j" || arg === "--json") {
271
- console.error("[x] --json is only supported by cicy-rpc");
271
+ console.error("[x] --json is not supported");
272
272
  process.exit(1);
273
273
  } else if (arg === "-cn" || arg === "--cn") {
274
274
  useCNMirror = true;
@@ -343,9 +343,7 @@ Examples:
343
343
  cicy status
344
344
  cicy restart
345
345
  cicy logs
346
- cicy --port 8201
347
-
348
- RPC commands moved to: cicy-rpc`);
346
+ cicy --port 8201`);
349
347
  }
350
348
 
351
349
  function update() {
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ // Copyright 2026 CiCy AI
3
+ // SPDX-License-Identifier: Apache-2.0
4
+
2
5
 
3
6
  const fs = require('fs');
4
7
  const path = require('path');