@lifeaitools/clauth 1.30.19 → 1.30.20
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/cli/commands/serve.js
CHANGED
|
@@ -1556,7 +1556,7 @@ function renderSupervisorSurface(surface) {
|
|
|
1556
1556
|
return '<div class="supervisor-row"><div class="supervisor-row-top"><span class="supervisor-name">' + htmlEscape(surface.plugin_id + ":" + surface.id) + '</span>' + supervisorBadge(surface.lifecycle_owner || "unknown", ownerKind) + supervisorBadge(surface.state || surface.status || "unknown", stateKind) + '</div>' +
|
|
1557
1557
|
'<div class="supervisor-meta">' + htmlEscape(surface.destination || "—") + ' · port ' + htmlEscape(surface.port || "—") + '</div>' +
|
|
1558
1558
|
'<div class="supervisor-meta">' + htmlEscape(surface.health || surface.health_url || "no health") + '</div>' +
|
|
1559
|
-
'<div class="supervisor-row-actions">' + ["start","stop","restart","reconcile","test","promote","rollback"].map(a => '<button class="supervisor-action" data-supervisor-action="' + a + '" onclick="runSupervisorSurface(' + jsArg(surface.id) + ',' + jsArg(a) + ')">' + a + '</button>').join("") + '</div></div>';
|
|
1559
|
+
'<div class="supervisor-row-actions">' + ["start","stop","restart","reconcile","test","promote","rollback"].map(a => '<button class="supervisor-action" data-supervisor-action="' + a + '" onclick="runSupervisorSurface(' + jsArg(surface.plugin_id + ":" + surface.id) + ',' + jsArg(a) + ')">' + a + '</button>').join("") + '</div></div>';
|
|
1560
1560
|
}
|
|
1561
1561
|
|
|
1562
1562
|
async function rescanSupervisorPlugins() {
|
|
@@ -1,16 +1,94 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { listSurfaces, listPlugins, runSurfaceAction, runPluginAction } from './supervisor-registry.js';
|
|
7
|
+
|
|
8
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const serveSource = fs.readFileSync(path.join(here, 'commands', 'serve.js'), 'utf8');
|
|
10
|
+
|
|
11
|
+
// Regression coverage for the 2026-08-06 incident: every surface across every
|
|
12
|
+
// plugin shares the bare id "primary", and the dashboard's onclick handlers
|
|
13
|
+
// sent that bare id instead of the plugin-qualified "plugin_id:id" that
|
|
14
|
+
// findSurface() already supported. The server-side .find() always resolved
|
|
15
|
+
// to the FIRST surface in the array (codeflow-mcp), which unconditionally
|
|
16
|
+
// rejects every action as self-owned -- so all 49 buttons (7 surfaces x 7
|
|
17
|
+
// actions) silently hit the same surface and appeared to do nothing, on
|
|
18
|
+
// every surface, for every action. The prior test in this file only
|
|
19
|
+
// regex-matched that the action-name strings existed in source; it would
|
|
20
|
+
// pass under this exact bug. These tests exercise the real resolution path
|
|
21
|
+
// through the same exported functions the HTTP routes call (POST
|
|
22
|
+
// /v1/surfaces/:id/actions -> runSurfaceAction; POST /v1/plugins/:id/:action
|
|
23
|
+
// -> runPluginAction), which is the same simulate-a-button-click contract as
|
|
24
|
+
// the dashboard onclick handlers use, without needing a browser.
|
|
25
|
+
|
|
26
|
+
test('the dashboard encodes a plugin-qualified surface id, not the bare (colliding) surface.id', () => {
|
|
27
|
+
assert.match(
|
|
28
|
+
serveSource,
|
|
29
|
+
/jsArg\(surface\.plugin_id \+ ":" \+ surface\.id\)/,
|
|
30
|
+
'renderSupervisorSurface must send plugin_id:id, not the bare surface.id shared by every surface'
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('every real surface exists and every surface id collides with at least one other (documents why plugin_id is required)', () => {
|
|
35
|
+
const surfaces = listSurfaces();
|
|
36
|
+
assert.ok(surfaces.length > 1, 'expected more than one discovered surface to make this regression possible');
|
|
37
|
+
const bareIds = new Set(surfaces.map((s) => s.id));
|
|
38
|
+
assert.equal(bareIds.size, 1, 'expected every discovered surface to share the same bare id ("primary") -- if this ever stops being true, the plugin_id qualifier is still correct but this documentation test should be updated');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('runSurfaceAction resolves the plugin-qualified id to that exact surface, not a different one', () => {
|
|
42
|
+
const surfaces = listSurfaces();
|
|
43
|
+
assert.ok(surfaces.length >= 1, 'no surfaces discovered -- cannot verify resolution');
|
|
44
|
+
for (const surface of surfaces) {
|
|
45
|
+
const compositeId = surface.plugin_id + ':' + surface.id;
|
|
46
|
+
// action "test" is the designed no-op/safe action -- it never touches a
|
|
47
|
+
// real process, it only records a receipt, which is exactly what a
|
|
48
|
+
// verification harness should use.
|
|
49
|
+
const receipt = runSurfaceAction(compositeId, 'test', 'supervisor-ui.test.js');
|
|
50
|
+
assert.ok(!receipt.error, 'surface ' + compositeId + ' resolution failed: ' + receipt.error);
|
|
51
|
+
assert.equal(
|
|
52
|
+
receipt.prior_state?.plugin_id,
|
|
53
|
+
surface.plugin_id,
|
|
54
|
+
'requested surface ' + compositeId + ' but runSurfaceAction resolved a different surface owned by "' + receipt.prior_state?.plugin_id + '" -- this is the exact 2026-08-06 regression'
|
|
55
|
+
);
|
|
56
|
+
assert.equal(receipt.target.surface_id, compositeId);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('bare (unqualified) surface id is ambiguous: it always resolves to the same single surface regardless of which surface was intended', () => {
|
|
61
|
+
const surfaces = listSurfaces();
|
|
62
|
+
assert.ok(surfaces.length > 1, 'need multiple surfaces to demonstrate ambiguity');
|
|
63
|
+
const bareId = surfaces[0].id;
|
|
64
|
+
const receiptsByBareId = surfaces.map(() => runSurfaceAction(bareId, 'test', 'supervisor-ui.test.js'));
|
|
65
|
+
const resolvedOwners = new Set(receiptsByBareId.map((r) => r.prior_state?.plugin_id));
|
|
66
|
+
assert.equal(
|
|
67
|
+
resolvedOwners.size,
|
|
68
|
+
1,
|
|
69
|
+
'expected the bare id to be ambiguous (always resolve to one surface) -- if this now resolves multiple owners, the collision this test guards against has already been fixed at the id level and this test can be removed'
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('every one of the 7 button actions is exercised end-to-end through runSurfaceAction for every discovered surface', () => {
|
|
74
|
+
const actions = ['start', 'stop', 'restart', 'reconcile', 'test', 'promote', 'rollback'];
|
|
75
|
+
const surfaces = listSurfaces();
|
|
76
|
+
for (const surface of surfaces) {
|
|
77
|
+
const compositeId = surface.plugin_id + ':' + surface.id;
|
|
78
|
+
for (const action of actions) {
|
|
79
|
+
const receipt = runSurfaceAction(compositeId, action, 'supervisor-ui.test.js');
|
|
80
|
+
assert.notEqual(receipt.error, 'surface_not_found', compositeId + ' / ' + action + ' could not resolve the surface');
|
|
81
|
+
assert.notEqual(receipt.error, 'invalid_action', compositeId + ' / ' + action + ' is not a recognized action');
|
|
82
|
+
assert.equal(receipt.prior_state?.plugin_id, surface.plugin_id, compositeId + ' / ' + action + ' resolved the wrong surface');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('every plugin-level action is reachable through runPluginAction for every discovered plugin', () => {
|
|
88
|
+
const plugins = listPlugins();
|
|
89
|
+
assert.ok(plugins.length > 0, 'no plugins discovered');
|
|
90
|
+
for (const plugin of plugins) {
|
|
91
|
+
const receipt = runPluginAction(plugin.id, 'test', 'supervisor-ui.test.js');
|
|
92
|
+
assert.notEqual(receipt.error, 'plugin_not_found', plugin.id + ' could not be resolved by its own id');
|
|
93
|
+
}
|
|
94
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifeaitools/clauth",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.20",
|
|
4
4
|
"description": "Hardware-bound credential vault for the LIFEAI infrastructure stack",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "bash scripts/build.sh",
|
|
11
|
-
"test": "node --test cli/commands/scrub.test.js cli/api.classify.test.js test/studio-debug.test.mjs test/dashboard-key-generator.test.mjs && node test-auth-verdict.mjs",
|
|
11
|
+
"test": "node --test cli/commands/scrub.test.js cli/api.classify.test.js cli/supervisor-registry.test.js cli/supervisor-ui.test.js test/studio-debug.test.mjs test/dashboard-key-generator.test.mjs && node test-auth-verdict.mjs",
|
|
12
12
|
"test:studio-debug": "node --test test/studio-debug.test.mjs",
|
|
13
13
|
"test:agent-pool": "node test/agent-pool.test.mjs",
|
|
14
14
|
"test:call-agent-10": "node test/call-agent-10-skills.test.mjs",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|