feat(sessions): new post from session & drills (S2.7-8) (#30)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
A freeform Session births a Post. "New Post" in the Sessions pane opens an ask-before sheet prefilled with the session's last mentor reply (editable, G9); ONE confirm materializes the piece under projects/posts/ stamped origin: ai - immutable frontmatter, never stats-eligible - and opens it in Posts; a failed write keeps the sheet up with the reason inline and the draft intact. writeNew gains an origin parameter (additive default .writer, every existing caller compiles). "New Brainstorm" is a session started with an opener prompt - no new machinery (beginBrainstormSession over the normal new+prompt rails). The freeform composer (input, liveness, Stop) moved from MentorPaneView into the shared SessionTranscriptView: one conversation surface, two panes - the Sessions pane stops being a read-only transcript. Drill offers (S2.8) wire as one pass-persona section (v1.4): the seeded micro-drill doctrine owns the motivation moment, the two-minute bound, the single shelf, and the vanish - session flavor, no machinery beyond S2.3. Resume now speaks the real adapter wire. Live-probed against the engine: 0.21.5 answers session/load with the id at _meta.hermes.sessionProvenance.acpSessionId and NO top-level sessionId - resumeSession accepts both shapes; every prior real-engine resume misread as "engine does not know this session". The fake ACP server answers load in the real shape (a loadReplayLegacy knob pins the older contract), so the whole resume suite guards the live wire. New pins: draft-candidate extraction (last mentor row wins; thought/ card/research/raw lanes and refusal/connection rows never prefill), ai-stamp write + immutability through overwrite, brainstorm roster + labeled opener, legacy-shape resume. Finish-audit (three reviewers, parallel) converged on the confirm() dismissal that destroyed the edited draft on a failed write - fixed with sheet-local error state (stale-refusal re-show dies with the presentation) - and surfaced the missing brainstorm and legacy-shape pins; the resume fix was flip-verified (removing the provenance fallback fails the provenance pins). Full suite green (379 tests). Closes #30
This commit is contained in:
1 parent
b02d36bb5d
commit
ae234350ef
16 files changed
+521
-128
No files matched your search
@@ -11,7 +11,6 @@ import SwiftUI
|
||||
/// The mentor debug pane: transcript, freeform input, Stop while streaming,
|
||||
/// restart prompt on crash. Post-gate main surface (map decision).
|
||||
struct MentorPaneView: View {
|
||||
@State private var draft = ""
|
||||
@State private var model: MentorSessionModel
|
||||
/// #23 follow-up: opens the Fix Cards palette window (scene "fix-cards").
|
||||
@Environment(\.openWindow) private var openWindow
|
||||
@@ -72,10 +71,9 @@ struct MentorPaneView: View {
|
||||
Divider()
|
||||
}
|
||||
// #28: the transcript rendering is shared — the Sessions pane
|
||||
// reads the same surface in the writing voice.
|
||||
// reads the same surface in the writing voice. #30: the
|
||||
// freeform input + liveness ride the shared surface too.
|
||||
SessionTranscriptView(model: model, showsDebugRows: debugRows, home: home)
|
||||
Divider()
|
||||
inputBar
|
||||
case let .crashed(lastPrompt):
|
||||
crashCard(lastPrompt: lastPrompt)
|
||||
}
|
||||
@@ -157,61 +155,14 @@ struct MentorPaneView: View {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Input + crash card (file-scope extension — type_body_length posture)
|
||||
// MARK: Crash card (file-scope extension — type_body_length posture; the
|
||||
|
||||
// freeform composer moved to the shared SessionTranscriptView in #30)
|
||||
|
||||
private extension MentorPaneView {
|
||||
// MARK: Input
|
||||
|
||||
private var inputBar: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
// Liveness: a pass legitimately runs minutes of silent tool work
|
||||
// (skill loads, learnings) — without this the pane reads as dead
|
||||
// (dogfood #23: "hard to tell if it is still thinking").
|
||||
if model.isStreaming {
|
||||
HStack(spacing: 8) {
|
||||
ProgressView()
|
||||
.controlSize(.small)
|
||||
Text("Mentor is working — Stop to interrupt.")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
HStack(spacing: 8) {
|
||||
TextField("Ask the mentor…", text: $draft, axis: .vertical)
|
||||
.textFieldStyle(.plain)
|
||||
.lineLimit(1 ... 4)
|
||||
.onSubmit { send() }
|
||||
Button {
|
||||
send()
|
||||
} label: {
|
||||
Image(systemName: "arrow.up.circle.fill")
|
||||
.font(.title2)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.disabled(draft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || model.isStreaming)
|
||||
if model.isStreaming {
|
||||
Button {
|
||||
model.stopStreaming()
|
||||
} label: {
|
||||
Text("Stop")
|
||||
}
|
||||
.controlSize(.regular)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(12)
|
||||
.disabled(model.phase.isReady == false)
|
||||
}
|
||||
|
||||
private func send() {
|
||||
let text = draft
|
||||
draft = ""
|
||||
Task { await model.sendPrompt(text) }
|
||||
}
|
||||
|
||||
// MARK: Crash → restart prompt (map decision: EOF/crash surfaces an
|
||||
|
||||
// in-pane Restart prompt; the transcript replays from the engine (ADR-0007)
|
||||
// in-pane Restart prompt; the transcript replays from the engine, ADR-0007)
|
||||
|
||||
private func crashCard(lastPrompt: String?) -> some View {
|
||||
VStack(spacing: 14) {
|
||||
|
||||
Reference in new issue
Block a user