12c7642e35
Ctrl+K lists open chats most recently used first (tracked on open and pane focus, persisted per server) and preselects the previous chat, so Ctrl+K, Enter returns to it. Rows mark needs you / working / unread; a query also lists matching closed chats under Closed, and choosing one reopens it. Alt+N (Option+N) starts a new chat and Alt+J (Option+J) opens the next chat waiting for you, unread or failed, cycling; the terminal keeps both. In run detail, bare 1-4 switch tabs when not typing. Cheatsheet entries added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.4 KiB
Dart
41 lines
1.4 KiB
Dart
import '../../../core/api_gateway.dart';
|
|
import 'chat_list_activity.dart';
|
|
import 'chat_sessions.dart';
|
|
|
|
/// Whether an open chat needs the operator: it waits on an approval or a
|
|
/// question, has replies not read yet ([unread]), or an action on it failed
|
|
/// ([failed]).
|
|
bool chatNeedsAttention(
|
|
JsonMap session, {
|
|
required bool unread,
|
|
required bool failed,
|
|
}) => chatSessionAwaitingOperator(session) > 0 || unread || failed;
|
|
|
|
/// The chat Alt+J opens: the next open chat after [currentId], in the order
|
|
/// the list draws them (starred, then by directory; folded sections count),
|
|
/// that [needsAttention], wrapping around. With no current chat (or one not
|
|
/// among the open chats) the first such chat. Null when no other chat needs
|
|
/// the operator.
|
|
JsonMap? chatNextNeedingAttention(
|
|
List<JsonMap> sessions,
|
|
String? currentId,
|
|
bool Function(JsonMap session) needsAttention,
|
|
) {
|
|
final open = chatSessionsInListOrder(
|
|
chatSessionSections(
|
|
sessions
|
|
.where((row) => row['closed_at'] == null && row['closed'] != true)
|
|
.toList(),
|
|
),
|
|
isOpen: (_) => true,
|
|
);
|
|
if (open.isEmpty) return null;
|
|
final at = open.indexWhere((row) => '${row['id'] ?? ''}' == currentId);
|
|
for (var step = 1; step <= open.length; step++) {
|
|
final row = open[(at + step) % open.length];
|
|
if ('${row['id'] ?? ''}' == currentId) continue;
|
|
if (needsAttention(row)) return row;
|
|
}
|
|
return null;
|
|
}
|