34 lines
1.6 KiB
Swift
34 lines
1.6 KiB
Swift
import SwiftUI
|
|
import NucleicCore
|
|
|
|
/// Pretty rendering of an `ExitPlanMode` tool call — the plan the agent presents when it's
|
|
/// ready to leave plan mode and start coding. The generic tool card shows the plan as escaped
|
|
/// JSON with an unrendered Markdown blob; instead we render the plan body as formatted Markdown
|
|
/// under a "Plan" header, matching the assistant-prose look. The plan text lives on the call
|
|
/// input, so the card renders the moment the call streams in — before, and regardless of, the
|
|
/// user's approval. Mirrors `AskUserQuestionResultCard`'s accent-tinted card so a presented plan
|
|
/// reads as a distinct, first-class moment rather than an opaque tool row.
|
|
struct ExitPlanModeCard: View {
|
|
@Environment(\.appPalette) private var palette
|
|
let plan: ExitPlanMode.Plan
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 10) {
|
|
HStack(spacing: 8) {
|
|
Image(systemName: "list.bullet.clipboard")
|
|
.font(.caption).foregroundStyle(palette.accent).frame(width: 15)
|
|
Text("Plan")
|
|
.font(.callout.weight(.medium)).foregroundStyle(AppTheme.primaryText)
|
|
Spacer(minLength: 0)
|
|
}
|
|
MarkdownText(markdown: plan.markdown, bodySize: 13)
|
|
.textSelection(.enabled)
|
|
}
|
|
.padding(.horizontal, 12).padding(.vertical, 10)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.background(palette.accent.opacity(0.06))
|
|
.overlay(RoundedRectangle(cornerRadius: 8).strokeBorder(palette.accent.opacity(0.14), lineWidth: 1))
|
|
.clipShape(RoundedRectangle(cornerRadius: 8))
|
|
}
|
|
}
|