fix(scene): wire KeystrokeProvider around <Setup> so MaskedInput receives keys under rust mode#999
Merged
Merged
Conversation
…ives keys under rust mode
Closes the keystroke half of the rust-renderer Setup gap (visible
mirror landed in the previous PR). Under REASONIX_RENDERER=rust the
JS process runs Ink with a null stdin (src/cli/ui/scene/null-stdin.ts);
MaskedInput used Ink's useInput, which subscribes to that null stream,
so the masked input received nothing and the fresh-user path was a
hard dead end.
- chat.tsx: the pre-App <Setup> branch is now wrapped in
<KeystrokeProvider reader={keystrokeReader}> — same reader the App
tree already uses, so under rust mode keys come from the spawned
reasonix-render --emit-input child, and under default mode they
come from the stdin reader singleton.
- MaskedInput.tsx: useInput → useKeystroke. The hook already falls
back to useInput when no provider is mounted, so non-rust callers
(none today, but future ones) keep working unchanged.
Refs #868
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the keystroke half of the rust-renderer Setup gap. The visible
mirror landed in #998; this one makes the form actually interactive
under `REASONIX_RENDERER=rust`.
Why
Under `REASONIX_RENDERER=rust` the JS process runs Ink with a null
stdin (see `src/cli/ui/scene/null-stdin.ts`). `MaskedInput` was
calling Ink's `useInput`, which subscribes to that null stream, so
keys never reached the form. Combined with the previously-invisible
Ink stdout, a fresh user with no saved key sat at a completely dead
prompt.
What
`` — the same reader
the main `` tree below it already uses. So under rust mode
keys flow from the spawned `reasonix-render --emit-input` child,
and under the default mode they flow from the singleton
`StdinReader`.
`keystroke-context.tsx` already falls back to Ink's `useInput`
when no provider is mounted, so any future caller that mounts
`MaskedInput` outside a provider keeps working unchanged.
That's the whole change — 15 added / 12 removed across two files.
Result
Combined with #998 (`useSetupSceneTrace` visible feedback), the
`REASONIX_RENDERER=rust` fresh-user path now works end-to-end:
/ masked-input row in the scene frame
back into `MaskedInput` via the provider
Not in scope
end-to-end to confirm both halves work in practice — is a separate
step. The unit tests cover the wiring; the UX needs human eyes.
Ink-only; it's a richer modal and gets its own follow-up.
Refs #868