Files
museion/Museion/ContentView.swift
T
AlexKuceraandCipher c0b2cb0b93
CI / ci (push) Canceled after 0s
feat(provisioning): add S2.1 pass with failure alert & retry (fixes #47, #48)
Idempotent per-gate pass: create the museion Hermes profile only when
missing (exit-1 "already exists" = success), then additively seed the
bundled writing skills from seed-manifest.txt — temp-copy+rename, present
skills never touched, orphaned temps swept, manifest entries validated
kebab-case at the trust boundary.

Failures surface a separate phase-named alert ("couldn't set up the
writing profile" / "couldn't copy the writing skills"), never re-raising
the gate: excerpt behind Technical details (stdout per #43, stderr
fallback), Retry re-runs the whole pass, Not Now defers to the next
launch's silent retry. The card presents only after the gate sheet's
dismissal completes and snapshots its failure so a successful Retry
doesn't blank it mid-animation.

Provisioning writes nothing to the profile config (no mcp_servers entry,
#44) and leaves state.json engine-gate-only. 30/30 tests green.

Co-Authored-By: Cipher <cipher@babylondreams.de>
2026-09-05 15:03:01 +02:00

70 lines
1.8 KiB
Swift

//
// ContentView.swift
// Museion
//
// Created by Alexander Kucera on 26.08.26.
//
import SwiftUI
enum AppMetadata {
nonisolated static let name = "Museion"
nonisolated static let tagline = "The Agentic Writing Environment"
}
struct ContentView: View {
@Environment(AppGateState.self) private var gate
/// #48: provisioning failure presents only once the gate sheet has fully
/// dismissed — keying on `gateDismissed` (set in the sheet's onDismiss,
/// which fires at dismissal completion) rather than `!gateRaised` (which
/// flips at dismissal start); macOS can drop a sheet presented during
/// another sheet's dismissal animation.
private var failurePresented: Binding<Bool> {
Binding(
get: { gate.provisioning.hasFailure && gate.gateDismissed },
set: {
if !$0 {
gate.provisioning.deferFailure()
}
},
)
}
var body: some View {
@Bindable var gate = gate
VStack(spacing: 8) {
Image(systemName: "books.vertical")
.font(.largeTitle)
Text(AppMetadata.name)
.font(.title)
.bold()
Text(AppMetadata.tagline)
.foregroundStyle(.secondary)
}
.padding(32)
.frame(minWidth: 480, minHeight: 320)
.sheet(isPresented: $gate.gateRaised) {
EngineGateView(
model: gate.gateModel,
onEnginePass: {
// #47: provisioning runs in parallel on pass; idempotent, so re-fires
// are no-ops. Alert UX on failure is #48.
Task { await gate.provisioning.runPass(hermesBinary: gate.gateModel.currentBinaryPath) }
},
onDismiss: {
gate.gateRaised = false
gate.gateDismissed = true
},
)
}
.sheet(isPresented: failurePresented) {
ProvisioningFailureCard(model: gate.provisioning) {
Task { await gate.provisioning.runPass(hermesBinary: gate.gateModel.currentBinaryPath) }
}
.interactiveDismissDisabled()
}
}
}