Skip to content

feat(mobile): compile TypeScript cores and services for mobile targets - #346

Merged
ctate merged 3 commits into
mainfrom
mobile-ts-apps
Aug 13, 2026
Merged

feat(mobile): compile TypeScript cores and services for mobile targets#346
ctate merged 3 commits into
mainfrom
mobile-ts-apps

Conversation

@ctate

@ctate ctate commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

TypeScript apps now build and run on mobile. The engine already ran on iOS and Android for Zig-core apps; the pinned scriptc 0.0.29 compiles library archives for aarch64-apple-ios, aarch64-apple-ios-simulator, and aarch64-linux-android. This connects the two.

Changes

  • Compile drivers admit the three mobile triples, archive output only: iOS targets from macOS hosts, Android from any desktop host with an NDK (--android-ndk, threaded like --zig-exe; discovery via ANDROID_NDK_ROOT/ANDROID_NDK_HOME). Executable output on mobile refuses with a teaching.
  • The "TypeScript cores are desktop-only" teaching is removed; src/core.ts plus a mobile target selects the TS lane.
  • Carrier on mobile: auto and in_process resolve to the in-process pool; child refuses ("mobile apps cannot spawn a sibling service process"). Desktop behavior is unchanged. Child-carrier code never links into mobile builds.
  • New generated mobile wiring (ts_core_mobile.zig) satisfies the embed host's AppDef contract over the same mirror, markup, and registry, and owns the service pool. The embed host gains optional serviceDataRoot/serviceTeardown hooks so pool files live in the OS app-data directory.
  • Archives merge into the one embed static library the mobile host tiers already link. Android nesting is normalized by a new archive-flattening step (GNU long names safe), verified by an NDK --no-undefined link. native package --target ios|android works unmodified.
  • bionic errno spelling added for Android arm in the pty layer.

Executed proof

NATIVE_SDK_MOBILE=1 scripts/mobile-e2e.sh (env-gated lane, wired into the gate): builds a fixture app (multi-arm Msg core + a parsing service through the in-process pool) and runs the battery on a booted iPhone 15 simulator and a created-then-deleted headless arm64 android-35 emulator. Both assert typed results and updates through the pool, trap isolation poisoning exactly one instance, and replay reproducing results without initializing the archive. All 11 lane steps pass, re-verified after rebasing over the file-effects hardening.

Docs

Build-targets and scope sections updated across the typescript chapter, services chapter, and skill references: the matrix, floors (iOS 15.0, Android API 26), in-process-only carrier, unchanged npm lane.

Deferred

Model persistence, boot images, and URL media caching on mobile; GUI-level rendering proof on device (the batteries are the executed proof); the battery harness links at API 29 due to a bionic loader TLS-alignment requirement for executables — lane tooling only, shipped libraries keep the API 26 floor.

The external core and service compile drivers admit the pinned
compiler's three mobile triples — aarch64 iOS device and simulator
(macOS build host, iOS 15.0 floor) and aarch64 Android (any desktop
host, API 26 floor) — as library archives only, mapping the build
graph's Zig triples onto the compiler's own spellings and threading
the Android NDK location the way the graph already threads its zig.
The service executable lane refuses mobile targets with the
in-process pointer: no child process exists there, so the carrier
resolution turns "auto" into the in-process pool on iOS/Android and
teaches on an explicit "child", while desktop behavior is unchanged.

Mobile app builds stage a generated mobile entry beside the desktop
wiring: it satisfies the embed host's AppDef contract over the same
mirror, markup, and registry, drives the canonical mobile scene plus
the manifest's declared chrome, owns the service pool (markers and
stream relays live in the shim-installed app-data directory), and
delivers that directory through envMsgs. The compiled archives merge
into the embed static library the host tiers already link — flattened
to plain objects on Android, where Zig's ELF static-library emission
stores archive inputs as nested members the NDK link would skip.

A mobile execution lane (scripts/mobile-e2e.sh, NATIVE_SDK_MOBILE=1
in either gate tier) stages a battery over the service fixture's
compiled core and service archives, packages the fixture app for both
mobile targets and a services-free example for Android, then executes
the battery on a booted iPhone simulator and a headless arm64
emulator: typed pool results across update round trips, trap
isolation poisoning exactly one instance, and a journal replay that
reproduces the recorded model without initializing the archive. All
checks pass on both device classes. The TypeScript and services
chapters and the ts-core/ts-services skills state the mobile matrix;
persistence, boot images, and URL media caching remain unwired on
mobile.
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
native-sdk Ready Ready Preview Aug 13, 2026 10:41pm

@ctate
ctate merged commit 31d5b20 into main Aug 13, 2026
28 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