Repository navigation
Add Hex Code, an experimental second app, and share OpenCode Mobile's client code through opencode-kit / OpenCodeKit - #980
Merged
Merged
Conversation
Collaborator
Author
HexDot, HexPrimaryButton, HexButton, HexRoundButton, HexIconButton, HexTopBar, HexRow, HexPickerRow, HexSectionLabel, HexBadge, HexSearchField, HexTextField, HexSegmented, HexStatusLine, HexSpinner, HexPanel, HexSheet, HexTalkButton, HexMeter and HexChunk, built from the Hex tokens only, with previews in both palettes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
First run (welcome, scan, project and folder pickers, model page), home and Settings now use Hex tokens and components only, with no OpenCode Mobile theme, icons or components. The scan screen is dark throughout, as in the prototype, and draws its own camera view; :opencode-kit still decodes the pairing code. Notices show as a card at the top until HexToast arrives in M2. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The theme, icons, base components, keyboard and text helpers, their strings, tests and theme and syntax presets go back into :app, as on main, and :screenshot reads them from there again. The Hex Code additions to them (the warning notice tone, the bare top bar dot, the warning and QR icons, the presets' app filter) are dropped. :opencode-kit keeps only data, domain, network and the pairing QR decoder, and no longer uses Compose. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The theme, icon and hardcoded-text scripts check OpenCode Mobile's own files again, on both platforms, as on main; the Hex preset, the presets' apps field and the warning and QR icons are gone. The string-key check keeps comparing Hex Code's Android and iOS keys. check-hexcode-ui.mjs fails when Hex Code uses OpenCode Mobile's UI or when :opencode-kit gains UI again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…holder hostname in tests Add the pageTitle and badge text styles iOS already has, rename HexChunkText to HexChunk (and the data class to HexChunkItem) so both platforms share the names, and replace a real machine name in ServerNameTest with Example-MacBook-Pro.local. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Leaving Browse folders kept the browser's state, so coming back reopened the last folder. It now starts at the server home each time, as on iOS; folder listings fetched earlier in the session are still reused. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n on iOS Every Hex colour, type step, icon and component in each state, with a Light / Dark switch for the page alone. It now builds in every build; -HexCodeGallery YES still opens it on its own in debug builds. HexRow and HexTopBar gain verbatim titles for English-only developer copy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Settings › App ends with Version (0.1.0 (debug) or (release)). Ten taps on it, each within 2 s of the last, turn on a Developer section, saved on the phone: Component gallery, Speech lab (the dictation lab screen, now in every build, on the app's speech engine), Build with the git commit a new build phase stamps into Info.plist, and Hide developer settings. The Version label and the notice use settings.version and settings.developer.on; the Developer section is English only, like OpenCode Mobile's Developer Tools. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e previews Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… scroll over talk buttons on Android Tapping Build copies "Hex Code <version> (<type>) <commit>", as on iOS; below Android 13 a notice confirms it, since newer versions confirm copies themselves. The gallery's talk button samples sit under a cover, so a drag that starts on them scrolls the page. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s as plain Kotlin The summary prompt and message rules are versioned in SessionPrompts. StatusSummary reads a reply into a card or a fallback, clipped as the prototype; SummaryRefresher never runs two requests at once and keeps the last card when one fails; AgentStatus picks the top bar state; DailySession decides whether to reuse or create today's session and when to show the new-day notice. Tests cover the plan's M2 cases that need no server. Co-Authored-By: Claude Opus 5.5 <[email protected]>
HexToast is the prototype's top card with an icon tone (stop, info, steer, sun, and undo, which the prototype uses for a dropped take or a deleted chunk), a title, a one-line detail and an optional action; HexToastHost shows one for its time. HexProgress draws an 18 x 3 segment per step and the mono count. Both are in the shared samples, so the gallery and the previews show every state. Co-Authored-By: Claude Opus 5.5 <[email protected]>
TodaySession opens today's session, shows the empty card for a new one or asks for a summary for an existing one, and holds the agent's state for the top bar, the Needs-you hint and the waiting line. TodaySessionDemo has the same fake presets as iOS, so home can be looked at without a server until round 2 wires it to OpenCode. Co-Authored-By: Claude Opus 5.5 <[email protected]>
HexToast is the prototype's top notice (sun, info, stop, steer and undo tones, an optional action) with HexToaster and a host modifier. HexProgress is the status card's step segments with a mono label. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… plain Swift The versioned summary prompt and message rules, the reply parser with the prototype's clipping, the empty card and refresh label, one refresh at a time, the top bar state precedence, and the daily-session decision and setup steps, with tests for the plan's M2 cases. Nothing talks to a server yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…notices onto HexToast Home shows the status card, its fallback, the setup failure with Try again, the needs-you hint and the waiting line, and the draft replaces the card while you talk. A session comes only from -HexCodeDemoSession presets until it is wired to OpenCode. Home and Settings notices now use one HexToaster at the top of the screen. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…replace NoticeHost with HexToast Home now has the status card (title, Now, Next, progress and the refresh label), the fallback, the Couldn't open today's session state with Try again, the Needs-you hint and the waiting line, and the top bar follows the agent's state. A draft replaces the status card, as in the prototype. The data comes from a sample session that Settings > Developer > Sample session picks, until round 2 connects it to OpenCode. Home and Settings show their notices with HexToastHost, and the stand-in NoticeHost is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y into :opencode-kit Hex Code needs today's session, its event stream and OpenCode Mobile's reconnect timing. The code moves out of :app unchanged and keeps its dev.opencode.mobile packages, so :app reads it as before: - SessionsApi with SessionDtos and V2SessionDtos - EventsApi, SseDataLineParser and SseAttemptOutcome - SseRetryBackoff and SseAttemptPolicy Tests for the moved code move with it. As in the first move, the test seams :app tests still use become public, and MessageTokensDto and MessageTokenCacheDto move to their own file so the kit doesn't pull in message code. DefaultForegroundEventStream stays in :app: it is tied to OpenCode Mobile's sync and connection epochs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A session's model ref is part of the session, which now lives in the kit. Both classes move unchanged to their own file in the same package; :app reads them as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…OpenCodeKit on iOS EventsAPIClient with its SSE line parser, SseAttemptOutcome, SseRetryBackoff, SseAttemptPolicy and SseSubscribeTargets move unchanged; only access modifiers are added. OpenCode Mobile builds and its 3,343 tests pass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pencode-kit
Additive only, so OpenCode Mobile's requests are unchanged:
- sessions: time.busy and the session's model; create with a model; one page of the session list
with limit and cursor; POST /api/session/{id}/model
- the session's own pending approvals and questions (/api/session/{id}/permission and /form)
- PUT /api/experimental/session/{id}/instructions/entries/{key}
- an optional timeout for session generate, and an optional types list on the event stream, each
type sent as its own types= parameter
Co-Authored-By: Claude Opus 5.5 <[email protected]>
streamEvents(path:directory:types:) sends each type as its own types= parameter. The default is empty, so OpenCode Mobile's streams are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
SessionStateAPIClient lists sessions with search, parent, archived, limit and cursor; gets, creates (with location and model) and deletes a session; reads the running sessions; switches a session's model; lists a session's own pending approvals, questions and inbox; generates from the session; and puts an instruction entry. Its DTOs carry time.busy, location and model. New types only; OpenCode Mobile's session client is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…te to Hex Code's Android design system amberLine is amber at 30 %, the Needs-you border. A loading HexButton shows a spinner in its icon's place and ignores taps, for Try again. Home's HexTopBar takes no state while today's session is being set up, which leaves the slot empty. All three are in the gallery samples. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s Android first run /api/experimental/generate is now a deprecated alias of it; the body and the reply are the same, and the fallback to a throwaway session's generate route is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r fallback
The model test calls POST /api/experimental/generate/text. When OpenCode's free
tier turns that route away, the same prompt goes to a throwaway session's own
generate route ("Hex Code model test" in the project, with the model and
level), which is always deleted afterwards, as on Android.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move the README from docs/hexcode/ to hexcode/, with its screenshots, and add links to each part's sources (the iOS and Android apps, their OpenCode kits and the voice engine), so Hex Code is one place to start from. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Debug builds only. A new `artifact` sample session shows a summary card with an artifact tile, and its page (sample-artifact.html, a made-up report) opens in the artifact viewer with no server: iOS serves it from the scheme handler, Android from the debug assets. New launch options set up home for screenshots without pairing or a microphone: -HexCodeDemoSetup / HexCodeDemoSetup (placeholder project, model and computer, never saved), -HexCodeDemoOpenArtifact / HexCodeDemoOpenArtifact and -HexCodeDemoTake locked / HexCodeDemoTake (a locked take with its text so far). The Release build excludes the sample page. The iOS sample branches reply now links to a placeholder computer instead of a real one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace a real machine's hostname with Studio-Mac in the pairing and summary tests on both platforms, keeping the mixed-case and lowercase forms the tests compare. Co-Authored-By: Claude Opus 5.5 <[email protected]>
No tracking and no collected data: Hex Code has no analytics, ads or crash reporting, and talks only to the paired OpenCode server plus a one-time speech model download. Firebase is linked only into OpenCode Mobile. Declares the required-reason APIs it and its statically linked packages use: UserDefaults (CA92.1), system uptime for timing in-app events (35F9.1), and file metadata in the app's container, from FluidAudio (C617.1). The synchronized Hex Code folder puts it in the Hex Code app only; Debug and Release simulator builds include it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The target in frame 8 was the app's green, the only colour in the four graphics. It's now white with grey rings, like the talk button in frame 2, so the graphics read as one set. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ServerPayloadJson and the Attachment types moved from :app into :opencode-kit, which left screenshot's symlink to ServerPayloadJson.kt dangling and broke the Compile screenshot module step in Android Checks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Gradle configures :voice-engine on every Android build, so the configuration-time download ran for OpenCode Mobile's release builds and the iOS markdown-core build phase too. A GitHub outage could break an OpenCode store build. fetchSherpaOnnx now runs only when a task that builds voice-engine needs its classes or native libraries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
android-checks ran ktlint, lint and unit tests across every module, so Hex Code's 698 tests gated OpenCode Mobile pull requests. They now run in hexcode-checks.yml, and Hex-only changes no longer trigger android-checks unless they touch a Gradle build script. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ImagePrepTest was the only Robolectric test in the repo: five tests, run on two SDKs, that pulled Robolectric's Android runtimes into every Hex unit-test run. It also needed a test-only decodeFromMemory switch in AndroidImagePreparer. Remove the test, the switch and the Robolectric and androidx.test core test dependencies. Co-Authored-By: Claude Opus 5.5 <[email protected]>
On an unfolded foldable, a phone in landscape or the iPhone Duo's inner screen, home stretched edge to edge: a 640 dp talk button and a card in a thin band of a nearly square screen. A new column token (600, home's padding included) caps home and centres it, and its toasts, the stop countdown and Android's sheets follow it. The background, the stop edge and the in-app browser stay full width. Phones in portrait are narrower than the column, so nothing changes there. On iOS the draft's menu now lines up with the column's right edge rather than the screen's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The shared Swift package looks its text up in the app's main bundle, but string-checks.yml did not run when it changed and neither script read it. Scan it for hardcoded text, fail when it uses a key OpenCode Mobile's catalog lacks, and run the checks for Hex Code's string files too, since check-string-keys.mjs already reports on them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hex Code's iOS checks will resolve Hex Code.xcodeproj. Existing callers pass nothing and keep resolving OpenCode Mobile. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rename hexcode-checks.yml to hexcode-android-checks.yml (Hex Code Android Checks) ahead of a Hex Code iOS workflow. Run it for any module's Gradle build script, gradle.properties and the wrapper, since Gradle configures them all, and not for the iOS half of shared/voice-engine. Co-Authored-By: Claude Opus 5.5 <[email protected]>
iOS Checks ran for every android/ change because the build compiles markdown-core through Gradle. Only Gradle's root files and the module build scripts it configures can affect that build, so run for those (now including android/app's), not for Android module sources. Skip Hex Code's iOS project, sources and tests and shared/voice-engine: Hex Code gets its own iOS workflow and project. Also run for the marketing-version script the app's build phase calls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The server reads a bare + in a query as a space. Foundation's queryItems setter leaves + bare, and reading queryItems back decodes %2B to +, so sites that re-assigned queryItems (including authorizedRequest's directory / location[directory]) sent a raw + or undid an earlier %2B. Shell get/output/delete for a folder like c++-tool hit the wrong folder. All query building in OpenCodeKit and Hex's ArtifactsService now goes through URLComponents.appendQueryItems (and the URL / URLRequest appendingQueryItems wrappers), which encodes only the new items and sends + as %2B, as Ktor does on Android. Other bytes are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hex Code and Hex CodeTests move out of OpenCode Mobile.xcodeproj into ios/OpenCode Mobile/Hex Code.xcodeproj, next to it, so resolving or building OpenCode Mobile no longer fetches VoiceEngineKit's FluidAudio. The new project is carved out of the old one: the same target, build phase and configuration objects and IDs, the OpenCodeKit and voice-engine package references, and copies of the project-level Debug, Release and Lab configurations the targets inherit. Source folders stay where they are. Build settings for both targets in all three configurations match the old ones except for the project's own name, paths and GUID. The Hex Code scheme moves with it and the project gets its own Package.resolved (FluidAudio 0.15.5 only). OpenCode Mobile's pbxproj only loses Hex lines, and its Package.resolved only loses FluidAudio. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hex Code iOS Checks builds the Hex Code scheme of Hex Code.xcodeproj on the mac-mini runner and runs Hex CodeTests, for changes to Hex Code's iOS project, sources and tests, OpenCodeKit and VoiceEngineKit. No CI job built or tested them before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Moving the goal RPC into opencode-kit decoded it straight into a strict DTO, so a 200 the old hand parser read as "no goal" (junk, no JSON Content-Type) now threw and was retried, and `"rounds": null` or `1.0` lost a goal that was there. V2GoalStateDto.fromJson reads Goal.State the old way again (missing id or objective is no goal), goalV2 reads the body as text whatever its Content-Type, and every unreadable reply or goal event is logged with the session id and the reason, never the objective. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The toaster's hide timer slept in real time, and the test slept 300 ms then expected the notice gone. With the whole suite on the main actor the timer's task could still be waiting its turn, so CI failed it. HexToaster now takes its sleep, like the other Hex models, and show returns the wait that hides the notice. The test passes a sleep that returns at once and awaits that wait. Co-Authored-By: Claude Opus 5.5 <[email protected]>
theStreamClosesOnlyAfterTheBackgroundGrace slept 80 ms and expected the grace task to have asked for its 5 s sleep. On a busy main actor the task hadn't run yet (CI: asked → []). The test's sleep now opens a gate when it is asked, and the test awaits that. Co-Authored-By: Claude Opus 5.5 <[email protected]>
GoalHarness.send slept 30 ms after playing a line and assumed the session had handled it. Under the full suite's load it sometimes hadn't: a replace read as a first set, a delivered message didn't replace the goal's You line, and the command's 100 ms event wait ran out before the event came in. FakeTransport.deliver now returns once the stream has handled the line, send uses it, and the no-read test ends the event wait by hand after the event. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A lease's loop task cleared `streamTask` when an attempt ended while `stop()` cleared it from the main thread in `Lease.cancel()`, with no shared lock. Two unguarded writes of a Task reference can over-release it and crash the app. Thread Sanitizer flags it in DefaultForegroundEventStreamTests (a stream that ends right after server.connected while the test calls stop()), and it crashed the test host on CI. Both task handles now sit behind the lease's lock. A stream attached after the lease was cancelled is cancelled right away instead of being left running. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Read ANDROID_UPLOAD_* and ANDROID_VERSION_CODE/NAME through providers, as :app does, so App Distribution can sign :hexcode:assembleRelease with OpenCode Mobile's upload key and stamp its version. Without them release stays unsigned at 0.1.0 (1); a partial signing setup stops a release build. Co-Authored-By: Claude Opus 5.5 <[email protected]>
hexcode-app-distribution.yml builds signed Hex Code release builds for Android and iOS and sends them to the hexcode-android and hexcode-ios tester groups. It runs on demand (platform all/android/ios, optional source_ref validated as in OpenCode's) and nightly at 02:00 UTC when main changed Hex Code paths in the last 26 hours. Same runners, release environments, upload key, ASC key and keychain handling as OpenCode Mobile's distribution workflows, which stay unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`/distribute hex`, `/distribute hex android` and `/distribute hex ios` dispatch hexcode-app-distribution.yml with platform all/android/ios and the PR head SHA, through the same maintainer, same-repo and open-PR checks. The OpenCode forms dispatch and reply exactly as before; the unknown-target help now lists the hex forms too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
Merges
feature/hex-experiment. It does two things:Shared client code (affects OpenCode Mobile)
android/opencode-kit(:opencode-kit, minSdk 24, no Compose). It holds the API clients, DTOs, event stream, stores, secrets, connection and pairing code, and the domain models that:appused before.ios/OpenCodeKit(iOS 17.5). It imports only Foundation, CryptoKit, OSLog and Security.OpenCode Mobile.xcodeprojgains one local package reference, nothing else.Hex Code
android/hexcode(:hexcode, minSdk 26). iOS: theHex Codetarget in its own project,ios/OpenCode Mobile/Hex Code.xcodeproj(iOS 18). Sources are inios/OpenCode Mobile/Hex Code/.shared/voice-engine: on-device dictation (Parakeet). It runs on FluidAudio (CoreML) on iOS and on sherpa-onnx on Android. LiteRT is used only in the speech model lab. See its README.hexcode/gathers the README, screenshots, store listing and symlinks to the code.THIRD_PARTY_NOTICES.mdcovers the voice engine.Is OpenCode Mobile safe?
These were checked:
+encoding below.:appasks for no new permissions.voice-engine.:appand theOpenCode Mobilescheme.Changes made to get it ready to merge
:screenshotnow depends on:opencode-kit. A moved file had broken its symlink.sherpa-onnx is now fetched by a Gradle task, and only when
voice-enginebuilds. Before, every Gradle configuration downloaded it (49 MB), including OpenCode release builds and the iOS markdown-core build phase.Hex Code iOS has its own Xcode project, so OpenCode Mobile no longer resolves FluidAudio. No source files moved.
CI is split into four workflows. Each runs on its own sources plus the shared code it uses:
android-checks: OpenCode Mobile for Androidhexcode-android-checks: Hex Code for Androidios-checks: OpenCode Mobile for iOShexcode-ios-checks: new, runsHex CodeTestsA change to any Gradle build script still runs the OpenCode jobs, because Gradle configures every module.
string-checksnow also coversios/OpenCodeKit.iOS sends a literal
+in a server query value as%2B, in every query, as Android (Ktor) does. This fixes shells in folders such asc++-tool.Android reads a session's goal leniently again, as it did before the extraction. When a reply can't be read, it logs only the session ID and the reason.
Fixed an old data race in OpenCode Mobile's iOS event stream (
DefaultForegroundEventStream).stop()and the stream's loop could both clear the same task handle without a shared lock, which crashed the test host on CI. Thread Sanitizer flagged it; both handles now sit behind the lease's lock. It predates this pull request.Removed Hex Code's only Robolectric test. OpenCode Mobile has none.
Made three timing-dependent Hex Code iOS test suites deterministic, and replaced a real tailnet address in Hex Code's test fixtures with a neutral one.
How to try Hex Code
See hexcode/README.md: pairing, building on each platform, and the paths for developers.
Merging
The extraction and Hex Code are mixed in this one pull request. Use a merge commit, not squash, so that an OpenCode Mobile regression bisects to a small commit.
With a merge commit, Hex Code's commits land in
main's history.scripts/release-notes.mjs draftlistsgit log <tag>..HEADwith no path filter, so leave Hex Code's commits out when drafting the next OpenCode Mobile release notes.Checks
hexcode/README.md.Hex CodeTestssuite passed 25 times in a row, andDefaultForegroundEventStreamTestspassed under Thread Sanitizer with no warnings.Risks / Follow-ups
Not in this pull request:
mainhas violations in two:appandroidTest files, and:apphas older ktlint debt. The Android lint step does not block CI.network_security_confignow lives in:opencode-kit.OpenCodeKitframes. Mention this in the release notes.dev.opencode.mobilesubsystem as OpenCode Mobile.dev.opencode.hexcodeis a placeholder bundle and application ID.scripts/check-hexcode-ui.mjs, which checks that Hex Code uses no OpenCode Mobile UI, isn't run in CI.hexcode/README.mdand the links above point tofeature/hex-experiment, and the README calls this a draft pull request. Update them after the merge.🤖 Generated with Claude Code