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、支持任意模型,记忆和密码绝不离开设备。

feat(page): let a generated page pick its own look, and stop prescribing one

booboosuia20f23448424
diff --git a/CLAUDE.md b/CLAUDE.md
index 924487f..9404ec6 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -384,7 +384,7 @@ Two things in it are not styling:
**`show_html` does not block.** It used to sit in a latch until the user tapped 完成 — up to five minutes — and because `LocalBrain` runs a turn on one thread and runs tools on it synchronously, that latch held the *conversation*: the user's next sentence was accepted and then queued behind it. It now returns as soon as the page is up, with `closed: false`, and the news that the user finished with the page arrives by a second route: the local brain gets a silent `LocalBrain.note()` (readable by the next turn, never spoken — a turn here would mean a model call and a sentence every time anyone dismisses a page), and a hub gets a `page.closed` event it may ignore. Two consequences worth knowing. `HtmlActivity` keeps exactly **one** page (`pageUp`), and a second `show_html` while one is up is now **replaced in place** rather than stacked, so the shared static file cannot lose to whichever activity read it last. That used to be a *refusal* — an error telling the model to ask the user to dismiss the page — and the model said exactly that, so the most natural request there is, "改一下这页", ended with the user told to close the page by hand. What the limit forbids is one *instance*, not one render: `HtmlActivity.replaceFile` loads the new bytes into the running WebView (archived like a fresh page, so both versions are in the scrollback) and refuses only a page that is already on its way out. And the ball's perch, which used to be released by that same latch, is now released by the close callback.
-The device injects **no CSS** into `show_html`; styling belongs to the brain. So the house style (slate tokens, the `#9DB4FF` accent, an explicitly-named CJK font stack) lives in the `show_html` **description** in `ToolSchemas` — that prompt is the only lever on page quality, which matters most for the small models this runs against. `HtmlActivity` only fades the page in once `onPageFinished` lands, with a 2.5 s backstop because a top-level script that throws can leave that callback pending forever, and half a page beats a black screen.
+The device injects **no CSS** into `show_html`, and the `show_html` **description** in `ToolSchemas` no longer prescribes anything about how a page looks — colour, type and layout follow the content, and they are the brain's (and the user's) to pick. The slate tokens that used to live there (background `#0F172A`, the `#9DB4FF` accent, an explicitly-named CJK stack) pinned every page to the night palette whatever the theme was set to, and a static tool description cannot branch on `Theme.night` — that is what removing them settled. What is left in the description is only what is not a matter of taste: the `<meta viewport>` the WebView needs to lay the page out at the right width, and the ~110×44 px the ✕完成 pill occupies in the top-right corner. **The cost is on the record:** for the small models this runs against, that description was the one lever on page quality, so expect a wider spread of looks and nothing left enforcing that a generated page reads as part of Andee. `HtmlActivity` only fades the page in once `onPageFinished` lands, with a 2.5 s backstop because a top-level script that throws can leave that callback pending forever, and half a page beats a black screen.
### The cards share one look (`ui/Glass.kt`)
diff --git a/app/src/main/java/net/kuafuai/andee/brain/LocalPrompt.kt b/app/src/main/java/net/kuafuai/andee/brain/LocalPrompt.kt
index d606102..1c2d768 100644
--- a/app/src/main/java/net/kuafuai/andee/brain/LocalPrompt.kt
+++ b/app/src/main/java/net/kuafuai/andee/brain/LocalPrompt.kt
@@ -281,8 +281,6 @@ plays only on its own site, anything behind a login — use `open_url` into
Chrome, not an `iframe`: most sites refuse to be framed and the page comes up
empty.
-The rules for making a page (colour, type size, layout) are written in the `show_html` tool description — follow them. That style is what you look like; swap in another and the result stops looking like your work.
-
### 8. You may have legs
Some Andees have a robot dog attached. When one is attached, **that is your leg** — not a pet you keep, not a toy you drive by remote. So speak as "I am moving": 「我过去看看」「我转个身」 — not "I'll send the dog over". You have not gained a subordinate, you have gained a body part.
diff --git a/app/src/main/java/net/kuafuai/andee/net/ToolSchemas.kt b/app/src/main/java/net/kuafuai/andee/net/ToolSchemas.kt
index 24ad6d5..151118e 100644
--- a/app/src/main/java/net/kuafuai/andee/net/ToolSchemas.kt
+++ b/app/src/main/java/net/kuafuai/andee/net/ToolSchemas.kt
@@ -905,32 +905,16 @@ object ToolSchemas {
a URL they would have to go and open themselves. Keep `controls` on
a player. A plain http:// address will not load.
- HOUSE STYLE — follow it unless the user asked for something else.
- This is what the rest of the device looks like; a page that ignores
- it reads as a stray web page, not as part of Andee.
+ Two things about the page itself, and neither is a matter of taste.
+ The WebView lays the page out at the width its own viewport tag asks
+ for, so send one:
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
- Colours (use these exact values, no others):
- page background #0F172A
- card / surface #1E293B
- hairline border rgba(148,163,184,.18)
- body text #F8FAFC
- secondary text #94A3B8
- accent #9DB4FF ← the ball's colour; ONE accent only
-
- Type: font-family:-apple-system,"PingFang SC","Noto Sans CJK SC",
- system-ui,sans-serif — name the CJK families explicitly or Chinese
- falls back to a default glyph set and the page instantly looks cheap.
- Sizes 28 / 20 / 16 / 13 px, line-height 1.6.
-
- Layout: portrait, ONE column, 20px page gutters, spacing in
- multiples of 8px, card radius 14px. Use the hairline border to
- separate cards — no heavy box-shadows, no gradients, no glow.
- Large touch targets (44px minimum); type readable without zooming.
-
- A ✕完成 pill floats over the top-right corner so the user can always
- leave — keep roughly 110×44px clear there.
+ And a ✕完成 pill floats over the top-right corner so the user can
+ always leave — keep roughly 110×44px clear there.
+
+ Everything else — colour, type size, layout — is yours to pick.
""".trimIndent(),
required = listOf("html"),
props = mapOf(