@cotal-ai/cli 0.165.4 → 0.166.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/dist/command.js +1 -1
- package/dist/command.js.map +1 -1
- package/dist/commands/ext.js +4 -4
- package/dist/commands/ext.js.map +1 -1
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +3 -1
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/personas.d.ts.map +1 -1
- package/dist/commands/personas.js +17 -2
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/service-actions.d.ts.map +1 -1
- package/dist/commands/service-actions.js +39 -2
- package/dist/commands/service-actions.js.map +1 -1
- package/dist/commands/service-registry.d.ts +4 -0
- package/dist/commands/service-registry.d.ts.map +1 -1
- package/dist/commands/service-registry.js +3 -0
- package/dist/commands/service-registry.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +8 -7
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/stack-down.d.ts.map +1 -1
- package/dist/commands/stack-down.js +31 -14
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-up.d.ts +1 -0
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +62 -5
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/up.d.ts +1 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +31 -7
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts +12 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +58 -24
- package/dist/commands/update.js.map +1 -1
- package/dist/dispatch.d.ts +1 -1
- package/dist/dispatch.d.ts.map +1 -1
- package/dist/dispatch.js +1 -1
- package/dist/dispatch.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/app-user-identity.d.ts +2 -1
- package/dist/lib/app-user-identity.d.ts.map +1 -1
- package/dist/lib/app-user-identity.js +83 -36
- package/dist/lib/app-user-identity.js.map +1 -1
- package/dist/lib/broker-store-health.d.ts +7 -5
- package/dist/lib/broker-store-health.d.ts.map +1 -1
- package/dist/lib/broker-store-health.js +10 -7
- package/dist/lib/broker-store-health.js.map +1 -1
- package/dist/lib/extension-stage.d.ts.map +1 -1
- package/dist/lib/extension-stage.js +8 -5
- package/dist/lib/extension-stage.js.map +1 -1
- package/dist/lib/persona-files.d.ts.map +1 -1
- package/dist/lib/persona-files.js +11 -6
- package/dist/lib/persona-files.js.map +1 -1
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +1 -2
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/service-presets.js +1 -1
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/service-systemd.d.ts.map +1 -1
- package/dist/lib/service-systemd.js +43 -1
- package/dist/lib/service-systemd.js.map +1 -1
- package/dist/lib/store-dir.d.ts +3 -1
- package/dist/lib/store-dir.d.ts.map +1 -1
- package/dist/lib/store-dir.js +6 -2
- package/dist/lib/store-dir.js.map +1 -1
- package/dist/lib/update-snapshot.js +3 -3
- package/dist/lib/update-snapshot.js.map +1 -1
- package/dist/seed/lock.d.ts +6 -6
- package/dist/seed/lock.d.ts.map +1 -1
- package/dist/seed/lock.js +20 -11
- package/dist/seed/lock.js.map +1 -1
- package/dist/seed/paths.d.ts.map +1 -1
- package/dist/seed/paths.js +2 -3
- package/dist/seed/paths.js.map +1 -1
- package/dist/seed/reconcile.d.ts.map +1 -1
- package/dist/seed/reconcile.js +17 -3
- package/dist/seed/reconcile.js.map +1 -1
- package/dist/seed/store.d.ts.map +1 -1
- package/dist/seed/store.js +16 -1
- package/dist/seed/store.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type FlagSpec, type ParsedArgs } from "@cotal-ai/core";
|
|
2
2
|
import { type InstalledExtension } from "@cotal-ai/workspace";
|
|
3
|
+
import { repairInstallModes } from "../lib/install-umask.js";
|
|
3
4
|
import { installedCliVersion } from "../lib/version.js";
|
|
4
5
|
import { type MeshTarget } from "@cotal-ai/workspace";
|
|
5
6
|
import { type LegacyManagerReport } from "../lib/legacy-manager-report.js";
|
|
@@ -7,6 +8,10 @@ import { type RecordedStackRemedy } from "../lib/recorded-stack-remedy.js";
|
|
|
7
8
|
import { type UpdateManager } from "../lib/update-managers.js";
|
|
8
9
|
export { localUpdateManagers } from "../lib/update-managers.js";
|
|
9
10
|
export { managerPin as updateManagerPin } from "../lib/manager-choice.js";
|
|
11
|
+
/** Set by a parent that waits for the installed daemon generation after its reconcile child and prints
|
|
12
|
+
* the wait line. A child prints the line itself unless its parent set this: a parent from before this
|
|
13
|
+
* marker never waits there, so the line would be lost. */
|
|
14
|
+
export declare const UPDATE_PARENT_WAITS_ENV = "COTAL_UPDATE_PARENT_WAITS";
|
|
10
15
|
export declare const updateFlags: readonly FlagSpec[];
|
|
11
16
|
interface CommandResult {
|
|
12
17
|
readonly status: number | null;
|
|
@@ -37,6 +42,8 @@ export interface UpdateRuntime {
|
|
|
37
42
|
/** Refuse unsupported or unwritable execution destinations before any persistent writes. */
|
|
38
43
|
preflightExecution?(): void;
|
|
39
44
|
executionGlobalRoot?(): string;
|
|
45
|
+
/** Preserve the selected execution binding while hardening installer-owned modes. */
|
|
46
|
+
repairInstallModes?(root: string): number;
|
|
40
47
|
/** Prepare a complete retained target under the held global root lock, without publication. */
|
|
41
48
|
prepareExecution?(version: string, root: string): Promise<ExecutionReplacement>;
|
|
42
49
|
/** Reopen only a journal already validated against this logical installation. */
|
|
@@ -50,6 +57,8 @@ export interface UpdateRuntime {
|
|
|
50
57
|
/** Bring what connectors installed in their harnesses to this release; one line per connector. */
|
|
51
58
|
refreshConnectors(): Promise<readonly string[]>;
|
|
52
59
|
reportRunningManager(target: Record<string, unknown>): Promise<"none" | "legacy">;
|
|
60
|
+
/** Authenticate and retain an installed same-version repair before its connector writes. */
|
|
61
|
+
prepareReconciliation?(target: Record<string, unknown>): Promise<void>;
|
|
53
62
|
/** The binary may await its daemon's replacement generation before the bound child's read. */
|
|
54
63
|
waitForInstalledGeneration?(version: string): Promise<void>;
|
|
55
64
|
/** Explain whether the machine daemon can act on the saved automatic-update preference. */
|
|
@@ -78,8 +87,10 @@ export interface UpdateRuntime {
|
|
|
78
87
|
err(message: string): void;
|
|
79
88
|
stdout(message: string): void;
|
|
80
89
|
stderr(message: string): void;
|
|
90
|
+
/** Set when a manual version-changing update has already waited for the installed generation. */
|
|
91
|
+
generationWaited?: boolean;
|
|
81
92
|
}
|
|
82
|
-
export { installedCliVersion };
|
|
93
|
+
export { installedCliVersion, repairInstallModes };
|
|
83
94
|
export declare const updateRuntime: UpdateRuntime;
|
|
84
95
|
export declare function update(args: ParsedArgs, rt?: UpdateRuntime): Promise<void>;
|
|
85
96
|
/** Resume an abandoned replacement before a command or daemon can activate its closure. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAuBL,KAAK,kBAAkB,EAOxB,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAAE,kBAAkB,EAAoB,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAc,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAUpE,OAAO,EASL,KAAK,UAAU,EAEhB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAwC,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,i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E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAyB,EAC/F,MAAM,GAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,SAAS,aAAa,EAAwB,GACzF,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,CAoC5B;AAED,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,CAkI5L;AAED;;kGAEkG;AAClG,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAM,GAAG,SAAqB,EACrC,GAAG,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAkB,EACzC,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,mBAAmB,GAC7B,IAAI,CAcN;AAkeD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAYtD;AAQD;;qGAEqG;AACrG,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY5F;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAgB/E"}
|
package/dist/commands/update.js
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync, mkdtempSync, readFileSync, realpathSync, rmSync, statSync }
|
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { globalConfigDir } from "@cotal-ai/core";
|
|
6
|
-
import { CommandFailure, isCommandFailure, jsonFlag, plainFlag, presentationOf, protectedLocalDirectory, renderReport, writeResult, cmdSpawnSpec, beginGlobalUpdateChild, processStartToken, claimUpdateClosureAccess, updateClosureOwner, readUpdateRecovery, clearUpdateRecovery, writeUpdateRecovery, readUpdateSettings, recordUpdateCompletion, recordUpdateDeferral, recordUpdateReplacement, setUpdateSetting, bindExtensionPeers, claimGlobalNpmUpdateLock, launcherInstallRoot, logicalExecutionEntry, loadExtensionsManifest, provenance, SEEDED_EXTENSIONS, targetFlags, resolveControlTarget, recoveryDisposition, liveUpdateClosureOwner, recoveryProcessStartToken, observeUnownedRecovery, } from "@cotal-ai/workspace";
|
|
6
|
+
import { CommandFailure, isCommandFailure, jsonFlag, plainFlag, presentationOf, protectedLocalDirectory, renderReport, writeResult, cmdSpawnSpec, beginGlobalUpdateChild, processStartToken, claimUpdateClosureAccess, updateClosureOwner, readUpdateRecovery, clearUpdateRecovery, writeUpdateRecovery, readUpdateSettings, recordUpdateCompletion, recordUpdateDeferral, recordUpdateRefusal, recordUpdateReplacement, setUpdateSetting, bindExtensionPeers, claimGlobalNpmUpdateLock, launcherInstallRoot, logicalExecutionEntry, loadExtensionsManifest, provenance, SEEDED_EXTENSIONS, targetFlags, resolveControlTarget, recoveryDisposition, liveUpdateClosureOwner, recoveryProcessStartToken, observeUnownedRecovery, } from "@cotal-ai/workspace";
|
|
7
7
|
import { retainUnusableRecovery } from "../lib/update-recovery-state.js";
|
|
8
8
|
import { readUpdatePending } from "../lib/update-pending.js";
|
|
9
9
|
import { snapshotUpdateClosure } from "../lib/update-snapshot.js";
|
|
@@ -34,6 +34,10 @@ export { managerPin as updateManagerPin } from "../lib/manager-choice.js";
|
|
|
34
34
|
import { assertRecordIdentity, brokerAddressKey } from "@cotal-ai/workspace";
|
|
35
35
|
const UPDATE_TARGET_ENV = "COTAL_UPDATE_TARGET_VERSION";
|
|
36
36
|
const UPDATE_PARENT_ENV = "COTAL_UPDATE_PARENT";
|
|
37
|
+
/** Set by a parent that waits for the installed daemon generation after its reconcile child and prints
|
|
38
|
+
* the wait line. A child prints the line itself unless its parent set this: a parent from before this
|
|
39
|
+
* marker never waits there, so the line would be lost. */
|
|
40
|
+
export const UPDATE_PARENT_WAITS_ENV = "COTAL_UPDATE_PARENT_WAITS";
|
|
37
41
|
export const updateFlags = [
|
|
38
42
|
{ name: "auto", type: "boolean", description: "show automatic updates, or set them with --auto off|on" },
|
|
39
43
|
{ name: "notify", type: "boolean", description: "show update notices, or set them with --notify off|on" },
|
|
@@ -44,7 +48,7 @@ export const updateFlags = [
|
|
|
44
48
|
...targetFlags,
|
|
45
49
|
onFlag,
|
|
46
50
|
];
|
|
47
|
-
export { installedCliVersion };
|
|
51
|
+
export { installedCliVersion, repairInstallModes };
|
|
48
52
|
export const updateRuntime = {
|
|
49
53
|
env: process.env,
|
|
50
54
|
pid: process.pid,
|
|
@@ -132,7 +136,10 @@ export async function update(args, rt = updateRuntime) {
|
|
|
132
136
|
catch (error) {
|
|
133
137
|
if (isCommandFailure(error))
|
|
134
138
|
throw error;
|
|
135
|
-
|
|
139
|
+
const refusal = `This installation cannot update itself from this account: ${message(error)}; no changes were made`;
|
|
140
|
+
if (rt.env.COTAL_AUTO_UPDATE === "1")
|
|
141
|
+
recordUpdateRefusal(rt.version(), refusal);
|
|
142
|
+
throw new CommandFailure("refused", "DEPENDENCY_UNAVAILABLE", refusal, {
|
|
136
143
|
native: { outcome: "not-executed" },
|
|
137
144
|
});
|
|
138
145
|
}
|
|
@@ -155,7 +162,7 @@ export async function update(args, rt = updateRuntime) {
|
|
|
155
162
|
// reconcile is allowed to run.
|
|
156
163
|
const install = launcherInstallRoot();
|
|
157
164
|
for (const { what, root } of args.values.self === true && rt.prepareExecution ? [] : [...(install ? [{ what: "install", root: install }] : []), { what: "config", root: globalConfigDir() }]) {
|
|
158
|
-
const repaired = repairInstallModes(root);
|
|
165
|
+
const repaired = (rt.repairInstallModes ?? repairInstallModes)(root);
|
|
159
166
|
if (repaired)
|
|
160
167
|
rt.out(c.green(`✓ removed group and other write from ${repaired} ${repaired === 1 ? "entry" : "entries"} in Cotal's ${what} at ${root}`));
|
|
161
168
|
}
|
|
@@ -238,7 +245,7 @@ export async function recoverInterruptedUpdate(rt = updateRuntime, startup = fal
|
|
|
238
245
|
if (realpathSync(entry) !== realpathSync(entryScript()))
|
|
239
246
|
throw new Error("paused repair must run from the verified installed CLI");
|
|
240
247
|
snapshot.restore();
|
|
241
|
-
const env = { ...rt.env, [UPDATE_TARGET_ENV]: version, [UPDATE_PARENT_ENV]: String(rt.pid) };
|
|
248
|
+
const env = { ...rt.env, [UPDATE_TARGET_ENV]: version, [UPDATE_PARENT_ENV]: String(rt.pid), ...(!startup && rt.env.COTAL_AUTO_UPDATE !== "1" ? { [UPDATE_PARENT_WAITS_ENV]: "1" } : {}) };
|
|
242
249
|
const reconciled = await rt.spawnGlobal(root, "reconcile", rt.nodePath, [entry, "update"], env, true);
|
|
243
250
|
if (reconciled.status !== 0)
|
|
244
251
|
throw new Error(failure(reconciled));
|
|
@@ -273,7 +280,7 @@ export async function recoverInterruptedUpdate(rt = updateRuntime, startup = fal
|
|
|
273
280
|
entry = rt.verifyGlobalEntry(root, record.previous);
|
|
274
281
|
}
|
|
275
282
|
snapshot.restore();
|
|
276
|
-
const env = { ...rt.env, [UPDATE_TARGET_ENV]: record.previous, [UPDATE_PARENT_ENV]: String(rt.pid) };
|
|
283
|
+
const env = { ...rt.env, [UPDATE_TARGET_ENV]: record.previous, [UPDATE_PARENT_ENV]: String(rt.pid), ...(!startup && rt.env.COTAL_AUTO_UPDATE !== "1" ? { [UPDATE_PARENT_WAITS_ENV]: "1" } : {}) };
|
|
277
284
|
const reconciled = await rt.spawnGlobal(root, "reconcile", rt.nodePath, [entry, "update"], env, true);
|
|
278
285
|
if (reconciled.status !== 0)
|
|
279
286
|
throw new Error(failure(reconciled));
|
|
@@ -406,8 +413,18 @@ export async function executeUpdate(self, rt = updateRuntime, target = {}) {
|
|
|
406
413
|
}
|
|
407
414
|
if (self) {
|
|
408
415
|
const latest = latestVersion(rt);
|
|
409
|
-
if (latest.ok
|
|
410
|
-
|
|
416
|
+
if (!latest.ok) {
|
|
417
|
+
if (rt.env.COTAL_AUTO_UPDATE === "1")
|
|
418
|
+
recordUpdateDeferral(current, "waiting for registry availability", true);
|
|
419
|
+
rt.out("The registry cannot be reached; nothing was changed.");
|
|
420
|
+
return 0;
|
|
421
|
+
}
|
|
422
|
+
if (compareSemver(latest.version, current) > 0) {
|
|
423
|
+
const code = await upgradeAndReconcile(latest.version, current, rt, target);
|
|
424
|
+
if (code === 0 && rt.env.COTAL_AUTO_UPDATE !== "1")
|
|
425
|
+
rt.generationWaited = true;
|
|
426
|
+
return code;
|
|
427
|
+
}
|
|
411
428
|
if (latest.ok && rt.isCurrent?.()) {
|
|
412
429
|
try {
|
|
413
430
|
const custody = await rt.reportRunningManager(target);
|
|
@@ -427,12 +444,6 @@ export async function executeUpdate(self, rt = updateRuntime, target = {}) {
|
|
|
427
444
|
}
|
|
428
445
|
}
|
|
429
446
|
return reconcileCurrent(current, rt, target, (reconciled, deferred) => {
|
|
430
|
-
if (!latest.ok) {
|
|
431
|
-
if (rt.env.COTAL_AUTO_UPDATE === "1")
|
|
432
|
-
recordUpdateDeferral(current, "waiting for registry or extension closure availability", true);
|
|
433
|
-
rt.err(c.red(`✗ cotal-ai version check failed: ${latest.error}`));
|
|
434
|
-
return 1;
|
|
435
|
-
}
|
|
436
447
|
if (rt.env.COTAL_AUTO_UPDATE === "1") {
|
|
437
448
|
if (reconciled)
|
|
438
449
|
recordUpdateCompletion(current, `updated to ${current}`, true);
|
|
@@ -459,6 +470,13 @@ export async function executeUpdate(self, rt = updateRuntime, target = {}) {
|
|
|
459
470
|
});
|
|
460
471
|
}
|
|
461
472
|
async function reconcileCurrent(current, rt, target, finish) {
|
|
473
|
+
try {
|
|
474
|
+
await rt.prepareReconciliation?.(target);
|
|
475
|
+
}
|
|
476
|
+
catch (error) {
|
|
477
|
+
rt.err(c.red(`✗ installed connector reconciliation admission: ${refusal(error)}`));
|
|
478
|
+
return finish(false, true);
|
|
479
|
+
}
|
|
462
480
|
// OBSERVE BEFORE WRITING. `rt.reconcile()` is `runSeed({force: true})`: it rewrites the
|
|
463
481
|
// operator-global seed store, manifest and npm prefix. It used to run FIRST, so an
|
|
464
482
|
// `update --self` against a mesh that predates this release's authority stores rewrote the store
|
|
@@ -561,6 +579,7 @@ async function reconcileCurrent(current, rt, target, finish) {
|
|
|
561
579
|
};
|
|
562
580
|
delete env[UPDATE_TARGET_ENV];
|
|
563
581
|
delete env[UPDATE_PARENT_ENV];
|
|
582
|
+
delete env[UPDATE_PARENT_WAITS_ENV];
|
|
564
583
|
const extensionStarted = Date.now();
|
|
565
584
|
const result = rt.spawn(bin, [...argv, "ext", "__update-add", entry.pkg, spec], env);
|
|
566
585
|
rt.out(`✓ extension ${entry.pkg} install finished (${((Date.now() - extensionStarted) / 1000).toFixed(1)} s)`);
|
|
@@ -739,7 +758,8 @@ export async function readManagerContinuity(flags, options = {}) {
|
|
|
739
758
|
const server = typeof flags.server === "string" ? flags.server : undefined;
|
|
740
759
|
let peek;
|
|
741
760
|
try {
|
|
742
|
-
|
|
761
|
+
// This sweep only probes. Read-only staged checks need the same liveness verdict.
|
|
762
|
+
offline = (await pruneStaleMeshes(server)).offline;
|
|
743
763
|
peek = resolveMeshTarget(process.cwd(), { server, space, offline });
|
|
744
764
|
}
|
|
745
765
|
catch (e) {
|
|
@@ -788,6 +808,10 @@ export async function readManagerContinuity(flags, options = {}) {
|
|
|
788
808
|
}
|
|
789
809
|
console.log(c.dim(` ${peek.space}: a manager for this mesh runs on this machine; reading its custody`));
|
|
790
810
|
}
|
|
811
|
+
// Explicit and in-folder targets are not filtered by the resolver's offline set.
|
|
812
|
+
if (peek && offline?.includes(peek.space) && on === undefined &&
|
|
813
|
+
!supervisorMayServe(peek.space, options.installedEntry))
|
|
814
|
+
return "none";
|
|
791
815
|
// #3559: `cotal down` then `cotal update` is the cold path past a `legacy` verdict, so a stopped
|
|
792
816
|
// mesh is no custody rather than a refusal. Decided before the control connect, whose user-mode
|
|
793
817
|
// exchange would refuse on the stopped auth service first.
|
|
@@ -836,6 +860,12 @@ export async function readManagerContinuity(flags, options = {}) {
|
|
|
836
860
|
const seats = await askManager(cliControl, target.space, target.server, "ps", undefined, target.auth, "owner", undefined, pin);
|
|
837
861
|
if (!seats.ok)
|
|
838
862
|
throw new Error(seats.error ?? "manager seat inventory request failed");
|
|
863
|
+
if (options.retainGraph) {
|
|
864
|
+
const custody = status.data?.custody;
|
|
865
|
+
if (custody === undefined || custody === "legacy")
|
|
866
|
+
console.log(`Standalone Manager ${on ?? "(instance unavailable)"} in ${JSON.stringify(target.space)} keeps its loaded execution generation; no restart or seat stop is requested. New launches remain subject to the extension generation check.`);
|
|
867
|
+
return "none";
|
|
868
|
+
}
|
|
839
869
|
const report = await legacyManagerReport((status.data ?? {}), Array.isArray(seats.data)
|
|
840
870
|
? seats.data.map((seat) => {
|
|
841
871
|
const row = seat;
|
|
@@ -845,10 +875,6 @@ export async function readManagerContinuity(flags, options = {}) {
|
|
|
845
875
|
: []);
|
|
846
876
|
if (!report)
|
|
847
877
|
return "none";
|
|
848
|
-
if (options.retainGraph) {
|
|
849
|
-
console.log(`Standalone Manager ${on ?? "(instance unavailable)"} in ${JSON.stringify(target.space)} keeps its loaded execution generation; no restart or seat stop is requested. New launches remain subject to the extension generation check.`);
|
|
850
|
-
return "none";
|
|
851
|
-
}
|
|
852
878
|
const remedy = typeof flags.creds === "string" ? undefined : recordedStackRemedy(target.root, target.space, target.server, (status.data ?? {}));
|
|
853
879
|
printLegacyReport(report, target.space, undefined, console.log, on, remedy);
|
|
854
880
|
return "legacy";
|
|
@@ -877,7 +903,7 @@ export function printLegacyReport(report, space, _stop = undefined, out = consol
|
|
|
877
903
|
function latestVersion(rt) {
|
|
878
904
|
const cache = mkdtempSync(join(tmpdir(), "cotal-npm-view-"));
|
|
879
905
|
try {
|
|
880
|
-
const result = rt.npm(["view", "cotal-ai@latest", "version", "--json", "--cache", cache, "--logs-max=0", "--update-notifier=false"]);
|
|
906
|
+
const result = rt.npm(["view", "cotal-ai@latest", "version", "--json", "--cache", cache, "--logs-max=0", "--update-notifier=false", "--fetch-retries=0", "--fetch-timeout=15000"]);
|
|
881
907
|
if (result.status !== 0)
|
|
882
908
|
return { ok: false, error: failure(result) };
|
|
883
909
|
try {
|
|
@@ -898,7 +924,7 @@ function checkInstalledClosure(version, rt) {
|
|
|
898
924
|
return;
|
|
899
925
|
const staging = mkdtempSync(join(tmpdir(), "cotal-closure-check-"));
|
|
900
926
|
try {
|
|
901
|
-
const result = rt.npm(["install", "--prefix", staging, "--ignore-scripts", "--package-lock=false", "--no-audit", "--no-fund", "--fetch-retries=
|
|
927
|
+
const result = rt.npm(["install", "--prefix", staging, "--ignore-scripts", "--package-lock=false", "--no-audit", "--no-fund", "--fetch-retries=2", "--fetch-retry-mintimeout=1000", "--fetch-retry-maxtimeout=2000", "--fetch-timeout=15000", "--prefer-online", ...names.map(name => `${name}@${version}`)]);
|
|
902
928
|
if (result.status !== 0)
|
|
903
929
|
throw new Error(`installed extension dependency closure is unavailable: ${failure(result)}`);
|
|
904
930
|
}
|
|
@@ -910,7 +936,7 @@ function checkInstalledClosure(version, rt) {
|
|
|
910
936
|
* A private cache forces a registry read without changing the installed packages or running scripts. */
|
|
911
937
|
async function checkReleaseArchives(version, rt) {
|
|
912
938
|
const cache = mkdtempSync(join(tmpdir(), "cotal-release-check-"));
|
|
913
|
-
const options = ["--cache", cache, "--logs-max=0", "--update-notifier=false", "--fetch-retries=
|
|
939
|
+
const options = ["--cache", cache, "--logs-max=0", "--update-notifier=false", "--fetch-retries=2", "--fetch-retry-mintimeout=1000", "--fetch-retry-maxtimeout=2000", "--fetch-timeout=15000", "--prefer-online"];
|
|
914
940
|
const pending = new Set(["cotal-ai"]);
|
|
915
941
|
const names = ["cotal-ai"];
|
|
916
942
|
try {
|
|
@@ -1210,7 +1236,7 @@ async function upgradeAndReconcile(targetVersion, current, rt, target) {
|
|
|
1210
1236
|
}
|
|
1211
1237
|
recordUpdateReplacement(targetVersion);
|
|
1212
1238
|
writeUpdateRecovery({ previous: current, target: targetVersion, installed: current, phase: "replacing", reason: "global replacement in progress", owner: updateClosureOwner(), preparedRestart: rt.preparedRestart?.() ?? false, snapshot: snapshot.path, ...(execution ? { execution: execution.journal } : {}) });
|
|
1213
|
-
const npmInstall = cmdSpawnSpec("npm", ["install", "-g", ...prefixArgs, `cotal-ai@${targetVersion}`, "--json"]);
|
|
1239
|
+
const npmInstall = cmdSpawnSpec("npm", ["install", "-g", ...prefixArgs, `cotal-ai@${targetVersion}`, "--json", "--fetch-retries=2", "--fetch-retry-mintimeout=1000", "--fetch-retry-maxtimeout=2000", "--fetch-timeout=15000"]);
|
|
1214
1240
|
const installStarted = Date.now();
|
|
1215
1241
|
const installed = execution ? (() => {
|
|
1216
1242
|
execution.publish();
|
|
@@ -1253,6 +1279,7 @@ async function upgradeAndReconcile(targetVersion, current, rt, target) {
|
|
|
1253
1279
|
...(prefix ? { npm_config_prefix: prefix } : {}),
|
|
1254
1280
|
[UPDATE_TARGET_ENV]: targetVersion,
|
|
1255
1281
|
[UPDATE_PARENT_ENV]: String(rt.pid),
|
|
1282
|
+
...(rt.env.COTAL_AUTO_UPDATE !== "1" ? { [UPDATE_PARENT_WAITS_ENV]: "1" } : {}),
|
|
1256
1283
|
};
|
|
1257
1284
|
delete env[EXT_UPDATE_PARENT_ENV];
|
|
1258
1285
|
rt.out(`Reconciling installed cotal-ai@${targetVersion}`);
|
|
@@ -1279,6 +1306,12 @@ async function upgradeAndReconcile(targetVersion, current, rt, target) {
|
|
|
1279
1306
|
return await repairReplacement(`installed daemon generation: ${message(error)}`, 1, true);
|
|
1280
1307
|
}
|
|
1281
1308
|
}
|
|
1309
|
+
try {
|
|
1310
|
+
execution?.verify(targetVersion);
|
|
1311
|
+
}
|
|
1312
|
+
catch (error) {
|
|
1313
|
+
return await repairReplacement(`selected execution after reconciliation: ${message(error)}`, 1, true);
|
|
1314
|
+
}
|
|
1282
1315
|
rt.out("Removing completed update recovery snapshot");
|
|
1283
1316
|
snapshot.discard();
|
|
1284
1317
|
clearUpdateRecovery();
|
|
@@ -1291,7 +1324,7 @@ async function upgradeAndReconcile(targetVersion, current, rt, target) {
|
|
|
1291
1324
|
return interrupted;
|
|
1292
1325
|
async function reconcileVersion(version) {
|
|
1293
1326
|
const verified = execution ? (execution.verify(version), version === targetVersion ? execution.entry : join(root, "cotal-ai", "dist/cotal.js")) : rt.verifyGlobalEntry(root, version);
|
|
1294
|
-
const repairEnv = { ...rt.env, ...(prefix ? { npm_config_prefix: prefix } : {}), [UPDATE_TARGET_ENV]: version, [UPDATE_PARENT_ENV]: String(rt.pid) };
|
|
1327
|
+
const repairEnv = { ...rt.env, ...(prefix ? { npm_config_prefix: prefix } : {}), [UPDATE_TARGET_ENV]: version, [UPDATE_PARENT_ENV]: String(rt.pid), ...(rt.env.COTAL_AUTO_UPDATE !== "1" ? { [UPDATE_PARENT_WAITS_ENV]: "1" } : {}) };
|
|
1295
1328
|
delete repairEnv[EXT_UPDATE_PARENT_ENV];
|
|
1296
1329
|
const result = await rt.spawnGlobal(root, "reconcile", rt.nodePath, [verified, "update", ...targetArgv(target)], repairEnv, true);
|
|
1297
1330
|
if (result.stderr)
|
|
@@ -1300,6 +1333,7 @@ async function upgradeAndReconcile(targetVersion, current, rt, target) {
|
|
|
1300
1333
|
rt.stdout(result.stdout);
|
|
1301
1334
|
if (result.status !== 0)
|
|
1302
1335
|
return false;
|
|
1336
|
+
execution?.verify(version);
|
|
1303
1337
|
if (rt.env.COTAL_AUTO_UPDATE !== "1") {
|
|
1304
1338
|
const recovery = readUpdateRecovery();
|
|
1305
1339
|
if (recovery && recovery.phase !== "verified-ready")
|