@clagentic/console 1.0.0-beta.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 (221) hide show
  1. package/CREDITS.md +3 -0
  2. package/LICENSE +21 -0
  3. package/README.md +250 -0
  4. package/bin/cli.js +2812 -0
  5. package/lib/agents-favorites.js +164 -0
  6. package/lib/agents.js +282 -0
  7. package/lib/ask-user-mcp-server.js +120 -0
  8. package/lib/browser-mcp-server.js +484 -0
  9. package/lib/build-user-env.js +63 -0
  10. package/lib/certs/fullchain.pem +47 -0
  11. package/lib/certs/privkey.pem +5 -0
  12. package/lib/cli-sessions.js +265 -0
  13. package/lib/codex-defaults.js +18 -0
  14. package/lib/config.js +332 -0
  15. package/lib/crisis-safety.js +60 -0
  16. package/lib/daemon-projects.js +164 -0
  17. package/lib/daemon.js +1602 -0
  18. package/lib/dm.js +128 -0
  19. package/lib/ipc.js +125 -0
  20. package/lib/ipv4-only.js +39 -0
  21. package/lib/mcp-local.js +385 -0
  22. package/lib/notes.js +141 -0
  23. package/lib/os-users.js +529 -0
  24. package/lib/pages.js +1325 -0
  25. package/lib/project-connection.js +302 -0
  26. package/lib/project-external-trigger.js +236 -0
  27. package/lib/project-file-watch.js +120 -0
  28. package/lib/project-filesystem.js +528 -0
  29. package/lib/project-http.js +753 -0
  30. package/lib/project-image.js +95 -0
  31. package/lib/project-knowledge.js +88 -0
  32. package/lib/project-loop.js +1304 -0
  33. package/lib/project-mcp.js +374 -0
  34. package/lib/project-memory.js +39 -0
  35. package/lib/project-notifications.js +262 -0
  36. package/lib/project-sessions.js +1581 -0
  37. package/lib/project-user-mention.js +193 -0
  38. package/lib/project-user-message.js +628 -0
  39. package/lib/project.js +1303 -0
  40. package/lib/public/app.js +1031 -0
  41. package/lib/public/apple-touch-icon.png +0 -0
  42. package/lib/public/claude-code-avatar.png +0 -0
  43. package/lib/public/codex-avatar.png +0 -0
  44. package/lib/public/console-icon.png +0 -0
  45. package/lib/public/css/admin.css +736 -0
  46. package/lib/public/css/agent-picker.css +119 -0
  47. package/lib/public/css/base.css +235 -0
  48. package/lib/public/css/channel-layout.css +441 -0
  49. package/lib/public/css/command-palette.css +559 -0
  50. package/lib/public/css/debate.css +1609 -0
  51. package/lib/public/css/diff.css +139 -0
  52. package/lib/public/css/filebrowser.css +1976 -0
  53. package/lib/public/css/highlight.css +144 -0
  54. package/lib/public/css/home-hub.css +545 -0
  55. package/lib/public/css/icon-strip.css +1856 -0
  56. package/lib/public/css/input.css +1349 -0
  57. package/lib/public/css/loop.css +1248 -0
  58. package/lib/public/css/mention.css +317 -0
  59. package/lib/public/css/menus.css +857 -0
  60. package/lib/public/css/messages.css +1833 -0
  61. package/lib/public/css/mobile-nav.css +1332 -0
  62. package/lib/public/css/notifications-center.css +296 -0
  63. package/lib/public/css/overlays.css +1273 -0
  64. package/lib/public/css/playbook.css +264 -0
  65. package/lib/public/css/profile.css +397 -0
  66. package/lib/public/css/rewind.css +671 -0
  67. package/lib/public/css/scheduler-modal.css +1495 -0
  68. package/lib/public/css/scheduler.css +1420 -0
  69. package/lib/public/css/server-settings.css +909 -0
  70. package/lib/public/css/session-search.css +159 -0
  71. package/lib/public/css/sidebar.css +2012 -0
  72. package/lib/public/css/skills.css +789 -0
  73. package/lib/public/css/sticky-notes.css +854 -0
  74. package/lib/public/css/stt.css +155 -0
  75. package/lib/public/css/title-bar.css +674 -0
  76. package/lib/public/css/tooltip.css +67 -0
  77. package/lib/public/css/user-settings.css +702 -0
  78. package/lib/public/emoji-data.json +1 -0
  79. package/lib/public/favicon-banded-32.png +0 -0
  80. package/lib/public/favicon-banded.png +0 -0
  81. package/lib/public/favicon-dark.svg +32 -0
  82. package/lib/public/favicon.svg +32 -0
  83. package/lib/public/icon-192.png +0 -0
  84. package/lib/public/icon-512.png +0 -0
  85. package/lib/public/icon-banded-76.png +0 -0
  86. package/lib/public/icon-banded-96.png +0 -0
  87. package/lib/public/icon-mono.svg +25 -0
  88. package/lib/public/icons/email/gmail.svg +7 -0
  89. package/lib/public/icons/email/outlook.svg +35 -0
  90. package/lib/public/icons/email/yahoo.svg +1 -0
  91. package/lib/public/index.html +1946 -0
  92. package/lib/public/manifest.json +27 -0
  93. package/lib/public/markdown-worker.js +43 -0
  94. package/lib/public/marked.min.js +6 -0
  95. package/lib/public/modules/admin.js +954 -0
  96. package/lib/public/modules/agent-picker.js +429 -0
  97. package/lib/public/modules/app-connection.js +216 -0
  98. package/lib/public/modules/app-cursors.js +492 -0
  99. package/lib/public/modules/app-dm.js +265 -0
  100. package/lib/public/modules/app-favicon.js +231 -0
  101. package/lib/public/modules/app-header.js +242 -0
  102. package/lib/public/modules/app-home-hub.js +432 -0
  103. package/lib/public/modules/app-loop-ui.js +691 -0
  104. package/lib/public/modules/app-loop-wizard.js +439 -0
  105. package/lib/public/modules/app-messages.js +1415 -0
  106. package/lib/public/modules/app-misc.js +463 -0
  107. package/lib/public/modules/app-notifications.js +651 -0
  108. package/lib/public/modules/app-panels.js +1061 -0
  109. package/lib/public/modules/app-projects.js +875 -0
  110. package/lib/public/modules/app-rate-limit.js +529 -0
  111. package/lib/public/modules/app-rendering.js +739 -0
  112. package/lib/public/modules/app-skills-install.js +285 -0
  113. package/lib/public/modules/avatar.js +36 -0
  114. package/lib/public/modules/command-palette.js +491 -0
  115. package/lib/public/modules/console-logo.js +162 -0
  116. package/lib/public/modules/context-sources.js +365 -0
  117. package/lib/public/modules/diff.js +412 -0
  118. package/lib/public/modules/dom-refs.js +21 -0
  119. package/lib/public/modules/emoji-picker.js +222 -0
  120. package/lib/public/modules/events.js +21 -0
  121. package/lib/public/modules/filebrowser.js +1966 -0
  122. package/lib/public/modules/fileicons.js +172 -0
  123. package/lib/public/modules/icons.js +80 -0
  124. package/lib/public/modules/input.js +1102 -0
  125. package/lib/public/modules/longpress.js +74 -0
  126. package/lib/public/modules/markdown.js +486 -0
  127. package/lib/public/modules/mcp-ui.js +295 -0
  128. package/lib/public/modules/mention.js +1093 -0
  129. package/lib/public/modules/notifications.js +613 -0
  130. package/lib/public/modules/playbook.js +578 -0
  131. package/lib/public/modules/profile.js +594 -0
  132. package/lib/public/modules/project-settings.js +849 -0
  133. package/lib/public/modules/project-switcher.js +375 -0
  134. package/lib/public/modules/qrcode.js +87 -0
  135. package/lib/public/modules/rewind.js +381 -0
  136. package/lib/public/modules/scheduler-config.js +1611 -0
  137. package/lib/public/modules/scheduler-history.js +131 -0
  138. package/lib/public/modules/scheduler.js +1689 -0
  139. package/lib/public/modules/server-settings.js +842 -0
  140. package/lib/public/modules/session-search.js +456 -0
  141. package/lib/public/modules/settings-defaults.js +253 -0
  142. package/lib/public/modules/sidebar-mobile.js +1425 -0
  143. package/lib/public/modules/sidebar-projects.js +2022 -0
  144. package/lib/public/modules/sidebar-sessions.js +1548 -0
  145. package/lib/public/modules/sidebar-users.js +449 -0
  146. package/lib/public/modules/sidebar.js +348 -0
  147. package/lib/public/modules/skills.js +793 -0
  148. package/lib/public/modules/state.js +3 -0
  149. package/lib/public/modules/sticky-notes.js +1221 -0
  150. package/lib/public/modules/store.js +34 -0
  151. package/lib/public/modules/stt.js +266 -0
  152. package/lib/public/modules/terminal.js +987 -0
  153. package/lib/public/modules/theme.js +812 -0
  154. package/lib/public/modules/tool-palette.js +562 -0
  155. package/lib/public/modules/tools.js +2285 -0
  156. package/lib/public/modules/tooltip.js +150 -0
  157. package/lib/public/modules/user-settings.js +544 -0
  158. package/lib/public/modules/utils.js +56 -0
  159. package/lib/public/modules/ws-ref.js +26 -0
  160. package/lib/public/style.css +34 -0
  161. package/lib/public/sw.js +159 -0
  162. package/lib/push.js +149 -0
  163. package/lib/scheduler.js +471 -0
  164. package/lib/sdk-bridge.js +1792 -0
  165. package/lib/sdk-message-processor.js +740 -0
  166. package/lib/sdk-message-queue.js +42 -0
  167. package/lib/sdk-skill-discovery.js +131 -0
  168. package/lib/sdk-worker.js +677 -0
  169. package/lib/server-admin.js +712 -0
  170. package/lib/server-auth.js +737 -0
  171. package/lib/server-dm.js +170 -0
  172. package/lib/server-palette.js +104 -0
  173. package/lib/server-settings.js +553 -0
  174. package/lib/server-skills.js +280 -0
  175. package/lib/server.js +1390 -0
  176. package/lib/session-search.js +693 -0
  177. package/lib/sessions.js +946 -0
  178. package/lib/smtp.js +221 -0
  179. package/lib/terminal-manager.js +219 -0
  180. package/lib/terminal.js +39 -0
  181. package/lib/themes/ayu-light.json +9 -0
  182. package/lib/themes/catppuccin-latte.json +9 -0
  183. package/lib/themes/catppuccin-mocha.json +9 -0
  184. package/lib/themes/clagentic-dark.json +10 -0
  185. package/lib/themes/clagentic-light.json +10 -0
  186. package/lib/themes/dracula.json +9 -0
  187. package/lib/themes/everforest-light.json +9 -0
  188. package/lib/themes/everforest.json +9 -0
  189. package/lib/themes/github-light.json +9 -0
  190. package/lib/themes/gruvbox-dark.json +9 -0
  191. package/lib/themes/gruvbox-light.json +9 -0
  192. package/lib/themes/monokai.json +9 -0
  193. package/lib/themes/nord-light.json +9 -0
  194. package/lib/themes/nord.json +9 -0
  195. package/lib/themes/one-dark.json +9 -0
  196. package/lib/themes/one-light.json +9 -0
  197. package/lib/themes/rose-pine-dawn.json +9 -0
  198. package/lib/themes/rose-pine.json +9 -0
  199. package/lib/themes/solarized-dark.json +9 -0
  200. package/lib/themes/solarized-light.json +9 -0
  201. package/lib/themes/tokyo-night-light.json +9 -0
  202. package/lib/themes/tokyo-night.json +9 -0
  203. package/lib/updater.js +124 -0
  204. package/lib/user-presence.js +92 -0
  205. package/lib/users-auth.js +146 -0
  206. package/lib/users-permissions.js +118 -0
  207. package/lib/users-preferences.js +254 -0
  208. package/lib/users.js +465 -0
  209. package/lib/utils.js +64 -0
  210. package/lib/worktree.js +134 -0
  211. package/lib/ws-schema.js +464 -0
  212. package/lib/yoke/adapters/claude-worker.js +759 -0
  213. package/lib/yoke/adapters/claude.js +1599 -0
  214. package/lib/yoke/adapters/codex.js +1559 -0
  215. package/lib/yoke/codex-app-server.js +352 -0
  216. package/lib/yoke/index.js +319 -0
  217. package/lib/yoke/instructions.js +61 -0
  218. package/lib/yoke/interface.js +98 -0
  219. package/lib/yoke/mcp-bridge-server.js +302 -0
  220. package/lib/yoke/package.json +7 -0
  221. package/package.json +72 -0
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Daemon project helpers -- Worktree tracking, project filtering, config handlers.
3
+ *
4
+ * Extracted from daemon.js to keep module sizes manageable.
5
+ */
6
+
7
+ var fs = require("fs");
8
+ var { scanWorktrees, isWorktree } = require("./worktree");
9
+
10
+ // --- Worktree tracking state ---
11
+ var worktreeRegistry = {}; // parentSlug -> [wtSlug, ...]
12
+ var worktreeTimers = {}; // parentSlug -> intervalId
13
+ var worktreeScanning = {}; // parentSlug -> boolean (mutex)
14
+
15
+ function isWorktreeSlug(slug) {
16
+ return slug.indexOf("--") !== -1;
17
+ }
18
+
19
+ /**
20
+ * Scan a parent project for worktrees and register them with the relay server.
21
+ * @param {object} relay - the relay server instance (has addProject, removeProject, etc.)
22
+ * @param {string} parentPath - absolute path to parent project
23
+ * @param {string} parentSlug - slug of parent project
24
+ * @param {string} parentIcon - icon of parent project
25
+ * @param {string} parentOwnerId - owner user ID
26
+ */
27
+ function scanAndRegisterWorktrees(relay, parentPath, parentSlug, parentIcon, parentOwnerId) {
28
+ if (isWorktree(parentPath)) return;
29
+ var worktrees = scanWorktrees(parentPath);
30
+ if (worktrees.length === 0) return;
31
+ if (!worktreeRegistry[parentSlug]) worktreeRegistry[parentSlug] = [];
32
+ for (var i = 0; i < worktrees.length; i++) {
33
+ var wt = worktrees[i];
34
+ var wtSlug = parentSlug + "--" + wt.dirName;
35
+ var alreadyRegistered = false;
36
+ for (var j = 0; j < worktreeRegistry[parentSlug].length; j++) {
37
+ if (worktreeRegistry[parentSlug][j] === wtSlug) { alreadyRegistered = true; break; }
38
+ }
39
+ if (alreadyRegistered) continue;
40
+ var wtMeta = { parentSlug: parentSlug, branch: wt.branch || wt.dirName, accessible: wt.accessible };
41
+ relay.addProject(wt.path, wtSlug, wt.branch || wt.dirName, parentIcon, parentOwnerId, wtMeta);
42
+ worktreeRegistry[parentSlug].push(wtSlug);
43
+ console.log("[daemon] Registered worktree:", wtSlug, "->", wt.path, wt.accessible ? "(accessible)" : "(inaccessible)");
44
+ }
45
+ if (!worktreeTimers[parentSlug]) {
46
+ worktreeTimers[parentSlug] = setInterval(function () {
47
+ rescanWorktrees(relay, parentPath, parentSlug, parentIcon, parentOwnerId);
48
+ }, 10000);
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Rescan worktrees for a parent project, adding new and removing stale ones.
54
+ * @param {object} relay - the relay server instance
55
+ * @param {string} parentPath - absolute path to parent project
56
+ * @param {string} parentSlug - slug of parent project
57
+ * @param {string} parentIcon - icon of parent project
58
+ * @param {string} parentOwnerId - owner user ID
59
+ * @param {object} [config] - daemon config (optional, for broadcasting project count)
60
+ */
61
+ function rescanWorktrees(relay, parentPath, parentSlug, parentIcon, parentOwnerId, config) {
62
+ if (worktreeScanning[parentSlug]) return;
63
+ worktreeScanning[parentSlug] = true;
64
+ try {
65
+ var discovered = scanWorktrees(parentPath);
66
+ var changed = false;
67
+ var existingSlugs = worktreeRegistry[parentSlug] || [];
68
+ var discoveredNames = {};
69
+ for (var i = 0; i < discovered.length; i++) {
70
+ discoveredNames[discovered[i].dirName] = discovered[i];
71
+ }
72
+ for (var di = 0; di < discovered.length; di++) {
73
+ var wt = discovered[di];
74
+ var wtSlug = parentSlug + "--" + wt.dirName;
75
+ var found = false;
76
+ for (var ei = 0; ei < existingSlugs.length; ei++) {
77
+ if (existingSlugs[ei] === wtSlug) { found = true; break; }
78
+ }
79
+ if (!found) {
80
+ var wtMeta = { parentSlug: parentSlug, branch: wt.branch || wt.dirName, accessible: wt.accessible };
81
+ relay.addProject(wt.path, wtSlug, wt.branch || wt.dirName, parentIcon, parentOwnerId, wtMeta);
82
+ if (!worktreeRegistry[parentSlug]) worktreeRegistry[parentSlug] = [];
83
+ worktreeRegistry[parentSlug].push(wtSlug);
84
+ console.log("[daemon] Rescan: added worktree:", wtSlug);
85
+ changed = true;
86
+ }
87
+ }
88
+ for (var si = existingSlugs.length - 1; si >= 0; si--) {
89
+ var sSlug = existingSlugs[si];
90
+ var dirName = sSlug.split("--").slice(1).join("--");
91
+ if (!discoveredNames[dirName]) {
92
+ relay.removeProject(sSlug);
93
+ existingSlugs.splice(si, 1);
94
+ console.log("[daemon] Rescan: removed stale worktree:", sSlug);
95
+ changed = true;
96
+ }
97
+ }
98
+ if (changed) {
99
+ relay.broadcastAll({
100
+ type: "projects_updated",
101
+ projects: relay.getProjects(),
102
+ projectCount: config ? config.projects.length : 0,
103
+ });
104
+ }
105
+ } finally {
106
+ worktreeScanning[parentSlug] = false;
107
+ }
108
+ }
109
+
110
+ function cleanupWorktreesForParent(relay, parentSlug) {
111
+ var wtSlugs = worktreeRegistry[parentSlug] || [];
112
+ for (var i = 0; i < wtSlugs.length; i++) {
113
+ relay.removeProject(wtSlugs[i]);
114
+ console.log("[daemon] Cascade removed worktree:", wtSlugs[i]);
115
+ }
116
+ delete worktreeRegistry[parentSlug];
117
+ if (worktreeTimers[parentSlug]) {
118
+ clearInterval(worktreeTimers[parentSlug]);
119
+ delete worktreeTimers[parentSlug];
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Filter removed projects by userId and existence.
125
+ * @param {object} config - daemon config with removedProjects array
126
+ * @param {string|null} userId - user ID to filter by (null for single-user mode)
127
+ */
128
+ function getFilteredRemovedProjects(config, userId) {
129
+ if (!config.removedProjects || config.removedProjects.length === 0) return [];
130
+ return config.removedProjects.filter(function (rp) {
131
+ if (userId && rp.userId && rp.userId !== userId) return false;
132
+ if (!userId && rp.userId) return false;
133
+ return fs.existsSync(rp.path);
134
+ });
135
+ }
136
+
137
+ /**
138
+ * Register a worktree slug under a parent slug.
139
+ * Used by daemon.js when creating worktrees directly.
140
+ */
141
+ function registerWorktreeSlug(parentSlug, wtSlug) {
142
+ if (!worktreeRegistry[parentSlug]) worktreeRegistry[parentSlug] = [];
143
+ worktreeRegistry[parentSlug].push(wtSlug);
144
+ }
145
+
146
+ /**
147
+ * Unregister a worktree slug from its parent.
148
+ * Used by daemon.js when removing worktree projects directly.
149
+ */
150
+ function unregisterWorktreeSlug(parentSlug, wtSlug) {
151
+ if (worktreeRegistry[parentSlug]) {
152
+ worktreeRegistry[parentSlug] = worktreeRegistry[parentSlug].filter(function (s) { return s !== wtSlug; });
153
+ }
154
+ }
155
+
156
+ module.exports = {
157
+ isWorktreeSlug: isWorktreeSlug,
158
+ scanAndRegisterWorktrees: scanAndRegisterWorktrees,
159
+ rescanWorktrees: rescanWorktrees,
160
+ cleanupWorktreesForParent: cleanupWorktreesForParent,
161
+ getFilteredRemovedProjects: getFilteredRemovedProjects,
162
+ registerWorktreeSlug: registerWorktreeSlug,
163
+ unregisterWorktreeSlug: unregisterWorktreeSlug,
164
+ };