@camstack/agent 1.1.58 → 1.1.59
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/{chunk-2P5A5KTL.mjs → chunk-54PFYHKN.mjs} +2 -2
- package/dist/{chunk-DIBZT6GT.mjs → chunk-ADZNLSIO.mjs} +61 -33
- package/dist/chunk-ADZNLSIO.mjs.map +1 -0
- package/dist/cli.js +60 -32
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/index.js +60 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/starter.js +60 -32
- package/dist/starter.js.map +1 -1
- package/dist/starter.mjs +1 -1
- package/package.json +4 -4
- package/dist/chunk-DIBZT6GT.mjs.map +0 -1
- /package/dist/{chunk-2P5A5KTL.mjs.map → chunk-54PFYHKN.mjs.map} +0 -0
package/dist/cli.mjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { createRequire as __cr } from 'node:module'; const require = globalThis.require ?? __cr(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
startAgent
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-54PFYHKN.mjs";
|
|
6
|
+
import "./chunk-ADZNLSIO.mjs";
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
9
|
import { existsSync } from "fs";
|
package/dist/index.js
CHANGED
|
@@ -318,6 +318,33 @@ var require_dist = __commonJS({
|
|
|
318
318
|
}
|
|
319
319
|
var fs32 = __toESM2(require("fs"));
|
|
320
320
|
var path32 = __toESM2(require("path"));
|
|
321
|
+
function parse(version) {
|
|
322
|
+
const dashIdx = version.indexOf("-");
|
|
323
|
+
const base = dashIdx === -1 ? version : version.slice(0, dashIdx);
|
|
324
|
+
const prerelease = dashIdx === -1 ? null : version.slice(dashIdx + 1);
|
|
325
|
+
const nums = base.split(".").map((seg) => {
|
|
326
|
+
const n = Number.parseInt(seg, 10);
|
|
327
|
+
return Number.isNaN(n) ? 0 : n;
|
|
328
|
+
});
|
|
329
|
+
return { nums, prerelease };
|
|
330
|
+
}
|
|
331
|
+
function compareSemver(a, b) {
|
|
332
|
+
const pa = parse(a);
|
|
333
|
+
const pb = parse(b);
|
|
334
|
+
const len = Math.max(pa.nums.length, pb.nums.length);
|
|
335
|
+
for (let i = 0; i < len; i++) {
|
|
336
|
+
const na = pa.nums[i] ?? 0;
|
|
337
|
+
const nb = pb.nums[i] ?? 0;
|
|
338
|
+
if (na < nb) return -1;
|
|
339
|
+
if (na > nb) return 1;
|
|
340
|
+
}
|
|
341
|
+
if (pa.prerelease === null && pb.prerelease === null) return 0;
|
|
342
|
+
if (pa.prerelease === null) return 1;
|
|
343
|
+
if (pb.prerelease === null) return -1;
|
|
344
|
+
if (pa.prerelease < pb.prerelease) return -1;
|
|
345
|
+
if (pa.prerelease > pb.prerelease) return 1;
|
|
346
|
+
return 0;
|
|
347
|
+
}
|
|
321
348
|
var CURRENT_DIRNAME = "current";
|
|
322
349
|
var PENDING_ROOT_SWAP_FILE = ".pending-root-swap.json";
|
|
323
350
|
var LEGACY_FRAMEWORK_MARKERS = [
|
|
@@ -459,13 +486,41 @@ var require_dist = __commonJS({
|
|
|
459
486
|
log(`[single-copy] applied staged root swap \u2192 ${marker.version}`);
|
|
460
487
|
return { applied: true, version: marker.version, reason: "applied" };
|
|
461
488
|
}
|
|
489
|
+
function readClosureVersion(closureDir, spec) {
|
|
490
|
+
try {
|
|
491
|
+
const raw = JSON.parse(
|
|
492
|
+
fs32.readFileSync(path32.join(rootPackageDir(closureDir, spec), "package.json"), "utf-8")
|
|
493
|
+
);
|
|
494
|
+
if (typeof raw === "object" && raw !== null) {
|
|
495
|
+
const version = raw["version"];
|
|
496
|
+
if (typeof version === "string") return version;
|
|
497
|
+
}
|
|
498
|
+
} catch {
|
|
499
|
+
}
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
502
|
+
function isAdoptablePendingClosure(rootDir, version, nodeMajor, spec) {
|
|
503
|
+
const dir = versionDir(rootDir, version);
|
|
504
|
+
return validateClosureDir(dir, nodeMajor, spec, version) === null && findMissingNativePrebuilds(dir).length === 0;
|
|
505
|
+
}
|
|
462
506
|
function migrateToSingleCopy(rootDir, spec, nodeMajor, now, log) {
|
|
463
507
|
const dest = currentDir(rootDir);
|
|
464
|
-
|
|
465
|
-
|
|
508
|
+
const legacyState = readServerRootState(rootDir);
|
|
509
|
+
const pendingVersion = legacyState?.pendingBoot?.version ?? null;
|
|
510
|
+
const pendingAdoptable = pendingVersion !== null && isAdoptablePendingClosure(rootDir, pendingVersion, nodeMajor, spec);
|
|
511
|
+
const currentValid = fs32.existsSync(dest) && validateClosureDir(dest, nodeMajor, spec) === null;
|
|
512
|
+
if (currentValid) {
|
|
513
|
+
const currentVersion = readClosureVersion(dest, spec);
|
|
514
|
+
const pendingSupersedes = pendingAdoptable && pendingVersion !== null && (currentVersion === null || compareSemver(pendingVersion, currentVersion) > 0);
|
|
515
|
+
if (!pendingSupersedes) {
|
|
516
|
+
return { migrated: false, version: null, reason: "current already present" };
|
|
517
|
+
}
|
|
518
|
+
log(
|
|
519
|
+
`[single-copy] in-flight pending ${pendingVersion} supersedes older current ${currentVersion ?? "?"}`
|
|
520
|
+
);
|
|
466
521
|
}
|
|
467
522
|
const candidates = [];
|
|
468
|
-
|
|
523
|
+
if (pendingAdoptable && pendingVersion !== null) candidates.push(pendingVersion);
|
|
469
524
|
if (legacyState !== null) {
|
|
470
525
|
for (const v of [
|
|
471
526
|
legacyState.currentVersion,
|
|
@@ -532,33 +587,6 @@ var require_dist = __commonJS({
|
|
|
532
587
|
}
|
|
533
588
|
return { kind: "baked", reason: "no valid single-copy closure \u2014 booting the baked seed" };
|
|
534
589
|
}
|
|
535
|
-
function parse(version) {
|
|
536
|
-
const dashIdx = version.indexOf("-");
|
|
537
|
-
const base = dashIdx === -1 ? version : version.slice(0, dashIdx);
|
|
538
|
-
const prerelease = dashIdx === -1 ? null : version.slice(dashIdx + 1);
|
|
539
|
-
const nums = base.split(".").map((seg) => {
|
|
540
|
-
const n = Number.parseInt(seg, 10);
|
|
541
|
-
return Number.isNaN(n) ? 0 : n;
|
|
542
|
-
});
|
|
543
|
-
return { nums, prerelease };
|
|
544
|
-
}
|
|
545
|
-
function compareSemver(a, b) {
|
|
546
|
-
const pa = parse(a);
|
|
547
|
-
const pb = parse(b);
|
|
548
|
-
const len = Math.max(pa.nums.length, pb.nums.length);
|
|
549
|
-
for (let i = 0; i < len; i++) {
|
|
550
|
-
const na = pa.nums[i] ?? 0;
|
|
551
|
-
const nb = pb.nums[i] ?? 0;
|
|
552
|
-
if (na < nb) return -1;
|
|
553
|
-
if (na > nb) return 1;
|
|
554
|
-
}
|
|
555
|
-
if (pa.prerelease === null && pb.prerelease === null) return 0;
|
|
556
|
-
if (pa.prerelease === null) return 1;
|
|
557
|
-
if (pb.prerelease === null) return -1;
|
|
558
|
-
if (pa.prerelease < pb.prerelease) return -1;
|
|
559
|
-
if (pa.prerelease > pb.prerelease) return 1;
|
|
560
|
-
return 0;
|
|
561
|
-
}
|
|
562
590
|
var fs42 = __toESM2(require("fs"));
|
|
563
591
|
var path42 = __toESM2(require("path"));
|
|
564
592
|
function detectWorkspaceRoot(fromDir) {
|
|
@@ -621,7 +649,7 @@ var require_dist = __commonJS({
|
|
|
621
649
|
};
|
|
622
650
|
registerHooks(hooks);
|
|
623
651
|
}
|
|
624
|
-
function
|
|
652
|
+
function readClosureVersion2(closureDir, spec) {
|
|
625
653
|
try {
|
|
626
654
|
const raw = JSON.parse(
|
|
627
655
|
fs52.readFileSync(path52.join(rootPackageDir(closureDir, spec), "package.json"), "utf-8")
|
|
@@ -676,7 +704,7 @@ var require_dist = __commonJS({
|
|
|
676
704
|
}
|
|
677
705
|
const plan = planBoot(invalid === null);
|
|
678
706
|
if (plan.kind === "current") {
|
|
679
|
-
const version =
|
|
707
|
+
const version = readClosureVersion2(activeRootDir, options.spec);
|
|
680
708
|
const entry = currentEntryPath(rootDir, options.spec);
|
|
681
709
|
console.log(
|
|
682
710
|
`[starter] booting ${options.spec.packageName}@${version ?? "?"} from ${activeRootDir}`
|