feat: rpc bridge

This commit is contained in:
Cristina Poncela Cubeiro
2026-06-18 13:32:17 +02:00
parent 0d02df760f
commit 8bc92fc90b
6 changed files with 126 additions and 1 deletions
+12
View File
@@ -6,8 +6,11 @@ import {
createAgentSessionRuntime,
createAgentSessionServices,
getAgentDir,
type RpcCommand,
type RpcResponse,
SessionManager,
} from "@earendil-works/pi-coding-agent";
import { handleRpcCommand } from "./rpc-bridge.ts";
import { getInstance, loadInstances, removeInstance, upsertInstance } from "./storage.ts";
import type { InstanceRecord } from "./types.ts";
@@ -94,6 +97,15 @@ export class OrchestratorSupervisor {
removeInstance(instanceId);
return cloneInstance(live.record);
}
async handleRpc(instanceId: string, command: RpcCommand): Promise<RpcResponse | undefined> {
const live = this.liveInstances.get(instanceId);
if (!live) {
return undefined;
}
return handleRpcCommand(live.runtime, command);
}
}
export const supervisor = new OrchestratorSupervisor();