@clagentic/console 1.8.0 → 1.9.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 +12 -1
- package/lib/agents.js +13 -3
- package/lib/build-sha.json +2 -2
- package/lib/cli/ipc-subcommands.js +40 -4
- package/lib/daemon.js +25 -1
- package/lib/generated/claude-model-catalog.json +180 -0
- package/lib/model-catalog.js +202 -0
- package/lib/model-families.js +243 -0
- package/lib/project-connection.js +30 -5
- package/lib/project-loop.js +46 -2
- package/lib/project-sessions.js +133 -21
- package/lib/project-user-message.js +70 -3
- package/lib/project.js +11 -1
- package/lib/public/app.js +14 -4
- package/lib/public/css/base.css +14 -0
- package/lib/public/css/home-hub.css +28 -8
- package/lib/public/css/icon-strip.css +17 -0
- package/lib/public/css/menus.css +67 -0
- package/lib/public/css/messages.css +11 -0
- package/lib/public/css/mobile-nav.css +22 -0
- package/lib/public/css/server-settings.css +72 -0
- package/lib/public/css/sidebar.css +15 -0
- package/lib/public/css/title-bar.css +10 -1
- package/lib/public/index.html +4 -0
- package/lib/public/modules/activity-latch.js +159 -0
- package/lib/public/modules/activity-state.js +157 -0
- package/lib/public/modules/app-connection.js +10 -4
- package/lib/public/modules/app-favicon.js +88 -1
- package/lib/public/modules/app-home-hub.js +14 -11
- package/lib/public/modules/app-loop-ui.js +90 -2
- package/lib/public/modules/app-messages.js +117 -28
- package/lib/public/modules/app-panels.js +184 -56
- package/lib/public/modules/app-projects.js +28 -8
- package/lib/public/modules/app-rate-limit.js +14 -2
- package/lib/public/modules/model-families.js +230 -0
- package/lib/public/modules/project-settings.js +1 -0
- package/lib/public/modules/scheduler.js +5 -0
- package/lib/public/modules/server-settings.js +14 -12
- package/lib/public/modules/settings-defaults.js +151 -41
- package/lib/public/modules/sidebar-mobile.js +32 -22
- package/lib/public/modules/sidebar-projects.js +42 -14
- package/lib/public/modules/sidebar-sessions.js +168 -48
- package/lib/public/modules/tools.js +22 -12
- package/lib/sdk-bridge.js +389 -35
- package/lib/sdk-message-processor.js +215 -7
- package/lib/sdk-skill-discovery.js +46 -6
- package/lib/sdk-slash-enrichment.js +5 -2
- package/lib/server-hub-sessions.js +70 -0
- package/lib/server.js +79 -22
- package/lib/session-activity.js +289 -0
- package/lib/sessions.js +104 -3
- package/lib/smtp.js +10 -1
- package/lib/terminal-manager.js +40 -0
- package/lib/utils.js +44 -0
- package/lib/ws-schema.js +17 -0
- package/lib/yoke/adapters/claude-worker.js +6 -2
- package/lib/yoke/adapters/claude.js +384 -88
- package/lib/yoke/adapters/codex.js +239 -31
- package/package.json +2 -2
- package/scripts/check-test-count.js +397 -0
- package/scripts/generate-model-catalog.js +337 -0
- package/scripts/test-file-completion-reporter.js +43 -0
- package/lib/model-context-windows.js +0 -65
- package/lib/public/modules/model-context-windows.js +0 -62
package/lib/terminal-manager.js
CHANGED
|
@@ -15,6 +15,17 @@ var SCROLLBACK_MAX = 50 * 1024; // 50 KB per terminal
|
|
|
15
15
|
* filtered to the requesting user's own terminals; admins see all with an
|
|
16
16
|
* ownerUserId field attached.
|
|
17
17
|
*/
|
|
18
|
+
// lr-13c047: grace window between a PTY exiting and its terminal session
|
|
19
|
+
// being auto-pruned from the server-side `terminals` Map. Before this, an
|
|
20
|
+
// exited session had no automatic removal path at all — only an explicit
|
|
21
|
+
// term_close (user action) ever called terminals.delete(id), so a dead tab
|
|
22
|
+
// could linger indefinitely as a phantom entry in term_list/list() until
|
|
23
|
+
// someone manually closed it. The grace window keeps the "[Process exited]"
|
|
24
|
+
// tab (and its scrollback) visible/reviewable for a short period — matching
|
|
25
|
+
// the existing UI affordance of a greyed-out exited tab — before it's
|
|
26
|
+
// reconciled away automatically.
|
|
27
|
+
var EXITED_AUTOCLOSE_MS = 30000;
|
|
28
|
+
|
|
18
29
|
function createTerminalManager(opts) {
|
|
19
30
|
var cwd = opts.cwd;
|
|
20
31
|
var send = opts.send;
|
|
@@ -97,6 +108,20 @@ function createTerminalManager(opts) {
|
|
|
97
108
|
} else {
|
|
98
109
|
send({ type: "term_list", terminals: list() });
|
|
99
110
|
}
|
|
111
|
+
|
|
112
|
+
// lr-13c047: auto-prune this session after a grace window instead of
|
|
113
|
+
// leaving it in `terminals` forever. Without this, a dead PTY tab was
|
|
114
|
+
// reconciled correctly on the client at exit time (badge count is
|
|
115
|
+
// right immediately), but the ghost session itself never left the
|
|
116
|
+
// server's Map — every subsequent reconnect/term_list still listed it,
|
|
117
|
+
// and a user had to notice and manually term_close a tab that had
|
|
118
|
+
// already finished. close() below already guards on terminals.get(id)
|
|
119
|
+
// still resolving to THIS session, so a manual close (or a brand new
|
|
120
|
+
// terminal reusing this same id after nextId wraps — it can't, nextId
|
|
121
|
+
// only increments) in the meantime is harmless.
|
|
122
|
+
session._autoCloseTimer = setTimeout(function () {
|
|
123
|
+
close(id, null);
|
|
124
|
+
}, EXITED_AUTOCLOSE_MS);
|
|
100
125
|
});
|
|
101
126
|
|
|
102
127
|
terminals.set(id, session);
|
|
@@ -179,6 +204,14 @@ function createTerminalManager(opts) {
|
|
|
179
204
|
if (!session) return;
|
|
180
205
|
if (!isAuthorized(session, callerWs)) return;
|
|
181
206
|
|
|
207
|
+
// lr-13c047: cancel the exited-session auto-close timer (see pty.onExit)
|
|
208
|
+
// so an earlier manual close doesn't leave a stray timer that later
|
|
209
|
+
// fires close(id, null) with no matching session left to act on.
|
|
210
|
+
if (session._autoCloseTimer) {
|
|
211
|
+
clearTimeout(session._autoCloseTimer);
|
|
212
|
+
session._autoCloseTimer = null;
|
|
213
|
+
}
|
|
214
|
+
|
|
182
215
|
if (session.pty) {
|
|
183
216
|
try { session.pty.kill(); } catch (e) {}
|
|
184
217
|
session.pty = null;
|
|
@@ -240,6 +273,13 @@ function createTerminalManager(opts) {
|
|
|
240
273
|
try { session.pty.kill(); } catch (e) {}
|
|
241
274
|
session.pty = null;
|
|
242
275
|
}
|
|
276
|
+
// lr-13c047: cancel any pending auto-close timer so it doesn't fire
|
|
277
|
+
// close(id, null) after this manager (and its `terminals` Map) has
|
|
278
|
+
// already been torn down.
|
|
279
|
+
if (session._autoCloseTimer) {
|
|
280
|
+
clearTimeout(session._autoCloseTimer);
|
|
281
|
+
session._autoCloseTimer = null;
|
|
282
|
+
}
|
|
243
283
|
}
|
|
244
284
|
terminals.clear();
|
|
245
285
|
}
|
package/lib/utils.js
CHANGED
|
@@ -79,6 +79,49 @@ function sanitizeAllowedTools(value) {
|
|
|
79
79
|
return out;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Compute the key used to index a session's "allow for session" grant map
|
|
84
|
+
* (session.allowedTools) for a given tool call (lr-f969dc).
|
|
85
|
+
*
|
|
86
|
+
* Most tools are correctly discriminated by bare tool name alone — MCP tools
|
|
87
|
+
* already fold server + tool identity into the name itself (e.g.
|
|
88
|
+
* "mcp__browser__navigate" vs "mcp__browser__screenshot" are already
|
|
89
|
+
* distinct keys), so approving one MCP tool must not silently approve a
|
|
90
|
+
* different one, and bare-name keying already gives that.
|
|
91
|
+
*
|
|
92
|
+
* The Claude `Skill` tool is the one exception found so far: every distinct
|
|
93
|
+
* skill invocation arrives as the SAME toolName "Skill" with a different
|
|
94
|
+
* `input.skill` discriminator. Keying on bare "Skill" means granting one
|
|
95
|
+
* skill silently authorizes every other skill for the rest of the session —
|
|
96
|
+
* a security regression, not the "doesn't stick" fix the grant was meant to
|
|
97
|
+
* provide. Fold the discriminator into the key so a grant is scoped to the
|
|
98
|
+
* specific skill that was actually approved.
|
|
99
|
+
*
|
|
100
|
+
* This repo is vendor-agnostic via the YOKE adapter layer (lib/yoke/), so a
|
|
101
|
+
* bare "Skill" literal here is a deliberate, checked exception, not a
|
|
102
|
+
* default pattern for future tools. Verified (lr-f969dc): Codex's approval
|
|
103
|
+
* RPCs (exec/file/MCP, lib/yoke/adapters/codex.js) route through this same
|
|
104
|
+
* function via the identical vendor-neutral canUseTool wiring, and all of
|
|
105
|
+
* them already send correctly-flat tool names — Codex has no tool today
|
|
106
|
+
* whose identity fans out under one shared name the way Skill does, so no
|
|
107
|
+
* generalization is needed for vendor parity right now. If a second vendor
|
|
108
|
+
* or a renamed/restructured tool introduces another input-discriminated
|
|
109
|
+
* tool, extend this with another explicit branch (or a small declarative
|
|
110
|
+
* toolName -> discriminator-field table if a third case appears) rather
|
|
111
|
+
* than reaching for a config knob nobody would otherwise set.
|
|
112
|
+
*
|
|
113
|
+
* Falls back to the bare tool name when the expected discriminator is
|
|
114
|
+
* missing or not a string (fails closed to the pre-existing per-tool grant
|
|
115
|
+
* rather than throwing or producing an unstable key). Never hardcodes an
|
|
116
|
+
* individual skill name — only the shared "Skill" tool identifier.
|
|
117
|
+
*/
|
|
118
|
+
function permissionGrantKey(toolName, input) {
|
|
119
|
+
if (toolName === "Skill" && input && typeof input.skill === "string" && input.skill) {
|
|
120
|
+
return "Skill:" + input.skill;
|
|
121
|
+
}
|
|
122
|
+
return toolName;
|
|
123
|
+
}
|
|
124
|
+
|
|
82
125
|
/**
|
|
83
126
|
* Default hard cap for readCappedBody() call sites that don't pass their own
|
|
84
127
|
* maxBytes: these are small JSON-only pre-auth endpoints (login, PIN
|
|
@@ -138,6 +181,7 @@ module.exports = {
|
|
|
138
181
|
resolveEncodedDir: resolveEncodedDir,
|
|
139
182
|
resolveEncodedFile: resolveEncodedFile,
|
|
140
183
|
sanitizeAllowedTools: sanitizeAllowedTools,
|
|
184
|
+
permissionGrantKey: permissionGrantKey,
|
|
141
185
|
readCappedBody: readCappedBody,
|
|
142
186
|
DEFAULT_BODY_CAP_BYTES: DEFAULT_BODY_CAP_BYTES,
|
|
143
187
|
};
|
package/lib/ws-schema.js
CHANGED
|
@@ -23,6 +23,7 @@ var schema = {
|
|
|
23
23
|
"set_session_bookmark": { direction: "c2s", handler: "lib/project-sessions.js", description: "Bookmark or unbookmark a session in the sidebar" },
|
|
24
24
|
"reorder_session_bookmarks": { direction: "c2s", handler: "lib/project-sessions.js", description: "Reorder favorited sessions within the favorites area" },
|
|
25
25
|
"bulk_delete_sessions": { direction: "c2s", handler: "lib/project-sessions.js", description: "Delete a group of sessions at once" },
|
|
26
|
+
"mark_cross_project_read": { direction: "c2s", handler: "lib/project-sessions.js", description: "Clear the cross-project unread badge for a project slug without switching to it (lr-13c047)" },
|
|
26
27
|
"resume_session": { direction: "c2s", handler: "lib/project-sessions.js", description: "Resume a CLI session by its CLI session ID" },
|
|
27
28
|
"set_session_visibility": { direction: "c2s", handler: "lib/project-sessions.js", description: "Show or hide a session in the sidebar" },
|
|
28
29
|
"search_sessions": { direction: "c2s", handler: "lib/project-sessions.js", description: "Search session titles" },
|
|
@@ -32,6 +33,10 @@ var schema = {
|
|
|
32
33
|
"fork_session": { direction: "c2s", handler: "lib/project-sessions.js", description: "Fork a session from a given message UUID" },
|
|
33
34
|
"input_sync": { direction: "c2s", handler: "lib/project-sessions.js", description: "Sync the current input field text to other clients" },
|
|
34
35
|
|
|
36
|
+
// lr-66c118: session_list items carry isProcessing/unread/ownerId — the
|
|
37
|
+
// exact fields lib/public/modules/activity-state.js's sessionActivity()
|
|
38
|
+
// derives every render surface's dot from. No new wire message type was
|
|
39
|
+
// added for "activity"; it is data already on this existing message.
|
|
35
40
|
"session_list": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Full list of sessions for the sidebar" },
|
|
36
41
|
"session_switched": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Confirmation that active session changed" },
|
|
37
42
|
"session_id": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "CLI session ID assigned to the current session" },
|
|
@@ -67,6 +72,13 @@ var schema = {
|
|
|
67
72
|
"message_uuid": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "UUID assigned to a user or assistant message" },
|
|
68
73
|
"prompt_suggestion": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Suggested follow-up prompt from the assistant" },
|
|
69
74
|
"context_preview": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Preview of context sources included in a query" },
|
|
75
|
+
// lr-66c118 fold-in: found missing from this schema by the new CI
|
|
76
|
+
// absence-invariant (test/activity-state-lr-66c118.test.js) that scans
|
|
77
|
+
// every real sendAndRecord(session, { type: "..." }) call site — these 4
|
|
78
|
+
// were live, sent types with no documentation entry.
|
|
79
|
+
"plan_content": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Plan-mode content for the plan card" },
|
|
80
|
+
"sdk_notification": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Informational notification surfaced from the vendor SDK" },
|
|
81
|
+
"diagnostic": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Session-scoped diagnostic toast (settings preflight, memory shedding, adapter warnings)" },
|
|
70
82
|
|
|
71
83
|
// -----------------------------------------------------------------------
|
|
72
84
|
// Thinking
|
|
@@ -97,6 +109,8 @@ var schema = {
|
|
|
97
109
|
"team_request_state": { direction: "c2s", handler: "lib/project-team.js", description: "Client requests current team snapshot" },
|
|
98
110
|
"task_started": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Background task started" },
|
|
99
111
|
"task_progress": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Background task progress update" },
|
|
112
|
+
// lr-66c118 fold-in: see the plan_content/sdk_notification/diagnostic note above.
|
|
113
|
+
"task_updated": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Background task status/description patch" },
|
|
100
114
|
|
|
101
115
|
// -----------------------------------------------------------------------
|
|
102
116
|
// Permissions
|
|
@@ -449,6 +463,9 @@ var schema = {
|
|
|
449
463
|
"hub_schedules_list": { direction: "c2s", handler: "lib/project-loop.js", description: "Request the hub schedules list" },
|
|
450
464
|
"hub_schedules": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Hub schedules list" },
|
|
451
465
|
"hub_recent_sessions_list": { direction: "c2s", handler: "lib/project-loop.js", description: "Request cross-project recent sessions for hub" },
|
|
466
|
+
// lr-66c118: each session item now also carries ownerId (added alongside
|
|
467
|
+
// isProcessing/unread) so the Home Hub Recent Sessions dot can render the
|
|
468
|
+
// multi-user 'other' tone via activity-state.js, same as session_list.
|
|
452
469
|
"hub_recent_sessions": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "Cross-project recent sessions list for hub" },
|
|
453
470
|
"schedule_run_started": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "A scheduled run has started" },
|
|
454
471
|
"schedule_run_finished": { direction: "s2c", handler: "lib/public/modules/app-messages.js", description: "A scheduled run has finished" },
|
|
@@ -623,9 +623,13 @@ async function handleSetModel(msg) {
|
|
|
623
623
|
if (!queryInstance) return;
|
|
624
624
|
try {
|
|
625
625
|
await queryInstance.setModel(msg.model);
|
|
626
|
-
|
|
626
|
+
// lr-f22787: echo requestId so the daemon-side setModel() promise
|
|
627
|
+
// (claude.js pendingSetModel) can be correlated and resolved — without
|
|
628
|
+
// it, the daemon has no way to distinguish this reply from any other
|
|
629
|
+
// model_changed broadcast.
|
|
630
|
+
sendToDaemon({ type: "model_changed", model: msg.model, requestId: msg.requestId });
|
|
627
631
|
} catch (e) {
|
|
628
|
-
sendToDaemon({ type: "worker_error", error: "Failed to set model: " + (e.message || e) });
|
|
632
|
+
sendToDaemon({ type: "worker_error", error: "Failed to set model: " + (e.message || e), requestId: msg.requestId });
|
|
629
633
|
}
|
|
630
634
|
}
|
|
631
635
|
|