Skip to content

Reply box: its stores, files, recipients and voice are handed in - #4165

Merged
backnotprop merged 9 commits into
mainfrom
refactor/inbox-reply-box-seams
Nov 28, 2026
Merged

backnotprop merged 9 commits into
mainfrom
refactor/inbox-reply-box-seams

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

What it is for

The Spaces app is to show Inbox threads with the Inbox's own reply box, not a copy. Step 1 (#4044) made the box its own view (components/reply/ReplyBox.tsx). This is step 2: the box and the parts it draws take their stores, files, recipients, voice and skills from the host. A second box on the same page, or another host, then shares no words, drafts, files or recipients with the Inbox's. Everything stays inside packages/inbox. Nothing moves to @plannotator/ui yet.

Nothing a person sees changes, and how that is proved

  • components/reply/replyBoxParity.test.tsx compares the thread's foot byte for byte with 12 fixtures captured on main. It passes after every commit, and the fixtures are not touched.
  • The Inbox's wiring passes exactly what it showed before: the placeholder words, its skills, its voice, its recipient rules (typed tags count toward the cap) and its own Send checks.
  • Reply DOM tests run locally, all green: replyFocusOnOpen, replyDraftNeverLost, sendAlwaysEnds, endedSession, replyFootPhone, paneFailureKeepsReply, replyRecipient, voiceMirror, voiceKeptWords, pickerOpensOnTyping, floaters, plus the unit tests replyDraftLanding, machineDrafts, replyRecipients, tests/inbox-structure and the DOM allowlist. tsc for packages/inbox and packages/core passes.

Inventory (what the box reached at module level on main)

Where What Now
replyDraft.ts:81-358 21 module variables (conflicts, offers, failed words, carried file changes, files landing, Sends on their way, the restart-guard count, the localStorage mirror) and the free functions over them inside createReplyDraftPage(); the Inbox's page is inboxReplyDraftPage, and its members keep their old export names
replyDraft.ts keptHere / replyWordsKept.ts words no draft holds, kept in localStorage a page made with keepInBrowser: false writes and reads none
ReplyBox.tsx:30, ComposerField.tsx:41 → VoiceMic → voice.ts → voiceRecorder / voiceSession / voiceAudio every box loaded the recorder voice comes only through components/reply/replyVoice.ts
ComposerField.tsx useSkillReferenceAutocomplete (ui skillCatalog: module transport and cache, fetch('/api/skills') by default) always on the field's skills={false} turns it off: no list and no catalog read
ComposeFiles.tsx fromUpload a reloaded draft's image had no preview DraftFileUploader.previewUrl?(uploadId) (core), absent in the Inbox
ReplyBox thread: InboxThread used only for its id and the replaced-question notice threadId and the changedNotice slot
ReplyBox recipientPill (a node built in Thread) the box could not own who gets the reply recipients as data, onChange(to: readonly string[]), maxRecipients
Still module-level (not changed) threadMentions.ts maps keyed by thread id (two fields on the SAME thread collide), remoteReplyWords, replyDraftHeldOffer, replyWordsKept, lostDraftFiles, lateVoice, sessionAdopt; skill catalog cache, voice settings, textSize, faces stores (via AuthorMark), the page drag counter in ComposeFiles listed for step 3

Each seam and its Inbox default

  1. Words store: replyText was already per box (useReplyTextStore). Default: Thread.tsx.
  2. Draft page: createReplyDraftPage({ keepInBrowser }) returns useReplyDraft(threadId, { store }). Default: inboxReplyDraftPage. Its body keeps the module's indentation, so git diff -w is small.
  3. Files: useComposeFiles(…, { uploader }) over a DraftFileUploader. The new optional previewUrl(uploadId) gives the preview of a reloaded image. Default: the HTTP uploader, which has no previewUrl, so a reloaded tile still shows its icon.
  4. Recipients: ReplyBoxRecipients, drawn by components/reply/ReplyBoxRecipients.tsx with the Inbox's own control.
    • Pressing a name sends to that agent alone. A tick adds or removes an agent.
    • maxRecipients: 1 gives the list's single-pick mode, with no ticks. When unset, the cap is RECIPIENTS_MAX: what a draft holds, and what the Inbox did before.
    • Default: Thread's rcptBox.
  5. Voice: voice?: { handle, parts }. Without it there is no microphone, no voice line and no voice in the field.
    • The field's body is now ComposerFieldBase.tsx, with no voice import. ComposerField.tsx's InboxComposerField passes VoiceMic's parts, so every other composer is unchanged.
    • Entry: packages/inbox/components/reply/replyVoice.ts.
    • Default: Thread passes replyVoiceParts.
  6. Skills: skills?: { onOpen, noneHint, filter, commands }. Without it there is no Skills button, no / list and no catalog read. placeholder is a prop; the Inbox passes its current words.

