/**
 * Session handoff types and helpers.
 *
 * A handoff captures the state of a session so that a successor
 * session (or a different agent) can pick up where the previous
 * one left off.
 */
export function rowToSessionHandoff(row) {
    let artifacts = [];
    try {
        const parsed = JSON.parse(row.artifacts_json);
        if (Array.isArray(parsed)) {
            artifacts = parsed.map((item) => String(item));
        }
    }
    catch {
        artifacts = [];
    }
    return {
        version: 1,
        sessionId: row.session_id,
        repoRoot: row.repo_root ?? undefined,
        taskId: row.task_id ?? undefined,
        summary: row.summary,
        nextAction: row.next_action ?? undefined,
        artifacts,
        scope: row.scope ?? null,
        updatedAt: row.created_at,
    };
}
//# sourceMappingURL=handoff.js.map