agent-relay-orchestrator 0.11.3 → 0.11.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-orchestrator",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "description": "Agent Relay orchestrator — manages agent lifecycle across hosts",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "test": "bun test"
17
17
  },
18
18
  "dependencies": {
19
- "agent-relay-sdk": "0.2.2"
19
+ "agent-relay-sdk": "0.2.3"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/bun": "latest",
package/src/control.ts CHANGED
@@ -163,10 +163,10 @@ export function spawnOptionsFromControl(ctrl: Record<string, any>, config: Orche
163
163
  profile: typeof ctrl.profile === "string" ? ctrl.profile : undefined,
164
164
  workspaceMode: workspaceMode(ctrl.workspaceMode),
165
165
  agentProfile: isRecord(ctrl.agentProfile) ? ctrl.agentProfile : undefined,
166
- label: ctrl.label,
166
+ label: typeof ctrl.label === "string" ? ctrl.label : undefined,
167
167
  agentId: typeof ctrl.agentId === "string" ? ctrl.agentId : undefined,
168
- approvalMode: ctrl.approvalMode || "guarded",
169
- prompt: ctrl.prompt,
168
+ approvalMode: typeof ctrl.approvalMode === "string" ? ctrl.approvalMode : "guarded",
169
+ prompt: typeof ctrl.prompt === "string" ? ctrl.prompt : undefined,
170
170
  systemPromptAppend: typeof ctrl.systemPromptAppend === "string" ? ctrl.systemPromptAppend : undefined,
171
171
  tags: stringArray(ctrl.tags),
172
172
  capabilities: stringArray(ctrl.capabilities),
@@ -183,6 +183,7 @@ export function spawnOptionsFromRestartSource(restartSource: Record<string, any>
183
183
  return {
184
184
  provider: restartSource.provider === "codex" ? "codex" : "claude",
185
185
  cwd: typeof restartSource.cwd === "string" ? restartSource.cwd : config.baseDir,
186
+ rig: typeof restartSource.rig === "string" ? restartSource.rig : undefined,
186
187
  model: modelFromControl(restartSource),
187
188
  effort: typeof restartSource.effort === "string" ? restartSource.effort : undefined,
188
189
  profile: typeof restartSource.profile === "string" ? restartSource.profile : undefined,
package/src/index.ts CHANGED
@@ -17,12 +17,19 @@ if (args[0] === "init") {
17
17
  process.exit(0);
18
18
  }
19
19
 
20
+ if (args[0] === "--version" || args[0] === "-v") {
21
+ const { VERSION } = await import("./version");
22
+ console.log(VERSION);
23
+ process.exit(0);
24
+ }
25
+
20
26
  if (args[0] === "--help" || args[0] === "-h") {
21
27
  console.log(`agent-relay-orchestrator — manage agent lifecycle across hosts
22
28
 
23
29
  Usage:
24
- agent-relay-orchestrator Start the orchestrator daemon
25
- agent-relay-orchestrator init Create default config file
30
+ agent-relay-orchestrator Start the orchestrator daemon
31
+ agent-relay-orchestrator init Create default config file
32
+ agent-relay-orchestrator --version Print version and exit
26
33
 
27
34
  Environment:
28
35
  AGENT_RELAY_URL Relay server URL (default: http://localhost:4850)
@@ -1,8 +1,7 @@
1
- import { existsSync } from "node:fs";
2
1
  import { join } from "node:path";
3
2
  import type { OrchestratorConfig } from "./config";
4
3
  import type { RelayClient, RelayCommand } from "./relay";
5
- import { detectSelfSupervision } from "./self-supervision";
4
+ import { detectSelfSupervision, type SelfSupervision } from "./self-supervision";
6
5
 
7
6
  const VALID_PROVIDERS = new Set(["auto", "all", "codex", "claude", "orchestrator"]);
8
7
  const SEMVER_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
@@ -36,7 +35,6 @@ export interface SelfUpgradePlan {
36
35
  providers: string[];
37
36
  unit: string;
38
37
  runtimePrefix?: string;
39
- binary: string;
40
38
  installCmd: string[];
41
39
  restartCmd: string[];
42
40
  /** restart runs decoupled from this process's cgroup (transient unit) */
@@ -63,16 +61,7 @@ export function planSelfUpgrade(
63
61
  throw new Error("orchestrator is not under systemd or launchd; remote self-upgrade requires a managed service");
64
62
  }
65
63
  const unit = supervision.selfUnit;
66
- const binary = resolveBinary(supervision.runtimePrefix);
67
-
68
- const installCmd = [
69
- binary, "upgrade",
70
- "--version", targetVersion,
71
- "--providers", providers.join(","),
72
- "--no-restart",
73
- "--yes",
74
- ];
75
- if (supervision.runtimePrefix) installCmd.push("--runtime-prefix", supervision.runtimePrefix);
64
+ const installCmd = buildInstallCommand(targetVersion, providers, supervision, runner);
76
65
 
77
66
  let restartDetached: boolean;
78
67
  let restartCmd: string[];
@@ -93,7 +82,7 @@ export function planSelfUpgrade(
93
82
  : ["setsid", "systemctl", "--user", "restart", unit];
94
83
  }
95
84
 
96
- return { targetVersion, providers, unit, runtimePrefix: supervision.runtimePrefix, binary, installCmd, restartCmd, restartDetached };
85
+ return { targetVersion, providers, unit, runtimePrefix: supervision.runtimePrefix, installCmd, restartCmd, restartDetached };
97
86
  }
98
87
 
99
88
  /**
@@ -145,10 +134,56 @@ function normalizeProviders(value: unknown): string[] {
145
134
  return [...new Set(providers)];
146
135
  }
147
136
 
148
- function resolveBinary(runtimePrefix?: string): string {
149
- if (runtimePrefix) {
150
- const local = join(runtimePrefix, "node_modules", ".bin", "agent-relay");
151
- if (existsSync(local)) return local;
137
+ function buildInstallCommand(
138
+ targetVersion: string,
139
+ providers: string[],
140
+ supervision: SelfSupervision,
141
+ runner: SelfUpgradeRunner,
142
+ ): string[] {
143
+ if (supervision.runtimePrefix) {
144
+ if (!runner.commandExists("npm")) {
145
+ throw new Error("npm is required for runtime-prefix self-upgrade");
146
+ }
147
+ return [
148
+ "npm",
149
+ "install",
150
+ "--prefix",
151
+ supervision.runtimePrefix,
152
+ ...packagesForProviders(targetVersion, providers),
153
+ ];
154
+ }
155
+
156
+ if (runner.commandExists("agent-relay")) {
157
+ return [
158
+ "agent-relay", "upgrade",
159
+ "--version", targetVersion,
160
+ "--providers", providers.join(","),
161
+ "--no-restart",
162
+ "--yes",
163
+ ];
164
+ }
165
+
166
+ throw new Error("agent-relay CLI is not available and no runtime prefix was detected; self-upgrade cannot install packages");
167
+ }
168
+
169
+ function packagesForProviders(targetVersion: string, providers: string[]): string[] {
170
+ const selected = new Set(providers);
171
+ const packages = new Set<string>();
172
+ const includeAll = selected.has("all");
173
+ const includeAuto = selected.has("auto");
174
+
175
+ if (includeAll || includeAuto || selected.has("orchestrator")) {
176
+ packages.add("agent-relay-orchestrator");
152
177
  }
153
- return "agent-relay";
178
+ if (includeAll || selected.has("codex")) {
179
+ packages.add("agent-relay-runner");
180
+ packages.add("agent-relay-codex");
181
+ }
182
+ if (includeAll || selected.has("claude")) {
183
+ packages.add("agent-relay-runner");
184
+ packages.add("agent-relay-plugin");
185
+ }
186
+
187
+ if (packages.size === 0) packages.add("agent-relay-orchestrator");
188
+ return [...packages].map((pkg) => `${pkg}@${targetVersion}`);
154
189
  }
package/src/version.ts CHANGED
@@ -21,6 +21,7 @@ export const CONTRACTS = {
21
21
  export const RUNTIME_CAPABILITIES = {
22
22
  directoryBrowse: true,
23
23
  relayCommandBus: true,
24
+ selfUpgrade: true,
24
25
  authenticatedLogProxy: true,
25
26
  artifactProxy: true,
26
27
  managedAgentReports: true,