feat(android): AffineScript UI in the Gossamer webview (#83 sub-PR #8)#127
Open
hyperpolymath wants to merge 2 commits into
Open
feat(android): AffineScript UI in the Gossamer webview (#83 sub-PR #8)#127hyperpolymath wants to merge 2 commits into
hyperpolymath wants to merge 2 commits into
Conversation
Reimplement the Kotlin MainActivity + activity_main.xml UI as the AffineScript webview UI loaded by the Gossamer Android shell. - src/bridge.affine: typed bridge to the native Rust core (was NativeLib JNI): init/start/stop/process_sensor/query/query_local/query_claude/ get_neural_context/get_state/reset/is_running. - src/ui.affine: view/controller logic ported 1:1 from MainActivity (init, start/stop toggle, 500ms neural-context poll, query + Prefer Local routing). - index.html + styles.css: webview entry with visual parity to the old Android layout. - deno.json + build.sh: AffineScript -> Deno-ESM build wiring (no npm/Node). build.sh falls back to a committed compiler-output stub (dist/ui.mjs) until the affinescript toolchain is vendored. - README.adoc: documents bridge assumptions and TODO(#83) markers. Depends on #3 (Gossamer host) and #4 (NativeLib->Rust JNI), both in parallel and not merged; assumptions marked TODO(#83 rebase). No Rust/Cargo files touched; web assets only. https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw
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.
Sub-PR #8 — AffineScript UI in the Gossamer webview
Part of the Android Kotlin→Rust/Gossamer migration (epic #83, RFC PR #97, sub-issue #114).
Reimplements the UI currently in
android/app/src/main/java/ai/neurophone/MainActivity.kt+res/layout/activity_main.xmlas the AffineScript webview UI that the Gossamer Android shell loads. The Kotlin sources are left in place; their removal happens at migration cutover.Dependency note
Needs #3 (Gossamer scaffolding / webview host) and #4 (NativeLib→Rust JNI) — both in parallel and not merged. Based off
main; their structure is assumed and every assumption is markedTODO(#83 rebase)/TODO(#83).Files added
All new files carry
SPDX-License-Identifier: MPL-2.0. Underandroid/app/src/main/assets/gossamer-ui/:src/bridge.affineNativeLibJNI):init,start,stop,process_sensor,query,query_local,query_claude,get_neural_context,get_state,reset,is_running. Config ported verbatim fromMainActivity.createConfig().src/ui.affineMainActivity: init-on-load, Start/Stop toggle, 500 ms neural-context poll, query + "Prefer Local" routing.index.htmlui.affinequeries.styles.cssactivity_main.xml(16dp padding, centred header, monospace neural-context panel, spinner, etc.).deno.jsonbuild.shdist/ui.mjsREADME.adocPlus a scoped
.gitignorenegation so the committeddist/ui.mjsstub is tracked while the generaldist/ignore stays.AffineScript build wiring + assumptions
.affine) compiles to Deno-ESM via the estateaffinescripttoolchain (OCaml/Dune CLI:check/fmt/compile --target deno-esm), driven through Deno tasks:deno task check:ui/build:ui/fmt:ui.build.shis the single CI-ready entry point.affinescriptcompiler is not yet vendored in this repo/CI. Sodist/ui.mjsis a hand-written generated-output stub faithfully mirroringsrc/ui.affine+src/bridge.affine, keeping the webview loadable/reviewable today.build.shfalls back to the committed stub when the compiler is absent (and says so loudly).TODO(#83): vendor/pin the toolchain, flipUSE_STUB=0, regenerate, delete the stub, wiredeno task build:uiinto CI.globalThis.gossamerwithinvoke(cmd, args): Promise<string>; command names are snake_case forms of the oldNativeLibmethods; host servesindex.htmlas the webview root. All markedTODO(#83 rebase).bridge.process_sensorstays exposed for parity.Verification
build.shruns clean with the stub fallback (exit 0).deno.jsonis valid JSON..gitignoreonly).cargo build --workspacecurrently fails onmainin thelsm/esncrates due to a pre-existingrand0.10 API drift (.random()/.sample()), present onorigin/mainbefore this branch and unaffected by these changes.TODOs / risks
TODO(#83 rebase): reconcile the bridge object name/call convention and DOM-host bindings against chore(deps): update rand_distr requirement from 0.4 to 0.5 #3/chore(deps): update thiserror requirement from 1.0 to 2.0 #4 once merged.TODO(#83): vendor the AffineScript toolchain and replace thedist/ui.mjsstub with real compiled output; wire into CI.lsm/esnrandAPI build failure onmainis out of scope for this UI PR.Language policy
AffineScript (primary app language) + HTML/CSS + a Deno-run Bash build script. No TypeScript, Node, or npm. The single
.mjsis a compiler-output stub, not hand-authored application logic.https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw
Generated by Claude Code