Pwsh
Pwsh hosts PowerShell 7.7 (System.Management.Automation on CoreCLR, .NET 11)
inside an Android application process. There is no Linux userland, no
terminal emulator package and no .NET for Android. The framework's
android.app.NativeActivity loads a host library emitted by the build; the
host starts CoreCLR, serves assemblies from a memory-mapped store, opens a
runspace on the main thread and runs Profile.ps1.
The build is one PowerShell script, setup.ps1. It needs only pwsh; it
restores every input from pinned, hash-verified addresses and emits the APK
itself: ELF libraries, binary XML manifest, ZIP container and APK Signature
Scheme v2 signature. No Android SDK, JDK, .NET SDK, MSBuild or C compiler is
involved.
Artifact contents
| Component | Produced by | Role |
|---|---|---|
libpwsh-host.so |
setup.ps1, named instruction encoders for x86-64, A64 and Thumb-2 |
ANativeActivity_onCreate; starts CoreCLR with an assembly probe |
libassembly-store.so |
setup.ps1 |
ELF image carrying the IL-only assembly store, mapped read-only |
libpsl-native.so |
setup.ps1 |
The native library SMA calls during runspace open |
Dev.MansfieldPlumbing.Pwsh.dll |
setup.ps1, persisted LINQ expression trees |
Managed host: admission, runspace, profile execution |
| 98 assemblies | Pinned NuGet packages, re-emitted IL-only | CoreLib, SMA, command assemblies and their closure; see Payload |
AndroidManifest.xml, ZIP, v2 signature |
setup.ps1 |
Packaging and signing |
Every emitted instruction is decoded back by an independent decoder in the
build and checked against its calling convention. The build fails if any file
outside build/ changes during a run.
Status
| Capability | x86-64 emulator | arm64 device | arm32 device |
|---|---|---|---|
| CoreCLR starts from the owned host (gate 2a) | Proven | Proven | Proven |
| Assemblies served in place from the store (2b) | Proven | Proven | Proven |
| Runspace opens on the main thread (2c) | Proven | Proven | Proven |
Profile.ps1 discovery and execution (2d) |
Proven | Proven | Proven |
| Utility, Management and Security cmdlets import | Proven | Proven | Open |
| Hardware Canvas presenter (diagnostic) | Proven | Proven | Open |
| Console model: 63 conformance vectors on device | Proven | Proven | Proven |
| Interactive terminal, retained UI, IME, recovery | Planned | Planned | Planned |
| Hashing and TLS | Planned | Planned | Planned |
Results for each row are in Established facts and the roadmap. The preview's finish line is a working installed console, an independent graphical pane, Android text input, profile recovery and results for the same release artifact on every backend.
Without ReadyToRun code the JIT compiles the startup path: about 1.0 s from admission to the first script on a Snapdragon 8 Gen 2 device, and about 7 s on the arm32 device.
In this documentation
| Section | Contents |
|---|---|
| Execution model | Where PowerShell runs, where lowered code runs, and when lowering happens |
| Host and runspaces | Startup order, dispatch and isolation |
| Rendering and UI | Composition, frame contract, text input, intents |
| Build Pwsh | Running setup.ps1, its steps and outputs |
| Payload | Every shipped assembly and why |
| Console host and Recovery | Startup modes, the crash-loop breaker, Recovery and private storage |
| Text editing | One editing core with cell and proportional layouts |
| Views and live tiles | Tiles as projections of the runspace, control surfaces, endpoint zones, navigation tree |
| Processes, native bundles and the broker | Running tools, bundling your own native code, updates outside a store |
| Lowering PowerShell to IL | The pipeline, a compiler defect, the IL stack check |
| Working practices | How evidence, tests and optimization are done here |
| Roadmap | Gates, results and planned work |
Source: github.com/MansfieldPlumbing/Pwsh.