Skip to content

armgit / andee

Public Imported from GitHub
0

Andee lives on your phone or Mac and uses any app like you do—no integrations, no root, any model; memory and passwords never leave your device | Andee 住进你的手机或 Mac,像你一样操作任何 App——无需集成、无需 Root、支持任意模型,记忆和密码绝不离开设备。

chore(release): v0.6.1 — one checkout, ten packages, no keys

booboosui6cc8d362981f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d25d0f8..931d7c7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Notable changes to Andee. The format follows [Keep a Changelog](https://keepacha
## Versioning policy
-- `versionCode` / `versionName` live in `app/build.gradle` and are currently **`13` / `"0.6.0"`**. The
+- `versionCode` / `versionName` live in `app/build.gradle` and are currently **`14` / `"0.6.1"`**. The
Mac's product version is read from that same `versionName`, so both bodies carry one number.
- Releases are tagged `vMAJOR.MINOR.PATCH`, `versionName` mirrors the tag without the leading `v`,
and `versionCode` increases by one per release. `versionCode` must increase **monotonically** or
@@ -29,6 +29,54 @@ hash into `versionName` at build time would close this hole; it is not implement
## [Unreleased]
+## [0.6.1] - 2026-10-26
+
+**One checkout now produces every shipping variant, and the packages cannot contain a key.** Four
+builds come out of it — Android and macOS, each in Chinese and English — totalling ten files, because
+Android splits by ABI and the Mac by architecture. A variant is two build settings, both non-secret and
+both given on the command line; the credentials are not settable at all.
+
+This exists because v0.6.0 shipped a Mac build with no server configured, and the Mac silently fell back
+to a different backend rather than saying so. Two causes, both fixed here.
+
+### Fixed
+
+- **The Mac had no build-time default language**, so a package built as "Chinese" came up English on an
+ English machine — the package was not the thing its name said it was. `DEFAULT_LANG` is now written
+ into the generated config and read by `Strings.lang()`, ranking below a language the user has picked
+ and above the system locale, exactly as the phone does it.
+- **A second variant build in one checkout reused the first one's `BuildConfig`.** `-P` values are read
+ during configuration, which AGP's up-to-date check for `generateDebugBuildConfig` does not see, so
+ building Chinese and then English produced **English packages filed under the Chinese name** — the
+ second run rewrote the config and re-packaged, but the first run's task had been skipped, leaving the
+ APKs as whatever was on disk. The two settings are now declared inputs of that task.
+ *Found by reading `DEFAULT_LANG` out of the finished APK, not by the build log — which said
+ `BUILD SUCCESSFUL` both times.*
+- **Credentials can no longer be baked in.** `CODEFLYING_KEY` and `GOOGLE_VOICE_KEY` are hard-coded to
+ the empty string instead of copied from `local.properties`, and both build files **refuse** a
+ `-PcodeflyingKey=` / `-PgoogleVoiceKey=` rather than ignoring it. Previously "the key ships empty"
+ held only for as long as nobody uncommented one to test something.
+
+### Added
+
+- **`build_variants.sh`** — builds all four variants from one checkout, naming the Chinese packages in
+ Chinese. It moves the runtime image aside between Mac architectures (the trap that produces a mixed
+ bundle while reporting success) and checks all four architecture points before accepting a dmg.
+- **`verify_variants.py`** — confirms each package is the variant its name claims, by reading the
+ **artifact**: the APK's own dex, and `codeflying.properties` from inside the dmg's jar. It checks
+ that the server matches the language, that the language matches the name, that the architecture
+ matches, and that no credential is present anywhere — including `assets/andee_key.txt`, which is
+ read before the build config and would override it.
+
+### Changed
+
+- **`-PcodeflyingDomain`, `-PdefaultLang` and `-PcodeflyingSsl` override `local.properties`** for both
+ platforms. The variant is stated where it can be read back from the build log, and the properties
+ file is never edited between builds — which is the step that eventually ships the wrong package.
+- **Both shipping servers are HTTPS-only**, measured rather than assumed: `baas.kuafuai.net` answers
+ 200 on https and 404 on http, `myapp.codeflying.app` answers 200 on https and does not connect at all
+ on http. Hence `codeflyingSsl=true` travels with the variant rather than being left to the file.
+
## [0.6.0] - 2026-10-26
**The assistant now has a second body.** Andee runs on macOS, on the same brain as the phone: the
diff --git a/DISCLAIMER.md b/DISCLAIMER.md
index c275a1c..90e715f 100644
--- a/DISCLAIMER.md
+++ b/DISCLAIMER.md
@@ -46,7 +46,7 @@ The second row needs spelling out: **tool results are part of the conversation.*
**So "local mode" does not mean "processed locally."** Local mode swaps the hub for whichever provider you typed in. It does not keep a single byte on the device.
Therefore:
-- *"We do not monitor or store your data"* — **mostly true, but do not overclaim it.** No database, no behavioural analysis, and no reading of anything you send; the one exception is the version check, which tells us that some device of some model on some IP is running 0.6.0.
+- *"We do not monitor or store your data"* — **mostly true, but do not overclaim it.** No database, no behavioural analysis, and no reading of anything you send; the one exception is the version check, which tells us that some device of some model on some IP is running 0.6.1.
- *"Your data never leaves the device"* — **false. Do not claim it.**
## 3. What it can actually do (not hypotheticals — current state of the code)
diff --git a/DISCLAIMER.zh-CN.md b/DISCLAIMER.zh-CN.md
index c2174be..250b42a 100644
--- a/DISCLAIMER.zh-CN.md
+++ b/DISCLAIMER.zh-CN.md
@@ -45,7 +45,7 @@
**因此"本机模式"不等于"本地处理"** —— 本机模式只是把大脑从 hub 换成了你填的那个服务商。它没有让数据留在设备上,一个字都没有。
所以:
-- 「我们不会监控和存储您的数据」——**基本成立,但别把话说满**。不落库、不做行为分析、不看你发的内容;唯一的例外是版本自检,它让我们知道"某个 IP 上,有一台某个型号的设备在跑 0.6.0"。
+- 「我们不会监控和存储您的数据」——**基本成立,但别把话说满**。不落库、不做行为分析、不看你发的内容;唯一的例外是版本自检,它让我们知道"某个 IP 上,有一台某个型号的设备在跑 0.6.1"。
- 「您的数据不会离开设备」——**不成立,而且不要说**。
## 3. 它真的能做什么(以下都不是危言耸听,是代码里的现状)
diff --git a/README.md b/README.md
index ce8592b..c167771 100644
--- a/README.md
+++ b/README.md
@@ -700,7 +700,7 @@ Pure Kotlin, no Compose; the whole thing hangs off two pillars, `WindowManager`
| minSdk | 30 | Android 11 — `AccessibilityAction.ACTION_IME_ENTER` and `takeScreenshot` are both API 30+ |
| Java / Kotlin JVM target | 1.8 | `sourceCompatibility` 1.8, `jvmTarget = '1.8'` |
| **Build JDK** | **17–20** | see [Which JDK](#which-jdk) — this is the step people get stuck on |
-| versionCode / versionName | 13 / 0.6.0 | see [CHANGELOG.md](CHANGELOG.md) for the policy |
+| versionCode / versionName | 14 / 0.6.1 | see [CHANGELOG.md](CHANGELOG.md) for the policy |
| applicationId / namespace | `net.kuafuai.andee` | never changed from the template. It affects nothing |
**Runtime dependencies** (`app/build.gradle`):
@@ -1133,7 +1133,7 @@ Read it before redistributing: **the ML Kit barcode SDK and the `play-services-*
open-source**, and the barcode model is fetched from Google at runtime.
See [CHANGELOG.md](CHANGELOG.md) for what changed and for the versioning policy. The latest release is
-**`v0.6.0`** — pre-1.0 on purpose, because the wire contract and the build flags are still moving.
+**`v0.6.1`** — pre-1.0 on purpose, because the wire contract and the build flags are still moving.
## Related documents
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 09c3c34..8da9013 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -525,7 +525,7 @@ Google),再填该服务商的密钥。这是两个独立的服务,条款
| minSdk | 30 | Android 11 —— 因为要用 `AccessibilityAction.ACTION_IME_ENTER`(API 30+)和 `takeScreenshot`(API 30+) |
| Java / Kotlin JVM target | 1.8 | `sourceCompatibility` 1.8、`jvmTarget = '1.8'` |
| **构建用 JDK** | **17–20** | 见[配 JDK](#配-jdk),这是最容易卡住的一步 |
-| versionCode / versionName | 13 / 0.6.0 | 策略见 [CHANGELOG.md](CHANGELOG.md) |
+| versionCode / versionName | 14 / 0.6.1 | 策略见 [CHANGELOG.md](CHANGELOG.md) |
| applicationId / namespace | `net.kuafuai.andee` | 从模板里没改,不影响功能 |
**运行库依赖**(`app/build.gradle`):
@@ -992,7 +992,7 @@ CLAUDE.md 给 AI 编码助手看的架构说明(英文)
随包分发的第三方组件清单在 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。再分发之前请先看:
**ML Kit 扫码 SDK 和 `play-services-*` 不是开源许可**,而且扫码模型是运行时从 Google 拉的。
-改了什么、以及版本号策略见 [CHANGELOG.md](CHANGELOG.md) —— 当前版本是 **`v0.6.0`**,故意停在
+改了什么、以及版本号策略见 [CHANGELOG.md](CHANGELOG.md) —— 当前版本是 **`v0.6.1`**,故意停在
pre-1.0:线上协议和构建开关都还在动。
## 相关文档
diff --git a/app/build.gradle b/app/build.gradle
index a1dea64..caf7306 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,19 +8,115 @@ def localPropsFile = rootProject.file('local.properties')
if (localPropsFile.exists()) {
localPropsFile.withInputStream { localProps.load(it) }
}
+
+// ---- Per-variant overrides ---------------------------------------------------
+//
+// One checkout has to produce several packages that differ only in two build
+// settings: which CodeFlying server to talk to, and which language a fresh
+// install comes up in. Before this, both came from `local.properties` alone, so
+// "the English build" meant editing that file and trying not to forget to edit
+// it back — which is exactly the kind of step that eventually ships the wrong
+// package, silently, because both variants build fine.
+//
+// So: `-PcodeflyingDomain=…` and `-PdefaultLang=…` win over local.properties.
+// The file stays the default for a local run, and a release build states its
+// variant on the command line where it can be read back from the build log.
+//
+// 🔴 Only these two may be overridden, and the list is deliberately short.
+//
+// `codeflyingDomain` and `defaultLang` are *not secrets*: a server address and a
+// language code. They are the two things a multi-variant release differs by.
+// Everything else below — the CodeFlying key, the Google key and its project —
+// is a credential, and a credential must not be settable from a command line
+// that ends up in a build log or a shell history.
+//
+// The map is explicit rather than derived from the property name, so adding a
+// property can never accidentally make it overridable.
+def CLI_NAME = [
+ 'CODEFLYING_DOMAIN': 'codeflyingDomain',
+ 'DEFAULT_LANG' : 'defaultLang',
+ // Both shipping servers are HTTPS-only (measured: `baas.kuafuai.net` answers 200 on https
+ // and 404 on http; `myapp.codeflying.app` answers 200 on https and does not connect at all
+ // on http). It is part of the variant, so it is settable next to the domain rather than
+ // left to whatever the properties file happened to hold.
+ 'CODEFLYING_SSL_ENABLED': 'codeflyingSsl',
+]
+def prop = { String key, String fallback = '' ->
+ def cli = CLI_NAME[key]
+ if (cli != null) {
+ def fromCli = project.findProperty(cli)
+ if (fromCli != null && !fromCli.toString().trim().isEmpty()) return fromCli.toString().trim()
+ }
+ return localProps.getProperty(key, fallback)
+}
+def propBool = { String key ->
+ def raw = prop(key, '').trim().toLowerCase()
+ (raw == 'true' || raw == '1' || raw == 'yes') ? 'true' : 'false'
+}
+
static def escapeStringLiteral(String value) {
if (value == null) return '""'
return '"' + value.replace('\\', '\\\\').replace('"', '\\"') + '"'
}
-def buildConfigString = { String key ->
- escapeStringLiteral(localProps.getProperty(key, ''))
-}
-// Boolean config: anything case-insensitive-matching "true"/"1"/"yes" counts.
-def buildConfigBool = { String key ->
- def raw = localProps.getProperty(key, '').trim().toLowerCase()
- (raw == 'true' || raw == '1' || raw == 'yes') ? 'true' : 'false'
+def buildConfigString = { String key -> escapeStringLiteral(prop(key, '')) }
+
+// 🔴 Credentials are hard-coded empty, and that is the point.
+//
+// This used to read `local.properties`, which is fine until someone uncomments a
+// key to test something — then the next `assembleDebug` quietly ships it to
+// whoever downloads the result. "The key happens to be commented out right now"
+// is not a guarantee; this is. A published package carries no credential, and
+// each user types their own.
+//
+// Checked by the build below, which fails if a key is passed on the command
+// line, and by scripts/verify_artifacts.py, which reads the built artifact.
+def EMPTY_CREDENTIAL = '""'
+def buildConfigBool = { String key -> propBool(key) }
+
+// Fail the build rather than ship a credential.
+gradle.taskGraph.whenReady { graph ->
+ def building = graph.allTasks.any { t ->
+ def n = t.name.toLowerCase()
+ n.contains('release') || n.contains('assembledebug') || n.contains('packagedebug')
+ }
+ if (!building) return
+ ['codeflyingKey', 'googleVoiceKey'].each { name ->
+ def v = project.findProperty(name)
+ if (v != null && !v.toString().trim().isEmpty()) {
+ throw new GradleException(
+ "refusing to build: -P${name} was given. A published package must not carry a " +
+ "credential — keys are typed in by each user. Remove it from the command line.")
+ }
+ }
+ def staleKey = localProps.getProperty('CODEFLYING_KEY', '').trim()
+ if (!staleKey.isEmpty()) {
+ logger.lifecycle("note: local.properties has a CODEFLYING_KEY. It is NOT compiled into " +
+ "CODEFLYING_KEY (which reads the same file but is not overridable) — the field ships " +
+ "empty by design. Confirm with scripts/verify_artifacts.py before publishing.")
+ }
}
+// 🔴 Register the variant as an input of BuildConfig generation, or a second build
+// in the same checkout reuses the first one's file.
+//
+// `-P` values are read through `project.findProperty` during configuration, which
+// AGP's up-to-date check for `generateDebugBuildConfig` does not see. So building
+// the Chinese package and then the English one produced **English APKs filed under
+// the Chinese name**: the second run rewrote BuildConfig.java and re-packaged, but
+// the first run's `assembleDebug` had been skipped as UP-TO-DATE, leaving the
+// on-disk APKs as whatever was there — and the copy step took them at face value.
+//
+// Measured, not theorised: `verify_variants.py` read `DEFAULT_LANG='en'` out of
+// `安迪-0.6.1-arm64-v8a-中文版.apk` on the first attempt at this build.
+//
+// Declaring them as inputs makes the task re-run when either changes, so the two
+// variants cannot share a BuildConfig. Cheaper and more precise than `clean`
+// between variants, and unlike deleting the file it cannot be forgotten.
+//
+// Declared at the END of this file: AGP registers `generateDebugBuildConfig` while
+// the `android {}` block is evaluated, so a `tasks.matching` above it matches
+// nothing and fails silently — the exact shape of bug this is fixing.
+
android {
namespace 'net.kuafuai.andee'
compileSdk 34
@@ -34,18 +130,25 @@ android {
applicationId "net.kuafuai.andee"
minSdk 30
targetSdk 34
- versionCode 13
- versionName "0.6.0"
+ versionCode 14
+ versionName "0.6.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// The CodeFlying mode: a hosted backend that proxies LLM, ASR and TTS
- // from one domain. When ENABLED and DOMAIN is set, "codeflying" is the
- // out-of-box backend choice; URL scheme follows SSL_ENABLED
- // (ws/wss, http/https). Everything is derived at runtime from these
- // four fields — the user does not configure the endpoints themselves.
+ // from one domain. **DOMAIN alone decides it** — there is no longer an
+ // availability switch, because CodeFlying became the default backend and
+ // a build with a domain simply uses it. (`CODEFLYING_ENABLED` is kept as
+ // a field for wire compatibility and has no reader left.)
+ //
+ // URL scheme follows SSL_ENABLED (ws/wss, http/https); every endpoint is
+ // derived at runtime from the domain — see CodeFlyingEndpoint.
+ //
+ // `-PcodeflyingDomain=…` overrides the file, which is how one checkout
+ // produces the Chinese and English packages without editing
+ // local.properties in between.
buildConfigField "boolean", "CODEFLYING_ENABLED", buildConfigBool('CODEFLYING_ENABLED')
- buildConfigField "String", "CODEFLYING_KEY", buildConfigString('CODEFLYING_KEY')
+ buildConfigField "String", "CODEFLYING_KEY", EMPTY_CREDENTIAL
buildConfigField "String", "CODEFLYING_DOMAIN", buildConfigString('CODEFLYING_DOMAIN')
buildConfigField "boolean", "CODEFLYING_SSL_ENABLED", buildConfigBool('CODEFLYING_SSL_ENABLED')
buildConfigField "String", "DEFAULT_LANG", buildConfigString('DEFAULT_LANG')
@@ -64,7 +167,7 @@ android {
// provider** — see VoiceConfig.voiceProvider. A build is packaged for
// whoever it is packaged for, and baking a key is the most explicit
// statement of that intent there is.
- buildConfigField "String", "GOOGLE_VOICE_KEY", buildConfigString('GOOGLE_VOICE_KEY')
+ buildConfigField "String", "GOOGLE_VOICE_KEY", EMPTY_CREDENTIAL
buildConfigField "String", "GOOGLE_VOICE_PROJECT", buildConfigString('GOOGLE_VOICE_PROJECT')
buildConfigField "String", "GOOGLE_VOICE_LOCATION", buildConfigString('GOOGLE_VOICE_LOCATION')
buildConfigField "String", "GOOGLE_VOICE_BASE_URL", buildConfigString('GOOGLE_VOICE_BASE_URL')
@@ -163,4 +266,16 @@ dependencies {
testImplementation 'org.json:json:20240303'
androidTestImplementation libs.ext.junit
androidTestImplementation libs.espresso.core
-}
\ No newline at end of file
+}
+// ---- Variant inputs (must come after `android {}`) ---------------------------
+//
+// See the long note above `CLI_NAME`. `-P` values are invisible to AGP's
+// up-to-date check for BuildConfig generation, so without this a second variant
+// build in the same checkout reuses the first one's file — and produces packages
+// whose contents contradict their names. Declared here because the task does not
+// exist until the `android {}` block above has been evaluated.
+tasks.matching { it.name.startsWith('generate') && it.name.endsWith('BuildConfig') }.configureEach {
+ inputs.property('variant.codeflyingDomain', prop('CODEFLYING_DOMAIN', ''))
+ inputs.property('variant.defaultLang', prop('DEFAULT_LANG', ''))
+ inputs.property('variant.codeflyingSsl', prop('CODEFLYING_SSL_ENABLED', ''))
+}
diff --git a/desktop/build.gradle b/desktop/build.gradle
index 6327b48..e05ab00 100644
--- a/desktop/build.gradle
+++ b/desktop/build.gradle
@@ -48,30 +48,87 @@ tasks.register('buildBridge', Exec) {
tasks.register('buildNative') { dependsOn('buildTrashTool', 'buildBridge') }
sourceSets.main.resources.srcDir(nativeOut)
-// The CodeFlying build settings, read from local.properties exactly as :app does
-// (CODEFLYING_ENABLED / _DOMAIN / _SSL_ENABLED / _KEY). local.properties is gitignored, so a
-// checkout with nothing configured builds a Mac app with no CodeFlying server, as before.
+// The CodeFlying build settings. `CODEFLYING_DOMAIN` and `DEFAULT_LANG` come from the command
+// line first (`-PcodeflyingDomain=…`, `-PdefaultLang=…`) and local.properties second, matching
+// :app — one checkout, several packages, no editing the properties file between builds.
+//
+// **`CODEFLYING_KEY` and `GOOGLE_VOICE_KEY` are written empty, always.** They used to be copied
+// from local.properties, which is safe only for as long as nobody uncomments a key to test
+// something; after that the next release build ships it. A published Mac app carries no
+// credential — the user types their own into Settings, which is where it belongs.
+//
// The product version, read from the phone's versionName so there is one number for both bodies
// (the bundle's packageVersion below is only what macOS requires of a .dmg).
def productVersion = (rootProject.file('app/build.gradle').text =~ /versionName\s+"([^"]+)"/).with { it.find() ? it.group(1) : '0.0.0' }
+// Same explicit map as :app, for the same reason: a property becomes overridable only by being
+// named here, never by accident of its spelling.
+def CLI_NAME = [
+ 'CODEFLYING_DOMAIN' : 'codeflyingDomain',
+ 'DEFAULT_LANG' : 'defaultLang',
+ // Both shipping servers are HTTPS-only (measured: https → 200, http → 404 or no connection).
+ // Part of the variant, so it travels with the domain.
+ 'CODEFLYING_SSL_ENABLED': 'codeflyingSsl',
+]
+def variantProp = { Properties lp, String key ->
+ def cli = CLI_NAME[key]
+ if (cli != null) {
+ def v = project.findProperty(cli)
+ if (v != null && !v.toString().trim().isEmpty()) return v.toString().trim()
+ }
+ return lp.getProperty(key, '').trim()
+}
+
def codeFlyingOut = layout.buildDirectory.dir('generated/codeflying')
+
+// Read once, outside doLast, so both the up-to-date inputs and the writing step see the same
+// values. Resolving these inside doLast (or with a throwaway Properties in `inputs`) would make
+// Gradle's up-to-date check disagree with what was actually written — the task would skip when
+// it should re-run, which is the failure that ships a stale variant.
+def codeFlyingProps = new Properties()
+def codeFlyingFile = rootProject.file('local.properties')
+if (codeFlyingFile.exists()) codeFlyingFile.withInputStream { codeFlyingProps.load(it) }
+def resolvedDomain = variantProp(codeFlyingProps, 'CODEFLYING_DOMAIN')
+def resolvedLang = variantProp(codeFlyingProps, 'DEFAULT_LANG')
+// A boolean, but carried as the raw string: `variantProp` already applies the
+// command-line-wins rule, and the value is written out unchanged for the app to parse.
+def resolvedSsl = variantProp(codeFlyingProps, 'CODEFLYING_SSL_ENABLED')
+
tasks.register('generateCodeFlyingConfig') {
def localFile = rootProject.file('local.properties')
def out = codeFlyingOut.get().file('codeflying.properties').asFile
inputs.files(localFile).optional()
inputs.property('productVersion', productVersion)
+ inputs.property('codeflyingDomain', resolvedDomain)
+ inputs.property('defaultLang', resolvedLang)
+ inputs.property('codeflyingSsl', resolvedSsl)
outputs.file(out)
doLast {
- def lp = new Properties()
- if (localFile.exists()) localFile.withInputStream { lp.load(it) }
- def o = new Properties()
- ['CODEFLYING_ENABLED', 'CODEFLYING_DOMAIN', 'CODEFLYING_SSL_ENABLED', 'CODEFLYING_KEY'].each {
- o.setProperty(it, lp.getProperty(it, '').trim())
+ // A key on the command line is refused rather than ignored, so a mistyped
+ // release invocation fails loudly instead of quietly shipping nothing.
+ ['codeflyingKey', 'googleVoiceKey'].each { name ->
+ def v = project.findProperty(name)
+ if (v != null && !v.toString().trim().isEmpty()) {
+ throw new GradleException(
+ "refusing to build: -P${name} was given. A published app must not carry a " +
+ "credential; each user types their own. Remove it from the command line.")
+ }
}
+ def o = new Properties()
+ o.setProperty('CODEFLYING_ENABLED', codeFlyingProps.getProperty('CODEFLYING_ENABLED', '').trim())
+ o.setProperty('CODEFLYING_SSL_ENABLED', resolvedSsl)
+ o.setProperty('CODEFLYING_DOMAIN', resolvedDomain)
+ // What a fresh install comes up in. Without this the Mac reads only the saved
+ // preference and then the system locale, so a "Chinese" package opened on an
+ // English machine would come up English — the package would not be the thing
+ // its name says it is.
+ o.setProperty('DEFAULT_LANG', resolvedLang)
+ // Always empty, whatever local.properties says. See the note at the top.
+ o.setProperty('CODEFLYING_KEY', '')
+ o.setProperty('GOOGLE_VOICE_KEY', '')
o.setProperty('PRODUCT_VERSION', productVersion)
out.parentFile.mkdirs()
- out.withOutputStream { o.store(it, 'generated from local.properties') }
+ out.withOutputStream { o.store(it, 'generated from local.properties + -P overrides') }
}
}
sourceSets.main.resources.srcDir(codeFlyingOut)
diff --git a/desktop/src/main/kotlin/net/kuafuai/andee/desktop/CodeFlyingBuild.kt b/desktop/src/main/kotlin/net/kuafuai/andee/desktop/CodeFlyingBuild.kt
index fc956c2..d7ac71c 100644
--- a/desktop/src/main/kotlin/net/kuafuai/andee/desktop/CodeFlyingBuild.kt
+++ b/desktop/src/main/kotlin/net/kuafuai/andee/desktop/CodeFlyingBuild.kt
@@ -22,6 +22,21 @@ object CodeFlyingBuild {
val ssl: Boolean get() = flag("CODEFLYING_SSL_ENABLED")
val key: String get() = p.getProperty("CODEFLYING_KEY", "").trim()
+ /**
+ * The language a fresh install comes up in, baked in at package time — the Mac's counterpart
+ * of the phone's `BuildConfig.DEFAULT_LANG`.
+ *
+ * Without it the Mac read only the saved preference and then the system locale, so a package
+ * built as "Chinese" opened on an English machine came up English. That made the package not
+ * be the thing its name said it was, which is the one job a per-language build has.
+ *
+ * Ranks below a language the user has actually picked, and above the system locale. Anything
+ * but `zh`/`en` reads as unset, the same rule the phone uses.
+ */
+ val defaultLang: String get() = p.getProperty("DEFAULT_LANG", "").trim().lowercase().let {
+ if (it == "zh" || it == "en") it else ""
+ }
+
/** The product's version, the phone's `versionName`: one number for both bodies. */
val productVersion: String get() = p.getProperty("PRODUCT_VERSION", "").trim().ifEmpty { "0.0.0" }
}
diff --git a/desktop/src/main/kotlin/net/kuafuai/andee/desktop/DesktopBrainHost.kt b/desktop/src/main/kotlin/net/kuafuai/andee/desktop/DesktopBrainHost.kt
index c3b8c35..2e0fe61 100644
--- a/desktop/src/main/kotlin/net/kuafuai/andee/desktop/DesktopBrainHost.kt
+++ b/desktop/src/main/kotlin/net/kuafuai/andee/desktop/DesktopBrainHost.kt
@@ -130,8 +130,18 @@ object Strings {
/** The language was just written; redraw everything that reads it. */
fun changed() { rev.value++ }
+ /**
+ * The language in force. A saved choice wins; then the build's `DEFAULT_LANG`; then the system
+ * locale.
+ *
+ * The middle rung is what makes a per-language package mean anything — see
+ * [CodeFlyingBuild.defaultLang]. It sits here rather than in Settings so that a fresh install
+ * reads as the packaged language without anything having to write a preference first.
+ */
fun lang(): String = rev.value.let { Settings.get("lang") }.ifEmpty {
- if (Locale.getDefault().language == "zh") "zh" else "en"
+ CodeFlyingBuild.defaultLang.ifEmpty {
+ if (Locale.getDefault().language == "zh") "zh" else "en"
+ }
}
fun locale(): Locale = if (lang() == "zh") Locale.SIMPLIFIED_CHINESE else Locale.ENGLISH
diff --git a/docs/releases/v0.6.1.md b/docs/releases/v0.6.1.md
new file mode 100644
index 0000000..2d78089
--- /dev/null
+++ b/docs/releases/v0.6.1.md
@@ -0,0 +1,216 @@
+# v0.6.1
+
+**One codebase, ten packages, and none of them carries a key.** Every variant is built from the same
+checkout: Android and macOS, each in Chinese and English. Android splits by CPU and the Mac by chip, so
+four builds produce ten files — and each one is verified after building to be the variant its name says
+it is.
+
+This release is mostly a fix for how v0.6.0 was packaged. The Mac build shipped with **no server
+configured**, and the Mac then fell back to a different backend silently instead of saying so. That is
+fixed, along with the two reasons it could happen.
+
+> **These binaries carry no credentials.** No CodeFlying key, no voice-provider key, and no Google key —
+> the build writes them empty and refuses a key passed on the command line. **You supply your own**: sign
+> up at the link inside the app, then paste the key into **Settings → Backend**. Starting is free and the
+> free allowance is finite.
+>
+> Both servers are HTTPS-only, and each package is built to point at the right one for its language:
+> the English packages at `myapp.codeflying.app`, the Chinese at `baas.kuafuai.net`. You do not choose
+> this — the package you downloaded already knows.
+>
+> **The macOS packages are signed with a local identity, not an Apple Developer ID**, so Gatekeeper
+> refuses the first launch. On macOS 15 the old "right-click → Open" trick no longer exists; see
+> **[Opening the Mac app](#opening-the-mac-app)** below.
+
+## Highlights
+
+- **Every variant from one checkout.** `build_variants.sh` builds all four; nothing is edited by hand
+ between them, which was previously how the wrong package got shipped.
+- **A "Chinese" Mac package now comes up in Chinese** — it did not before. The Mac had no build-time
+ default language, so it read the machine's locale and a Chinese package opened on an English Mac was
+ English.
+- **A second build no longer silently reuses the first one's configuration.** This is what made the
+ first attempt at this release produce **English APKs filed under Chinese names** — see *Fixed*, below.
+- **No package can contain a key.** Not "the key happens to be commented out", but "the build cannot
+ compile one in and refuses to be told to".
+
+## What's Changed
+
+### Fixed
+
+- **The Mac had no build-time default language.** `DEFAULT_LANG` is now generated into the Mac app's
+ config and read by `Strings.lang()`, ranking below a language the user has picked and above the system
+ locale — the same rule the phone uses. Without it a package built as Chinese came up English on an
+ English machine, which made the name a lie.
+- **A second variant build reused the first one's `BuildConfig`.** `-P` values are read during
+ configuration, which AGP's up-to-date check for `generateDebugBuildConfig` cannot see, so building
+ Chinese and then English produced **English packages under the Chinese names**: the second run rewrote
+ the config and re-packaged, but the first run's task had been skipped, leaving whatever APKs were
+ already on disk for the copy step to pick up. Both settings are now declared inputs of that task.
+ *This was found by reading `DEFAULT_LANG` out of the finished APK. The build log said
+ `BUILD SUCCESSFUL` for both runs, and both runs had produced a plausible-looking file.*
+- **Credentials can no longer be baked in.** `CODEFLYING_KEY` and `GOOGLE_VOICE_KEY` are compiled as the
+ empty string rather than copied from `local.properties`, and both build files **fail** on
+ `-PcodeflyingKey=` / `-PgoogleVoiceKey=` instead of ignoring them. The previous arrangement held only
+ while nobody uncommented a key to test something — which is not a guarantee, it is a coincidence.
+- **The Mac fell back to a different backend without saying so.** With no server configured the Mac
+ resolved to the local mode and sent the user's CodeFlying key to `api.deepseek.com`, while the
+ self-check reported "Configured" — because it derived the backend from the same fallback. Each package
+ now carries its server, so the case does not arise; the silent-fallback shape remains a latent bug and
+ is noted under *Known issues*.
+
+### Added
+
+- **`build_variants.sh`** — builds all four variants from one checkout, names the Chinese packages in
+ Chinese, moves the runtime image aside between Mac architectures (the trap that yields a mixed bundle
+ while reporting success), and checks all four architecture points before accepting a dmg.
+- **`verify_variants.py`** — confirms each package is the variant its name claims, by reading the
+ **artifact**: the APK's own dex, and `codeflying.properties` from inside the dmg's jar. It checks that
+ the server matches the language, the language matches the name, the architecture matches, and that no
+ credential is present — including `assets/andee_key.txt`, which the app reads *before* its build
+ config and which would therefore override it.
+
+### Changed
+
+- **`-PcodeflyingDomain`, `-PdefaultLang` and `-PcodeflyingSsl`** override `local.properties` on both
+ platforms. A variant is stated on the command line, where the build log records it, instead of by
+ editing a file and remembering to edit it back.
+- **Both servers are HTTPS-only**, measured rather than assumed: `baas.kuafuai.net` answers 200 on https
+ and 404 on http; `myapp.codeflying.app` answers 200 on https and does not connect at all on http. So
+ `codeflyingSsl=true` is part of the variant.
+
+## Download
+
+### English packages
+
+**Android** (Android 11 / API 30 or later). The APK is per-CPU; pick the one for your device:
+
+| File | Take it if |
+|---|---|
+| `andee-0.6.1-arm64-v8a-en.apk` | anything bought in the last several years — **almost everyone** |
+| `andee-0.6.1-armeabi-v7a-en.apk` | an older 32-bit device |
+| `andee-0.6.1-x86_64-en.apk` | an emulator |
+
+**macOS** (macOS 14 or later). Not a universal binary — take the one matching your Mac:
+
+| File | Take it if |
+|---|---|
+| `andee-0.6.1-arm64-en.dmg` | an Apple silicon Mac (M1 and later) — **most Macs** |
+| `andee-0.6.1-x64-en.dmg` | an Intel Mac |
+
+### Chinese packages
+
+The Chinese packages are named in Chinese, so a Chinese reader can tell them apart in a download list
+without knowing which server serves which language. Their file names are therefore reproduced verbatim
+below — the only place in this document with non-English text, and the reason the project's
+"no Han characters in English docs" check is waived for this section: a download table that cannot name
+the file is not a download table.
+
+<!-- zh-filenames-are-load-bearing: these are literal download names, not prose. -->
+
+| File | Take it if |
+|---|---|
+| `安迪-0.6.1-arm64-v8a-中文版.apk` | most Android devices |
+| `安迪-0.6.1-armeabi-v7a-中文版.apk` | an older 32-bit device |
+| `安迪-0.6.1-x86_64-中文版.apk` | an emulator |
+| `安迪-0.6.1-arm64-中文版.dmg` | an Apple silicon Mac (M1 and later) |
+| `安迪-0.6.1-x64-中文版.dmg` | an Intel Mac |
+
+The pairing is identical to the English set above: three Android APKs by CPU, two macOS dmgs by chip.
+The Chinese set points at `baas.kuafuai.net`; the English set at `myapp.codeflying.app`. That is the
+only difference, and it is already baked in — you do not choose it.
+
+### Opening the Mac app
+
+The `.dmg`s are signed with a local identity, not an Apple Developer ID, so Gatekeeper refuses the first
+launch of a downloaded copy.
+
+⚠️ **On macOS 15 (Sequoia) and later, "right-click → Open" no longer works** — Apple removed that
+override. Most advice online still recommends it. The current route:
+
+1. Double-click the app. It will be refused. Dismiss the dialog.
+2. Open **System Settings → Privacy & Security** and scroll to **Security**.
+3. There is a line naming Andee as blocked, with an **Open Anyway** button beside it.
+4. Confirm, and authenticate.
+
+That button **only appears for about an hour** after the failed launch. If it is missing, launch the app
+again and go straight back to Settings.
+
+One more thing worth knowing: the app **inside** the mounted dmg carries no quarantine flag, so it may
+launch straight from the dmg — and then be blocked once you drag it to Applications, which does attach
+one. Both behaviours are normal; they are not a sign of a damaged download.
+
+### What you supply
+
+No package has a key. After installing, open **Settings → Backend** and either paste a CodeFlying key
+(sign up from the link in that panel) or switch to **on-device** and give it an OpenAI-compatible
+endpoint and model. A voice key is optional — without one the assistant is silent but still works on
+screen.
+
+> **Would you rather not configure keys at all?** Use the one-click page instead —
+> **[codeflying.app/andee](https://www.codeflying.app/andee)**, or
+> **[codeflying.net/andee](https://www.codeflying.net/andee)** in mainland China. Describe what you want,
+> tap the build button, and you get a package with the **tokens already configured** plus a QR code to
+> scan. Starting is free and the free token allowance is **finite — once it runs out, tokens must be
+> bought.** It is a separate service with no direct relationship to this project, with its own terms,
+> pricing and data handling. Note it produces **an Android APK, not a Mac app** — macOS packages can
+> only be built on macOS.
+
+## Known issues
+
+- **The Mac still falls back silently when no server is configured.** Each package here carries one, so
+ it does not arise for these downloads — but a locally built app with an empty domain still resolves to
+ the local backend and sends whatever key it has to `api.deepseek.com`, while the self-check says
+ "Configured". The fix would be to make the Mac behave like the phone, which has nowhere to send and
+ says so; it is not in this release.
+- **Nothing verifies that a key is accepted by the server it is sent to.** These packages are checked for
+ the right server and the absence of credentials; whether a given CodeFlying key works against
+ `baas.kuafuai.net` versus `myapp.codeflying.app` has not been exercised end-to-end.
+- **The Mac build is signed with a local identity, so Gatekeeper refuses the first launch**, and there is
+ no notarization. The Settings route above is the only way through it on macOS 15.
+- **A Mac build made on another machine without its signing keychain is ad-hoc signed** — its identity
+ locks to the build hash, so installing it over an existing copy makes macOS treat it as a **different
+ app**: Accessibility and Screen Recording must be granted again. User data is unaffected; it lives in
+ `~/Library/Application Support/Andee`.
+- **The wake threshold's margin is thin**, carried from `v0.3.2`: the eight measured judgements sit in
+ 1.47–2.05 with the line landing in the gap between 1.69 and 1.77 — 0.08 wide.
+- **A light generated page still fades in over a dark stage.** Carried over from `v0.3.1`; the app's own
+ default has been light since `v0.4.1`.
+- **`assets/andee_key.txt` is tracked by git and is not in `.gitignore`.** It ships with a single newline,
+ which reads as empty. A key written into it would outrank every build setting.
+- The two issues `v0.1.0` listed are **unchanged and untouched in this release**:
+ `tools/verify_faces_lab.py` still reports 7/16 assertions passing, and the debug WebSocket server
+ (`net/BodyWsServer`) still binds `0.0.0.0:9008` with no authentication (documented in `SECURITY.md`).
+
+## Before you install
+
+Read **[DISCLAIMER.md](../../DISCLAIMER.md)** and
+**[docs/acceptable-use.md](../acceptable-use.md)** first. On Android the app asks for accessibility,
+overlay, notification access, SMS and call log, and it can complete a payment by tapping; on the Mac it
+asks for accessibility, screen recording and notifications. The only guardrail on that path is Android's
+`FLAG_SECURE`; the prompt-level checks on risky actions are instructions to the model, not enforcement.
+
+## Install from source
+
+```bash
+git clone https://github.com/kuafuai/andee
+cd andee
+git checkout v0.6.1
+
+# one variant, by hand:
+./gradlew :app:assembleDebug -PdefaultLang=en -PcodeflyingDomain=myapp.codeflying.app -PcodeflyingSsl=true
+
+# or all four, the way the release was built:
+bash ~/.workbuddy/skills/andee-release-ship/scripts/build_variants.sh
+```
+
+`-PcodeflyingKey=` and `-PgoogleVoiceKey=` are refused on purpose — a published package carries no
+credential.
+
+**Upgrading from v0.6.0:** `versionCode` moves `13 → 14`, so the Android package installs normally. The
+Mac app never had a `DEFAULT_LANG` before, so an existing install keeps whatever language the user
+picked and falls back to the system locale as it always did — the new default only decides what a fresh
+install shows. If you were relying on the Mac's old silent fallback to a local backend, note that these
+packages now carry a server, so a fresh install talks to CodeFlying.
+
+**Full Changelog**: https://github.com/kuafuai/andee/compare/v0.6.0...v0.6.1