feat(provisioning): add S2.1 pass with failure alert & retry (fixes #47, #48)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
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>
This commit is contained in:
1 parent
67cf3d42e4
commit
c0b2cb0b93
19 files changed
+912
-9
No files matched your search
@@ -159,6 +159,80 @@ struct EngineGateView: View {
|
||||
private let installCommand = "curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash"
|
||||
}
|
||||
|
||||
/// #48: provisioning failure card — separate from the gate, which never re-raises.
|
||||
/// Presented only after the gate sheet has been dismissed.
|
||||
struct ProvisioningFailureCard: View {
|
||||
let model: ProvisioningModel
|
||||
/// Retry re-runs the whole idempotent pass with the gate's binary (#45).
|
||||
let onRetry: () -> Void
|
||||
|
||||
/// Snapshot taken when the card appears; a successful Retry nils
|
||||
/// `model.lastFailure` mid-presentation, and reading it live would blank
|
||||
/// the card during its dismiss animation.
|
||||
@State private var failure: ProfileProvisioner.Outcome?
|
||||
|
||||
var body: some View {
|
||||
if let failure, case let .failed(phase, excerpt) = failure {
|
||||
VStack(spacing: 14) {
|
||||
Image(systemName: "exclamationmark.triangle.fill")
|
||||
.font(.system(size: 30))
|
||||
.foregroundStyle(.orange)
|
||||
Text(phase.rawValue)
|
||||
.font(.title3)
|
||||
Text("Museion couldn't finish setting up the mentor's writing profile. Nothing is lost — the setup is safe to run again.")
|
||||
.font(.callout)
|
||||
.foregroundStyle(.secondary)
|
||||
.multilineTextAlignment(.center)
|
||||
|
||||
if !excerpt.isEmpty {
|
||||
DisclosureGroup("Technical details") {
|
||||
Text(excerpt)
|
||||
.font(.system(size: 10, design: .monospaced))
|
||||
.foregroundStyle(.secondary)
|
||||
.textSelection(.enabled)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
.font(.system(size: 11))
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
HStack {
|
||||
Button("Not Now") {
|
||||
model.deferFailure()
|
||||
}
|
||||
.keyboardShortcut(.cancelAction)
|
||||
Button("Retry") {
|
||||
onRetry()
|
||||
}
|
||||
.keyboardShortcut(.defaultAction)
|
||||
.buttonStyle(.borderedProminent)
|
||||
}
|
||||
}
|
||||
.padding(24)
|
||||
.frame(width: 460)
|
||||
.onAppear(perform: refreshIfNewFailure)
|
||||
.onChange(of: model.lastFailure) {
|
||||
refreshIfNewFailure()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Refresh only on a new failure — never on clearing, so the card stays
|
||||
/// rendered until the sheet dismisses it.
|
||||
private func refreshIfNewFailure() {
|
||||
if case .failed = model.lastFailure {
|
||||
failure = model.lastFailure
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
EngineGateView(model: EngineGateModel())
|
||||
}
|
||||
|
||||
#Preview("provisioning failure") {
|
||||
ProvisioningFailureCard(
|
||||
model: ProvisioningModel(),
|
||||
onRetry: {},
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user