@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
23 lines • 1.13 kB
JavaScript
const SESSION_ARCHIVED_CUSTOM_TYPE = "session_archived";
/**
* The data of `entry` when it is a `customType` marker written for session `sessionId`, else undefined. Every
* per-thread flag kept in the session file (archived, settled) counts only for the session it names this way.
*/
export function sessionMarkerData(entry, customType, sessionId) {
if (entry.type !== "custom" || entry.customType !== customType)
return undefined;
const data = entry.data;
return data?.sessionId === sessionId ? data : undefined;
}
/** The flag `entry` sets for session `sessionId`, or undefined when it sets none there. */
export function archivedFlagOf(entry, sessionId) {
const data = sessionMarkerData(entry, SESSION_ARCHIVED_CUSTOM_TYPE, sessionId);
return data === undefined ? undefined : data.archived === true;
}
export function isSessionArchived(manager) {
return manager.isArchived();
}
export function setSessionArchived(manager, archived) {
manager.appendCustomEntry(SESSION_ARCHIVED_CUSTOM_TYPE, { archived, sessionId: manager.getSessionId() });
}
//# sourceMappingURL=session-archived.js.map