@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
20 lines • 960 B
JavaScript
import { RpcSessionRegistryError } from "./session-registry-types.js";
/** Synchronous refcount change: never opens a path and never applies a launch profile. */
export function attachLiveSession(entry, now, markAttached) {
if (entry?.state !== "open")
throw new RpcSessionRegistryError("unknown_session");
const wasParked = entry.retainOnDisconnect === true && entry.attachments === 0;
entry.attachments++;
entry.detachedAt = undefined;
entry.lastCommandAt = now;
markAttached();
if (wasParked && entry.runtime)
entry.lifecycleMutex = entry.lifecycleMutex.then(() => entry.runtime?.emitAttachmentEvent("session_resumed"));
return entry;
}
/** Publish the live-only attachment in the same claim store as open_session. */
export function markPathAttached(entry, claims) {
if (entry?.reservationKey)
claims?.setAttached(entry.reservationKey, true);
}
//# sourceMappingURL=session-live-attachment.js.map