@clagentic/console 1.7.1-beta.1 → 1.8.0-beta.2
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/bin/cli.js +199 -2545
- package/lib/build-sha.json +2 -2
- package/lib/cli/daemon-launch.js +797 -0
- package/lib/cli/ipc-subcommands.js +186 -0
- package/lib/cli/menus.js +847 -0
- package/lib/cli/net-detect.js +209 -0
- package/lib/cli/tui.js +589 -0
- package/lib/pages.js +13 -17
- package/lib/project-loop.js +10 -2
- package/lib/project.js +6 -0
- package/lib/public/css/base.css +14 -1
- package/lib/public/css/diagnostics.css +15 -0
- package/lib/public/css/home-hub.css +32 -15
- package/lib/public/css/overlays.css +19 -0
- package/lib/public/index.html +12 -11
- package/lib/public/manifest.json +1 -1
- package/lib/public/modules/app-connection.js +187 -4
- package/lib/public/modules/app-history-replay.js +155 -0
- package/lib/public/modules/app-home-hub.js +33 -30
- package/lib/public/modules/app-messages.js +1245 -1489
- package/lib/public/modules/app-notifications.js +4 -4
- package/lib/public/modules/command-palette.js +11 -22
- package/lib/public/modules/context-sources.js +1 -6
- package/lib/public/modules/filebrowser.js +25 -13
- package/lib/public/modules/mcp-ui.js +2 -2
- package/lib/public/modules/notifications.js +22 -1
- package/lib/public/modules/playbook.js +6 -6
- package/lib/public/modules/project-settings.js +5 -13
- package/lib/public/modules/qrcode.js +2 -2
- package/lib/public/modules/relative-time.js +27 -0
- package/lib/public/modules/scheduler-history.js +1 -5
- package/lib/public/modules/server-settings.js +28 -15
- package/lib/public/modules/sidebar-projects.js +1 -1
- package/lib/public/modules/sidebar-sessions.js +1 -15
- package/lib/public/modules/sidebar.js +3 -3
- package/lib/public/modules/utils.js +6 -1
- package/lib/public/sw.js +24 -4
- package/lib/server-auth.js +48 -2
- package/lib/server-settings.js +70 -4
- package/lib/server.js +269 -15
- package/lib/sessions.js +9 -2
- package/lib/smtp.js +6 -6
- package/lib/users.js +19 -10
- package/lib/worktree.js +73 -1
- package/lib/yoke/adapters/codex.js +1 -1
- package/package.json +1 -1
package/lib/users.js
CHANGED
|
@@ -29,19 +29,28 @@ function loadUsers() {
|
|
|
29
29
|
// store.js is async-first; we fall back to synchronous fs here because the
|
|
30
30
|
// entire users.js call graph is synchronous and converting all ~79 call sites
|
|
31
31
|
// is a follow-up task (TODO(lr-b372): convert users.js callers to async).
|
|
32
|
+
var raw;
|
|
32
33
|
try {
|
|
33
|
-
|
|
34
|
-
var data = JSON.parse(raw);
|
|
35
|
-
// Ensure all required fields exist
|
|
36
|
-
if (!data.users) data.users = [];
|
|
37
|
-
if (!data.invites) data.invites = [];
|
|
38
|
-
if (data.multiUser === undefined) data.multiUser = true;
|
|
39
|
-
if (data.setupCode === undefined) data.setupCode = null;
|
|
40
|
-
if (data.smtp === undefined) data.smtp = null;
|
|
41
|
-
return data;
|
|
34
|
+
raw = fs.readFileSync(USERS_FILE, "utf8");
|
|
42
35
|
} catch (e) {
|
|
43
|
-
|
|
36
|
+
// ENOENT is the only case that legitimately means "no users yet" --
|
|
37
|
+
// every other read failure (EACCES, transient I/O error under
|
|
38
|
+
// contention, etc.) must not silently masquerade as an empty user set.
|
|
39
|
+
if (e && e.code === "ENOENT") return defaultData();
|
|
40
|
+
throw e;
|
|
44
41
|
}
|
|
42
|
+
// A parse failure on an existing file means the file is corrupt, not
|
|
43
|
+
// absent. Swallowing this here previously caused findUserById() to return
|
|
44
|
+
// null for every user (lr-ae85d5), surfacing downstream as a confusing
|
|
45
|
+
// "ownerId is null" failure instead of a loud, diagnosable error.
|
|
46
|
+
var data = JSON.parse(raw);
|
|
47
|
+
// Ensure all required fields exist
|
|
48
|
+
if (!data.users) data.users = [];
|
|
49
|
+
if (!data.invites) data.invites = [];
|
|
50
|
+
if (data.multiUser === undefined) data.multiUser = true;
|
|
51
|
+
if (data.setupCode === undefined) data.setupCode = null;
|
|
52
|
+
if (data.smtp === undefined) data.smtp = null;
|
|
53
|
+
return data;
|
|
45
54
|
}
|
|
46
55
|
|
|
47
56
|
function saveUsers(data) {
|
package/lib/worktree.js
CHANGED
|
@@ -104,11 +104,83 @@ function createWorktree(projectPath, branchName, dirName, baseBranch) {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
// Resolve the actual registered path for a worktree identified by dirName
|
|
108
|
+
// (the leaf directory name, i.e. path.basename of the worktree's git-registered
|
|
109
|
+
// path -- see scanWorktrees()'s wt.dirName). Blindly reconstructing
|
|
110
|
+
// path.join(parentPath, dirName) is only correct when the worktree lives
|
|
111
|
+
// directly inside parentPath; a worktree registered elsewhere (e.g. created
|
|
112
|
+
// via `git worktree add ../sibling -b x` outside the app, or nested under a
|
|
113
|
+
// subdirectory) has a basename that does not round-trip back to its real
|
|
114
|
+
// path, and git then rejects the reconstructed path as "not a valid working
|
|
115
|
+
// tree" (lr-76fbc3). Matching against `git worktree list --porcelain` finds
|
|
116
|
+
// the actual registered path regardless of where it lives on disk.
|
|
117
|
+
//
|
|
118
|
+
// Matching on basename alone is not safe: two DIFFERENT parents can each
|
|
119
|
+
// register a worktree with the same leaf dirName (e.g. ./feat and
|
|
120
|
+
// ../sibling/feat), and `git worktree list` for either parent's repo returns
|
|
121
|
+
// BOTH entries (worktrees are tracked per-repository, not per-caller-cwd).
|
|
122
|
+
// Picking the first basename match would silently remove whichever one
|
|
123
|
+
// happens to sort first -- a wrong-target deletion is worse than the
|
|
124
|
+
// original "not a valid working tree" failure it replaced. So we bind the
|
|
125
|
+
// match to the caller's actual parent identity: first look for an entry
|
|
126
|
+
// whose resolved path is registered directly under resolvedParent (the
|
|
127
|
+
// expected common case); only fall back to a basename-only match when that
|
|
128
|
+
// yields exactly one candidate anywhere. If more than one candidate remains
|
|
129
|
+
// after both passes, the match is genuinely ambiguous -- refuse to guess and
|
|
130
|
+
// return null so the caller surfaces {ok:false,error} instead of resolving
|
|
131
|
+
// to a possibly-wrong path (PR #365 review).
|
|
132
|
+
//
|
|
133
|
+
// Returns the resolved absolute path, or null if no worktree with that
|
|
134
|
+
// dirName can be unambiguously resolved under parentPath.
|
|
135
|
+
function resolveWorktreePath(resolvedParent, worktreeDirName) {
|
|
136
|
+
try {
|
|
137
|
+
var output = execFileSync("git", ["worktree", "list", "--porcelain"], {
|
|
138
|
+
cwd: resolvedParent,
|
|
139
|
+
encoding: "utf8",
|
|
140
|
+
timeout: 5000,
|
|
141
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
142
|
+
});
|
|
143
|
+
var all = parseWorktreeOutput(output);
|
|
144
|
+
var underParent = [];
|
|
145
|
+
var basenameMatches = [];
|
|
146
|
+
for (var i = 0; i < all.length; i++) {
|
|
147
|
+
var wt = all[i];
|
|
148
|
+
if (wt.bare) continue;
|
|
149
|
+
if (path.basename(wt.path) !== worktreeDirName) continue;
|
|
150
|
+
var resolvedWt = path.resolve(wt.path);
|
|
151
|
+
basenameMatches.push(resolvedWt);
|
|
152
|
+
if (resolvedWt === path.join(resolvedParent, worktreeDirName)) {
|
|
153
|
+
underParent.push(resolvedWt);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Preferred: exactly one entry registered directly under this parent.
|
|
157
|
+
if (underParent.length === 1) return underParent[0];
|
|
158
|
+
if (underParent.length > 1) return null; // should be impossible; refuse to guess
|
|
159
|
+
// Fallback: no entry lives directly under the parent (e.g. the
|
|
160
|
+
// lr-76fbc3 "registered elsewhere on disk" case) -- only safe when the
|
|
161
|
+
// basename identifies a single worktree across the whole repo.
|
|
162
|
+
if (basenameMatches.length === 1) return basenameMatches[0];
|
|
163
|
+
return null; // zero or ambiguous multiple matches -- caller surfaces an error
|
|
164
|
+
} catch (e) {
|
|
165
|
+
// fall through to null -- caller falls back to the naive join
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
|
|
107
170
|
// Remove a worktree
|
|
108
171
|
// Returns { ok, error }
|
|
109
172
|
function removeWorktree(projectPath, worktreeDirName) {
|
|
110
173
|
var resolvedParent = path.resolve(projectPath);
|
|
111
|
-
|
|
174
|
+
// Resolve against what git actually registered rather than assuming the
|
|
175
|
+
// worktree lives directly inside resolvedParent (lr-76fbc3), and bind that
|
|
176
|
+
// resolution to THIS parent so a same-basename worktree under a different
|
|
177
|
+
// parent is never matched (PR #365 review). Fall back to the naive join
|
|
178
|
+
// only if resolveWorktreePath found no unambiguous match -- that join is
|
|
179
|
+
// always scoped to resolvedParent, so it can only ever point at a path
|
|
180
|
+
// under the caller's own parent directory (never at another parent's
|
|
181
|
+
// worktree); if nothing is registered there git rejects it and the real
|
|
182
|
+
// error is surfaced to the caller below.
|
|
183
|
+
var wtPath = resolveWorktreePath(resolvedParent, worktreeDirName) || path.join(resolvedParent, worktreeDirName);
|
|
112
184
|
// Try normal remove first
|
|
113
185
|
try {
|
|
114
186
|
execFileSync("git", ["worktree", "remove", wtPath], {
|
|
@@ -1492,7 +1492,7 @@ function createCodexAdapter(opts) {
|
|
|
1492
1492
|
await _appServer.start();
|
|
1493
1493
|
|
|
1494
1494
|
await _appServer.send("initialize", {
|
|
1495
|
-
clientInfo: { name: "clagentic", title: "Clagentic:Console", version: "1.0.0" },
|
|
1495
|
+
clientInfo: { name: "clagentic", title: "Clagentic: Console", version: "1.0.0" },
|
|
1496
1496
|
capabilities: { experimentalApi: true },
|
|
1497
1497
|
});
|
|
1498
1498
|
_appServer.notify("initialized", {});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.8.0-beta.2",
|
|
7
7
|
"description": "Self-hosted console for Claude Code and Codex. Multi-user, browser-based, persistent AI sessions.",
|
|
8
8
|
"bin": {
|
|
9
9
|
"clagentic-console": "./bin/cli.js"
|