1.30.0: embeddable interactive-shell controller + web-barrel shell helpers#78
Merged
Conversation
Add CwdMarker, ShellDialect, and the command classifiers (mayChangeCwdOrGit, launchesForegroundProgram) to omnyshell_client_web.dart. These pure-Dart helpers let a browser client drive a pipe-mode shell (prompt, local echo, marker-based completion) reusing the exact logic the CLI uses. Importing them from src/ directly forced the dev compiler (DDC) to pull the package's dart:io modules, breaking `webdev serve`; routing through the public web barrel keeps the browser build clean. Bump to 1.30.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extract the interactive-shell orchestration into a reusable, terminal-agnostic controller so the CLI and embedders (the web client) share one implementation instead of duplicating it. - Add ShellSessionPort (the narrow session surface RemoteSession implements) and InteractiveShellController: prompt priming, command wrapping via ShellDialect, CwdMarker completion/cwd tracking, send-window grants, raw passthrough, and resume-into-alt-screen — calling back to the host (onOutput/onStderr/onPrompt/ onPassthrough) for line editing and prompt rendering. Pure Dart (browser-safe); exported from both omnyshell_client.dart and omnyshell_client_web.dart. - Refactor the CLI's _runInteractiveSession to delegate this protocol core to the controller, keeping only terminal/dart:io concerns (line editor, history, tab-completion, local : commands, raw-mode, SIGWINCH/SIGINT, welcome). stderr stays on fd 2 via the separate onStderr callback; behaviour is unchanged. - Unit-test the controller with an in-memory fake port. Ships in 1.30.0 alongside the web-barrel shell-integration exports. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary (1.30.0)
Two related changes that let a browser client drive an interactive shell exactly like the CLI, and remove the duplicated orchestration:
1.
InteractiveShellController— embeddable interactive shellOmnyShell runs the remote shell as a pipe (no PTY): no prompt, no echo, no completion signal. The CLI's
connectloop supplies that protocol layer, and the web client had to re-implement it. This extracts it into a reusable, terminal-agnostic, pure-Dart controller:ShellSessionPortthatRemoteSessionimplements directly.ShellDialect(CwdMarkertail, full vs ping bymayChangeCwdOrGit), marker-stripping + cwd/git tracking, send-window grants, raw passthrough, and resume-into-alt-screen.onOutput/onStderr/onPrompt/onPassthrough/onExit) for line editing and prompt rendering — the parts that genuinely differ per embedder.omnyshell_client.dartandomnyshell_client_web.dart(browser-safe).The CLI's
_runInteractiveSessionnow delegates its protocol core to the controller, keeping only terminal/dart:ioconcerns (line editor, history, tab-completion, local:commands, raw-mode, SIGWINCH/SIGINT, welcome/closure). stderr stays on fd 2 via the separateonStderrcallback; behaviour is unchanged. Unit-tested with an in-memory fake port.2. Web-barrel shell-integration exports
omnyshell_client_web.dartalso exportsCwdMarker,ShellDialect, and the command classifiers — the primitives the controller builds on. Importing these fromsrc/directly forced the dev compiler (DDC) to pull the package'sdart:iomodules and skip the browser entrypoint; routing through the public web barrel keeps the browser build clean.Verification
dart analyze --fatal-infos --fatal-warnings .+dart format— clean.dart test— all 489 tests pass (incl. the new controller unit tests).dart compile jsof an entrypoint importing the controller via the web barrel — nodart:io.webdev serve(DDC) compiles the entrypoint and the live terminal works against a real hub.Additive (no breaking changes). Ships as 1.30.0.
🤖 Generated with Claude Code