feat(ui): design-council polish overhaul
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s

Eight arbitrated rounds over the workspace surface: piece-scoped Mentor
hosting, conversation-voice system messages, glyph-measured roster
truncation, bounded learnings/archive columns, symmetric trends grid,
top-aligned settings forms, serif editor titles, outline rail rhythm,
launch auto-focus root fix. New seams pinned by SessionScopeTests +
WordBoundaryTruncationTests; full suite green.
This commit is contained in:
AlexKucera committed 2026-11-07 20:41:34 +01:00
1 parent b2db859887
commit 3a7d495b4b
21 files changed
+2287 -516

No files matched your search

+130 -15
View File
@@ -110,14 +110,21 @@ struct MentorPaneView: View {
}
.buttonStyle(.plain)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 14)
.padding(.horizontal, 16)
.padding(.top, 10)
}
// #28: the transcript rendering is shared — the Sessions pane
// reads the same surface in the writing voice. #30: the
// freeform input + liveness ride the shared surface too.
// #155: the debug toggle's seat is the composer's edge.
SessionTranscriptView(model: model, showsDebugRows: debugRows, debugBinding: $debugRows, home: home)
// Owner ruling (2026-11-07): no roster session for the open
// piece → the honest empty presentation below (pass controls
// above stay); a foreign transcript never renders.
if model.activeEntry == nil {
scopedEmptyPresentation
} else {
SessionTranscriptView(model: model, showsDebugRows: debugRows, debugBinding: $debugRows, home: home)
}
case let .crashed(lastPrompt):
crashCard(lastPrompt: lastPrompt)
}
@@ -145,8 +152,75 @@ struct MentorPaneView: View {
// missing-engine states own the no-binary interim.
if binaryPath != nil {
await model.openSession()
// Owner ruling (2026-11-07): the pane hosts the open piece's
// session — launch, first open, and every remount scope
// exactly like a piece switch (the restoring open piece, if
// any).
await scopeToOpenPiece()
}
}
// Owner ruling (2026-11-07): a piece switch re-hosts — the model's
// scope rail resumes the matching roster session or clears to the
// empty presentation; an in-flight turn or pass defers the switch
// to stream end (never torn down mid-stream).
.onChange(of: openPieceTitle) {
Task { await scopeToOpenPiece() }
}
}
// MARK: Piece-scoped hosting (owner ruling 2026-11-07)
/// The open piece in Posts — the hosting scope target. Reuses the
/// Sessions pane's pinned open-piece rail (the same association
/// "New Session on <title>" stamps); nil = unsaved draft, external
/// guest, or nothing open.
private var openPieceTitle: String? {
SessionsPaneView.openPiece(in: posts)?.title
}
private func scopeToOpenPiece() async {
await model.scopeHostedSession(toOpenPieceTitle: openPieceTitle)
}
/// The honest empty presentation: the open piece has no roster session
/// (or nothing is open). The pass bar above stays.
/// Round-7 (sol#30): TWO elements — the caption line + the wired
/// action; the serif heading and the separate Sessions-navigation
/// footnote line died (the caption already names the piece).
/// Round-7 (mercury#5): the block TOP-anchors ~48pt below the pass
/// bar — the centered block split the pane with a ~290px dead zone.
/// Round-8 (sol#2 + mercury#10/13 — FINAL RULING: left-align): the
/// caption + button align to the column's 16pt leading edge, one
/// axis with the pass controls above (centered text read as a second
/// glued region; re-centering stays outvoted — it produced r6's
/// dead zone).
private var scopedEmptyPresentation: some View {
VStack(alignment: .leading, spacing: 8) {
Text(emptyPresentationBody)
.font(.callout)
.foregroundStyle(DesignTokens.muted)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
.frame(maxWidth: .infinity, alignment: .leading)
if model.canStartSession, let openPieceTitle {
Button("New session for this piece") {
Task { _ = await model.newSession(name: "New Session", pieceTitle: openPieceTitle) }
}
.buttonStyle(BorderedSecondaryButtonStyle(minHeight: 28))
.padding(.top, 4)
.help("Start a session on “\(openPieceTitle)” — it hosts right here.")
}
}
.padding(.horizontal, 16)
.padding(.top, 48)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
}
private var emptyPresentationBody: String {
if let openPieceTitle {
return "The mentor pane follows “\(openPieceTitle)” — start one below, or from the Sessions pane."
}
return "The mentor pane follows the open piece — open one to see its session here."
}
// MARK: Header
@@ -167,16 +241,17 @@ struct MentorPaneView: View {
// layout priority.
if case .ready = model.phase, let sessionId = model.activeEntry?.sessionId, sessionId != MentorSessionModel.passTranscriptKey {
Text("session \(sessionId.prefix(8))")
.font(.system(size: 10, design: DesignTokens.mono))
.font(.system(size: 11, design: DesignTokens.mono))
.foregroundStyle(DesignTokens.muted)
.opacity(0.75)
.textSelection(.enabled)
}
}
.padding(.horizontal, 14)
.padding(.horizontal, 16)
// #90: pane heads align at the export's 52px — same height as the
// Posts header and the editor toolbar, so the three hairlines read
// as one line.
// as one line. Round-2 polish: 16 — the ONE leading edge the
// transcript, pass bar, and composer all share.
.frame(minHeight: 52)
}
}
@@ -217,7 +292,9 @@ private extension MentorPaneView {
DisclosureGroup("Technical details") {
Text(model.stderrTail.joined(separator: "\n"))
.font(.system(size: 10, design: .monospaced))
.foregroundStyle(.secondary)
// Round-2 sweep: muted at full ink (0.75 floor) —
// .secondary read fainter than the palette allows.
.foregroundStyle(DesignTokens.muted)
.textSelection(.enabled)
.frame(maxWidth: .infinity, alignment: .leading)
}
@@ -258,13 +335,21 @@ private struct MonoButton: View {
}
.buttonStyle(.plain)
.disabled(disabled)
.opacity(disabled ? 0.45 : 1)
// Round-4 contrast (sol#4/39 + argon#11 + mercury#52): a disabled
// SECONDARY no longer dims the whole button — the ink carries the
// state (see `ink`); solid/outline keep the 0.75 dim.
.opacity(disabled && style != .secondary ? 0.75 : 1)
}
private var ink: Color {
switch style {
case .solid: DesignTokens.surface
case .secondary: DesignTokens.foreground
// Round-7 (argon#37/45 + mercury#45) → Round-8 (sol#1/argon#5 —
// FOURTH round, final): BOTH secondary states render muted #6B6964
// over the same clearly-visible border — full ink when enabled,
// ~65% when disabled. The r7 50% dim read as a ghost, not a
// control; the disabled state explains itself via `help`.
case .secondary: DesignTokens.muted.opacity(disabled ? 0.65 : 1)
case .outline: DesignTokens.accent
}
}
@@ -280,7 +365,12 @@ private struct MonoButton: View {
private var stroke: Color {
switch style {
case .solid: .clear
case .secondary: DesignTokens.border
// Round-7 (final ruling, with `ink`): the SAME clearly-visible
// border in BOTH secondary states — the r5 one-step-stronger
// darkening of border #E8E5DF via foreground opacity (no new
// hex). Ink opacity alone separates enabled from disabled;
// both states stay unmistakably controls.
case .secondary: DesignTokens.foreground.opacity(0.17)
case .outline: DesignTokens.accent
}
}
@@ -303,24 +393,45 @@ private struct PassBarView: View {
var body: some View {
VStack(alignment: .leading, spacing: 0) {
selector
.padding(.bottom, 9)
.padding(.horizontal, 16)
// Round-6 (argon#44): the tab row sits DIRECTLY on the divider
// — the r5 9pt gap left the active underline floating ~10px
// above the strip's bottom edge. The tab's internal 5pt bottom
// padding keeps text off the underline; the underline itself
// lands flush (zero gap).
Divider()
statusLine
.padding(.horizontal, 16)
.padding(.top, 8)
.padding(.bottom, 5)
Text(description)
.font(.system(size: 11))
.foregroundStyle(DesignTokens.muted)
.fixedSize(horizontal: false, vertical: true)
.padding(.horizontal, 16)
.padding(.bottom, 10)
actions
.padding(.horizontal, 16)
// #137: the pass profile's provider has no key — name it and
// offer the way out. A readable-but-keyed profile shows nothing.
if let label = missingKeyLabel {
missingKeyLine(label: label)
.padding(.horizontal, 16)
.padding(.top, 8)
}
}
.padding(.horizontal, 14)
.padding(.vertical, 12)
// Round-2 polish (all three council seats): ONE leading edge — 16,
// the same inset as the header, the transcript's measure pads, and
// the composer below (the tabs/description/actions sat visibly
// deeper in the round-2 shots).
// Round-4 (argon#1/sol#6/mercury#25 — THIRD round on this): the
// padding above was always 16 — but the pane's outer VStack
// centers by default and this bar hugs its content, so the whole
// block rode ~56px in (centered in the 356pt column) while the
// header sits at 16. Claim the full width at leading; the
// declared 16 is now the REAL left edge.
.frame(maxWidth: .infinity, alignment: .leading)
}
/// Contract `.selector`: text tabs — mono 10, uppercase, tracked; the
@@ -357,10 +468,11 @@ private struct PassBarView: View {
}
/// Contract `.status-line`: `PASS N · STATE` — the open piece's Pass
/// State in the library's post-meta voice.
/// State in the library's post-meta voice. Round-4: 11 — informational
/// micro-labels ride the 11pt legibility floor (mercury#52).
private var statusLine: some View {
Text("\(kind.rawValue) · \(stateLabel)")
.font(.system(size: 10, design: DesignTokens.mono))
.font(.system(size: 11, design: DesignTokens.mono))
.tracking(0.8)
.textCase(.uppercase)
.foregroundStyle(DesignTokens.muted)
@@ -457,10 +569,13 @@ private struct PassBarView: View {
)
}
/// #122: why the Blind Read can't fire right now (nil = it can).
/// #122: why the Blind Read can't fire right now (nil = it can). The
/// text names the actual gating condition — the snapshot one mirrors
/// `openPieceHasSnapshot` (latestPassSnapshot: no pass ever ran over
/// the open piece).
private var blindReadBlocked: String? {
guard let posts, posts.session?.postID != nil else { return "Open a post to run a Blind Read." }
guard posts.openPieceHasSnapshot else { return "No Pass snapshot yet — run a Pass first." }
guard posts.openPieceHasSnapshot else { return "Needs a pass snapshot — run Pass 1 first." }
guard model.phase.isReady, !model.isStreaming else { return "The mentor engine can't take the turn right now." }
return nil
}