feat: tabs own the panel header, a Termux key bar, and agent memory

- The panel's top row is now the tab group plus the close button; each tab
  keeps its own header: the files tab has the breadcrumb with new/more (or
  the name and edit/download while previewing), knowledge its search and
  refresh, the terminal its status.
- The key bar is Termux's two rows of seven: ESC / — HOME ↑ END PGUP, then
  TAB CTRL ALT ← ↓ → PGDN; the modifiers still apply to what the phone
  keyboard types.
- The panel is a dialog, so it gives the IME's height back itself
  (viewInsets.bottom). The key bar and the terminal stay above the
  keyboard, and the PTY reflows to the smaller terminal.
- Project knowledge gains the memory tab: both scopes from
  /api/agent-memory/all, absent when the server has memory switched off,
  with type, edit and delete.
- File preview editing passes minLines: null alongside expands.
- 0.3.12 (312).
This commit is contained in:
blumia committed 2026-11-21 11:09:44 +08:00
1 parent 5f95e2da97
commit 5a371e4faf
8 files changed
+675 -231

No files matched your search

+32 -42
View File
@@ -186,82 +186,74 @@ class _TerminalPanelState extends State<TerminalPanel> {
// ------------------------------------------------------------- key bar
static const _symbols = [
'/', '-', '|', '~', '*', r'$', '#', '_', '=', '+', ':', ';',
'"', "'", '(', ')', '[', ']', '{', '}', '<', '>', '?', '!',
'&', r'\', '^', '%', '@',
];
/// Two rows of seven, the way Termux lays them out: the keys a phone
/// keyboard cannot produce, all reachable with a thumb.
Widget _keyBar(ThemeData theme) {
return Container(
height: 46,
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerHigh,
border: Border(top: BorderSide(color: theme.dividerColor, width: 0.5)),
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.symmetric(horizontal: 6),
child: Row(
children: [
_key('CTRL', active: _t.ctrl, onTap: _t.toggleCtrl),
_key('ALT', active: _t.alt, onTap: _t.toggleAlt),
_key('SHIFT', active: _t.shift, onTap: _t.toggleShift),
_divider(theme),
padding: const EdgeInsets.fromLTRB(3, 3, 3, 3),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_keyRow([
_key('ESC', onTap: () => _sendKey(TerminalKey.escape)),
_key('TAB', onTap: () => _sendKey(TerminalKey.tab)),
_divider(theme),
_key('←', onTap: () => _sendKey(TerminalKey.arrowLeft)),
_key('↑', onTap: () => _sendKey(TerminalKey.arrowUp)),
_key('↓', onTap: () => _sendKey(TerminalKey.arrowDown)),
_key('→', onTap: () => _sendKey(TerminalKey.arrowRight)),
_divider(theme),
_key('/', onTap: () => _sendText('/')),
_key('—', onTap: () => _sendText('-')),
_key('HOME', onTap: () => _sendKey(TerminalKey.home)),
_key('↑', big: true, onTap: () => _sendKey(TerminalKey.arrowUp)),
_key('END', onTap: () => _sendKey(TerminalKey.end)),
_key('PGUP', onTap: () => _sendKey(TerminalKey.pageUp)),
]),
_keyRow([
_key('TAB', onTap: () => _sendKey(TerminalKey.tab)),
_key('CTRL', active: _t.ctrl, onTap: _t.toggleCtrl),
_key('ALT', active: _t.alt, onTap: _t.toggleAlt),
_key('←', big: true, onTap: () => _sendKey(TerminalKey.arrowLeft)),
_key('↓', big: true, onTap: () => _sendKey(TerminalKey.arrowDown)),
_key('→', big: true, onTap: () => _sendKey(TerminalKey.arrowRight)),
_key('PGDN', onTap: () => _sendKey(TerminalKey.pageDown)),
_key('DEL', onTap: () => _sendKey(TerminalKey.delete)),
_divider(theme),
for (final symbol in _symbols)
_key(symbol, onTap: () => _sendText(symbol)),
],
),
]),
],
),
);
}
Widget _divider(ThemeData theme) => Container(
width: 1,
height: 20,
margin: const EdgeInsets.symmetric(horizontal: 4),
color: theme.dividerColor,
Widget _keyRow(List<Widget> keys) => Padding(
padding: const EdgeInsets.symmetric(vertical: 1.5),
child: Row(
children: [for (final key in keys) Expanded(child: key)],
),
);
/// [big] draws a single glyph (an arrow) larger than a word.
Widget _key(String label,
{bool active = false, required VoidCallback onTap}) {
{bool active = false, bool big = false, required VoidCallback onTap}) {
final theme = Theme.of(context);
final scheme = theme.colorScheme;
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: onTap,
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 2, vertical: 8),
padding: const EdgeInsets.symmetric(horizontal: 10),
height: 30,
margin: const EdgeInsets.symmetric(horizontal: 1.5),
alignment: Alignment.center,
constraints: const BoxConstraints(minWidth: 34),
decoration: BoxDecoration(
color: active
? scheme.primary.withValues(alpha: 0.22)
: scheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(7),
borderRadius: BorderRadius.circular(6),
border: Border.all(
color: active ? scheme.primary : Colors.transparent, width: 1),
),
child: Text(
label,
maxLines: 1,
style: TextStyle(
fontFamily: 'monospace',
fontSize: 12,
fontSize: big ? 16 : 11,
fontWeight: active ? FontWeight.w700 : FontWeight.w500,
color: active ? scheme.primary : scheme.onSurface,
),
@@ -270,8 +262,6 @@ class _TerminalPanelState extends State<TerminalPanel> {
);
}
// The terminal state applies the pending modifiers (and clears them) as the
// text leaves for the PTY, so both the bar and the phone keyboard take them.
void _sendKey(TerminalKey key) =>
_t.model.keyInput(key, ctrl: _t.ctrl, alt: _t.alt, shift: _t.shift);