Repository navigation
Implement scoped audiences and actor projections - #49
Conversation
j2msReginaldBot
left a comment
There was a problem hiding this comment.
Approving: I found no blocking defects. I reviewed head 4997bd49144b5a7ca5d9edabcaafd6b535f2eafd against base dd91b532c9bea3af0e36a7f413f68549dbc5df1f.
What I checked
parsePerformance: precedence, outside-base recipients, actor-own perception, fallbacks, escaping, nesting and unclosed scopes, and atomic rejection. I also probed edge cases directly. Both documented examples produce the expected per-observer projections.- Every path that feeds a model or memory reads the observer's projection only:
inspectActorContext, which now re-projects even a caller-suppliedturnssubset;branch-episodeclosure generation;candidate-routing;projectPerceptions; and the Reverie source builder, which dropsrecipientsfor scoped turns. I found no remaining consumer oftranscriptoraudience.includesthat sends authored text to a model. - Body corrections persist fresh projections and reject routing changes (
correctScopedPerformance). The archive verifier recomputes both the message performance and the correction performance, so forged spans or projections are rejected. - The CLI and HTTP scoped paths skip the presence-roster fallback.
commitManualTurnstill checks the expected head, after the idempotent replay check. The DSH client journalsrequestIdandexpectedHeadbefore sending, and the server uses them ascommandIdandexpectedHead. - Locally,
lint,tsc --noEmit,node --test tests/*.test.ts(504 tests: 501 pass, 3 skipped, 0 fail) andsmokeall pass on Linux at this head. I ran no browser or live-model check.
Minor notes (non-blocking)
- An empty primary span drops the actor from their own turn. With base
[mara, nell]and the fallback opt-in,#Mara(|she nods)is accepted. The canonical audience is["nell"]: the performing actor and the named recipient Mara get no projection or perception, and Nell gets the fallback. Consider rejecting a fallback scope with a blank primary, or a turn whose actor projection is empty. - Elision leaves visible gaps. With base
[mara, nell],Hello #Mara(secret) worldprojectsHello world(two spaces) to Nell. This matches the documented rule of preserving internal spacing, but it hints at hidden text in model input. Collapsing whitespace at span boundaries in non-recipient projections would remove the hint. Alternatively, accept this as a deliberate authoring responsibility. - A legacy Stage history edit turns a null base into "actor only".
stage-history.tsopens a scoped turn withaudience: baseAudience ?? []. If the original turn had no base (all scoped spans), an edit that adds unscoped text is delivered to the actor alone instead of failing with "Choose a default or turn audience". This narrows delivery rather than widening it, so it is safe, but it differs from the "never silently fall back" rule. I found this by reading the code; I did not exercise it in a browser.
j2msReginaldBot
left a comment
There was a problem hiding this comment.
Re-reviewed 522d6af (base dd91b53), which covers the three earlier notes. Approving.
- Empty primary: fixed.
parsePerformancenow rejects a fallback scope with a blank primary. My earlier probe#Mara(|she nods)now fails with "An observer fallback requires a nonempty primary performance." - Double spaces: resolved by documentation. Whitespace stays under the author's control, and the doc shows
Hello #Mara(secret )worldas the authoring pattern. That is reasonable. - Null base in history edits: fixed. The Stage and DSH historical editors now keep a null base for an entirely scoped turn and offer an explicit "Only the actor" / "Use actor-only base" choice. The Stage editor validates the text with
parsePerformancebefore submitting, andvalidateAlternativeRequest,buildAlternativeCommitand the archive verifier acceptaudience: nullonly together withaudienceSyntax.
Locally at 522d6af: lint, tsc --noEmit, node --test tests/*.test.ts (508 tests: 505 pass, 3 skipped, 0 fail) and smoke all pass.
One new minor issue (non-blocking). The DSH historical editor can now hold form.editedAudience === null, but the speaker-change handler still calls form.editedAudience.filter(...) (scripts/dsh-gui-spike/client.js:806). Opening an entirely scoped turn and choosing another speaking character therefore throws a TypeError, and the speaker is not updated. A guard such as form.editedAudience?.filter(...) ?? null would fix it. I found this by reading the code; I did not exercise it in a browser.
j2msReginaldBot
left a comment
There was a problem hiding this comment.
Re-reviewed 55f0616 (base dd91b53). Approving; no open findings remain.
The speaker-change handler now uses form.editedAudience?.filter(...) ?? null, so an unresolved base stays null instead of throwing. The new tests/dsh-history-editor.test.ts renders the real client.js component and covers three cases: unresolved, explicit actor-only, and selected base. In each case it changes the speaker and checks the editedAudience sent with history-edit-next.
Locally at 55f0616: lint, tsc --noEmit, node --test tests/*.test.ts (511 tests: 508 pass, 3 skipped, 0 fail) and smoke all pass. No browser check was run.
Perform previously delivered one text body to its entire audience. It now accepts
@Corin, a leading#Mara,Nell, and flat#Mara(text)scopes within one atomic, branch-bound turn. Closing a scope restores the base; outside-base recipients receive only their named spans, while the actor retains their own primary performance.The maintained DSH composer and legacy workbench keep an explicitly selected, visible default across turns. Typed actor/turn overrides do not modify it; opening another context resets it.
#Mara(primary|fallback)is supported behind explicit opt-in and remains an unratified product extension. Parentheses balance, literal delimiters can be escaped, and unresolved identities or malformed scopes reject the whole turn without widening delivery.Resolved spans and per-character projections persist with accepted turns. Context, runtime input, perceptions, closure callbacks and standalone Reverie source/reflection use only the observer's projection, omitting unperceived turns and hidden scope metadata. Delivery changes neither presence nor access and does not establish a claim's truth. Legacy turns remain literal. Generated candidates retain their existing routing contract; transcript visual redesign is outside scope.
Core, HTTP, CLI, DSH Perform, legacy Stage recovery, historical replacements, body-only corrections and archive validation are integrated. Body-only corrections persist fresh projections while preserving audience structure; routing changes require replacement turns. DSH journals the exact acceptance identity, branch head, default and syntax before transmission and exposes Retry pending performance. Lost-response retries cannot duplicate or rebind the occurrence to newer input/defaults.
Fallback scopes require nonblank primary content. Historical editors preserve a null base through opening, recovery and replacement; shared text requires an explicit base or turn audience. This applies to both DSH and the legacy workbench. Authored whitespace remains unchanged; the scope guide shows how to include connective whitespace in a private span so its omission leaves no gap.
The DSH historical speaker control also preserves a null base when changing characters. Handler-level regression tests cover unresolved, explicit actor-only and selected bases, including the submitted replacement request. Current focused validation passes 18 tests plus lint and TypeScript.
Validation:
Supersedes the closed documentation-only handoff in memrok-com/reverie#30. The implementation belongs in Doxvelt; Reverie's public Rust/JSON-lines contract is unchanged.