@clagentic/console 1.9.0 → 1.10.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.
- package/LICENSE +117 -12
- package/LICENSES/MIT-legacy.txt +22 -0
- package/LICENSES/README.md +15 -0
- package/README.md +8 -2
- package/bin/cli.js +30 -5
- package/deploy/clagentic-console.service +10 -6
- package/lib/audit.js +3 -2
- package/lib/build-sha.json +2 -2
- package/lib/build-update-check.js +138 -0
- package/lib/cli/daemon-launch.js +17 -17
- package/lib/config.js +32 -20
- package/lib/daemon-env-settings.js +84 -0
- package/lib/daemon-projects.js +38 -0
- package/lib/daemon.js +202 -158
- 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/lore-attestation.js +73 -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/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 +23 -22
- package/lib/project-external-trigger.js +103 -10
- 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 +12 -5
- 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 +216 -0
- package/lib/project-sessions.js +164 -302
- package/lib/project-user-message.js +36 -11
- package/lib/project.js +189 -142
- 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 +673 -0
- package/lib/public/app.js +1 -1
- package/lib/public/css/diagnostics.css +50 -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/app-connection.js +7 -0
- package/lib/public/modules/app-cursors.js +7 -5
- package/lib/public/modules/app-messages.js +45 -45
- package/lib/public/modules/app-notifications.js +47 -71
- package/lib/public/modules/app-panels.js +61 -58
- package/lib/public/modules/app-projects.js +2 -1
- package/lib/public/modules/app-rendering.js +4 -10
- package/lib/public/modules/diagnostics.js +60 -16
- 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 +67 -904
- package/lib/public/modules/vendor-picker.js +53 -0
- package/lib/public/modules/vendor-registry.js +133 -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 +290 -273
- package/lib/sdk-message-processor.js +125 -145
- package/lib/server-hub-sessions.js +13 -10
- package/lib/server-palette.js +28 -19
- package/lib/server.js +141 -113
- package/lib/service-install.js +96 -0
- package/lib/session-capabilities.js +76 -0
- package/lib/sessions.js +45 -28
- 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 +65 -0
- package/lib/ws-origin.js +99 -0
- package/lib/ws-schema.js +33 -22
- package/lib/yoke/adapters/claude-capabilities.js +38 -0
- package/lib/yoke/adapters/claude-vendor.js +35 -0
- package/lib/yoke/adapters/claude-worker.js +55 -87
- package/lib/yoke/adapters/claude.js +156 -62
- package/lib/yoke/adapters/codex-capabilities.js +37 -0
- package/lib/yoke/adapters/codex-vendor.js +46 -0
- package/lib/yoke/adapters/codex.js +347 -156
- 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 +104 -0
- package/lib/yoke/capabilities.js +49 -0
- package/lib/yoke/codex-app-server.js +23 -5
- package/lib/yoke/env-ownership.js +40 -0
- package/lib/yoke/index.js +67 -173
- package/lib/yoke/install-probe.js +121 -0
- package/lib/yoke/instructions.js +7 -11
- package/lib/yoke/interface.js +199 -3
- package/lib/yoke/package.json +1 -1
- package/lib/yoke/provider-credentials.js +96 -0
- package/lib/yoke/registry.js +340 -0
- package/package.json +12 -8
- 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.js +67 -0
- package/lib/sdk-permission-ownership.js +0 -136
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// verify-installed.js — entry point of `npm run verify:installed-build`.
|
|
5
|
+
//
|
|
6
|
+
// Runs the two independent post-merge checks and reports each result:
|
|
7
|
+
// installed-build scripts/verify-installed-build.js (installed files + running process vs merged HEAD)
|
|
8
|
+
// sdk-lock-drift scripts/check-sdk-lock-drift.js (installed SDK versions vs the lock)
|
|
9
|
+
//
|
|
10
|
+
// They were chained with `&&`, so verify-installed-build's PROCESS_MISMATCH —
|
|
11
|
+
// expected after every merge until the daemon restarts — stopped the drift check
|
|
12
|
+
// from ever running. Neither result says anything about the other, so both always
|
|
13
|
+
// run, each result is printed, and the exit code is non-zero if either failed.
|
|
14
|
+
//
|
|
15
|
+
// TOOL CONSIDERED: `a; b` / `a || true` in the npm script. A shell separator
|
|
16
|
+
// would run both but lose each exit status (or need extra shell to recover it),
|
|
17
|
+
// and loadout-merge rejects shell operator tokens in post_merge_steps commands.
|
|
18
|
+
|
|
19
|
+
const path = require('path');
|
|
20
|
+
const { spawnSync } = require('child_process');
|
|
21
|
+
|
|
22
|
+
const CHECKS = [
|
|
23
|
+
{ name: 'installed-build', script: 'verify-installed-build.js' },
|
|
24
|
+
{ name: 'sdk-lock-drift', script: 'check-sdk-lock-drift.js' },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const TAG = '[verify:installed-build]';
|
|
28
|
+
|
|
29
|
+
function spawnScript(scriptPath) {
|
|
30
|
+
const res = spawnSync(process.execPath, [scriptPath], { stdio: 'inherit' });
|
|
31
|
+
if (res.error) return { status: 1, error: res.error.message };
|
|
32
|
+
return { status: res.status === null ? 1 : res.status, signal: res.signal };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {object} [opts]
|
|
37
|
+
* @param {Array<{name:string, script:string}>} [opts.checks]
|
|
38
|
+
* @param {string} [opts.scriptsDir]
|
|
39
|
+
* @param {function} [opts.runScript] (absPath) => {status, error?}; for tests.
|
|
40
|
+
* @param {function} [opts.log]
|
|
41
|
+
* @returns {{ok: boolean, results: Array<{name:string, status:number}>}}
|
|
42
|
+
*/
|
|
43
|
+
function runAll(opts) {
|
|
44
|
+
opts = opts || {};
|
|
45
|
+
const checks = opts.checks || CHECKS;
|
|
46
|
+
const scriptsDir = opts.scriptsDir || __dirname;
|
|
47
|
+
const runScript = opts.runScript || spawnScript;
|
|
48
|
+
const log = opts.log || ((m) => console.log(m));
|
|
49
|
+
|
|
50
|
+
const results = [];
|
|
51
|
+
for (const check of checks) {
|
|
52
|
+
const res = runScript(path.join(scriptsDir, check.script));
|
|
53
|
+
const status = res.status;
|
|
54
|
+
results.push({ name: check.name, status });
|
|
55
|
+
log(`${TAG} ${check.name}: ${status === 0 ? 'PASS' : 'FAIL'} (exit ${status}${res.error ? `: ${res.error}` : ''})`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const failed = results.filter((r) => r.status !== 0);
|
|
59
|
+
log(`${TAG} ${failed.length === 0 ? 'all checks passed' : `FAILED: ${failed.map((r) => r.name).join(', ')}`}`);
|
|
60
|
+
return { ok: failed.length === 0, results };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = { runAll, CHECKS };
|
|
64
|
+
|
|
65
|
+
if (require.main === module) {
|
|
66
|
+
process.exit(runAll().ok ? 0 : 1);
|
|
67
|
+
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
// lr-9d4b: Shared keep-vs-clear decision for session.pendingPermissions /
|
|
2
|
-
// activeTaskToolIds / taskIdMap at turn-boundary cleanup sites.
|
|
3
|
-
//
|
|
4
|
-
// Two call sites reset this same state at the end of a turn:
|
|
5
|
-
// - sdk-message-processor.js: the 'result' message handler
|
|
6
|
-
// - sdk-bridge.js: processQueryStream's finally block (normal, non-
|
|
7
|
-
// superseded completion)
|
|
8
|
-
// Both used to unconditionally wipe session.pendingPermissions, which
|
|
9
|
-
// destroys a backgrounded sub-agent's still-open permission resolver if the
|
|
10
|
-
// sub-agent's own tool call (e.g. Bash) is still awaiting the operator's
|
|
11
|
-
// approval when the parent turn ends. The permission card stays on the UI,
|
|
12
|
-
// but the resolver is gone, so the sub-agent's canUseTool Promise (no
|
|
13
|
-
// timeout on the in-process path) hangs forever (lr-9d4b root cause).
|
|
14
|
-
//
|
|
15
|
-
// This module computes which entries are owned by a still-active
|
|
16
|
-
// backgrounded sub-agent (via session.subagentToolOwners, recorded in
|
|
17
|
-
// processSubagentMessage) so both cleanup sites can preserve them instead of
|
|
18
|
-
// wiping them, mirroring the existing _keepAskUser preservation pattern for
|
|
19
|
-
// session.pendingAskUser (mcp-mode entries survive the same cleanup sites).
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Partition session.pendingPermissions into entries to keep (owned by a
|
|
23
|
-
* still-active backgrounded sub-agent) vs. the rest (top-level, or a
|
|
24
|
-
* sub-agent whose owning Task has already finished) — the latter are
|
|
25
|
-
* cleared exactly as before.
|
|
26
|
-
*
|
|
27
|
-
* @param {object} session - session object with pendingPermissions,
|
|
28
|
-
* subagentToolOwners, activeTaskToolIds.
|
|
29
|
-
* @returns {{keptPermissions: object, preservedTaskIds: object}}
|
|
30
|
-
* keptPermissions: requestId -> pending entry, to become the new
|
|
31
|
-
* session.pendingPermissions.
|
|
32
|
-
* preservedTaskIds: Task tool-use id -> true, for the caller to also keep
|
|
33
|
-
* the corresponding activeTaskToolIds/taskIdMap entries (the sub-agent's
|
|
34
|
-
* bookkeeping must survive alongside its pending permission).
|
|
35
|
-
*/
|
|
36
|
-
function partitionSubagentOwnedPermissions(session) {
|
|
37
|
-
var keptPermissions = {};
|
|
38
|
-
var pendingPermissions = session.pendingPermissions || {};
|
|
39
|
-
var subagentToolOwners = session.subagentToolOwners || {};
|
|
40
|
-
var activeTaskToolIds = session.activeTaskToolIds || {};
|
|
41
|
-
|
|
42
|
-
var permissionIds = Object.keys(pendingPermissions);
|
|
43
|
-
for (var i = 0; i < permissionIds.length; i++) {
|
|
44
|
-
var pid = permissionIds[i];
|
|
45
|
-
var pentry = pendingPermissions[pid];
|
|
46
|
-
var owningTaskId = pentry && pentry.toolUseId ? subagentToolOwners[pentry.toolUseId] : null;
|
|
47
|
-
if (owningTaskId && activeTaskToolIds[owningTaskId]) {
|
|
48
|
-
keptPermissions[pid] = pentry;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var preservedTaskIds = {};
|
|
53
|
-
for (var kpid in keptPermissions) {
|
|
54
|
-
var kpTaskId = subagentToolOwners[keptPermissions[kpid].toolUseId];
|
|
55
|
-
preservedTaskIds[kpTaskId] = true;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return { keptPermissions: keptPermissions, preservedTaskIds: preservedTaskIds };
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// lr-f940 (N3, top-3): sm.permissionRequestIndex[requestId] -> session.localId
|
|
62
|
-
// is written once per permission request (sdk-bridge.js handleCanUseTool) and
|
|
63
|
-
// is normally deleted in exactly two places: the user-driven permission_response
|
|
64
|
-
// handler (project-sessions.js) and the opts.signal "abort" listener
|
|
65
|
-
// (sdk-bridge.js). Both turn-boundary cleanup sites that call
|
|
66
|
-
// partitionSubagentOwnedPermissions() (the 'result' message handler in
|
|
67
|
-
// sdk-message-processor.js, and processQueryStream's finally block in
|
|
68
|
-
// sdk-bridge.js) drop entries from session.pendingPermissions wholesale
|
|
69
|
-
// (everything not in keptPermissions) without ever touching
|
|
70
|
-
// sm.permissionRequestIndex, so the dropped requestIds' index entries persist
|
|
71
|
-
// for the life of the daemon. On the WORKER path this is the ONLY cleanup that
|
|
72
|
-
// ever runs for those entries: the worker's canUseTool bridge (yoke/adapters/
|
|
73
|
-
// claude.js) passes a fake `signal: { addEventListener: function() {} }` to
|
|
74
|
-
// the in-process canUseTool, so the abort-listener deletion path is a no-op —
|
|
75
|
-
// the index entry is orphaned unconditionally once the turn ends.
|
|
76
|
-
//
|
|
77
|
-
// Call this immediately after reassigning session.pendingPermissions to
|
|
78
|
-
// keptPermissions, passing the PRE-reassignment map, so every entry that was
|
|
79
|
-
// dropped (i.e. not preserved for a still-active backgrounded sub-agent) is
|
|
80
|
-
// swept from sm.permissionRequestIndex and its orphaned resolver is settled
|
|
81
|
-
// with a deny — an SDK canUseTool Promise left unresolved forever is itself a
|
|
82
|
-
// (smaller) leak on top of the index leak.
|
|
83
|
-
//
|
|
84
|
-
// @param {object} sm - the session manager (owns permissionRequestIndex).
|
|
85
|
-
// @param {object} prevPendingPermissions - session.pendingPermissions as it
|
|
86
|
-
// was BEFORE this cleanup pass reassigned it to keptPermissions.
|
|
87
|
-
// @param {object} keptPermissions - the entries being preserved (from
|
|
88
|
-
// partitionSubagentOwnedPermissions's return value).
|
|
89
|
-
function sweepClearedPermissionIndex(sm, prevPendingPermissions, keptPermissions) {
|
|
90
|
-
// Production sm always carries permissionRequestIndex (lib/sessions.js
|
|
91
|
-
// initializes it unconditionally) — this guard exists only so a caller
|
|
92
|
-
// without one (e.g. a minimal test double predating this sweep) is a
|
|
93
|
-
// no-op, matching its pre-existing behavior exactly rather than gaining a
|
|
94
|
-
// new side effect it never asked for.
|
|
95
|
-
if (!sm || !sm.permissionRequestIndex) return;
|
|
96
|
-
var prevIds = Object.keys(prevPendingPermissions || {});
|
|
97
|
-
for (var i = 0; i < prevIds.length; i++) {
|
|
98
|
-
var pid = prevIds[i];
|
|
99
|
-
if (keptPermissions && keptPermissions[pid]) continue; // still owned, not dropped
|
|
100
|
-
delete sm.permissionRequestIndex[pid];
|
|
101
|
-
// Settle the orphaned resolver too — an abandoned canUseTool Promise is
|
|
102
|
-
// itself a (smaller) leak on top of the index leak (lr-f940).
|
|
103
|
-
var droppedEntry = prevPendingPermissions[pid];
|
|
104
|
-
if (droppedEntry && typeof droppedEntry.resolve === "function") {
|
|
105
|
-
try { droppedEntry.resolve({ behavior: "deny", message: "Session turn ended" }); }
|
|
106
|
-
catch (e) { /* resolver already settled or threw — nothing further to do */ }
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Apply the partition result to activeTaskToolIds/taskIdMap, keeping only
|
|
113
|
-
* entries for Task ids whose permission was just preserved.
|
|
114
|
-
*
|
|
115
|
-
* @param {object} session
|
|
116
|
-
* @param {object} preservedTaskIds - from partitionSubagentOwnedPermissions.
|
|
117
|
-
*/
|
|
118
|
-
function retainPreservedTaskBookkeeping(session, preservedTaskIds) {
|
|
119
|
-
var nextActiveTaskToolIds = {};
|
|
120
|
-
for (var atk in (session.activeTaskToolIds || {})) {
|
|
121
|
-
if (preservedTaskIds[atk]) nextActiveTaskToolIds[atk] = session.activeTaskToolIds[atk];
|
|
122
|
-
}
|
|
123
|
-
session.activeTaskToolIds = nextActiveTaskToolIds;
|
|
124
|
-
|
|
125
|
-
var nextTaskIdMap = {};
|
|
126
|
-
for (var tik in (session.taskIdMap || {})) {
|
|
127
|
-
if (preservedTaskIds[tik]) nextTaskIdMap[tik] = session.taskIdMap[tik];
|
|
128
|
-
}
|
|
129
|
-
session.taskIdMap = nextTaskIdMap;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
module.exports = {
|
|
133
|
-
partitionSubagentOwnedPermissions: partitionSubagentOwnedPermissions,
|
|
134
|
-
retainPreservedTaskBookkeeping: retainPreservedTaskBookkeeping,
|
|
135
|
-
sweepClearedPermissionIndex: sweepClearedPermissionIndex,
|
|
136
|
-
};
|