feat(mentor): research & library-light (S8) (#29)
CI / ci (push) Canceled after 0s

The mentor researches mid-pass and its findings arrive as candidate
source-notes with provenance inside their Session. A third museion-
tools tool, submit_research_notes, is the typed rail (ADR-0006
posture): decode-validate only, reply {"received": N}, write NOTHING
— the session is the holding area, and keeping is the writer's act.

Candidates ride the transcript as first-class rows (researchNote):
parsed from the tool call's rawInput by payload shape — the notes
array routes before the fix-card parse, titles are display text —
one row per note, all-or-nothing per batch, the wire's whitespace
rule mirrored so both boundaries agree. Resume re-materializes them
for free: replays re-run the same parse; dispositions reset honestly
(they were never persisted — engine-owned cargo, ADR-0007).

The writer curates in place (full cards in the shared transcript, no
palette — a handful curates where it lands): Keep opens the
ask-before sheet (G9; PromoteAskSheet posture — inline refusal,
buttons kept) and ONE confirm lands one plain markdown note with
provenance into the piece's research/ via writeResearchNote — the
one folder(of:) id lookup anchors it inside this Home, a symlinked
research/ refuses, collision -2; Reject vanishes, recording nothing.
The pass stub names the rail and forbids the engine writing
candidates itself; kept notes flip hasResearch, so every later pass
sees the research/ path (S8.3 at v1 depth).

Finish-audit (three reviewers) drove the whitespace-parity and
shape-routing fixes, the ResearchNoteContent dedup, and a poll-loop
fix for the debounce rig's sidecar half that the larger suite's load
had pushed past its fixed sleep — full suite green (373 tests).

Closes #29
This commit is contained in:
AlexKucera committed 2026-10-22 14:06:16 +02:00
1 parent 9895614b7e
commit b02d36bb5d
22 files changed
+977 -33

No files matched your search

+7 -3
View File
@@ -48,12 +48,16 @@ struct EditorSessionTests {
#expect(session.saveState == .saved) // Changed → flush → Saved lands here
#expect(PostStore.readBody(id: "alpha", home: home) == "# Alpha\n\nOne. Two.")
// Sidecar: written on flush, reads back.
// Sidecar: written on flush, reads back. Await the sidecar rather
// than sleeping a fixed window — same starvation rule as above.
let cursor = PostStore.CursorState(selectionLocation: 3, selectionLength: 2, scrollOffset: 128)
session.cursorUpdate(cursor)
session.edit("# Alpha\n\nOne. Two. Three.")
try await Task.sleep(for: .milliseconds(200))
let restored = PostStore.readCursor(id: "alpha", home: home)
var restored: PostStore.CursorState?
while restored != cursor, ContinuousClock.now < deadline {
try await Task.sleep(for: .milliseconds(20))
restored = PostStore.readCursor(id: "alpha", home: home)
}
#expect(restored == cursor)
}