@clagentic/console 1.10.0-beta.1 → 1.10.0-beta.3
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/README.md +1 -1
- package/bin/cli.js +10 -0
- package/lib/activity-clock.js +23 -0
- package/lib/agent-dispatch-tool.js +20 -0
- 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-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 +8 -5
- 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/cli-transcript-title.js +131 -0
- package/lib/codex-defaults.js +8 -2
- package/lib/daemon-projects.js +19 -0
- package/lib/daemon.js +166 -127
- package/lib/debug-log.js +17 -0
- package/lib/exit-flush.js +44 -0
- package/lib/grant-keys.js +179 -0
- package/lib/log-field.js +34 -0
- package/lib/memory-shed.js +13 -32
- package/lib/project-connection.js +14 -0
- package/lib/project-external-trigger.js +91 -123
- package/lib/project-http.js +2 -0
- package/lib/project-loop.js +5 -4
- package/lib/project-notifications.js +4 -0
- package/lib/project-prompt-responses.js +7 -5
- package/lib/project-session-grants.js +73 -0
- package/lib/project-sessions.js +55 -68
- package/lib/project-user-message.js +13 -25
- package/lib/project.js +25 -5
- package/lib/prompt-kinds/permission.js +18 -0
- package/lib/prompt-label.js +60 -0
- package/lib/prompt-registry.js +123 -13
- package/lib/prompt-source.js +65 -0
- package/lib/public/css/diagnostics.css +30 -0
- package/lib/public/css/notifications-center.css +15 -0
- package/lib/public/css/overlays.css +18 -0
- package/lib/public/css/rewind.css +8 -0
- package/lib/public/modules/agent-dispatch-tool.js +9 -0
- package/lib/public/modules/app-messages.js +10 -2
- package/lib/public/modules/app-notifications.js +9 -1
- package/lib/public/modules/app-panels.js +0 -1
- package/lib/public/modules/build-update-detail.js +54 -0
- package/lib/public/modules/diagnostics.js +126 -20
- package/lib/public/modules/prompt-banner.js +12 -0
- package/lib/public/modules/prompt-kinds/permission-choices.js +6 -1
- package/lib/public/modules/prompt-kinds/permission.js +15 -0
- package/lib/public/modules/prompt-label.js +44 -0
- package/lib/public/modules/prompts.js +9 -0
- package/lib/public/modules/session-grants.js +131 -0
- package/lib/public/modules/sidebar-sessions.js +11 -0
- package/lib/public/modules/tools.js +14 -2
- package/lib/public/modules/vendor-picker.js +2 -2
- package/lib/public/modules/vendor-registry.js +11 -2
- package/lib/runtime-env.js +1 -1
- package/lib/sdk-bridge.js +114 -115
- package/lib/sdk-message-processor.js +25 -87
- package/lib/sdk-skill-discovery.js +65 -60
- package/lib/server.js +15 -2
- package/lib/session-ai-title.js +80 -0
- package/lib/session-id.js +33 -0
- package/lib/session-input-ipc.js +32 -0
- package/lib/session-input.js +409 -0
- package/lib/session-reclaim.js +284 -0
- package/lib/session-resume.js +172 -0
- package/lib/sessions.js +31 -21
- package/lib/supervisor.js +39 -0
- package/lib/turn-initiator.js +108 -0
- package/lib/utils.js +9 -47
- package/lib/vendor-registry-message.js +1 -0
- package/lib/ws-schema.js +9 -4
- package/lib/yoke/adapters/claude-vendor.js +0 -1
- package/lib/yoke/adapters/claude-worker.js +6 -4
- package/lib/yoke/adapters/claude.js +29 -86
- package/lib/yoke/adapters/codex-capabilities.js +9 -6
- package/lib/yoke/adapters/codex-vendor.js +15 -15
- package/lib/yoke/adapters/codex.js +125 -136
- package/lib/yoke/auth-checks.js +8 -21
- package/lib/yoke/codex-app-server.js +27 -71
- 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/index.js +20 -4
- package/lib/yoke/install-probe.js +21 -6
- package/lib/yoke/interface.js +14 -12
- package/lib/yoke/registry.js +41 -4
- package/package.json +1 -2
- package/scripts/verify-installed-build.js +59 -17
- package/lib/lore-attestation.js +0 -73
|
@@ -79,37 +79,52 @@ function findBinaryPath(name, linuxUser) {
|
|
|
79
79
|
/**
|
|
80
80
|
* Which registered vendors are installed, and which could not be checked.
|
|
81
81
|
* @param {?string} linuxUser
|
|
82
|
-
* @
|
|
82
|
+
* @param {{osUsers: ?boolean}} [options] osUsers: per-user OS isolation is on;
|
|
83
|
+
* an agent that does not support it is reported not installed, with the
|
|
84
|
+
* reason, and its probe is not run
|
|
85
|
+
* @returns {{installed: string[], failures: Object<string, string>, details: object}}
|
|
83
86
|
* failures maps a vendor id to the class of the lookup failure
|
|
84
87
|
*/
|
|
85
|
-
function detectVendorInstallState(linuxUser) {
|
|
88
|
+
function detectVendorInstallState(linuxUser, options) {
|
|
86
89
|
var installed = [];
|
|
87
90
|
var failures = {};
|
|
91
|
+
var details = {};
|
|
92
|
+
var osUsers = !!(options && options.osUsers);
|
|
88
93
|
registry.list().forEach(function (vendor) {
|
|
94
|
+
if (registry.disabledByOsUsers(vendor.id, osUsers)) {
|
|
95
|
+
details[vendor.id] = { path: null, version: null, source: null, reason: registry.osUsersReasonFor(vendor.id) };
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
89
98
|
try {
|
|
90
|
-
var
|
|
99
|
+
var outcome = vendor.probeInstalled({
|
|
100
|
+
linuxUser: linuxUser || null,
|
|
91
101
|
lookupBinary: function (name) {
|
|
92
102
|
var result = probeBinary(name, linuxUser);
|
|
93
103
|
if (result.state === "failed") throw ProbeFailedError(result.probeClass);
|
|
94
104
|
return result.state === "found";
|
|
95
105
|
},
|
|
96
106
|
});
|
|
107
|
+
// A probe answers with whether the agent is installed, or with that and
|
|
108
|
+
// what it found (path, version) or why it is not usable.
|
|
109
|
+
var found = outcome && typeof outcome === "object" ? outcome.installed : outcome;
|
|
110
|
+
if (outcome && typeof outcome === "object" && outcome.detail) details[vendor.id] = outcome.detail;
|
|
97
111
|
if (found) installed.push(vendor.id);
|
|
98
112
|
} catch (e) {
|
|
99
113
|
if (!e || e.code !== PROBE_FAILED_CODE) throw e;
|
|
100
114
|
failures[vendor.id] = e.probeClass;
|
|
101
115
|
}
|
|
102
116
|
});
|
|
103
|
-
return { installed: installed, failures: failures };
|
|
117
|
+
return { installed: installed, failures: failures, details: details };
|
|
104
118
|
}
|
|
105
119
|
|
|
106
120
|
/**
|
|
107
121
|
* Ids of the registered vendors that are installed.
|
|
108
122
|
* @param {?string} linuxUser
|
|
123
|
+
* @param {{osUsers: ?boolean}} [options]
|
|
109
124
|
* @returns {string[]}
|
|
110
125
|
*/
|
|
111
|
-
function detectInstalledVendors(linuxUser) {
|
|
112
|
-
return detectVendorInstallState(linuxUser).installed;
|
|
126
|
+
function detectInstalledVendors(linuxUser, options) {
|
|
127
|
+
return detectVendorInstallState(linuxUser, options).installed;
|
|
113
128
|
}
|
|
114
129
|
|
|
115
130
|
module.exports = {
|
package/lib/yoke/interface.js
CHANGED
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
// the console drives an adapter, not what a session negotiates, so they are
|
|
31
31
|
// never resolved, narrowed or overridden. A descriptor that still declares
|
|
32
32
|
// one as a capability is refused with a named error.
|
|
33
|
+
//
|
|
34
|
+
// 0.4.0 → 0.5.0 (2026-10, additive plus one removal)
|
|
35
|
+
// Added: QueryHandle.pushMessage takes an optional third argument, the
|
|
36
|
+
// initiator of the turn (lib/turn-initiator.js INITIATORS), which an adapter
|
|
37
|
+
// maps to its vendor's per-turn provenance field. An adapter that has none
|
|
38
|
+
// ignores it.
|
|
39
|
+
// Removed: the attestsHumanSessions trait. Provenance is per turn and carried
|
|
40
|
+
// by the turn itself, not declared per adapter.
|
|
33
41
|
|
|
34
42
|
/**
|
|
35
43
|
* YOKE contract version. Bumped on every additive or breaking change.
|
|
@@ -42,8 +50,9 @@
|
|
|
42
50
|
* 0.2.0 — added 'diagnostic' event type (lr-8c43)
|
|
43
51
|
* 0.3.0 — capability ledger, vendor registry, reconciled method lists
|
|
44
52
|
* 0.4.0 — adapter traits split out of the capability ledger
|
|
53
|
+
* 0.5.0 — per-turn initiator on pushMessage; attestsHumanSessions removed
|
|
45
54
|
*/
|
|
46
|
-
var INTERFACE_VERSION = "0.
|
|
55
|
+
var INTERFACE_VERSION = "0.5.0";
|
|
47
56
|
|
|
48
57
|
var TOOL_POLICIES = ["ask", "allow-all"];
|
|
49
58
|
|
|
@@ -60,11 +69,9 @@ var TOOL_POLICIES = ["ask", "allow-all"];
|
|
|
60
69
|
* .createToolServer(def): ToolServer (opaque)
|
|
61
70
|
* .createQuery(opts): QueryHandle
|
|
62
71
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* opts: { cwd }
|
|
67
|
-
* Returns a short (3-8 word) title string.
|
|
72
|
+
* There is no title-generation method: an adapter never starts a query to
|
|
73
|
+
* title a session. A session's title is the vendor CLI's own (see
|
|
74
|
+
* lib/session-ai-title.js) or the first-line title.
|
|
68
75
|
*
|
|
69
76
|
* Additional session management (Claude SDK specific, may vary per adapter):
|
|
70
77
|
* .getSessionInfo(sessionId, opts): Promise<object|null>
|
|
@@ -74,7 +81,7 @@ var TOOL_POLICIES = ["ask", "allow-all"];
|
|
|
74
81
|
*
|
|
75
82
|
* QueryHandle shape:
|
|
76
83
|
* [Symbol.asyncIterator]() - yields SDK events (raw in Phase 3, normalized later)
|
|
77
|
-
* .pushMessage(text, images)
|
|
84
|
+
* .pushMessage(text, images, initiator) - initiator optional, per turn
|
|
78
85
|
* .setModel(model)
|
|
79
86
|
* .setEffort(effort) - Promise; settles once the running query has
|
|
80
87
|
* taken the change and rejects (with a message
|
|
@@ -130,7 +137,6 @@ var QUERY_HANDLE_OPTIONAL_METHODS = [
|
|
|
130
137
|
/**
|
|
131
138
|
* Adapter methods and properties the console uses beyond ADAPTER_METHODS.
|
|
132
139
|
* Optional: the console feature behind each is gated by a capability.
|
|
133
|
-
* .generateTitle(messages, opts) - session titles
|
|
134
140
|
* .getSessionInfo / .listSessions / .renameSession - capabilities
|
|
135
141
|
* sessionList, sessionRename
|
|
136
142
|
* .forkSession(sessionId, opts) - capability fork
|
|
@@ -144,7 +150,6 @@ var QUERY_HANDLE_OPTIONAL_METHODS = [
|
|
|
144
150
|
* capabilities, which can only narrow the declaration (resolveCapabilities).
|
|
145
151
|
*/
|
|
146
152
|
var ADAPTER_OPTIONAL_METHODS = [
|
|
147
|
-
"generateTitle",
|
|
148
153
|
"getSessionInfo",
|
|
149
154
|
"listSessions",
|
|
150
155
|
"renameSession",
|
|
@@ -202,13 +207,10 @@ var CAPABILITY_KEYS = Object.keys(CAPABILITIES);
|
|
|
202
207
|
* created and shut down with it
|
|
203
208
|
* activityTokens - the adapter's tool and thinking blocks are tracked as
|
|
204
209
|
* activity tokens by the console
|
|
205
|
-
* attestsHumanSessions - the adapter's sessions are attested as human-driven
|
|
206
|
-
* by the console rather than by the adapter
|
|
207
210
|
*/
|
|
208
211
|
var TRAITS = {
|
|
209
212
|
perProjectRuntime: true,
|
|
210
213
|
activityTokens: true,
|
|
211
|
-
attestsHumanSessions: true,
|
|
212
214
|
};
|
|
213
215
|
|
|
214
216
|
var TRAIT_KEYS = Object.keys(TRAITS);
|
package/lib/yoke/registry.js
CHANGED
|
@@ -99,13 +99,18 @@ function validateCredentialGroups(descriptor) {
|
|
|
99
99
|
* priority number lower is preferred when choosing a default
|
|
100
100
|
* binaryNames string[] executables the install probe may look up; the
|
|
101
101
|
* allowlist for lookups is the union over vendors
|
|
102
|
-
* probeInstalled function(ctx) -> boolean, ctx.lookupBinary(name)
|
|
102
|
+
* probeInstalled function(ctx) -> boolean | {installed, detail}; ctx.lookupBinary(name)
|
|
103
|
+
* -> boolean, ctx.linuxUser (the OS user asked about, or null).
|
|
104
|
+
* detail ({path, version, reason}) is shown beside the agent
|
|
105
|
+
* recheck optional function(): forget what the probe remembered, so
|
|
106
|
+
* the next probe looks again (a user installed or updated it)
|
|
103
107
|
* checkAuth function() -> boolean
|
|
104
108
|
* installHint string one line telling the user how to install it
|
|
105
109
|
* loginCommand string the one place the login command is written
|
|
106
|
-
* osUsersSupported boolean can run under per-user OS isolation
|
|
110
|
+
* osUsersSupported boolean can run under per-user OS isolation; when false the
|
|
111
|
+
* agent is disabled, with a reason, in that mode
|
|
107
112
|
* needsRuntimeEnv boolean every entry point requires runtimeEnv
|
|
108
|
-
* perProjectRuntime, activityTokens
|
|
113
|
+
* perProjectRuntime, activityTokens
|
|
109
114
|
* optional booleans (false when absent): adapter traits, how
|
|
110
115
|
* the console drives the adapter (interface.js TRAITS). Never
|
|
111
116
|
* resolved or overridden; read with traitOf.
|
|
@@ -119,6 +124,9 @@ function validateCredentialGroups(descriptor) {
|
|
|
119
124
|
* nativeInstructionFiles string[] project instruction files the agent reads
|
|
120
125
|
* itself, so the console does not inject them again
|
|
121
126
|
* interruptMessage string shown when the user stops a turn
|
|
127
|
+
* capabilityReasons optional object capability key -> the line shown beside a
|
|
128
|
+
* control this agent has disabled, in place of the
|
|
129
|
+
* ledger's general one
|
|
122
130
|
* capabilities object the declared capabilities (interface.js ledger)
|
|
123
131
|
* createAdapter function(opts) -> adapter
|
|
124
132
|
*
|
|
@@ -142,8 +150,15 @@ function register(descriptor) {
|
|
|
142
150
|
requireFunction(descriptor, "probeInstalled");
|
|
143
151
|
requireFunction(descriptor, "checkAuth");
|
|
144
152
|
requireFunction(descriptor, "createAdapter");
|
|
153
|
+
if (descriptor.recheck !== undefined) requireFunction(descriptor, "recheck");
|
|
145
154
|
requireBoolean(descriptor, "osUsersSupported");
|
|
146
155
|
requireBoolean(descriptor, "needsRuntimeEnv");
|
|
156
|
+
if (descriptor.capabilityReasons === undefined) descriptor = Object.assign({}, descriptor, { capabilityReasons: {} });
|
|
157
|
+
Object.keys(descriptor.capabilityReasons).forEach(function (key) {
|
|
158
|
+
if (!iface.isCapabilityKey(key) || typeof descriptor.capabilityReasons[key] !== "string" || !descriptor.capabilityReasons[key]) {
|
|
159
|
+
throw new Error("[YOKE] Vendor descriptor '" + descriptor.id + "' capabilityReasons needs a ledger key with a non-empty string: " + key);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
147
162
|
var traitDefaults = {};
|
|
148
163
|
iface.TRAIT_KEYS.forEach(function (key) {
|
|
149
164
|
if (descriptor[key] === undefined) traitDefaults[key] = false;
|
|
@@ -167,6 +182,7 @@ function register(descriptor) {
|
|
|
167
182
|
ownedEnvPrefixes: descriptor.ownedEnvPrefixes.slice(),
|
|
168
183
|
nativeInstructionFiles: descriptor.nativeInstructionFiles.slice(),
|
|
169
184
|
capabilities: iface.completeCapabilities(descriptor.capabilities),
|
|
185
|
+
capabilityReasons: Object.assign({}, descriptor.capabilityReasons),
|
|
170
186
|
});
|
|
171
187
|
_vendors.set(entry.id, entry);
|
|
172
188
|
return entry;
|
|
@@ -283,7 +299,8 @@ function defaultVendorId(availableIds) {
|
|
|
283
299
|
|
|
284
300
|
/**
|
|
285
301
|
* The registry as the browser needs it: serializable, no functions.
|
|
286
|
-
* @param {{installed: string[], available: string[], capabilities: ?object, probeFailures: ?object}} state
|
|
302
|
+
* @param {{installed: string[], available: string[], capabilities: ?object, probeFailures: ?object, details: ?object}} state
|
|
303
|
+
* details maps a vendor id to what its probe found: {path, version, reason}.
|
|
287
304
|
* probeFailures maps a vendor id to the class of an install lookup that
|
|
288
305
|
* failed, so the picker says it could not check instead of "not installed".
|
|
289
306
|
* capabilities, when given, maps a vendor id to what a live session has
|
|
@@ -294,9 +311,11 @@ function describeForClient(state) {
|
|
|
294
311
|
var available = (state && state.available) || [];
|
|
295
312
|
var resolved = (state && state.capabilities) || {};
|
|
296
313
|
var failures = (state && state.probeFailures) || {};
|
|
314
|
+
var details = (state && state.details) || {};
|
|
297
315
|
return list().map(function (d) {
|
|
298
316
|
var live = Object.prototype.hasOwnProperty.call(resolved, d.id) ? resolved[d.id] : d.capabilities;
|
|
299
317
|
return {
|
|
318
|
+
installDetail: Object.prototype.hasOwnProperty.call(details, d.id) ? details[d.id] : null,
|
|
300
319
|
id: d.id,
|
|
301
320
|
displayName: d.displayName,
|
|
302
321
|
icon: d.icon,
|
|
@@ -307,10 +326,26 @@ function describeForClient(state) {
|
|
|
307
326
|
probeFailure: Object.prototype.hasOwnProperty.call(failures, d.id) ? failures[d.id] : null,
|
|
308
327
|
available: available.indexOf(d.id) !== -1,
|
|
309
328
|
capabilities: iface.completeCapabilities(live),
|
|
329
|
+
capabilityReasons: Object.assign({}, d.capabilityReasons),
|
|
310
330
|
};
|
|
311
331
|
});
|
|
312
332
|
}
|
|
313
333
|
|
|
334
|
+
/**
|
|
335
|
+
* Whether per-user OS isolation rules an agent out: it is on and the agent does
|
|
336
|
+
* not support it. Fail-closed callers never create or start such an agent.
|
|
337
|
+
* @param {string} id
|
|
338
|
+
* @param {boolean} osUsers
|
|
339
|
+
*/
|
|
340
|
+
function disabledByOsUsers(id, osUsers) {
|
|
341
|
+
return !!osUsers && getVendor(id).osUsersSupported !== true;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/** The reason shown for an agent that per-user OS isolation rules out. */
|
|
345
|
+
function osUsersReasonFor(id) {
|
|
346
|
+
return getVendor(id).displayName + " is not yet isolated per OS user";
|
|
347
|
+
}
|
|
348
|
+
|
|
314
349
|
/** key -> the one line shown beside a control the agent cannot support. */
|
|
315
350
|
function capabilityReasons() {
|
|
316
351
|
var out = {};
|
|
@@ -336,5 +371,7 @@ module.exports = {
|
|
|
336
371
|
assertAllowedBinary: assertAllowedBinary,
|
|
337
372
|
defaultVendorId: defaultVendorId,
|
|
338
373
|
describeForClient: describeForClient,
|
|
374
|
+
disabledByOsUsers: disabledByOsUsers,
|
|
375
|
+
osUsersReasonFor: osUsersReasonFor,
|
|
339
376
|
capabilityReasons: capabilityReasons,
|
|
340
377
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.10.0-beta.
|
|
6
|
+
"version": "1.10.0-beta.3",
|
|
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"
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"@anthropic-ai/claude-agent-sdk": "0.3.295",
|
|
64
64
|
"@anthropic-ai/sdk": "0.104.2",
|
|
65
65
|
"@lydell/node-pty": "^1.2.0-beta.3",
|
|
66
|
-
"@openai/codex": "^0.124.0",
|
|
67
66
|
"ajv": "^8.20.0",
|
|
68
67
|
"nodemailer": "^10.1.0",
|
|
69
68
|
"qrcode-terminal": "^0.12.0",
|
|
@@ -73,10 +73,22 @@
|
|
|
73
73
|
// upstream (NAOMI's post-merge report, HOLDEN's operator relay) as if it
|
|
74
74
|
// meant the running service was fixed.
|
|
75
75
|
//
|
|
76
|
+
// The process leg reports exactly one of three verdicts:
|
|
77
|
+
// adopted — the daemon loaded merged HEAD AND says the installed files
|
|
78
|
+
// are the ones it loaded (sha plus content hash). An identical
|
|
79
|
+
// reinstall over a running daemon (install:local-test, a
|
|
80
|
+
// post-merge reinstall) is adopted: its "(deleted)" mappings
|
|
81
|
+
// (staleInodes) are reported but do not decide it.
|
|
82
|
+
// stale — the daemon loaded a different build than the installed one;
|
|
83
|
+
// both shas are printed. Exit 1.
|
|
84
|
+
// inconclusive — the check cannot say (no daemon, a daemon that predates
|
|
85
|
+
// the status query or the content comparison); the reason is
|
|
86
|
+
// printed. Exit 0, and never read as adopted.
|
|
87
|
+
//
|
|
76
88
|
// Exit codes:
|
|
77
|
-
// 0 — ARTIFACT_AND_PROCESS_VERIFIED: installed build-sha.json
|
|
78
|
-
// merged HEAD AND the running daemon
|
|
79
|
-
//
|
|
89
|
+
// 0 — ARTIFACT_AND_PROCESS_VERIFIED (adopted): installed build-sha.json
|
|
90
|
+
// matches merged HEAD AND the running daemon loaded that same SHA and
|
|
91
|
+
// reports the installed files are the ones it loaded.
|
|
80
92
|
// — ARTIFACT_VERIFIED_NO_PROCESS: installed build-sha.json matches
|
|
81
93
|
// merged HEAD and no daemon is currently running, so the PROCESS
|
|
82
94
|
// CHECK DID NOT RUN. The service's build status is UNKNOWN, not
|
|
@@ -85,9 +97,9 @@
|
|
|
85
97
|
// never be read as "the service is fine".
|
|
86
98
|
// 1 — ARTIFACT_MISMATCH: installed build-sha.json does not match merged
|
|
87
99
|
// HEAD (PART 1's original failure mode, unchanged).
|
|
88
|
-
// — PROCESS_MISMATCH: the artifact matches, but the running
|
|
89
|
-
// loaded SHA differs from merged HEAD, or the daemon itself
|
|
90
|
-
//
|
|
100
|
+
// — PROCESS_MISMATCH (stale): the artifact matches, but the running
|
|
101
|
+
// daemon's loaded SHA differs from merged HEAD, or the daemon itself
|
|
102
|
+
// reports the installed build differs from the one it loaded. THIS is
|
|
91
103
|
// the failure mode that would have caught 2026-08-25 at 01:48 — see
|
|
92
104
|
// test/verify-installed-build-lr-dc9a3b.test.js for the
|
|
93
105
|
// demonstrated-failure-before-fix simulation.
|
|
@@ -116,6 +128,11 @@ const fs = require('fs');
|
|
|
116
128
|
const path = require('path');
|
|
117
129
|
const { execFileSync } = require('child_process');
|
|
118
130
|
|
|
131
|
+
// Never done by this check (see the NON-GOAL in the header comment).
|
|
132
|
+
const APPLY_IS_THE_OPERATORS =
|
|
133
|
+
'The artifact on disk is correct; the SERVICE is still serving the old build. Applying it is the ' +
|
|
134
|
+
'operator\'s decision: the "Restart to apply update" action in the Clagentic: Console UI offers it.';
|
|
135
|
+
|
|
119
136
|
function resolveHeadSha() {
|
|
120
137
|
return execFileSync('git', ['rev-parse', 'HEAD'], {
|
|
121
138
|
cwd: path.join(__dirname, '..'),
|
|
@@ -208,6 +225,13 @@ function resolveProcessBuildStatus(cliBin) {
|
|
|
208
225
|
return {
|
|
209
226
|
running: true,
|
|
210
227
|
loadedBuildSha: parsed.loadedBuildSha,
|
|
228
|
+
// The daemon's own verdict (adopted | stale | inconclusive) on whether
|
|
229
|
+
// the installed build is the one it loaded: sha plus a content hash of
|
|
230
|
+
// the installed files. Absent from a daemon that predates it.
|
|
231
|
+
installedBuildSha: parsed.installedBuildSha,
|
|
232
|
+
state: parsed.state,
|
|
233
|
+
reason: parsed.reason,
|
|
234
|
+
detail: parsed.detail,
|
|
211
235
|
staleInodes: !!parsed.staleInodes,
|
|
212
236
|
pid: parsed.pid,
|
|
213
237
|
};
|
|
@@ -254,7 +278,7 @@ function main() {
|
|
|
254
278
|
|
|
255
279
|
if (!processStatus.running) {
|
|
256
280
|
console.log(
|
|
257
|
-
'[verify-installed-build] ARTIFACT_VERIFIED_NO_PROCESS:
|
|
281
|
+
'[verify-installed-build] ARTIFACT_VERIFIED_NO_PROCESS: inconclusive. Artifact matches merged HEAD ' +
|
|
258
282
|
`(${headSha}); no daemon is running, so the PROCESS CHECK DID NOT RUN and the process ` +
|
|
259
283
|
'build status is UNKNOWN -- do not read this as the process/service being verified. ' +
|
|
260
284
|
'Not a failure: there is no running process to compare against yet.'
|
|
@@ -270,7 +294,7 @@ function main() {
|
|
|
270
294
|
// transport error). This is NOT read as "verified": the build status of
|
|
271
295
|
// the running process is explicitly UNKNOWN pending a restart.
|
|
272
296
|
console.log(
|
|
273
|
-
'[verify-installed-build] STALE_PROCESS:
|
|
297
|
+
'[verify-installed-build] STALE_PROCESS: inconclusive. Artifact matches merged HEAD ' +
|
|
274
298
|
`(${headSha}); the running daemon does not recognize the get_build_status query, ` +
|
|
275
299
|
'meaning it predates that handler and has not picked up any build since. The PROCESS build ' +
|
|
276
300
|
'status is UNKNOWN, NOT VERIFIED (PROCESS check inconclusive) -- restart the daemon to ' +
|
|
@@ -281,22 +305,40 @@ function main() {
|
|
|
281
305
|
return;
|
|
282
306
|
}
|
|
283
307
|
|
|
308
|
+
// stale: the process loaded a different build than the one installed, or the
|
|
309
|
+
// daemon itself says the installed files differ from what it loaded.
|
|
310
|
+
// staleInodes does not decide this: an identical reinstall (install:local-test,
|
|
311
|
+
// a post-merge reinstall) unlinks files the daemon keeps mapped without
|
|
312
|
+
// changing anything it runs.
|
|
284
313
|
const processMismatch = processStatus.loadedBuildSha !== headSha;
|
|
285
|
-
if (processMismatch || processStatus.
|
|
314
|
+
if (processMismatch || processStatus.state === 'stale') {
|
|
315
|
+
const daemonStale = processStatus.state === 'stale';
|
|
316
|
+
const installedSha = (daemonStale && processStatus.installedBuildSha) || headSha;
|
|
317
|
+
const why = daemonStale && processStatus.detail ? ` (${processStatus.detail})` : '';
|
|
286
318
|
console.error(
|
|
287
|
-
`[verify-installed-build] PROCESS_MISMATCH:
|
|
288
|
-
`
|
|
289
|
-
`
|
|
290
|
-
`The artifact on disk is correct; the SERVICE is still serving the old build. ` +
|
|
291
|
-
`Restart the daemon to load the new build: systemctl restart clagentic-console ` +
|
|
292
|
-
`(NOT done automatically by this check -- see this script's header comment for why).`
|
|
319
|
+
`[verify-installed-build] PROCESS_MISMATCH: stale. The RUNNING daemon (PID ${processStatus.pid}) has NOT ` +
|
|
320
|
+
`loaded the installed build. loadedBuildSha=${processStatus.loadedBuildSha || '(none)'} ` +
|
|
321
|
+
`installedBuildSha=${installedSha}${why}. ${APPLY_IS_THE_OPERATORS}`
|
|
293
322
|
);
|
|
294
323
|
process.exit(1);
|
|
295
324
|
}
|
|
296
325
|
|
|
326
|
+
if (processStatus.state !== 'adopted') {
|
|
327
|
+
// The shas agree but the daemon did not say the installed files are the
|
|
328
|
+
// ones it loaded (it predates that comparison, or could not read them).
|
|
329
|
+
console.log(
|
|
330
|
+
`[verify-installed-build] PROCESS_INCONCLUSIVE: inconclusive. The running daemon (PID ${processStatus.pid}) ` +
|
|
331
|
+
`loaded merged HEAD (${headSha}), but the PROCESS check cannot confirm it adopted the installed files: ` +
|
|
332
|
+
`${processStatus.detail || 'the daemon predates the content comparison'}. ` +
|
|
333
|
+
`Process build status is UNKNOWN, NOT VERIFIED. Not a failure.`
|
|
334
|
+
);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
|
|
297
338
|
console.log(
|
|
298
|
-
`[verify-installed-build] ARTIFACT_AND_PROCESS_VERIFIED: installed build-sha.json AND the ` +
|
|
299
|
-
`running daemon (PID ${processStatus.pid}) both match merged HEAD (${headSha}),
|
|
339
|
+
`[verify-installed-build] ARTIFACT_AND_PROCESS_VERIFIED: adopted. The installed build-sha.json AND the ` +
|
|
340
|
+
`running daemon (PID ${processStatus.pid}) both match merged HEAD (${headSha}), and the installed files ` +
|
|
341
|
+
`are the ones the daemon loaded (staleInodes=${processStatus.staleInodes} is informational).`
|
|
300
342
|
);
|
|
301
343
|
}
|
|
302
344
|
|
package/lib/lore-attestation.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// lr-f7c100 — declare human presence to LORE for a Codex session the
|
|
2
|
-
// operator is driving through the console.
|
|
3
|
-
//
|
|
4
|
-
// THE PRINCIPLE (operator, lore lr-df5939): a session mints iff a human is
|
|
5
|
-
// in it — nothing else, no launcher special-casing. The Console is the
|
|
6
|
-
// component that KNOWS a human is present (a person is typing into it), so
|
|
7
|
-
// the Console is the correct declarer.
|
|
8
|
-
//
|
|
9
|
-
// Claude (SDK) console sessions are already covered by LORE's own pulse
|
|
10
|
-
// hook (lore PR #1897) — Claude Code's Stop-hook lifecycle fires for an
|
|
11
|
-
// SDK-driven query exactly as it does for the `claude` CLI, so no console
|
|
12
|
-
// code is needed on that path. Codex sessions have no equivalent hook
|
|
13
|
-
// (Codex is a separate app-server protocol the console drives directly),
|
|
14
|
-
// so the console itself must call the declarer for Codex.
|
|
15
|
-
//
|
|
16
|
-
// FAIL-OPEN is load-bearing: a host without LORE installed, or any failure
|
|
17
|
-
// of the `lore` CLI, must never affect session create. This call is fired
|
|
18
|
-
// and forgotten — its result is never awaited by session-create/message
|
|
19
|
-
// dispatch, and any error is swallowed after a best-effort log line.
|
|
20
|
-
var { execFile } = require("child_process");
|
|
21
|
-
|
|
22
|
-
// Bounded so a hung/missing `lore` binary can never accumulate indefinitely
|
|
23
|
-
// under load — this is advisory telemetry, not something callers wait on.
|
|
24
|
-
var ATTEST_TIMEOUT_MS = 5000;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Declare that a human is driving the given vendor session id, via LORE's
|
|
28
|
-
* platform-agnostic attestation verb (`lore session attest-human <sid>`).
|
|
29
|
-
*
|
|
30
|
-
* Never throws, never returns a promise the caller needs to await for
|
|
31
|
-
* correctness — session create/message dispatch must proceed identically
|
|
32
|
-
* whether this succeeds, fails, or LORE is entirely absent from the host.
|
|
33
|
-
*
|
|
34
|
-
* @param {string} sessionId - the vendor's own session id (e.g. the Codex
|
|
35
|
-
* rollout/thread id) that LORE keys attestation on for that platform.
|
|
36
|
-
* @param {function} [onSettled] - TEST-ONLY hook, invoked with the execFile
|
|
37
|
-
* callback's (err) once the child process settles. Production call sites
|
|
38
|
-
* never pass this — attestHumanSession remains fire-and-forget for them.
|
|
39
|
-
* Exists so a regression test can deterministically wait for the real
|
|
40
|
-
* async execFile to finish instead of mutating global process state
|
|
41
|
-
* (e.g. process.env.PATH) and returning before the spawn it triggered
|
|
42
|
-
* has actually resolved, which would race the test's own cleanup and
|
|
43
|
-
* risk leaking an uncontrolled child process into the suite (lr-f7c100
|
|
44
|
-
* PEACHES fnd: verify no test path reaches the real CLI unawaited).
|
|
45
|
-
*/
|
|
46
|
-
function attestHumanSession(sessionId, onSettled) {
|
|
47
|
-
if (!sessionId || typeof sessionId !== "string") {
|
|
48
|
-
if (typeof onSettled === "function") onSettled(null);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
execFile("lore", ["session", "attest-human", sessionId], { timeout: ATTEST_TIMEOUT_MS }, function (err) {
|
|
53
|
-
if (err) {
|
|
54
|
-
// ENOENT (lore not installed) is the expected fail-open case on a
|
|
55
|
-
// host without LORE — log at a lower severity than an actual CLI
|
|
56
|
-
// failure so normal operation isn't noisy on hosts that never run it.
|
|
57
|
-
if (err.code === "ENOENT") {
|
|
58
|
-
console.log("[lore-attestation] lore CLI not found — skipping human-presence attestation (fail-open)");
|
|
59
|
-
} else {
|
|
60
|
-
console.error("[lore-attestation] attest-human failed for session " + sessionId + ":", err.message);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (typeof onSettled === "function") onSettled(err);
|
|
64
|
-
});
|
|
65
|
-
} catch (e) {
|
|
66
|
-
// Defensive: execFile itself should not throw synchronously, but this is
|
|
67
|
-
// a fail-open surface — no error here may ever propagate to the caller.
|
|
68
|
-
console.error("[lore-attestation] Unexpected error invoking lore CLI:", e.message);
|
|
69
|
-
if (typeof onSettled === "function") onSettled(e);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
module.exports = { attestHumanSession: attestHumanSession };
|