feat: rpc bridge
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user