@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
package/lib/utils.js ADDED
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Shared utility functions.
3
+ */
4
+
5
+ var fs = require("fs");
6
+
7
+ /**
8
+ * Encode a cwd path into a filesystem-safe directory/file name.
9
+ * Replaces all non-alphanumeric characters with hyphens, matching
10
+ * Claude Code CLI's encoding logic exactly (/[^a-zA-Z0-9]/g -> "-").
11
+ *
12
+ * Example: "/Users/jon.doe_42/my project" -> "-Users-jon-doe-42-my-project"
13
+ */
14
+ function encodeCwd(cwd) {
15
+ return cwd.replace(/[^a-zA-Z0-9]/g, "-");
16
+ }
17
+
18
+ /**
19
+ * Legacy encoding (pre-#182 fix). Only slashes and dots were replaced.
20
+ * Used for fallback resolution of on-disk data written before the fix.
21
+ */
22
+ function legacyEncodeCwd(cwd) {
23
+ return cwd.replace(/[\/\.]/g, "-");
24
+ }
25
+
26
+ /**
27
+ * Try candidate encoded names against a base directory.
28
+ * Returns the first match that exists on disk, or the first candidate
29
+ * (newest encoding) if none exist yet.
30
+ */
31
+ function resolveEncoded(baseDir, cwd, ext, checkFn) {
32
+ var newEncoded = encodeCwd(cwd);
33
+ var legacyEncoded = legacyEncodeCwd(cwd);
34
+ if (newEncoded === legacyEncoded) return newEncoded;
35
+ var full = baseDir + "/" + newEncoded + (ext || "");
36
+ try { if (checkFn(full)) return newEncoded; } catch (e) {}
37
+ var legacyFull = baseDir + "/" + legacyEncoded + (ext || "");
38
+ try { if (checkFn(legacyFull)) return legacyEncoded; } catch (e) {}
39
+ return newEncoded;
40
+ }
41
+
42
+ /**
43
+ * Resolve an encoded directory path with legacy fallback.
44
+ */
45
+ function resolveEncodedDir(baseDir, cwd) {
46
+ return resolveEncoded(baseDir, cwd, "", function(p) {
47
+ return fs.statSync(p).isDirectory();
48
+ });
49
+ }
50
+
51
+ /**
52
+ * Resolve an encoded file path with legacy fallback.
53
+ */
54
+ function resolveEncodedFile(baseDir, cwd, ext) {
55
+ return resolveEncoded(baseDir, cwd, ext, function(p) {
56
+ return fs.statSync(p).isFile();
57
+ });
58
+ }
59
+
60
+ module.exports = {
61
+ encodeCwd: encodeCwd,
62
+ resolveEncodedDir: resolveEncodedDir,
63
+ resolveEncodedFile: resolveEncodedFile,
64
+ };
@@ -0,0 +1,134 @@
1
+ var { execFileSync } = require("child_process");
2
+ var path = require("path");
3
+
4
+ // Parse `git worktree list --porcelain` output into structured objects
5
+ function parseWorktreeOutput(output) {
6
+ var worktrees = [];
7
+ var current = null;
8
+ var lines = output.split("\n");
9
+ for (var i = 0; i < lines.length; i++) {
10
+ var line = lines[i];
11
+ if (line.indexOf("worktree ") === 0) {
12
+ if (current) worktrees.push(current);
13
+ current = { path: line.slice(9), branch: null, bare: false, detached: false };
14
+ } else if (line.indexOf("branch ") === 0 && current) {
15
+ // refs/heads/feat/login -> feat/login
16
+ var ref = line.slice(7);
17
+ var headsIdx = ref.indexOf("refs/heads/");
18
+ current.branch = headsIdx === 0 ? ref.slice(11) : ref;
19
+ } else if (line === "bare" && current) {
20
+ current.bare = true;
21
+ } else if (line === "detached" && current) {
22
+ current.detached = true;
23
+ }
24
+ }
25
+ if (current) worktrees.push(current);
26
+ return worktrees;
27
+ }
28
+
29
+ // Check if a given path is itself a worktree (not the main working tree)
30
+ function isWorktree(projectPath) {
31
+ try {
32
+ var gitDir = execFileSync("git", ["rev-parse", "--git-dir"], {
33
+ cwd: projectPath, encoding: "utf8", timeout: 5000, stdio: ["pipe", "pipe", "pipe"],
34
+ }).trim();
35
+ var commonDir = execFileSync("git", ["rev-parse", "--git-common-dir"], {
36
+ cwd: projectPath, encoding: "utf8", timeout: 5000, stdio: ["pipe", "pipe", "pipe"],
37
+ }).trim();
38
+ var absGit = path.resolve(projectPath, gitDir);
39
+ var absCommon = path.resolve(projectPath, commonDir);
40
+ return absGit !== absCommon;
41
+ } catch (e) {
42
+ return false;
43
+ }
44
+ }
45
+
46
+ // Scan worktrees for a given project path
47
+ // Returns array of { path, branch, bare, detached, accessible }
48
+ // accessible = true if worktree path is inside parentPath
49
+ function scanWorktrees(projectPath) {
50
+ var resolvedParent = path.resolve(projectPath);
51
+ try {
52
+ var output = execFileSync("git", ["worktree", "list", "--porcelain"], {
53
+ cwd: resolvedParent,
54
+ encoding: "utf8",
55
+ timeout: 5000,
56
+ stdio: ["pipe", "pipe", "pipe"],
57
+ });
58
+ var all = parseWorktreeOutput(output);
59
+ // Filter out bare worktrees and the main worktree itself
60
+ var results = [];
61
+ for (var i = 0; i < all.length; i++) {
62
+ var wt = all[i];
63
+ if (wt.bare) continue;
64
+ var resolvedWt = path.resolve(wt.path);
65
+ if (resolvedWt === resolvedParent) continue;
66
+ wt.accessible = resolvedWt.indexOf(resolvedParent + path.sep) === 0;
67
+ wt.dirName = path.basename(wt.path);
68
+ results.push(wt);
69
+ }
70
+ return results;
71
+ } catch (e) {
72
+ return [];
73
+ }
74
+ }
75
+
76
+ // Create a new worktree inside the parent project directory
77
+ // Returns { ok, path, error }
78
+ function createWorktree(projectPath, branchName, dirName, baseBranch) {
79
+ var resolvedParent = path.resolve(projectPath);
80
+ var wtPath = path.join(resolvedParent, dirName || branchName);
81
+ var base = baseBranch || "main";
82
+ // Try creating with -b (new branch)
83
+ try {
84
+ execFileSync("git", ["worktree", "add", wtPath, "-b", branchName, base], {
85
+ cwd: resolvedParent,
86
+ encoding: "utf8",
87
+ timeout: 15000,
88
+ stdio: ["pipe", "pipe", "pipe"],
89
+ });
90
+ return { ok: true, path: wtPath };
91
+ } catch (e) {
92
+ // Branch may already exist, try without -b
93
+ try {
94
+ execFileSync("git", ["worktree", "add", wtPath, branchName], {
95
+ cwd: resolvedParent,
96
+ encoding: "utf8",
97
+ timeout: 15000,
98
+ stdio: ["pipe", "pipe", "pipe"],
99
+ });
100
+ return { ok: true, path: wtPath };
101
+ } catch (e2) {
102
+ return { ok: false, error: e2.message || "Failed to create worktree" };
103
+ }
104
+ }
105
+ }
106
+
107
+ // Remove a worktree
108
+ // Returns { ok, error }
109
+ function removeWorktree(projectPath, worktreeDirName) {
110
+ var resolvedParent = path.resolve(projectPath);
111
+ var wtPath = path.join(resolvedParent, worktreeDirName);
112
+ // Try normal remove first
113
+ try {
114
+ execFileSync("git", ["worktree", "remove", wtPath], {
115
+ cwd: resolvedParent,
116
+ encoding: "utf8",
117
+ timeout: 15000,
118
+ stdio: ["pipe", "pipe", "pipe"],
119
+ });
120
+ return { ok: true };
121
+ } catch (e) {
122
+ var errMsg = (e.stderr || e.message || "").toString();
123
+ // If dirty, report to user
124
+ if (errMsg.indexOf("modified") !== -1 || errMsg.indexOf("untracked") !== -1) {
125
+ return { ok: false, error: "Worktree has uncommitted changes. Commit or discard them first." };
126
+ }
127
+ if (errMsg.indexOf("locked") !== -1) {
128
+ return { ok: false, error: "Worktree is locked. Unlock it first with: git worktree unlock" };
129
+ }
130
+ return { ok: false, error: errMsg || "Failed to remove worktree" };
131
+ }
132
+ }
133
+
134
+ module.exports = { scanWorktrees: scanWorktrees, createWorktree: createWorktree, removeWorktree: removeWorktree, isWorktree: isWorktree };