onAttachFiles is optional (no paperclip without it).

The Send guards

  • A debounced save after Send has cleared the draft: guarded on main. claim() flushes the waiting save, stops the timer and marks the thread claimed. sent() stops the timer again. A queued save exits on the generation check.
  • Saves while a Send is in flight: guarded on main. save() returns while the thread is claimed.
  • Both live in useReplyDraft, which every store goes through. A new test runs them over a host's store.
  • Send while an upload runs: on main, only Thread's send() refused it. Now the box itself refuses: a press while a file uploads calls onSendWhileUploading, never onSend. The Inbox passes its own send() there, so the same checks run in the same order and the same words show.

New tests

  • components/reply/replyBoxSeams.test.tsx (8 tests):
    • two boxes on one page share no words, files or recipient list;
    • multi-pick when maxRecipients is unset, single-pick at 1, and a cap at 2;
    • with no voice and no skills: no microphone, no Skills button and no catalog read; with skills given, the list is read;
    • the host's preview of a reloaded image;
    • Send is held while a file uploads.
  • components/reply/replyDraftPages.test.tsx (3 tests): two draft pages share nothing; keepInBrowser: false writes no localStorage; the Send guards hold over a host's store.
  • components/reply/replyBoxVoiceSeam.test.ts (3 tests): walks the static imports and checks that ReplyBox reaches no voice module. It failed on 5 import chains before this change.

Sizes

  • Thread.tsx: 5695 lines, was 5705. Its ceiling is lowered to match, as the structure test requires.
  • api.ts, App.tsx and Settings.tsx are unchanged.
  • replyDraft.ts: 1473 lines. The option types moved to replyDraftOptions.ts.

Left for step 3

useReplyComposer: the controller that still lives in Thread.tsx (the draft hook, the files hook, send, aim, the keyboard Send). Until then, a host wires those hooks itself, as the test's Host does. A keyboard Send runs through the host's onFieldKeyDown, so the in-box upload guard covers only the button.

Not verified

  • No browser run, and no host bundle was built. The lazy use of the voice entry from another host is shown only by the static graph.
  • The module state that is still shared (listed above) is unchanged.

…viewUrl); without one a reloaded tile shows its icon, as before
…ets it, with an optional most (maxRecipients)
…otice are handed in; skills and the paperclip only when given; Send waits for uploads in the box
…; the box and its field load no voice code without it
…nd capped recipients, no voice or skills, host previews, Send held by an upload
… under 1500 lines); Thread.tsx's ceiling follows it down
@backnotprop backnotprop added the ci:e2e Run the full browser suite (Inbox window e2e) on this PR label Nov 28, 2026
@backnotprop
backnotprop marked this pull request as ready for review November 28, 2026 05:56
@backnotprop
backnotprop merged commit 1964c3e into main Nov 28, 2026
63 checks passed
backnotprop added a commit to bendrucker/plannotator that referenced this pull request Nov 28, 2026
…panel swipes and the HTML viewer's lost highlights

ui 0.67.0 and core 0.25.35 went to npm on 2026-11-28 with package files
that match the v0.29.6 tag (c21f65e), so this pair carries what merged
after v0.29.6, up to v0.29.7.

core 0.25.36 is additive: the linked mark "decisions" and
InboxDecision.machine (backnotprop#4066), DraftFileUploader.previewUrl (backnotprop#4165), and
holdingsOf no longer counting a question Mark read closed (backnotprop#4160). No
exports subpath changes; nothing removed.

ui 0.68.0 is a minor: Escape while an input method composes only ends the
composition, and shortcuts skip such keys; holdsImeEscape is new (backnotprop#3689,
backnotprop#4162). HtmlViewer treats a collapsed live Range as lost (backnotprop#4152). Compact
panels: OverlayScrollArea scrollMemory, SidebarContainer closing and
scrollPositions, ActionMenu compactEdgeSwipe, four new hooks and the panel
rules in theme.css (backnotprop#2861). useLaunchAnnouncement waits for ready (backnotprop#4067).
ui uses nothing new from core; its exact pin follows so a host gets one
core. Publish core first.

README and HANDOFF name the new pair, and HANDOFF adds what the published
0.25.35 / 0.67.0 already held beyond their notes (backnotprop#4114, backnotprop#4151).

bun.lock is bun install's own output: the two package version lines, and
six app workspace version lines (0.29.5 to 0.29.7) the release bumps left
behind.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:e2e Run the full browser suite (Inbox window e2e) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant