Cotton code
30 lines · 1.2 KB · SwiftRaw
// What a record carries besides its columns, read and written through the// store's one generic "this record, by kind and id" read, `read.record`// (`get_record` plus the record's threads, `phone/record_thread.rs`), and the// note engine's own verbs.import CottonKitimport SwiftUI/// `read.record`'s request. The kind is what the tool validates against; a/// journal page answers to `note` because both cases read `cotton_notes` by id.struct RecordReadRequest: Encodable, Sendable {    let kind: String    let id: String}/// The engine tool a comment on a record is written through.enum RecordExtrasTool {    static let createComment = "create_comment"}enum RecordExtras {    /// A writer's name a person can read: none for a missing label or a    /// writer's id ("job:synthetic", any "kind:" prefix) — nothing is said    /// rather than a raw id (recordpages-C, 16 Oct 2026).    static func writer(_ label: String?) -> String? {        guard let label = label?.trimmingCharacters(in: .whitespacesAndNewlines), !label.isEmpty else { return nil }        if let colon = label.firstIndex(of: ":"), !label[..<colon].contains(" ") { return nil }        return label    }}