agent-relay-orchestrator 0.10.1 → 0.10.3

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.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "Agent Relay orchestrator — manages agent lifecycle across hosts",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -2,8 +2,9 @@
2
2
  import { loadConfig, initConfigFile } from "./config";
3
3
  import { createRelayClient } from "./relay";
4
4
  import { createControlHandler } from "./control";
5
- import { recoverExistingSessions, hasSession } from "./tmux";
5
+ import { hasSession } from "./tmux";
6
6
  import { startApiServer } from "./api";
7
+ import { recoverManagedAgents } from "./recovery";
7
8
 
8
9
  const args = process.argv.slice(2);
9
10
 
@@ -62,12 +63,7 @@ async function startup(): Promise<void> {
62
63
  relay.startHeartbeatLoop();
63
64
 
64
65
  // Recover existing tmux sessions
65
- const recovered = await recoverExistingSessions(config);
66
- if (recovered.length > 0) {
67
- console.error(`[orchestrator] Recovered ${recovered.length} existing session(s)`);
68
- control.setManagedAgents(recovered);
69
- await relay.updateManagedAgents(recovered);
70
- }
66
+ await recoverManagedAgents(config, control, relay);
71
67
 
72
68
  // Start polling for command requests
73
69
  startPolling();
@@ -0,0 +1,22 @@
1
+ import type { OrchestratorConfig } from "./config";
2
+ import type { ManagedAgentReport, RelayClient } from "./relay";
3
+ import { recoverExistingSessions } from "./tmux";
4
+
5
+ interface ManagedAgentControl {
6
+ setManagedAgents(agents: ManagedAgentReport[]): void;
7
+ }
8
+
9
+ export async function recoverManagedAgents(
10
+ config: OrchestratorConfig,
11
+ control: ManagedAgentControl,
12
+ relay: Pick<RelayClient, "updateManagedAgents">,
13
+ recover: (config: OrchestratorConfig) => Promise<ManagedAgentReport[]> = recoverExistingSessions,
14
+ ): Promise<ManagedAgentReport[]> {
15
+ const recovered = await recover(config);
16
+ if (recovered.length > 0) {
17
+ console.error(`[orchestrator] Recovered ${recovered.length} existing session(s)`);
18
+ }
19
+ control.setManagedAgents(recovered);
20
+ await relay.updateManagedAgents(recovered);
21
+ return recovered;
22
+ }