Skip to content

feat(cli): add runtime-backed shell mode and streamline CLI docs - #1971

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/cli-shell-mode-docs
Aug 2, 2026
Merged

feat(cli): add runtime-backed shell mode and streamline CLI docs#1971
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/cli-shell-mode-docs

Conversation

@limityan

@limityan limityan commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add an OpenCode-compatible Shell composer entered by typing ! into an empty prompt. The marker is presentation-only; / remains literal shell input, Escape and empty Backspace exit, chat/shell histories stay separate, and unsupported image or structured-reference payloads fail before submission.
  • Route user-authored commands through a narrow AgentUserShellCommandPort in the Rust Runtime SDK. Core reuses the existing ExecCommand ToolPipeline, permission policy, local/remote workspace ports, cancellation, audit, persistence, and Agentic events; the CLI never spawns the command itself.
  • Extend the private Shared TUI IPC with the closed run_user_shell_command operation and protocol version 12, preserving current-controller, idle, timeout, disconnect-cancellation, and outcome-unknown rules.
  • Streamline the CLI user guide and ownership documentation, and condense the CLI architecture document around durable current-state boundaries.

Architecture and behavior

  • No /shell alias or new slash command is introduced; the entry and exit behavior follows OpenCode.
  • Shell execution is a standard model-visible UserDialog plus ModelRound tool call/result, so Desktop restore and later model context observe the same persisted facts.
  • Explicit user input may auto-approve interactive ask, while static global/project/profile deny rules remain authoritative.
  • The ToolPipeline derives a child cancellation token from the accepted turn token before validation, so cancellation is latched before permissions or process side effects can begin.
  • Shared IPC remains a first-party local TUI adapter, not a public SDK, remote protocol, or generic Tool/process API. Protocol 12 requires a matching Shared Runtime/TUI binary pair.

Validation

  • cargo check -p bitfun-cli -p bitfun-core -p bitfun-agent-runtime-ipc -p bitfun-agent-runtime -p bitfun-runtime-ports
  • cargo test -p bitfun-core --lib --no-fail-fast — 1768 passed, 1 ignored
  • cargo test -p bitfun-core user_shell_command -- --nocapture — 5 passed
  • cargo test -p bitfun-agent-runtime -p bitfun-agent-runtime-ipc --no-fail-fast — passed; IPC 53/53
  • Focused CLI Shell-mode and programmatic-prefill tests — 3/3 passed
  • pnpm run check:core-boundaries and pnpm run check:core-boundaries:test — passed; 32/32 boundary tests
  • git diff --check and local Markdown-link validation — passed
  • Independent adversarial review after implementation — no remaining P0-P3 findings

Full Windows CLI tests reached 600/603. The three failures are unchanged Dispatch workspace/platform tests outside this diff: two require detached workers that currently support only Linux/macOS, and one passes a \\?\\C: worktree path that Git for Windows rejects. cargo check --workspace could not complete in this local environment because src/mobile-web/dist was absent and the sherpa-onnx prebuilt download ended early; the affected crates above pass.

Out of scope

  • Relay behavior, GUI Shell input, public SDK/App Server protocol, generic Tool execution APIs, CI workflow changes, and the unrelated Windows Dispatch failures.
  • No superpowers documentation is included.

Implementation was AI-assisted; testing level is extensive local verification as listed above.

@limityan
limityan marked this pull request as ready for review August 2, 2026 09:05
@limityan
limityan merged commit 6434a9b into GCWing:main Aug 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant