@camstack/server 1.2.304 → 1.2.306
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/dist/agent/agent-http.js
CHANGED
|
@@ -121,14 +121,14 @@ function resolveUiDistDir(dataDir,
|
|
|
121
121
|
// joins onto. On a packaged desktop that is the closure's own scope dir,
|
|
122
122
|
// `Contents/Resources/node_modules/@camstack`; it was a second, hand-copied
|
|
123
123
|
// `Contents/Resources/addons` tree until 2026-08-25.
|
|
124
|
-
bundledAddonsDir
|
|
125
|
-
//
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
bundledAddonsDir) {
|
|
125
|
+
// REMOVED 2026-09-17: a sibling `dist/` resolved out of the server closure,
|
|
126
|
+
// `path.resolve(__dirname, '../../addon-agent-ui/dist')`, returned with
|
|
127
|
+
// absolute priority before the installed copy was looked at. Its comment
|
|
128
|
+
// claimed it was "always version-matched to the agent"; `pickUiDist` below
|
|
129
|
+
// exists because it was not. It was the only runtime consumer on any role
|
|
130
|
+
// that read an addon out of the closure, and an addon is loaded from the
|
|
131
|
+
// addon root — see `scripts/check-addon-root-is-the-only-load-path.ts` (D518).
|
|
132
132
|
const installed = readUiDistCandidate(path.join(dataDir, 'addons', '@camstack', 'addon-agent-ui'));
|
|
133
133
|
const bundled = bundledAddonsDir
|
|
134
134
|
? readUiDistCandidate(path.join(bundledAddonsDir, 'addon-agent-ui'))
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.planAddonRealignment = planAddonRealignment;
|
|
4
|
+
/** `a` strictly newer than `b`, by numeric segments, missing segments as 0. */
|
|
5
|
+
function isStrictlyNewer(a, b) {
|
|
6
|
+
const pa = a.split('.').map((p) => Number.parseInt(p, 10));
|
|
7
|
+
const pb = b.split('.').map((p) => Number.parseInt(p, 10));
|
|
8
|
+
const len = Math.max(pa.length, pb.length);
|
|
9
|
+
for (let i = 0; i < len; i += 1) {
|
|
10
|
+
const x = pa[i] ?? 0;
|
|
11
|
+
const y = pb[i] ?? 0;
|
|
12
|
+
if (!Number.isFinite(x) || !Number.isFinite(y))
|
|
13
|
+
return false;
|
|
14
|
+
if (x !== y)
|
|
15
|
+
return x > y;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
function planAddonRealignment(candidates) {
|
|
20
|
+
return candidates.map((c) => {
|
|
21
|
+
if (c.closureVersion === null) {
|
|
22
|
+
return { pkg: c.pkg, action: 'keep', reason: 'not carried by this closure' };
|
|
23
|
+
}
|
|
24
|
+
if (!isStrictlyNewer(c.closureVersion, c.installedVersion)) {
|
|
25
|
+
return {
|
|
26
|
+
pkg: c.pkg,
|
|
27
|
+
action: 'keep',
|
|
28
|
+
reason: `installed ${c.installedVersion}, closure ${c.closureVersion} — not strictly newer`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (c.installedUpdatedAtMs === null || c.closureLandedAtMs === null) {
|
|
32
|
+
return {
|
|
33
|
+
pkg: c.pkg,
|
|
34
|
+
action: 'keep',
|
|
35
|
+
reason: 'cannot date the install or the closure — an unknown is not evidence of being stale',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (c.installedUpdatedAtMs >= c.closureLandedAtMs) {
|
|
39
|
+
return {
|
|
40
|
+
pkg: c.pkg,
|
|
41
|
+
action: 'keep',
|
|
42
|
+
reason: `installed ${c.installedVersion} was deployed AFTER this closure landed — better informed than ${c.closureVersion}`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
pkg: c.pkg,
|
|
47
|
+
action: 'realign',
|
|
48
|
+
reason: `installed ${c.installedVersion} predates this closure, which carries ${c.closureVersion}`,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
|
@@ -3101,9 +3101,27 @@ class AddonRegistryService {
|
|
|
3101
3101
|
throw new Error(`initializeAddonGroup("${runnerId}") requires at least one addon`);
|
|
3102
3102
|
}
|
|
3103
3103
|
try {
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3104
|
+
// Serialized on the SAME key as `ensureForkedRunner`. This is the boot
|
|
3105
|
+
// path, and a boot spawn racing the restart a deploy fires for itself is
|
|
3106
|
+
// exactly how two runners started in the same second on 2026-09-17 —
|
|
3107
|
+
// with no manual restart anywhere. Covering only the converge left the
|
|
3108
|
+
// same race with a smaller window, and it lost the very next deploy.
|
|
3109
|
+
await this.serializeRunner(runnerId, async () => {
|
|
3110
|
+
try {
|
|
3111
|
+
await this.broker.call('$process.spawnRunner', { runnerId, addons });
|
|
3112
|
+
}
|
|
3113
|
+
catch (err) {
|
|
3114
|
+
// Losing the race is not a failure, and this method's own docblock
|
|
3115
|
+
// already promised so: "No-op when the runner is already running".
|
|
3116
|
+
// Unserialized the loser almost never got here — it spawned a SECOND
|
|
3117
|
+
// runner instead, which is the defect. Serializing makes the loser
|
|
3118
|
+
// reliable, so the promise has to be kept rather than documented.
|
|
3119
|
+
if (!/already running/i.test((0, types_1.errMsg)(err)))
|
|
3120
|
+
throw err;
|
|
3121
|
+
this.logger.info('initializeAddonGroup: runner already running — nothing to spawn', {
|
|
3122
|
+
meta: { runnerId, addonIds: addons.map((a) => a.addonId) },
|
|
3123
|
+
});
|
|
3124
|
+
}
|
|
3107
3125
|
});
|
|
3108
3126
|
}
|
|
3109
3127
|
catch (err) {
|
package/dist/launcher.js
CHANGED
|
@@ -59,6 +59,7 @@ const tar = __importStar(require("tar"));
|
|
|
59
59
|
const addon_root_inventory_js_1 = require("./addon-root-inventory.js");
|
|
60
60
|
const bootstrap_packages_js_1 = require("./bootstrap-packages.js");
|
|
61
61
|
const first_boot_addon_plan_js_1 = require("./first-boot-addon-plan.js");
|
|
62
|
+
const addon_realign_plan_js_1 = require("./core/addon/addon-realign-plan.js");
|
|
62
63
|
const framework_nodepath_js_1 = require("./framework-nodepath.js");
|
|
63
64
|
const package_inventory_js_1 = require("./package-inventory.js");
|
|
64
65
|
/** Path of the manifest file embedded inside every archive. */
|
|
@@ -228,6 +229,21 @@ function readOwnManifest() {
|
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
231
|
/** The version each required package currently has under the addon root. */
|
|
232
|
+
/**
|
|
233
|
+
* When a package directory was last written, ms, or `null` when unreadable.
|
|
234
|
+
*
|
|
235
|
+
* `null` is not zero: an unreadable time is an unknown, and the re-alignment
|
|
236
|
+
* treats an unknown as "cannot be shown to be stale" rather than as "old"
|
|
237
|
+
* (D393). Folding it into a number is how a deliberate deploy gets destroyed.
|
|
238
|
+
*/
|
|
239
|
+
function readDirTimeMs(dir) {
|
|
240
|
+
try {
|
|
241
|
+
return fs.statSync(dir).mtimeMs;
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
231
247
|
function readInstalledAddonVersions(addonRoot, packages) {
|
|
232
248
|
const out = {};
|
|
233
249
|
for (const name of packages) {
|
|
@@ -435,6 +451,54 @@ async function launch() {
|
|
|
435
451
|
console.warn(`[launcher] first-boot addon plan failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
436
452
|
}
|
|
437
453
|
await installer.ensureRequiredPackages(bootstrapRequired);
|
|
454
|
+
// THE ARM THE PLAN ABOVE NEVER HAD (D518).
|
|
455
|
+
//
|
|
456
|
+
// The closure carries a copy of every addon it declares, and nothing ever
|
|
457
|
+
// loads one from there — the addon root is the only load path on every role.
|
|
458
|
+
// So `applyServerUpdate` advanced the closure and changed nothing that runs:
|
|
459
|
+
// six addons on this hub were behind by up to nineteen versions, each frozen
|
|
460
|
+
// at whenever somebody last ran `camstack deploy`. `planFirstBootAddons` has
|
|
461
|
+
// printed that drift at INFO on every boot for a month, and its `PlanMode`
|
|
462
|
+
// has an `'enforce'` arm that was never built. This is it.
|
|
463
|
+
//
|
|
464
|
+
// Diagnostics-grade failure policy, like the plan and the inventories: a
|
|
465
|
+
// re-alignment that throws must never end a boot. An addon that stays behind
|
|
466
|
+
// is the status quo; a node that will not start is not.
|
|
467
|
+
try {
|
|
468
|
+
const closureNodeModules = path.resolve(__dirname, '..', 'node_modules');
|
|
469
|
+
const decisions = (0, addon_realign_plan_js_1.planAddonRealignment)(bootstrapRequired.flatMap((pkg) => {
|
|
470
|
+
const installedVersion = readInstalledAddonVersions(addonsDir, [pkg])[pkg];
|
|
471
|
+
if (typeof installedVersion !== 'string')
|
|
472
|
+
return [];
|
|
473
|
+
return [
|
|
474
|
+
{
|
|
475
|
+
pkg,
|
|
476
|
+
installedVersion,
|
|
477
|
+
installedUpdatedAtMs: readDirTimeMs(path.join(addonsDir, pkg)),
|
|
478
|
+
closureVersion: readInstalledAddonVersions(closureNodeModules, [pkg])[pkg] ?? null,
|
|
479
|
+
closureLandedAtMs: readDirTimeMs(path.join(closureNodeModules, pkg)),
|
|
480
|
+
},
|
|
481
|
+
];
|
|
482
|
+
}));
|
|
483
|
+
for (const d of decisions) {
|
|
484
|
+
if (d.action !== 'realign')
|
|
485
|
+
continue;
|
|
486
|
+
try {
|
|
487
|
+
const done = await installer.realignFromClosure(d.pkg, path.join(closureNodeModules, d.pkg));
|
|
488
|
+
console.log(`[launcher] re-aligned ${d.pkg} → ${done.version} — ${d.reason}`);
|
|
489
|
+
}
|
|
490
|
+
catch (err) {
|
|
491
|
+
// Named per addon. A batch that reports only a count cannot say which
|
|
492
|
+
// one is still behind, which is the whole question afterwards.
|
|
493
|
+
console.warn(`[launcher] re-align FAILED for ${d.pkg}: ${err instanceof Error ? err.message : String(err)}`);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
const kept = decisions.filter((d) => d.action === 'keep').length;
|
|
497
|
+
console.log(`[launcher] addon re-alignment: ${decisions.length - kept} re-aligned, ${kept} kept as they are`);
|
|
498
|
+
}
|
|
499
|
+
catch (err) {
|
|
500
|
+
console.warn(`[launcher] addon re-alignment failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
501
|
+
}
|
|
438
502
|
// Make every installed addon's runtime deps resolvable — the restore
|
|
439
503
|
// repair (D338: a restored addons/ tree carries no node_modules, and only
|
|
440
504
|
// bootstrap addons were reinstalled here, leaving every other addon
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.306",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
]
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@camstack/addon-admin-ui": "1.2.
|
|
39
|
-
"@camstack/addon-agent-ui": "1.2.
|
|
40
|
-
"@camstack/addon-auth": "1.2.
|
|
41
|
-
"@camstack/addon-decoder-nodeav": "1.2.
|
|
42
|
-
"@camstack/addon-notifiers": "1.2.
|
|
43
|
-
"@camstack/addon-pipeline": "1.2.
|
|
44
|
-
"@camstack/addon-pipeline-orchestrator": "1.2.
|
|
45
|
-
"@camstack/addon-post-analysis": "1.2.
|
|
46
|
-
"@camstack/sdk": "1.2.
|
|
47
|
-
"@camstack/system": "1.2.
|
|
48
|
-
"@camstack/types": "1.2.
|
|
49
|
-
"@camstack/ui-library": "1.2.
|
|
38
|
+
"@camstack/addon-admin-ui": "1.2.210",
|
|
39
|
+
"@camstack/addon-agent-ui": "1.2.114",
|
|
40
|
+
"@camstack/addon-auth": "1.2.116",
|
|
41
|
+
"@camstack/addon-decoder-nodeav": "1.2.109",
|
|
42
|
+
"@camstack/addon-notifiers": "1.2.113",
|
|
43
|
+
"@camstack/addon-pipeline": "1.2.253",
|
|
44
|
+
"@camstack/addon-pipeline-orchestrator": "1.2.215",
|
|
45
|
+
"@camstack/addon-post-analysis": "1.2.257",
|
|
46
|
+
"@camstack/sdk": "1.2.112",
|
|
47
|
+
"@camstack/system": "1.2.248",
|
|
48
|
+
"@camstack/types": "1.2.206",
|
|
49
|
+
"@camstack/ui-library": "1.2.171",
|
|
50
50
|
"@fastify/compress": "^9.0.0",
|
|
51
51
|
"@fastify/cookie": "^11.0.2",
|
|
52
52
|
"@fastify/cors": "^11.2.0",
|