Files
luma/Sources/LumaCore/Persistence/SessionOutboxRecord.swift
Ole André Vadla Ravnås 9d02419562 Sync sessions across collaborative labs
Sessions in a lab are now collaborative artifacts. Any owner can
host (own the local Frida attachment) and any owner can drive
(issue REPL evals and instrument commands); a driver's actions
are relayed to the current host. Members watch read-only and see
an "Only lab owners can host sessions" CTA when they try the new
session button.

Re-host (Run on My Device…) lets an owner take over a running
session by attaching to their own equivalent process; the prior
host's Frida attachment detaches and the new host auto-loads the
session's instruments. Driver auto-reverts to host when the
current driver fully disconnects from the lab.
2026-04-30 23:28:15 +02:00

31 lines
967 B
Swift

import Foundation
import GRDB
/// Row in `session_outbox`. Backs ProjectStore's pending session-ops queue:
/// each row is a serialized SessionOp awaiting delivery to the server.
struct SessionOutboxRecord: Codable, Sendable, FetchableRecord, PersistableRecord {
static let databaseTableName = "session_outbox"
var opID: String
var kind: String
var sessionID: String
var payloadJSON: String
var createdAt: Date
enum CodingKeys: String, CodingKey {
case opID = "op_id"
case kind
case sessionID = "session_id"
case payloadJSON = "payload_json"
case createdAt = "created_at"
}
func toOp() -> SessionOp? {
guard let data = payloadJSON.data(using: .utf8),
let obj = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
let sid = UUID(uuidString: sessionID)
else { return nil }
return SessionOp.fromJSON(obj, sessionID: sid)
}
}