main
12
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f49e4b6ca0 |
refactor(settings): provider facts as data
CI / ci (push) Canceled after 0s
#181: ModelProvider is the provider-descriptor table — label, effort ladder, flagship, endpoint, env var joined by wire dialect (chat/models paths + the SSE decoder selector), auth mode (Bearer vs Anthropic's header pair), keyless (nous rides the Portal login), and the ONE trailing-slash endpoint trim. The probe's URL builders, auth headers, and stream-decoder picks select by data; the per-dialect bodies and decoders stay separate functions, not switch clothing. ProviderCredential.resolve is the ONE credential rail (provider key, else the shared Portal session key for keyless providers — official endpoint ONLY, never a user-set URL). Settings' Test Connection and the new PassReadiness module both call it; the twice-implemented #175 fallback can no longer drift. One deliberate tightening, reviewer- blessed: a nous pass profile on a custom base_url with no pasted key now reads missingKey where the old session-model fallback said ready — the old copy had no endpoint gate at all. Pass readiness leaves the session model (PassReadiness.swift maps each pass surface to ready/missingKey/unknown over the descriptor; MentorSessionModel stores the verdicts and reads no keys or auth files). runPass and blindRead run their guards through one shared rail (guardOpenPieceRun) — identical refusal strings, blockers named honestly. No app-side model-settings store (ADR-0014 red line). Rider: the #179 mid-pass repoint pin polls the rig's hasHeldPrompt before releasing the held turn — runningPass flips before the one-shot engine parks its prompt, so firing into that window false-failed under parallel-suite load. Full suite 668/668 (xcresult executed count). Finish-audit: three reviewers (ponytail/security/general), zero findings above LOW; two ponytail trims and one pin tightening applied. Closes #181 |
||
|
|
218e2db397 |
refactor(posts): one frontmatter read/write codec
CI / ci (push) Canceled after 0s
#180: one PostFrontmatter module now owns the lenient read (parse/split/decoded) and every write posture — fresh stamp, merge-import, update-keys — behind one known-key table (type, pass_state, origin; one insertion order). The three near-twin walkers are deleted byte-identically: PostStore.stamped/splitFrontmatter/ mergedFrontmatter, LearningDecay.stampingFrontmatter, Post.frontmatter(of:) — 21 call sites swept across seven production files and eight test files. The Unaided First Draft eligibility is named once and consumed by both gates: isUnaidedFirstDraftPair (writer ∧ post — the scan's read-back gate) and isCaptureEligible (pair ∧ First Draft — the capture gate at pass invocation). The lenient ?? default stamp decode is extracted with it (the third copy's deferred extraction). One deliberate divergence from the absorbed writer, doc-commented and pinned: mergingImport now preserves hand-edit lines above the opening --- on import where the old split-first shape silently dropped them — lossless through every posture is the ticket's contract. Seven codec pins (PostFrontmatterTests) cover the posture round-trip (foreign keys verbatim through import → save → advance → micropub), the lenient unknown-type decode, and the predicates' truth table. Existing pieces are untouched on disk: every posture moved verbatim and the full suite pins the byte shapes (664/664 green; the one under-load flake in the #179 repoint pin is pre-existing on main, proven by a stashed-tree control run). Closes #180 |
||
|
|
5bf09552f6 |
refactor(posts): route every library write through one rail
CI / ci (push) Canceled after 0s
#179: every library-reflecting store write (draft save, session-born post, rename, move to project, archive/restore, trash, convert, project creation, import batch, pass advance) now rides one internal seam — performWrite pairs the write with exactly one rescan and owns the error strip (cleared BEFORE the write so importFiles' per-file failure messages survive the success tail; a nil-Home refusal writes nothing). The model owns the Home: watchedHome is private(set), set only by bind (construction + the Settings repoint); no public method takes a Home parameter — 14 view call sites and ~115 test call sites swept, dead home plumbing cut. The editor's debounced flush, the card closes, the pass substrate and the micropub publish stay off the rail by design (own error semantics, no library regroup). A converged review finding is closed with a guard: the pass advance re-resolves watchedHome after the engine's minutes-long turn, so a mid-pass Settings repoint now refuses the advance with an honest strip message instead of silently stamping pass state into the repointed library (wrong-piece write on a slug collision). createProject failures now surface in the sheet AND the strip — the rail-owns-the- strip posture supersedes the #108 sheet-only rule. Five rail pins (PostsModelWriteRailTests, suite members): write → one library refresh + strip cleared, failed write owns the strip, nil-Home refusal, import batch keeps per-file messages, mid-pass repoint refuses the advance — the last two flip-verified against their guards. ScriptedEngine gains endHeldPrompt (release a held turn as ended). Verification: suite 657/657 the evening this landed; the next-morning re-run could not start — both test runners hung before establishing connection (#134 testmanagerd wedge; an untouched control suite hangs identically — machine state, not this diff; reboot pending). Rail pins 5/5 isolated after the last test-only edit; swiftlint at baseline parity; swiftformat clean. Closes #179 [Generated by AI] |
||
|
|
627ecf515e |
refactor(session): extract the engine host
CI / ci (push) Canceled after 0s
Engine lifecycle policy — spawn, handshake, respawn-on-crash, teardown, and the per-surface residency rules (resident chat engine; one-shot pass engines spawned per run, torn down at the verdict, ADR-0014) — moves out of MentorSessionModel into EngineHost behind the EngineTransport seam. The model keeps session + turn coordination and stays the only observable the panes see; ACPEngineClient becomes the seam's production adapter, and a scripted in-process engine (ScriptedEngine) becomes the second adapter — engine-behaviour tests (streaming, crash, cancel, restart, per-surface spawn) now run without child processes, retiring the zsh fake-server rigs from logic tests (#30 flake family). Exactly one real-process wire smoke per LLM surface survives (chat two-act + parameterized pass1/pass2): the held-turn cancel contract, hung-child SIGTERM teardown, handshake, streamed turn, crash, restart. One-shot teardown is structural (withOneShot closes at body end, every exit path); the one-shot slot is claimed before the first suspension so the at-most-one invariant holds across the spawn/handshake awaits. Suite: 652 executed / 652 passed / 0 failed (653 argument cases), counted from the xcresult; swiftformat idempotent, swiftlint clean on touched files. Closes #178 |
||
|
|
d14cb40e73 |
refactor(session): type the transcript rail
CI / ci (push) Canceled after 0s
SessionRow text rows carry (body, speaker, notice) as data — agent/
user/system plus refused/interrupted/connectionLost/kickoff/failed/
plain — typed at every append site; no stored row holds a speaker
prefix (pinned). The two wire-only classifications are sniffed once at
the append seam: a replayed pass kick-off ('Pass Pass N…') and the
engine's 'Operation interrupted:' notice. The transcript view, the
writing-session filter, and the New Post prefill switch on typed data;
rendering is identical (refusal/connection-lost rows stay agent prose
by pinned render).
Fix Card and Research Note payloads decode through one shared
ToolPayloads decoder: lenient for the transcript rail (both the nested
card-rail shape and the flat #14-era fake kept), strict for the
museion-tools MCP trust boundary with named CardErrors. Three
intentional wire tightenings at the strict entry: empty cards/notes
arrays throw instead of no-op succeeding, the camelCase
diagnosticQuestion alias is rejected (schema is snake_case), and
decode failures answer short named errors instead of DecodingError
dumps. quote/note type parity restored (present-but-wrong-type throws).
Every wire-shape fact is pinned in ToolPayloadsTests.
Full suite 653/653, swiftformat/swiftlint clean. Audit flip-verified.
Closes #177
|
||
|
|
4724e00b73 |
feat(mentor): native deslop lint as fix cards (#6)
CI / ci (push) Canceled after 0s
PRD S3.4: the deslop doctrine's deterministic findings — banned-vocab tiers and em-dash density — are now computed in Swift at pass invocation, one line after the #31 stats capture, with no engine round-trip. Findings land as real fix cards (emitter lint) through FixCardStore, so they render in the existing palette with ask-before Apply on mechanical mapping cards; mapped phrases (the skill's verb swaps + #31, e.g. utilize→use) case-match their anchor per ADR-0006, everything else closes Done/Skip. One card per phrase over its tier allowance, whole-word case-insensitive matching (delved never fires delve), em-dash density card first when over budget; emit dedups against OPEN cards so re-runs make progress and the engine never re-cards a live lint finding. The tiers ship as data (Resources/deslop-lint.json mirroring the deslop skill verbatim — key/landscape/highlight/bare-underscore omitted as POS-ambiguous) with a <home>/deslop-lint.json override that wins whenever it exists and decodes: trivially editable without a recompile. Finish-audit fixes folded in: whitespace-only override phrases can no longer silently kill a whole submit (the guard mirrors the store's trimmed validation), and submit now refuses a symlinked cards/ dir (promote's posture — the lint auto-fires it every Run Pass). Suite 489; one EditorSession load-flake cleared in isolation and on the idle re-run. Closes #6 |
||
|
|
1c697440d8 |
feat(mentor): per-surface engine lifecycle (#137)
CI / ci (push) Canceled after 0s
Profiles S4: passes run on their OWN one-shot engines — `hermes acp -p museion-passN` spawns per pass run and tears down at the verdict, so a model switch costs nothing (the next spawn reads fresh config). The verdict streams into a TRANSIENT unrostered transcript (#129's ruling: one Sessions surface over the chat engine; a rostered pass session would be unresumable by the chat engine). `beginPassSession` died with it — passes never mint sessions; the #28 roster pins flipped to the transient posture. The chat engine stays resident (adopted museion profile): a Chat model change in Settings fires onChatSurfaceWrite after a successful chat-surface write only, wired to requestRestart — re-spawn in place when idle (resuming the pre-restart active session), deferred to turn end while any turn streams (#129). Missing-key posture (#132): refreshPassReadiness reads both pass profiles' providers and their .env keys at pane entry; Run Pass disables naming the provider with an Open Settings link, .unknown never blocks, and the guard refuses before anything touches disk. Finish-audit (ponytail/security/general fanout) applied: the general reviewer's Medium — a session/new/load/fork completing mid-pass stole the active surface and lost the Cancel to the wrong engine — fixed with ONE claimActive gate across the post-await activation writers, pinned deterministically via the fake's loadReplayHold park + a mode-file flip (flip-verified: guard off fails on the steal observables and the misrouted-cancel hang). Also fixed: a spawn-window cancel loss in stopStreaming (keyed on the transient entry, not the late-arriving wire id), and a PRE-EXISTING rescan bug where a stale scan snapshot "vanished" a just-opened piece and killed its session, cancelling the edit debounce — the vanish-kill now re-checks disk and the watched home. Ponytail cut ~59 lines of test duplication; the app target's only force-unwrap is gone. Suite 477 (was 472): EngineLifecycleTests new (own-engine end-to-end, held-pass cancel, idle + deferred restart ordering, readiness, steal pin), +3 Settings hook pins, one duplicate pin deduplicated. swiftformat clean, swiftlint at HEAD baseline. Closes #137 |
||
|
|
42bcfce9ba |
feat(stats): first-draft stats capture (S5.1) (#31)
CI / ci (push) Canceled after 0s
Measure the writer, not the text. Running Pass 1 or Pass 2 on an unaided draft (origin: writer, First Draft Pass State, post type - lenient defaults, so bare legacy posts qualify) computes four style metrics natively in Swift at the invocation - before the engine sees anything - and stamps stats_captured plus four stats_* values into the piece's frontmatter in place, so the S5.2 trend view is a plain scan of Post.frontmatter. Capture re-fires while still First Draft (latest draft wins); a cancelled pass keeps its capture; ai-origin and advanced pieces never qualify. The capture exposed an erasure class: the existingStamp-to-stamped block rewrite rebuilt frontmatter from three parsed fields, silently dropping everything else. advancePassState and overwrite now update their owned keys in place (stampingFrontmatter, widened internal per its own third-caller trigger; bare posts still normalize through stamped), so captured stats and foreign YAML survive pass completion AND mid-pass editor saves. Both fixes are flip-verified by pins. DraftStats carries the four metrics (burstiness, type-token ratio, sentence-length variation, trigram repetition) as a pure Foundation model - full precision out, %.3f at store time. 16 new pins across DraftStatsTests, PostStoreTests, and PassRunTests; full unit bundle 396/396 (sequential gate; parallel runs flake under external CPU load per the #30 learning). Finish-audit fanout (ponytail/security/ review) ran on the diff: its MEDIUM (overwrite erasure) and the converged deletions landed here. Closes #31 |
||
|
|
9895614b7e |
feat(sessions): session lifecycle UI (S2.3) (#28)
CI / ci (push) Canceled after 0s
Each Session is a conversation Museion UIs, never owns. The mentor bridge hosts multiple engine-owned sessions: per-session transcripts keyed by wire sessionId behind same-named proxies (every existing caller compiles unchanged), a names-only roster at Application Support/sessions.json (0600; id/name/pieceTitle/date — the words stay engine-owned per ADR-0007), and the standard affordances over the wire: session/new, session/load, session/fork, compact as the /compress slash prompt, session/cancel as the Stop rail. The Sessions pane replaces its placeholder: roster list (piece- associated by name when Posts has an open piece), row-click resume with the engine's full-history replay (user turns included), Fork · Compact, live streaming with Stop; every pass auto-creates its rostered session and streams into it; the transcript renderer is shared with the mentor pane. Notification hops ride the main queue (FIFO with the continuation resume) so the adapter's replay-before- response contract is guaranteed, not probabilistic. Resume refusals are honest and entry-attributed (an engine-unknown session never fabricates history); concurrent replays refuse instead of interleaving; restart replays from the engine rather than trusting a diverging local copy. Finish-audit (three reviewers) surfaced the concurrent-resume race, the dead restart branch, the runPass guard window, the 15 s session/load default, and the missing createSession backstop — all fixed and pinned (12 lifecycle pins; 359 tests green). Closes #28 |
||
|
|
154bb8a114 |
test(mentor): cancel-ack fake + deferred teardown
CI / ci (push) Canceled after 0s
The fake ACP engine's hangOnPrompt mode slept oblivious to session/cancel, so a cancelled turn was only observable through teardown and the pass bar's Cancel rail was never individually discriminated. hangOnPrompt now holds the turn reading: session/cancel answers the hanging prompt with stopReason "cancelled" (the real engine's contract); stdin EOF without a cancel answers end_turn so the child exits. New pin 'cancelling a held pass ends the turn cancelled with no advance' (RED->GREEN; bounded polls, so an emptied cancelPass fails the pin instead of hanging the suite). Every fake-spawning test (27 rigs across ACPClientTests + PassRunTests) tears down via defer at rig creation — a cancelled or interrupted test cannot leak the child; trailing happy-path teardowns removed, mechanism/bound teardowns kept and commented. Harness docs updated to match; 316 tests green. Closes #124 |
||
|
|
78f6bb2dba |
test(mentor): pin runPass guard matrix (#24)
CI / ci (push) Canceled after 0s
The pass rails landed in
|
||
|
|
683ddf8426 |
feat(mentor): museion-tools MCP server (#23)
CI / ci (push) Canceled after 0s
Headless --serve-mcp role in the app binary: NDJSON JSON-RPC on stdio exposing query_learnings and submit_fix_cards (ADR-0006 cards, anchor-validated; stale lands flagged, never rejected), registered into the museion profile at provisioning. Cards persist per piece under <piece>/cards/ and surface in a floating Fix Cards palette with pass-stamped provenance. Live dogfood drove the shape: session/prompt waits pass length (the 15 s request default abandoned working turns), a liveness row and a persisted Debug checkbox (off) split writing sessions from debug chatter, the verdict references findings by title only while the cards carry the detail (persona v1.3 — tools work in silence), and the #24 pass rails (pass bar, TurnOutcome seam, snapshots) ride in. Three-reviewer audit round: piece-path shape guard closes the JSON-drop and substring-oracle holes, nested submit rawInput parsing (the flat parser never matched the live rail), missing stopReason never advances a pass, 1 MB stdin cap, card scan off MainActor. 296 tests green; every behavioral fix flip-verified. Closes #23 |