agent-relay-orchestrator 0.70.1 → 0.71.0
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/package.json +1 -1
- package/src/self-upgrade.ts +10 -3
package/package.json
CHANGED
package/src/self-upgrade.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
2
4
|
import type { OrchestratorConfig } from "./config";
|
|
3
5
|
import type { RelayClient, RelayCommand } from "./relay";
|
|
4
6
|
import { detectSelfSupervision, type SelfSupervision } from "./self-supervision";
|
|
@@ -34,6 +36,7 @@ function isCacheRaceError(output: string): boolean {
|
|
|
34
36
|
export interface SelfUpgradeRunner {
|
|
35
37
|
run(cmd: string[]): Promise<{ exitCode: number; stdout: string; stderr: string }>;
|
|
36
38
|
commandExists(name: string): boolean;
|
|
39
|
+
fileExists?(path: string): boolean;
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
const defaultRunner: SelfUpgradeRunner = {
|
|
@@ -53,6 +56,9 @@ const defaultRunner: SelfUpgradeRunner = {
|
|
|
53
56
|
return false;
|
|
54
57
|
}
|
|
55
58
|
},
|
|
59
|
+
fileExists(path) {
|
|
60
|
+
return existsSync(path);
|
|
61
|
+
},
|
|
56
62
|
};
|
|
57
63
|
|
|
58
64
|
interface SelfUpgradePlan {
|
|
@@ -218,9 +224,10 @@ function buildInstallCommand(
|
|
|
218
224
|
];
|
|
219
225
|
}
|
|
220
226
|
|
|
221
|
-
|
|
227
|
+
const runtimeCli = join(homedir(), ".agent-relay", "runtime", "node_modules", ".bin", "agent-relay");
|
|
228
|
+
if (runner.fileExists?.(runtimeCli)) {
|
|
222
229
|
return [
|
|
223
|
-
|
|
230
|
+
runtimeCli, "upgrade",
|
|
224
231
|
"--version", targetVersion,
|
|
225
232
|
"--providers", providers.join(","),
|
|
226
233
|
"--no-restart",
|
|
@@ -228,7 +235,7 @@ function buildInstallCommand(
|
|
|
228
235
|
];
|
|
229
236
|
}
|
|
230
237
|
|
|
231
|
-
throw new Error(
|
|
238
|
+
throw new Error(`runtime agent-relay CLI is not available at ${runtimeCli} and no runtime prefix was detected; refusing ambient PATH self-upgrade`);
|
|
232
239
|
}
|
|
233
240
|
|
|
234
241
|
function packagesForProviders(targetVersion: string, providers: string[]): string[] {
|