UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

25 lines • 1.46 kB
/** * `move_session` as the multi-session router runs it (senpi#3676): this host's agent directory and hosted paths, and the * open an `import` asks for with `open` (senpi#6267), which meets the gates an `open_session` from that connection would. */ import { compactAdmissionGate } from "./compact-socket-commands.js"; import { moveSession } from "./session-move-commands.js"; import { error } from "./session-router-errors.js"; import { openWithBarrier } from "./session-router-open.js"; export function routeMoveSession(host, command) { // The registry's directory only, never the host's own: a host that runs its sessions in workers has a directory and // still does not move sessions. `find_session` reads the host's own; that must not switch this on. const agentDir = host.registry.agentDir; if (agentDir === undefined) return Promise.resolve(error(command.id, command.type, "move_unsupported: this host keeps no agent directory to move sessions in")); return moveSession({ agentDir, hostedPaths: () => host.registry.list().flatMap((row) => (row.sessionPath === undefined ? [] : [row.sessionPath])), open: async (open, reply) => { if (host.draining) return error(open.id, open.type, "host_draining"); return compactAdmissionGate(host, open) ?? openWithBarrier(host, open, reply); }, }, command); } //# sourceMappingURL=session-move-router.js.map