agent-relay-server 0.10.4 → 0.10.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/upgrade.ts +37 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-server",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
4
4
  "description": "Lightweight HTTP message relay for inter-agent communication across machines",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
package/src/upgrade.ts CHANGED
@@ -113,13 +113,25 @@ export function createUpgradePlan(snapshot: UpgradeSnapshot, options: UpgradeOpt
113
113
  const runnerRequested = codexRequested || claudeRequested;
114
114
  const actions: UpgradeAction[] = [];
115
115
  const warnings: string[] = [];
116
+ const packages: string[] = [];
117
+ let serverPackageUpdated = false;
118
+ let orchestratorPackageUpdated = false;
119
+
120
+ if (packageNeedsUpgrade(snapshot.serverPackage, targetVersion)) {
121
+ packages.push(`agent-relay-server@${targetVersion}`);
122
+ serverPackageUpdated = true;
123
+ }
124
+ if (runnerRequested && packageNeedsUpgrade(snapshot.runnerPackage, targetVersion)) {
125
+ packages.push(`agent-relay-runner@${targetVersion}`);
126
+ }
127
+ if (orchestratorRequested && packageNeedsUpgrade(snapshot.orchestratorPackage, targetVersion)) {
128
+ packages.push(`agent-relay-orchestrator@${targetVersion}`);
129
+ orchestratorPackageUpdated = true;
130
+ }
116
131
 
117
132
  if (snapshot.packageManager === "none") {
118
- warnings.push("No supported global package manager found. Install Bun or npm, then rerun `agent-relay upgrade`.");
119
- } else {
120
- const packages = [`agent-relay-server@${targetVersion}`];
121
- if (runnerRequested) packages.push(`agent-relay-runner@${targetVersion}`);
122
- if (orchestratorRequested) packages.push(`agent-relay-orchestrator@${targetVersion}`);
133
+ if (packages.length > 0) warnings.push("No supported global package manager found. Install Bun or npm, then rerun `agent-relay upgrade`.");
134
+ } else if (packages.length > 0) {
123
135
  const command = snapshot.packageManager === "bun"
124
136
  ? ["bun", "add", "-g", ...packages]
125
137
  : ["npm", "install", "-g", ...packages];
@@ -131,6 +143,14 @@ export function createUpgradePlan(snapshot: UpgradeSnapshot, options: UpgradeOpt
131
143
  });
132
144
  }
133
145
 
146
+ if (snapshot.codexCopiedPackage) {
147
+ warnings.push(`Legacy Codex copied package ${snapshot.codexCopiedPackage.version ?? "unknown"} at ${snapshot.codexCopiedPackage.path ?? "~/.agent-relay/codex/package"} is ignored by the Phase 3.5 runner upgrade. Codex lifecycle now uses agent-relay-runner; refresh shims with \`agent-relay provider wrap codex\`.`);
148
+ }
149
+
150
+ if (snapshot.claudePluginInstalls.length > 0) {
151
+ warnings.push(`Legacy Claude Code plugin install(s) ${formatClaudePlugins(snapshot.claudePluginInstalls)} are not upgraded by the Phase 3.5 runner upgrade. Claude lifecycle now uses agent-relay-runner; refresh shims with \`agent-relay provider wrap claude\`.`);
152
+ }
153
+
134
154
  if (!codexRequested && providerSet.has("auto") && !isCodexDetected(snapshot)) {
135
155
  warnings.push("Codex provider not detected; skipping Codex integration upgrade.");
136
156
  }
@@ -147,7 +167,8 @@ export function createUpgradePlan(snapshot: UpgradeSnapshot, options: UpgradeOpt
147
167
  warnings.push("Agent Relay orchestrator not detected; skipping orchestrator package upgrade.");
148
168
  }
149
169
 
150
- if (snapshot.hasSystemdUserService) {
170
+ const serverRestartNeeded = serverPackageUpdated || Boolean(snapshot.runningServerVersion && snapshot.runningServerVersion !== targetVersion);
171
+ if (snapshot.hasSystemdUserService && serverRestartNeeded) {
151
172
  if (options.noRestart) {
152
173
  warnings.push("agent-relay.service detected but --no-restart was set; restart manually to run the upgraded server.");
153
174
  } else {
@@ -158,11 +179,14 @@ export function createUpgradePlan(snapshot: UpgradeSnapshot, options: UpgradeOpt
158
179
  mutates: true,
159
180
  });
160
181
  }
161
- } else {
182
+ } else if (!snapshot.hasSystemdUserService) {
162
183
  warnings.push("No systemd user service detected; restart any manually running Agent Relay server yourself.");
163
184
  }
164
185
 
165
- if (snapshot.hasSystemdUserOrchestratorService) {
186
+ const orchestratorRestartNeeded = orchestratorPackageUpdated || (snapshot.runningOrchestrators ?? []).some((orch) =>
187
+ Boolean((orch.version && orch.version !== targetVersion) || orch.health?.restartRequired)
188
+ );
189
+ if (snapshot.hasSystemdUserOrchestratorService && orchestratorRestartNeeded) {
166
190
  if (options.noRestart) {
167
191
  warnings.push("agent-relay-orchestrator.service detected but --no-restart was set; restart manually to run the upgraded orchestrator.");
168
192
  } else {
@@ -173,7 +197,7 @@ export function createUpgradePlan(snapshot: UpgradeSnapshot, options: UpgradeOpt
173
197
  mutates: true,
174
198
  });
175
199
  }
176
- } else if (orchestratorRequested) {
200
+ } else if (!snapshot.hasSystemdUserOrchestratorService && orchestratorRequested) {
177
201
  warnings.push("No agent-relay-orchestrator.service detected; restart any manually running orchestrator yourself.");
178
202
  }
179
203
 
@@ -270,6 +294,10 @@ function isOrchestratorDetected(snapshot: UpgradeSnapshot): boolean {
270
294
  return Boolean(snapshot.orchestratorPackage || snapshot.hasOrchestratorCommand || snapshot.hasSystemdUserOrchestratorService || (snapshot.runningOrchestrators?.length ?? 0) > 0);
271
295
  }
272
296
 
297
+ function packageNeedsUpgrade(pkg: InstalledPackage | undefined, targetVersion: string): boolean {
298
+ return pkg?.version !== targetVersion;
299
+ }
300
+
273
301
  function installedPackage(name: string, bunPackages: Map<string, string>, npmPackages: Map<string, string>): InstalledPackage | undefined {
274
302
  const bunVersion = bunPackages.get(name);
275
303
  if (bunVersion) return { version: bunVersion, source: "bun" };