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

+61
View File
@@ -131,6 +131,19 @@ nonisolated enum SessionRoster {
}
}
/// Owner ruling (2026-11-07): the Mentor pane hosts the OPEN PIECE's
/// session — this is the pure seam the pane's scoping rides. The roster is
/// newest-first, so the FIRST exact `pieceTitle` match is the newest
/// session for the piece; nil (no open piece, or no match) hosts nothing —
/// the pane's honest empty presentation, never a foreign transcript.
/// Pinned in SessionScopeTests.
nonisolated extension SessionRoster {
static func hostedSessionId(forOpenPieceTitle title: String?, in entries: [SessionEntry]) -> String? {
guard let title else { return nil }
return entries.first { $0.pieceTitle == title }?.sessionId
}
}
/// Pane + bridge state machine. Lazy lifecycle: the engine spawns when the
/// pane opens its first session and stays alive for the app's life (map
/// decision: child lifecycle). The engine bridge is session-agnostic —
@@ -222,6 +235,11 @@ final class MentorSessionModel {
/// #137: a model-change restart requested mid-turn — fires at turn end
/// (firePendingRestartIfRequested), whichever engine streamed.
private var pendingRestart = false
/// Owner ruling (2026-11-07): an open-piece switch that arrived while a
/// turn or pass streamed — fires at turn end
/// (firePendingScopeIfRequested); an in-flight transcript is never
/// torn down mid-stream.
private var pendingScopePieceTitle: String?
/// #137: per-pass readiness (refreshPassReadiness, same-file #137
/// extension) + the injectable read seam (tests). Stored in the class
/// body — extensions carry no stored state.
@@ -574,6 +592,33 @@ final class MentorSessionModel {
}
}
/// Owner ruling (2026-11-07): the Mentor pane hosts the OPEN PIECE's
/// session, never the engine's latest unconditionally — editing one
/// piece must not show a conversation about another. The target is the
/// pure seam's answer over the roster (`hostedSessionId` — exact
/// pieceTitle match, newest first); the switch rides `resumeSession`.
/// No match (or nothing open) hosts NOTHING — `activeEntry` clears and
/// the pane renders its honest empty presentation; the roster is
/// untouched (the Sessions pane stays the unscoped archive). Guards: a
/// streaming turn or in-flight pass transcript is never interrupted —
/// the switch defers to turn end; not-ready is a no-op (the pane's
/// engine states own that path).
func scopeHostedSession(toOpenPieceTitle pieceTitle: String?) async {
guard phase.isReady else { return }
guard !isStreaming else {
pendingScopePieceTitle = pieceTitle
return
}
pendingScopePieceTitle = nil
let target = SessionRoster.hostedSessionId(forOpenPieceTitle: pieceTitle, in: roster)
guard activeEntry?.sessionId != target else { return }
guard let entry = roster.first(where: { $0.sessionId == target }) else {
activeEntry = nil
return
}
_ = await resumeSession(entry)
}
/// Fork the active session (#28): the engine copies its history to a NEW
/// sessionId (session/fork); Museion rosters '<name> (fork)' with the
/// same pieceTitle and activates it with a FRESH transcript — the
@@ -783,6 +828,9 @@ extension MentorSessionModel {
isStreaming = false
// #137: a model-change restart requested mid-turn fires now.
firePendingRestartIfRequested()
// Owner ruling (2026-11-07): a piece switch deferred behind the
// turn fires now too.
firePendingScopeIfRequested()
}
return await turnCore(
client: client,
@@ -918,6 +966,10 @@ extension MentorSessionModel {
isStreaming = false
teardownPassEngine()
firePendingRestartIfRequested()
// Owner ruling (2026-11-07): a piece switch deferred behind the
// pass fires at the verdict — the in-flight transcript was never
// interrupted.
firePendingScopeIfRequested()
}
let pass = ACPEngineClient(binaryPath: binaryPath, profile: profile)
passClient = pass
@@ -1053,6 +1105,15 @@ extension MentorSessionModel {
Task { await respawn() }
}
/// Owner ruling (2026-11-07): a deferred open-piece switch fires at turn
/// end — from BOTH turn-end defers (chat sendPrompt and the pass run),
/// after `isStreaming` cleared, so the scope rail re-evaluates for real.
private func firePendingScopeIfRequested() {
guard let title = pendingScopePieceTitle else { return }
pendingScopePieceTitle = nil
Task { await scopeHostedSession(toOpenPieceTitle: title) }
}
/// Base version of a version string — the part before `+` build metadata
/// (PEP 440 local version segment). `0.21.5+2177.g735e426` → `0.21.5`.
nonisolated static func baseVersion(of version: String) -> String {