agent-relay-orchestrator 0.61.2 → 0.62.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-orchestrator",
3
- "version": "0.61.2",
3
+ "version": "0.62.0",
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.37"
19
+ "agent-relay-sdk": "0.2.38"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/bun": "latest",
package/src/control.ts CHANGED
@@ -2,6 +2,7 @@ import { errMessage, isRecord, normalizeAgentLifecycle, normalizeWorkspaceMode }
2
2
  import type { OrchestratorConfig } from "./config";
3
3
  import type { ManagedAgentReport, RelayClient, RelayCommand } from "./relay";
4
4
  import { handleSelfUpgrade } from "./self-upgrade";
5
+ import { readLocalProviderConfigs } from "./provider-config-migration";
5
6
  import { spawnAgent, stopSession, type SpawnOptions } from "./spawn";
6
7
  import { cleanupWorkspace, mergeWorkspace, pruneWorktrees, reconcileWorkspace, refreshWorkspaceDeps, workspacesRoot } from "./workspace-probe";
7
8
  import { armWorkspacePrAutoMerge, mergeWorkspacePr, refreshWorkspacePrBranch } from "./workspace-pr";
@@ -175,6 +176,10 @@ export function createControlHandler(
175
176
  repoRoot: typeof command.params.repoRoot === "string" ? command.params.repoRoot : undefined,
176
177
  });
177
178
  await relay.updateCommand(command.id, "succeeded", result);
179
+ } else if (command.type === "orchestrator.migrate-provider-config") {
180
+ // Report our host-local provider config files; the relay seeds the central
181
+ // provider-config rows with its own authority (#465). We don't write anything.
182
+ await relay.updateCommand(command.id, "succeeded", { ...readLocalProviderConfigs() });
178
183
  } else if (command.type === "orchestrator.upgrade") {
179
184
  // Install + restart ourselves. Intentionally NOT marked "succeeded": the
180
185
  // relay settles it by reconciling the version we report after we restart,
@@ -0,0 +1,38 @@
1
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
2
+ import { homedir, hostname } from "node:os";
3
+ import { join } from "node:path";
4
+
5
+ interface ProviderConfigMigrationPayload {
6
+ host: string;
7
+ configs: Record<string, unknown>;
8
+ }
9
+
10
+ function agentRelayHome(): string {
11
+ return process.env.AGENT_RELAY_HOME || join(homedir(), ".agent-relay");
12
+ }
13
+
14
+ /**
15
+ * Read the host-local per-provider config files (`~/.agent-relay/providers/*.json`)
16
+ * so the relay can seed the central `provider-config` rows with server authority
17
+ * (#465). We stay deliberately dumb here — raw parsed JSON, no defaulting or
18
+ * schema knowledge — because the relay owns provider-config validation/normalization.
19
+ * `host` matches what the runner keys central reads by: bare `os.hostname()`.
20
+ */
21
+ export function readLocalProviderConfigs(home = agentRelayHome()): ProviderConfigMigrationPayload {
22
+ const dir = join(home, "providers");
23
+ const configs: Record<string, unknown> = {};
24
+ if (existsSync(dir)) {
25
+ for (const file of readdirSync(dir)) {
26
+ if (!file.endsWith(".json")) continue;
27
+ const provider = file.slice(0, -".json".length);
28
+ if (!provider) continue;
29
+ try {
30
+ const parsed = JSON.parse(readFileSync(join(dir, file), "utf8"));
31
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) configs[provider] = parsed;
32
+ } catch {
33
+ // Skip unparseable files — a malformed local file shouldn't fail the migration.
34
+ }
35
+ }
36
+ }
37
+ return { host: hostname(), configs };
38
+ }
package/src/version.ts CHANGED
@@ -28,6 +28,7 @@ export const RUNTIME_CAPABILITIES = {
28
28
  artifactProxy: true,
29
29
  managedAgentReports: true,
30
30
  durableRunnerSupervisor: true,
31
+ migrateProviderConfig: true,
31
32
  } as const;
32
33
 
33
34
  export function runtimeMetadata() {