@clagentic/console 1.9.0 → 1.10.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/LICENSE +117 -12
- package/LICENSES/MIT-legacy.txt +22 -0
- package/LICENSES/README.md +15 -0
- package/README.md +9 -3
- package/bin/cli.js +40 -5
- package/deploy/clagentic-console.service +10 -6
- package/lib/agent-dispatch-tool.js +20 -0
- package/lib/audit.js +3 -2
- package/lib/build-changes.js +79 -0
- package/lib/build-identity.js +192 -0
- package/lib/build-monitor.js +125 -0
- package/lib/build-sha.json +2 -2
- package/lib/build-update-check.js +138 -0
- package/lib/build-update-offer.js +141 -0
- package/lib/build-update-restart.js +142 -0
- package/lib/build-update-standing.js +184 -0
- package/lib/cli/daemon-launch.js +25 -22
- package/lib/cli/ipc-subcommands.js +6 -0
- package/lib/cli/session-subcommands.js +122 -0
- package/lib/cli-sessions.js +8 -1
- package/lib/codex-defaults.js +8 -2
- package/lib/config.js +32 -20
- package/lib/daemon-env-settings.js +84 -0
- package/lib/daemon-projects.js +57 -0
- package/lib/daemon.js +288 -205
- package/lib/drain.js +74 -17
- package/lib/env-compat.js +61 -0
- package/lib/extension-commands.js +45 -0
- package/lib/history-visibility.js +4 -0
- package/lib/idle-adapter-reaper.js +71 -0
- package/lib/link-trap.js +78 -0
- package/lib/mcp-local.js +8 -6
- package/lib/mcp-tool-input.js +116 -0
- package/lib/mcp-tool-schema.js +179 -0
- package/lib/memory-limits.js +61 -5
- package/lib/memory-setting-validate.js +65 -0
- package/lib/memory-shed.js +13 -32
- package/lib/new-work-gate.js +47 -0
- package/lib/os-users.js +5 -3
- package/lib/project-access.js +139 -0
- package/lib/project-connection.js +37 -22
- package/lib/project-external-trigger.js +166 -105
- package/lib/project-file-scope.js +172 -0
- package/lib/project-file-watch.js +86 -61
- package/lib/project-filesystem.js +144 -128
- package/lib/project-git.js +119 -0
- package/lib/project-http.js +44 -28
- package/lib/project-loop.js +17 -9
- package/lib/project-mcp.js +53 -72
- package/lib/project-message-gate.js +70 -0
- package/lib/project-notifications.js +31 -4
- package/lib/project-prompt-responses.js +217 -0
- package/lib/project-sessions.js +192 -355
- package/lib/project-user-message.js +27 -15
- package/lib/project.js +212 -147
- package/lib/projects-dir.js +90 -0
- package/lib/prompt-access.js +22 -0
- package/lib/prompt-kinds/answer-limits.js +15 -0
- package/lib/prompt-kinds/ask-user.js +58 -0
- package/lib/prompt-kinds/codecs.js +97 -0
- package/lib/prompt-kinds/elicitation.js +77 -0
- package/lib/prompt-kinds/extension.js +39 -0
- package/lib/prompt-kinds/index.js +68 -0
- package/lib/prompt-kinds/permission.js +114 -0
- package/lib/prompt-kinds/plan.js +79 -0
- package/lib/prompt-kinds/tool-call.js +38 -0
- package/lib/prompt-registry.js +680 -0
- package/lib/public/app.js +1 -1
- package/lib/public/css/diagnostics.css +80 -0
- package/lib/public/css/input.css +17 -3
- package/lib/public/css/menus.css +10 -0
- package/lib/public/css/messages.css +5 -0
- package/lib/public/css/rewind.css +22 -0
- package/lib/public/index.html +4 -12
- package/lib/public/modules/agent-dispatch-tool.js +9 -0
- package/lib/public/modules/app-connection.js +7 -0
- package/lib/public/modules/app-cursors.js +7 -5
- package/lib/public/modules/app-messages.js +52 -47
- package/lib/public/modules/app-notifications.js +47 -71
- package/lib/public/modules/app-panels.js +61 -59
- package/lib/public/modules/app-projects.js +2 -1
- package/lib/public/modules/app-rendering.js +4 -10
- package/lib/public/modules/build-update-detail.js +54 -0
- package/lib/public/modules/diagnostics.js +170 -20
- package/lib/public/modules/filebrowser.js +18 -16
- package/lib/public/modules/history-visibility.js +4 -0
- package/lib/public/modules/mention.js +3 -2
- package/lib/public/modules/mode-options.js +38 -0
- package/lib/public/modules/project-settings.js +19 -8
- package/lib/public/modules/prompt-banner.js +78 -0
- package/lib/public/modules/prompt-card.js +201 -0
- package/lib/public/modules/prompt-kinds/ask-user-codec.js +131 -0
- package/lib/public/modules/prompt-kinds/ask-user.js +213 -0
- package/lib/public/modules/prompt-kinds/elicitation-codec.js +343 -0
- package/lib/public/modules/prompt-kinds/elicitation.js +176 -0
- package/lib/public/modules/prompt-kinds/index.js +18 -0
- package/lib/public/modules/prompt-kinds/own-key.js +29 -0
- package/lib/public/modules/prompt-kinds/package.json +3 -0
- package/lib/public/modules/prompt-kinds/permission-choices.js +31 -0
- package/lib/public/modules/prompt-kinds/permission.js +209 -0
- package/lib/public/modules/prompt-kinds/plan.js +102 -0
- package/lib/public/modules/prompt-state.js +142 -0
- package/lib/public/modules/prompts.js +134 -0
- package/lib/public/modules/rewind.js +4 -1
- package/lib/public/modules/server-settings.js +2 -4
- package/lib/public/modules/sidebar-mobile.js +19 -9
- package/lib/public/modules/sidebar-sessions.js +21 -14
- package/lib/public/modules/sticky-notes.js +3 -2
- package/lib/public/modules/team-panel.js +5 -4
- package/lib/public/modules/tools.js +81 -906
- package/lib/public/modules/vendor-picker.js +53 -0
- package/lib/public/modules/vendor-registry.js +142 -0
- package/lib/public/sw.js +3 -1
- package/lib/rc-migrate.js +44 -0
- package/lib/runtime-env-keys.js +109 -0
- package/lib/runtime-env.js +236 -0
- package/lib/sdk-bridge.js +348 -284
- package/lib/sdk-message-processor.js +117 -146
- package/lib/sdk-skill-discovery.js +65 -60
- package/lib/server-hub-sessions.js +13 -10
- package/lib/server-palette.js +28 -19
- package/lib/server.js +156 -115
- package/lib/service-install.js +96 -0
- package/lib/session-capabilities.js +76 -0
- package/lib/session-id.js +33 -0
- package/lib/session-input-ipc.js +32 -0
- package/lib/session-input.js +379 -0
- package/lib/session-reclaim.js +284 -0
- package/lib/session-resume.js +172 -0
- package/lib/sessions.js +61 -30
- package/lib/supervisor.js +39 -0
- package/lib/turn-initiator.js +108 -0
- package/lib/users-permissions.js +9 -6
- package/lib/users.js +9 -0
- package/lib/utils.js +4 -2
- package/lib/vendor-auth.js +22 -0
- package/lib/vendor-registry-message.js +66 -0
- package/lib/ws-origin.js +99 -0
- package/lib/ws-schema.js +36 -23
- package/lib/yoke/adapters/claude-capabilities.js +38 -0
- package/lib/yoke/adapters/claude-vendor.js +34 -0
- package/lib/yoke/adapters/claude-worker.js +57 -87
- package/lib/yoke/adapters/claude.js +182 -88
- package/lib/yoke/adapters/codex-capabilities.js +40 -0
- package/lib/yoke/adapters/codex-vendor.js +46 -0
- package/lib/yoke/adapters/codex.js +462 -211
- package/lib/yoke/adapters/effort-control.js +34 -0
- package/lib/yoke/adapters/permission-relay.js +58 -0
- package/lib/yoke/adapters/worker-mcp-servers.js +81 -0
- package/lib/yoke/auth-checks.js +91 -0
- package/lib/yoke/capabilities.js +49 -0
- package/lib/yoke/codex-app-server.js +30 -56
- package/lib/yoke/codex-binary.js +254 -0
- package/lib/yoke/codex-command.js +122 -0
- package/lib/yoke/codex-protocol.js +96 -0
- package/lib/yoke/codex-version.js +135 -0
- package/lib/yoke/env-ownership.js +40 -0
- package/lib/yoke/index.js +84 -174
- package/lib/yoke/install-probe.js +136 -0
- package/lib/yoke/instructions.js +7 -11
- package/lib/yoke/interface.js +206 -4
- package/lib/yoke/package.json +1 -1
- package/lib/yoke/provider-credentials.js +96 -0
- package/lib/yoke/registry.js +377 -0
- package/package.json +12 -9
- package/scripts/check-sdk-lock-drift.js +160 -0
- package/scripts/check-test-count.js +76 -1
- package/scripts/postinstall.js +218 -136
- package/scripts/prompt-harness-history.js +202 -0
- package/scripts/verify-installed-build.js +59 -17
- package/scripts/verify-installed.js +67 -0
- package/lib/sdk-permission-ownership.js +0 -136
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// daemon-env-settings.js - where the shared and per-project environment texts
|
|
2
|
+
// are kept. The daemon holds the shared text on its config (sharedEnv) and each
|
|
3
|
+
// project's on its record (envrc); the Settings pages read and write them
|
|
4
|
+
// through the four callbacks this returns.
|
|
5
|
+
//
|
|
6
|
+
// A text is checked here as well as on the WebSocket handler that receives it,
|
|
7
|
+
// so a caller that reaches the store another way cannot save a protected
|
|
8
|
+
// variable.
|
|
9
|
+
|
|
10
|
+
var runtimeEnv = require("./runtime-env");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {object} deps
|
|
14
|
+
* @param {function(): object} deps.getConfig the daemon config (projects[], sharedEnv)
|
|
15
|
+
* @param {function(object): void} deps.saveConfig
|
|
16
|
+
* @returns {{onGetProjectEnv: function, onSetProjectEnv: function, onGetSharedEnv: function, onSetSharedEnv: function}}
|
|
17
|
+
*/
|
|
18
|
+
function createEnvSettings(deps) {
|
|
19
|
+
var getConfig = deps.getConfig;
|
|
20
|
+
var saveConfig = deps.saveConfig;
|
|
21
|
+
|
|
22
|
+
function findProject(slug) {
|
|
23
|
+
var projects = getConfig().projects || [];
|
|
24
|
+
for (var i = 0; i < projects.length; i++) {
|
|
25
|
+
if (projects[i].slug === slug) return projects[i];
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
onGetProjectEnv: function (slug) {
|
|
32
|
+
var project = findProject(slug);
|
|
33
|
+
return { envrc: (project && project.envrc) || "" };
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
onSetProjectEnv: function (slug, envrc) {
|
|
37
|
+
var project = findProject(slug);
|
|
38
|
+
if (!project) return { ok: false, error: "Project not found" };
|
|
39
|
+
var problem = runtimeEnv.validateEnvText(envrc);
|
|
40
|
+
if (problem) return { ok: false, error: problem };
|
|
41
|
+
if (envrc) {
|
|
42
|
+
project.envrc = envrc;
|
|
43
|
+
} else {
|
|
44
|
+
delete project.envrc;
|
|
45
|
+
}
|
|
46
|
+
saveConfig(getConfig());
|
|
47
|
+
return { ok: true };
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
onGetSharedEnv: function () {
|
|
51
|
+
return { envrc: getConfig().sharedEnv || "" };
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
onSetSharedEnv: function (envrc) {
|
|
55
|
+
var problem = runtimeEnv.validateEnvText(envrc);
|
|
56
|
+
if (problem) return { ok: false, error: problem };
|
|
57
|
+
var config = getConfig();
|
|
58
|
+
if (envrc) {
|
|
59
|
+
config.sharedEnv = envrc;
|
|
60
|
+
} else {
|
|
61
|
+
delete config.sharedEnv;
|
|
62
|
+
}
|
|
63
|
+
saveConfig(config);
|
|
64
|
+
return { ok: true };
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A project's environment text was written by its owner and applies to the
|
|
71
|
+
* owner's sessions: when the owner changes, the new owner does not inherit it.
|
|
72
|
+
* @param {object} project the project record (mutated)
|
|
73
|
+
* @param {string|null} oldOwnerId
|
|
74
|
+
* @param {string|null} newOwnerId
|
|
75
|
+
* @returns {boolean} true when the text was removed
|
|
76
|
+
*/
|
|
77
|
+
function removeEnvrcOnOwnerChange(project, oldOwnerId, newOwnerId) {
|
|
78
|
+
if ((oldOwnerId || null) === (newOwnerId || null)) return false;
|
|
79
|
+
if (!project || !("envrc" in project)) return false;
|
|
80
|
+
delete project.envrc;
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = { createEnvSettings: createEnvSettings, removeEnvrcOnOwnerChange: removeEnvrcOnOwnerChange };
|
package/lib/daemon-projects.js
CHANGED
|
@@ -11,6 +11,22 @@ var { scanWorktrees, isWorktree } = require("./worktree");
|
|
|
11
11
|
var worktreeRegistry = {}; // parentSlug -> [wtSlug, ...]
|
|
12
12
|
var worktreeTimers = {}; // parentSlug -> intervalId
|
|
13
13
|
var worktreeScanning = {}; // parentSlug -> boolean (mutex)
|
|
14
|
+
// Set when shutdown begins and never cleared: a rescan that fires from then on
|
|
15
|
+
// would re-add worktrees (and create adapters for them) to projects that were
|
|
16
|
+
// just destroyed, inside the shutdown's force-exit window.
|
|
17
|
+
var rescansStopped = false;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Stop every worktree rescan timer and make any rescan or registration that
|
|
21
|
+
* still arrives a no-op. Shutdown calls this before it destroys the projects.
|
|
22
|
+
*/
|
|
23
|
+
function stopWorktreeRescans() {
|
|
24
|
+
rescansStopped = true;
|
|
25
|
+
Object.keys(worktreeTimers).forEach(function (parentSlug) {
|
|
26
|
+
clearInterval(worktreeTimers[parentSlug]);
|
|
27
|
+
delete worktreeTimers[parentSlug];
|
|
28
|
+
});
|
|
29
|
+
}
|
|
14
30
|
|
|
15
31
|
function isWorktreeSlug(slug) {
|
|
16
32
|
return slug.indexOf("--") !== -1;
|
|
@@ -25,6 +41,7 @@ function isWorktreeSlug(slug) {
|
|
|
25
41
|
* @param {string} parentOwnerId - owner user ID
|
|
26
42
|
*/
|
|
27
43
|
function scanAndRegisterWorktrees(relay, parentPath, parentSlug, parentIcon, parentOwnerId) {
|
|
44
|
+
if (rescansStopped) return;
|
|
28
45
|
if (isWorktree(parentPath)) return;
|
|
29
46
|
var worktrees = scanWorktrees(parentPath);
|
|
30
47
|
if (worktrees.length === 0) return;
|
|
@@ -59,6 +76,7 @@ function scanAndRegisterWorktrees(relay, parentPath, parentSlug, parentIcon, par
|
|
|
59
76
|
* @param {object} [config] - daemon config (optional, for broadcasting project count)
|
|
60
77
|
*/
|
|
61
78
|
function rescanWorktrees(relay, parentPath, parentSlug, parentIcon, parentOwnerId, config) {
|
|
79
|
+
if (rescansStopped) return;
|
|
62
80
|
if (worktreeScanning[parentSlug]) return;
|
|
63
81
|
worktreeScanning[parentSlug] = true;
|
|
64
82
|
try {
|
|
@@ -134,6 +152,42 @@ function getFilteredRemovedProjects(config, userId) {
|
|
|
134
152
|
});
|
|
135
153
|
}
|
|
136
154
|
|
|
155
|
+
/**
|
|
156
|
+
* The parent project's slug for a registered worktree slug, or null when the
|
|
157
|
+
* slug is not a registered worktree. Worktrees inherit their parent's access.
|
|
158
|
+
*/
|
|
159
|
+
function getWorktreeParent(wtSlug) {
|
|
160
|
+
var parents = Object.keys(worktreeRegistry);
|
|
161
|
+
for (var i = 0; i < parents.length; i++) {
|
|
162
|
+
if (worktreeRegistry[parents[i]].indexOf(wtSlug) !== -1) return parents[i];
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The access record for a project slug, as lib/server.js's access checks read
|
|
169
|
+
* it: { slug, visibility, allowedUsers, ownerId }, or { error } when no
|
|
170
|
+
* project has that slug. A worktree is not in config.projects, so it carries
|
|
171
|
+
* its parent's record (a registered worktree whose parent is gone has none).
|
|
172
|
+
* A project with no stored visibility is private in os-users mode and public
|
|
173
|
+
* otherwise; lib/users-permissions.js treats anything not "public" as private.
|
|
174
|
+
*/
|
|
175
|
+
function getProjectAccessRecord(config, slug) {
|
|
176
|
+
var accessSlug = getWorktreeParent(slug) || slug;
|
|
177
|
+
var projects = config.projects || [];
|
|
178
|
+
for (var i = 0; i < projects.length; i++) {
|
|
179
|
+
if (projects[i].slug === accessSlug) {
|
|
180
|
+
return {
|
|
181
|
+
slug: slug,
|
|
182
|
+
visibility: projects[i].visibility || (config.osUsers ? "private" : "public"),
|
|
183
|
+
allowedUsers: projects[i].allowedUsers || [],
|
|
184
|
+
ownerId: projects[i].ownerId || null,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return { error: "Project not found" };
|
|
189
|
+
}
|
|
190
|
+
|
|
137
191
|
/**
|
|
138
192
|
* Register a worktree slug under a parent slug.
|
|
139
193
|
* Used by daemon.js when creating worktrees directly.
|
|
@@ -157,8 +211,11 @@ module.exports = {
|
|
|
157
211
|
isWorktreeSlug: isWorktreeSlug,
|
|
158
212
|
scanAndRegisterWorktrees: scanAndRegisterWorktrees,
|
|
159
213
|
rescanWorktrees: rescanWorktrees,
|
|
214
|
+
stopWorktreeRescans: stopWorktreeRescans,
|
|
160
215
|
cleanupWorktreesForParent: cleanupWorktreesForParent,
|
|
161
216
|
getFilteredRemovedProjects: getFilteredRemovedProjects,
|
|
162
217
|
registerWorktreeSlug: registerWorktreeSlug,
|
|
163
218
|
unregisterWorktreeSlug: unregisterWorktreeSlug,
|
|
219
|
+
getWorktreeParent: getWorktreeParent,
|
|
220
|
+
getProjectAccessRecord: getProjectAccessRecord,
|
|
164
221
|
};
|