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

+72
View File
@@ -590,6 +590,78 @@ class ProjectContext {
bool get isEmpty => notes.isEmpty && todos.isEmpty && plans.isEmpty;
}
/// One remembered fact, preference or reference. The agent writes these
/// through its memory tool; the panel reads, corrects and deletes them.
class AgentMemoryEntry {
final String id;
final String title;
final String body;
final String type; // fact | preference | reference
final int createdAt;
final int updatedAt;
final bool flagged;
final String? sessionId;
const AgentMemoryEntry({
required this.id,
required this.title,
required this.body,
this.type = 'fact',
this.createdAt = 0,
this.updatedAt = 0,
this.flagged = false,
this.sessionId,
});
factory AgentMemoryEntry.fromJson(Map<String, dynamic> j) => AgentMemoryEntry(
id: j['id'] as String? ?? '',
title: j['title'] as String? ?? '',
body: j['body'] as String? ?? '',
type: j['type'] as String? ?? 'fact',
createdAt: (j['createdAt'] as num?)?.toInt() ?? 0,
updatedAt: (j['updatedAt'] as num?)?.toInt() ?? 0,
flagged: j['flagged'] == true,
sessionId: j['sessionId'] as String?,
);
String get typeLabel => switch (type) {
'preference' => '偏好',
'reference' => '参考',
_ => '事实',
};
}
/// Both memory scopes in one read, as `/api/agent-memory/all` answers.
class AgentMemorySnapshot {
final List<AgentMemoryEntry> global;
final List<AgentMemoryEntry> project;
final bool globalFailed;
final bool projectFailed;
const AgentMemorySnapshot({
this.global = const [],
this.project = const [],
this.globalFailed = false,
this.projectFailed = false,
});
factory AgentMemorySnapshot.fromJson(Map<String, dynamic> j) =>
AgentMemorySnapshot(
global: [
for (final m in (j['global'] as List? ?? []))
if (m is Map<String, dynamic>) AgentMemoryEntry.fromJson(m),
],
project: [
for (final m in (j['project'] as List? ?? []))
if (m is Map<String, dynamic>) AgentMemoryEntry.fromJson(m),
],
globalFailed: j['globalFailed'] == true,
projectFailed: j['projectFailed'] == true,
);
bool get isEmpty => global.isEmpty && project.isEmpty;
}
/// A plan as the server reads it back: the link plus its Markdown.
class ProjectPlanContent {
final String id;