feat: imported input-box pets, with dsh-Go's sprite packs

Nothing is built in: Settings → 宠物 shows "尚未导入宠物" until a zip is
picked. The zip holds a dsh-Go pack.json and PNG sheets; it is validated
(pack.json, every named sheet) and unpacked under the app's private files
directory, with enable, size (40/52/64) and remove kept on the device.

A pack's canvas, anchor, per-animation box and frame list drive rendering:
PetSlot reserves the area above the baseline and stands the sprite on the
composer's top edge (or on the activity cap while a turn runs). Idle,
thinking, working and error follow the chat's state, and a tap plays the
pack's react-left/react-right. Only one sheet is decoded at a time.

path_provider's JNI binding does not load on this engine, so MainActivity
exposes the files directory over a tiny method channel instead.

dist/deepy-whale-pet.zip is the Deepy whale for testing. Tests cover the
real pack manifest, frame/state mapping and zip import.

0.4.0 (400).
This commit is contained in:
blumia committed 2026-11-22 13:39:49 +08:00
1 parent ff0dbf1b37
commit d72af036a1
16 files changed
+1410 -12

No files matched your search

+6 -2
View File
@@ -5,7 +5,7 @@ Android first. This branch (`flutter`) is a framework evaluation: the same
feature set as the earlier Asuka/Go and MyGo attempts, reimplemented in
Flutter to compare mobile UI maturity.
Status: 0.3.21 — servers (passwordless / password login, HTTP/HTTPS and
Status: 0.4.0 — servers (passwordless / password login, HTTP/HTTPS and
SOCKS5/socks5h proxy, self-signed certificates and pinning), session list with search and live
events, chat with streaming Markdown and full history paging, tool steps
grouped per turn (icon, one-line summary, foldable run) with image previews, a
@@ -24,7 +24,9 @@ form one pill, the Build/Plan mode a separate chip (picked from a sheet). A
message sent while a turn runs can steer it or queue for its end, and waits as a
pending bubble that can be withdrawn; while a turn runs, an activity strip above
the input names the current step and its clock instead of the finished turn's
footer. The picker groups providers, favourites,
footer. Pets are opt-in: nothing is built in, and a dsh-Go sprite pack (a zip
with pack.json) is imported from Settings → 宠物 to stand above the input and
react to the turn's mood. The picker groups providers, favourites,
recents and context size. The sidebar footer names the connected server (tap to
switch) beside a settings key; settings holds appearance (theme mode and seed
colour, device-local), the server's follow-up behavior (steer or queue on a send
@@ -41,6 +43,8 @@ target used for local testing.
| `lib/storage.dart` | Saved servers in `shared_preferences`, tokens in `flutter_secure_storage` (Android Keystore) |
| `lib/state.dart` | The app state: connections, live sessions, the open chat, the server's follow-up behavior, and SSE event folding |
| `lib/appearance_prefs.dart` | Device-local theme mode and seed colour (`shared_preferences`) |
| `lib/pets/` | Imported pet packs: the dsh-Go `pack.json` sprite format, unpacked into the app's documents, plus the one-sheet image cache |
| `lib/widgets/pet_sprite.dart` | The pet strip above the composer and its sprite player (frames, moods, tap reactions) |
| `lib/terminal_state.dart` | The terminal session: an xterm model plus the `/api/terminal/ws` socket (binary control frames), kept per workspace so closing the panel keeps the shell |
| `lib/screens/` | Servers, the connected shell (`home_screen.dart`: drawer on a phone, two columns from 840 px), sessions, chat (streaming Markdown via `gpt_markdown`, composer, sheets, the native form dock, the files sidebar with the knowledge and terminal tabs); the message list is reversed so older pages grow above without moving the viewport |
| `lib/widgets/` | The context usage ring |