feat(microblog): post summary for Micro.blog
A piece's `summary:` frontmatter line now travels to Micro.blog beside `category:`. A first send carries the summary when it is not empty; a re-send replaces the post's summary only when the piece has the line (opt-in by key; an empty value clears it; no line leaves the blog's). The same rule as categories, so a piece that never gained the line cannot blank a summary set on Micro.blog itself. The publish sheet gains a Summary field and an AI summary button. The button drafts a first-person teaser from the open piece on a fresh one-shot engine on the chat profile (the Blind Read's rail — the resident session is never touched); the reply fills the field for the writer to edit, and nothing is written until the send stamps the line. The sheet is modal, so while its own turn runs the button is the Stop; a Pass or Blind Read that owns the rail disables the button with the reason on hover and refuses from behind it. The summary is read off the RAW frontmatter line, never through the lenient decode — which trims every edge quote — and the read walks the block the way the lenient reader does. A `split`-based read finds no block in a mixed-ending file while the lenient reader still sees the key, and the empty value it answers would have been sent over a live post's summary. Reviewed twice (two-axis during the build, three-reviewer finish-audit after): the mixed-ending read, an unfenced body line claiming the key, the uncancellable modal turn, and the wrapper rule eating a teaser's edge quotes were found and fixed before this commit. Every guard was watched fail on its own pin. Rail 814/814; SwiftFormat and SwiftLint clean. Docs: AGENTS.md bullets and learnings, the GLOSSARY term, CHANGELOG [Unreleased], PRD S6.1, and the devlog. Closes #208
This commit is contained in:
1 parent
6db4cf8cf1
commit
36393a9e8e
22 files changed
+1096
-36
No files matched your search
@@ -912,14 +912,15 @@ extension MentorSessionModel {
|
||||
return outcome
|
||||
}
|
||||
|
||||
/// The shared ONE-SHOT engine rail (#137 passes, #122 Blind Read): a
|
||||
/// The shared ONE-SHOT engine rail (#137 passes, #122 Blind Read,
|
||||
/// #208 the AI summary): a
|
||||
/// fresh engine on `profile` via the host (spawn → slim handshake →
|
||||
/// body → teardown — never resident past the body's end, even on thrown
|
||||
/// errors), a transient unrostered transcript, one turn. Same lifecycles
|
||||
/// for both riders — the cancel rail (stopStreaming) and the read-only
|
||||
/// for all three riders — the cancel rail (stopStreaming) and the read-only
|
||||
/// composer guard key on the transient entry and need no per-rider
|
||||
/// branches. `name` ("Pass 1" / "Blind Read") composes the entry label —
|
||||
/// callers can't pass a title-inconsistent one.
|
||||
/// branches. `name` ("Pass 1" / "Blind Read" / "Summary") composes the
|
||||
/// entry label — callers can't pass a title-inconsistent one.
|
||||
private func runOneShot(profile: String, name: String, prompt: String, pieceTitle: String) async -> TurnOutcome {
|
||||
guard phase.isReady, !isStreaming, !host.isOneShotRunning, host.binaryPath != nil else { return .failed }
|
||||
let label = "\(name) · \(pieceTitle)"
|
||||
@@ -1276,4 +1277,20 @@ extension MentorSessionModel {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/// #208: the AI summary — a fresh one-shot engine on the museion
|
||||
/// profile drafts a teaser from the prompt; the reply text comes
|
||||
/// back to the caller (nil when the turn did not end normally or
|
||||
/// said nothing). Never rostered, never saved — the caller owns
|
||||
/// where the text goes (the publish sheet's field).
|
||||
func runSummary(prompt: String, pieceTitle: String) async -> String? {
|
||||
let outcome = await runOneShot(
|
||||
profile: ProfileSurface.chat.profileName,
|
||||
name: "Summary",
|
||||
prompt: prompt,
|
||||
pieceTitle: pieceTitle,
|
||||
)
|
||||
guard case let .ended(stopReason) = outcome, stopReason == "end_turn" else { return nil }
|
||||
return Self.draftCandidateText(in: transcripts[Self.passTranscriptKey]?.rows ?? [])
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user