// PROTOTYPE — wayfinder #38 "Gate UI shape". THROWAWAY; not part of the app target. // Run: swiftc prototypes/GateUIPrototype.swift -o /tmp/gate_proto && /tmp/gate_proto // (←/→ arrows cycle variants; toggles in the bottom bar flip the scenario) // Three variants of the launch gate on a mock workspace: // A — Blocking sheet: modal gate card over the app, every launch // B — Gate window: first run the window IS the gate; repeat runs = toolbar pill only // C — Inline banner: never blocks; fail = banner with install steps, pass = quiet pill // Scenario controls: First run vs Repeat launch; whether the NEXT check passes or fails. // Install-instructions copy is PLACEHOLDER — real copy graduates after this ticket. import SwiftUI // MARK: - Tokens (from ref/Web-Prototype/museion-workspace.html) enum Tok { static let bg = Color(hex: 0xFAFAF7) static let surface = Color(hex: 0xFFFFFF) static let fg = Color(hex: 0x1A1916) static let muted = Color(hex: 0x6B6964) static let border = Color(hex: 0xE8E5DF) static let accent = Color(hex: 0xC96442) static let fgSoft = Color(hex: 0x1A1916).opacity(0.06) static let accentSoft = Color(hex: 0xC96442).opacity(0.14) static func display(_ size: CGFloat, _ weight: Font.Weight = .regular) -> Font { .custom("Iowan Old Style", size: size).weight(weight) } static func mono(_ size: CGFloat) -> Font { .system(size: size, design: .monospaced) } } extension Color { init(hex: UInt32) { self.init(.sRGB, red: Double((hex >> 16) & 0xFF) / 255, green: Double((hex >> 8) & 0xFF) / 255, blue: Double(hex & 0xFF) / 255) } } // MARK: - Mock state final class GateModel: ObservableObject { enum Phase: Equatable { case checking, passed, failed } @Published var phase: Phase = .checking @Published var firstRun = true @Published var nextPass = false // outcome of the NEXT check (scenario control) let version = "0.42.1" private var token = 0 func check() { token += 1 let myToken = token phase = .checking DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) { [weak self] in guard let self, self.token == myToken else { return } self.phase = self.nextPass ? .passed : .failed } } } // MARK: - Shared pieces struct EnginePill: View { @EnvironmentObject var model: GateModel var body: some View { HStack(spacing: 7) { Circle() .fill(dotColor) .frame(width: 7, height: 7) .modifier(Pulse(active: model.phase == .checking)) Text("Hermes") .font(Tok.mono(11)) .foregroundStyle(Tok.fg) if model.phase == .passed { Text(model.version) .font(Tok.mono(11)) .foregroundStyle(Tok.muted) } } .padding(.horizontal, 10) .frame(minHeight: 30) .background(Tok.surface, in: RoundedRectangle(cornerRadius: 10)) .overlay( RoundedRectangle(cornerRadius: 10) .strokeBorder(model.phase == .failed ? Tok.accent : Tok.border, lineWidth: 1) ) } private var dotColor: Color { switch model.phase { case .checking: Tok.accent case .passed: Tok.fg case .failed: Tok.accent } } } struct Pulse: ViewModifier { let active: Bool func body(content: Content) -> some View { if active { content.opacity(0.35).animation( Animation.easeInOut(duration: 0.55).repeatForever(autoreverses: true), value: active) } else { content } } } /// Placeholder install steps — the real copy is a graduated ticket, not this one. struct InstallSteps: View { var numbered = true var body: some View { VStack(alignment: .leading, spacing: 7) { ForEach(Array(steps.enumerated()), id: \.offset) { idx, step in HStack(alignment: .top, spacing: 8) { if numbered { Text("\(idx + 1).").font(Tok.mono(11)).foregroundStyle(Tok.muted) } Text(step) .font(.system(size: 12)) .foregroundStyle(Tok.fg) } } } .frame(maxWidth: .infinity, alignment: .leading) .padding(12) .background(Tok.bg, in: RoundedRectangle(cornerRadius: 10)) .overlay(RoundedRectangle(cornerRadius: 10).strokeBorder(Tok.border)) } private var steps: [String] { [ "Install Hermes: brew install hermes", "Check the install: hermes acp --check", "Then click Re-check below.", ] } } struct RecheckButton: View { @EnvironmentObject var model: GateModel var label = "Re-check" var body: some View { Button { model.check() } label: { HStack(spacing: 6) { if model.phase == .checking { ProgressView().controlSize(.small) } Text(model.phase == .checking ? "Checking…" : label) } .frame(maxWidth: 180) } .buttonStyle(.borderedProminent) .tint(Tok.accent) .disabled(model.phase == .checking) } } // MARK: - Mock workspace (context for the gate to sit over) struct MockWorkspace: View { @EnvironmentObject var model: GateModel var banner: AnyView? = nil var body: some View { VStack(spacing: 0) { toolbar if let banner { banner } HStack(spacing: 0) { rail editor } } .background(Tok.bg) } private var toolbar: some View { HStack(spacing: 12) { Text("M") .font(Tok.display(17, .semibold)) .foregroundStyle(Tok.accent) .frame(width: 26, height: 26) .background(Tok.accentSoft, in: RoundedRectangle(cornerRadius: 7)) Text("On rereading Orwell") .font(.system(size: 13)) .foregroundStyle(Tok.muted) .lineLimit(1) Spacer() EnginePill() } .padding(.horizontal, 14) .frame(height: 48) .background(Tok.surface) .overlay(alignment: .bottom) { Divider().overlay(Tok.border) } } private var rail: some View { VStack(spacing: 6) { ForEach(["square.stack.3d.up", "bubble.left.and.bubble.right", "sparkles", "gearshape"], id: \.self) { icon in Image(systemName: icon) .font(.system(size: 15)) .foregroundStyle(Tok.muted) .frame(width: 40, height: 40) } Spacer() } .padding(.top, 10) .frame(width: 56) .background(Tok.bg) .overlay(alignment: .trailing) { Divider().overlay(Tok.border) } } private var editor: some View { ScrollView { VStack(alignment: .leading, spacing: 18) { Text("On rereading Orwell") .font(Tok.display(26, .semibold)) Text(previewText) .font(.system(size: 14)) .foregroundStyle(Tok.fg) .lineSpacing(5) } .padding(36) .frame(maxWidth: 720, alignment: .leading) .frame(maxWidth: .infinity, alignment: .center) } } private var previewText: String { String(repeating: "The essay argues itself into a corner by the third paragraph, and the prose knows it. Sentences shorten. Claims retreat. ", count: 6) } } // MARK: - Variant A — blocking sheet, every launch struct VariantA: View { @EnvironmentObject var model: GateModel @State private var showSteps = false var body: some View { ZStack { MockWorkspace().disabled(true) Rectangle().fill(Tok.fg.opacity(0.28)).ignoresSafeArea() card .padding(30) .frame(maxWidth: 430) .background(Tok.surface, in: RoundedRectangle(cornerRadius: 14)) .overlay( RoundedRectangle(cornerRadius: 14) .strokeBorder(model.phase == .failed ? Tok.accent : Tok.border, lineWidth: 1) ) .shadow(radius: 24, y: 8) } } private var card: some View { VStack(spacing: 14) { Image(systemName: model.phase == .failed ? "exclamationmark.triangle.fill" : "checkmark.circle.fill") .font(.system(size: 30)) .foregroundStyle(model.phase == .failed ? Tok.accent : Tok.fg) .opacity(model.phase == .checking ? 0 : 1) Text(title) .font(Tok.display(19, .semibold)) .multilineTextAlignment(.center) Text(subtitle) .font(.system(size: 12.5)) .foregroundStyle(Tok.muted) .multilineTextAlignment(.center) .fixedSize(horizontal: false, vertical: true) if model.phase == .failed { if showSteps { InstallSteps() } else { Button("How do I install Hermes?") { showSteps = true } .buttonStyle(.link) .font(.system(size: 12)) } } RecheckButton(label: model.phase == .passed ? "Re-check anyway" : "Re-check") if model.phase == .passed { Text("Checked on launch · Hermes \(model.version)") .font(Tok.mono(10)) .foregroundStyle(Tok.muted) } } .padding(24) } private var title: String { switch model.phase { case .checking: "Checking the engine…" case .passed: "Engine ready" case .failed: "Museion needs its engine" } } private var subtitle: String { switch model.phase { case .checking: "Running hermes acp --check." case .passed: "Hermes \(model.version) answered the health check. The mentor is available." case .failed: "The Hermes engine wasn't found or didn't answer. Museion can't run Passes or Sessions without it — the editor below stays available." } } } // MARK: - Variant B — gate window (first run), pill (repeat runs) struct VariantB: View { @EnvironmentObject var model: GateModel var body: some View { if model.firstRun { GateWindow() } else { MockWorkspace() } } } private struct GateWindow: View { @EnvironmentObject var model: GateModel var body: some View { VStack(spacing: 0) { Spacer(minLength: 40) VStack(spacing: 16) { Text("Museion") .font(Tok.display(34, .semibold)) Text("The Agentic Writing Environment") .font(Tok.mono(11)) .foregroundStyle(Tok.muted) .textCase(.uppercase) Divider().frame(width: 60).overlay(Tok.border) status if model.phase == .failed { InstallSteps() } if model.phase == .passed { Text("First run complete — the workspace opens next.") .font(.system(size: 12)) .foregroundStyle(Tok.muted) } } .padding(34) .frame(maxWidth: 470) .background(Tok.surface, in: RoundedRectangle(cornerRadius: 14)) .overlay(RoundedRectangle(cornerRadius: 14).strokeBorder(Tok.border)) .shadow(radius: 18, y: 6) Spacer(minLength: 40) } .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Tok.bg) } @ViewBuilder private var status: some View { switch model.phase { case .checking: VStack(spacing: 10) { ProgressView().controlSize(.regular) Text("Looking for the Hermes engine…") .font(.system(size: 13)) .foregroundStyle(Tok.muted) } case .passed: VStack(spacing: 10) { Image(systemName: "checkmark.circle.fill") .font(.system(size: 26)) .foregroundStyle(Tok.fg) Text("Engine ready — Hermes \(model.version)") .font(Tok.display(15, .semibold)) } case .failed: VStack(spacing: 10) { Image(systemName: "exclamationmark.triangle.fill") .font(.system(size: 26)) .foregroundStyle(Tok.accent) Text("Engine missing") .font(Tok.display(15, .semibold)) } } } } // MARK: - Variant C — inline banner, never blocks struct VariantC: View { @EnvironmentObject var model: GateModel var body: some View { MockWorkspace(banner: AnyView(banner)) } @ViewBuilder private var banner: some View { if model.phase == .failed { failBanner } else if model.firstRun, model.phase == .passed { passBanner } } private var failBanner: some View { HStack(alignment: .top, spacing: 12) { Image(systemName: "exclamationmark.triangle.fill") .foregroundStyle(Tok.accent) VStack(alignment: .leading, spacing: 8) { (Text("Engine unavailable. ").font(.system(size: 12.5, weight: .semibold)) + Text("Passes and Sessions need Hermes; the editor keeps working.") .font(.system(size: 12.5)) .foregroundStyle(Tok.muted)) InstallSteps() } Spacer(minLength: 12) RecheckButton() } .padding(14) .background(Tok.accent.opacity(0.08)) .overlay(alignment: .bottom) { Rectangle().fill(Tok.accent).frame(height: 1) } } private var passBanner: some View { HStack(spacing: 8) { Image(systemName: "checkmark.circle.fill").foregroundStyle(Tok.fg) Text("Engine ready — Hermes \(model.version)") .font(.system(size: 12.5)) Spacer() } .padding(.horizontal, 14).padding(.vertical, 8) .background(Tok.surface) .overlay(alignment: .bottom) { Divider().overlay(Tok.border) } } } // MARK: - Root + switcher struct GatePrototypeRoot: View { @StateObject private var model = GateModel() @State private var variant = "A" let variants: [(String, String)] = [ ("A", "Blocking sheet"), ("B", "Gate window"), ("C", "Inline banner"), ] var body: some View { ZStack(alignment: .bottom) { currentView.environmentObject(model) SwitcherBar(variant: $variant, model: model) } .frame(minWidth: 1100, minHeight: 680) .background(Tok.bg) .onAppear { model.check() } } private var currentView: some View { switch variant { case "A": AnyView(VariantA()) case "B": AnyView(VariantB()) default: AnyView(VariantC()) } } } struct SwitcherBar: View { @Binding var variant: String @ObservedObject var model: GateModel var body: some View { HStack(spacing: 14) { arrow("chevron.left") { cycle(-1) } .keyboardShortcut(.leftArrow, modifiers: []) Text("\(variant) — \(variants.first { $0.0 == variant }?.1 ?? "")") .font(Tok.mono(12)) arrow("chevron.right") { cycle(1) } .keyboardShortcut(.rightArrow, modifiers: []) Divider().frame(height: 16).overlay(Tok.border) Toggle("First run", isOn: $model.firstRun) .toggleStyle(.checkbox).font(Tok.mono(11)) Toggle("Next check passes", isOn: $model.nextPass) .toggleStyle(.checkbox).font(Tok.mono(11)) Divider().frame(height: 16).overlay(Tok.border) Text(phaseLabel) .font(Tok.mono(11)).foregroundStyle(.tertiary) } .padding(.horizontal, 14).padding(.vertical, 9) .background(Tok.fg, in: RoundedRectangle(cornerRadius: 10)) .foregroundStyle(Tok.bg) .padding(.bottom, 14) .shadow(radius: 12, y: 4) .onAppear { NSApp.appearance = NSAppearance(named: .aqua) } // prototype: force light so tokens read as designed } private var variants: [(String, String)] { [("A", "Blocking sheet"), ("B", "Gate window"), ("C", "Inline banner")] } private var phaseLabel: String { switch model.phase { case .checking: "checking" case .passed: "passed · hermes \(model.version)" case .failed: "failed" } } private func cycle(_ dir: Int) { let idx = variants.firstIndex { $0.0 == variant } ?? 0 variant = variants[(idx + dir + variants.count) % variants.count].0 } private func arrow(_ system: String, action: @escaping () -> Void) -> some View { Button(action: action) { Image(systemName: system).font(.system(size: 11, weight: .semibold)) } .buttonStyle(.plain) } } @main struct GateUIPrototypeApp: App { var body: some Scene { WindowGroup { GatePrototypeRoot() } } }