fix: full chat history, picked model/agent, usage sheet, image previews

- The chat loaded only one page of history: a desc page's older side is
  cursor.next, not previous, and the server rejects a cursor combined
  with order (InvalidCursorError). The first page stores `next`, later
  pages pass only `cursor`. tool/history_probe.dart walks a 1698-message
  session down to the oldest message with no gaps.
- The message list is now reversed (newest at offset 0), so older pages
  grow above and the viewport stays put; near the top it loads by itself
  and a "load earlier" row remains as a fallback.
- The agent picker filtered only on mode, so Compaction/Title/Summary
  (primary but hidden) showed up. Filter `hidden` too, and mark the
  current model or agent with a check.
- The usage ring's sheet was guarded by a flag nothing ever set; the
  ring now opens the context detail sheet.
- Tool image previews use a self-loading dialog and Image.memory: no
  temp file and no path_provider, whose Android implementation throws
  ClassNotFoundException: Landroid/content/Context; on the emulator.
- "Add server" in the connected server sheet now opens the form and
  returns to the session list once connected.
- Add a Linux desktop target for fast local UI checks, plus the probe
  that pages history.
- Version 0.3.2 (code 302).
This commit is contained in:
blumia committed 2026-11-19 12:34:25 +08:00
1 parent 2f5aad3814
commit 61977d2b14
24 files changed
+834 -130

No files matched your search

+13 -1
View File
@@ -6,7 +6,11 @@ import '../storage.dart';
/// The first screen: the saved servers, or the connect form.
class ServersScreen extends StatefulWidget {
final AppState app;
const ServersScreen({super.key, required this.app});
/// Open the "add server" form straight away (pushed from the server sheet
/// while a connection is live).
final bool startEditing;
const ServersScreen({super.key, required this.app, this.startEditing = false});
@override
State<ServersScreen> createState() => _ServersScreenState();
@@ -25,6 +29,12 @@ class _ServersScreenState extends State<ServersScreen> {
bool _connecting = false;
String? _formError;
@override
void initState() {
super.initState();
if (widget.startEditing) _editing = true;
}
@override
Widget build(BuildContext context) {
return ListenableBuilder(
@@ -279,6 +289,8 @@ class _ServersScreenState extends State<ServersScreen> {
if (mounted) {
if (widget.app.client != null) {
setState(() => _editing = false);
// Pushed on top of a live session list: return there.
if (Navigator.of(context).canPop()) Navigator.of(context).pop();
} else {
setState(() {
_connecting = false;