feat: queue a message for the running turn, and fold the composer when the IME closes

- A send while a turn runs joins it (delivery "steer") on a short press; a
  long press offers steer or queue. Queue/steer prompts wait in the server's
  inbox and show as a pending bubble at the end of the transcript, with
  改为排队/转为转向 and 撤回 (which puts the text back into the composer).
  The inbox is read on open and resume and kept current by the
  session.inbox.* events; delivery reloads the tail.
- The send key is stop only while running with an empty draft; with text it
  sends (as dsh-Go does), leaving the long press for the delivery choice.
- The composer also folds to one line when the phone's back gesture closes
  the keyboard while the field keeps focus: the page passes the keyboard
  height (a Scaffold strips the bottom inset from its body) and the composer
  treats a fall below half the peak as a dismissal.
- The Build/Plan chip now opens a bottom sheet with icons, hints and a check,
  instead of a popup menu.
- Tests: composer_box_test (focus opens, IME dismissal folds, typing reopens)
  and inbox_item_test (list items, enqueued events, delivery changes).
- 0.3.16 (316).
This commit is contained in:
blumia committed 2026-11-21 18:32:57 +08:00
1 parent ea3b1f0f5e
commit 1aa84a53e5
13 files changed
+655 -49

No files matched your search

+7 -2
View File
@@ -18,10 +18,14 @@ class NewSessionScreen extends StatefulWidget {
/// Opens the session drawer; null where the list is always on screen.
final VoidCallback? onOpenSessions;
/// The soft keyboard's height, from above the shell's Scaffold.
final double keyboardInset;
const NewSessionScreen({
super.key,
required this.app,
this.onOpenSessions,
this.keyboardInset = 0,
});
@override
@@ -255,7 +259,7 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
items: _attachments,
onRemove: _removeAttachment,
),
_composer(theme),
_composer(theme, widget.keyboardInset),
],
),
),
@@ -296,7 +300,7 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
);
}
Widget _composer(ThemeData theme) {
Widget _composer(ThemeData theme, double keyboardInset) {
final scheme = theme.colorScheme;
final sending = widget.app.sendingDraft;
final slash = _slashMatches();
@@ -306,6 +310,7 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
focusNode: _inputFocus,
hint: '规划、构建或提问',
maxLines: 5,
keyboardInset: keyboardInset,
textInputAction:
slash != null ? TextInputAction.send : TextInputAction.newline,
onSubmitted: slash == null || slashRows.isEmpty