Merge branch 'worktree-agent-a85504335ecc45672' into worktree-agent-a717651aa412e3b7c

This commit is contained in:
2026-12-03 00:49:51 +00:00
25 changed files with 1223 additions and 46 deletions
@@ -0,0 +1,25 @@
{
"size": "1440x1000",
"params": "chats=8&colors=1&activity=1&closed=2",
"steps": [
{ "open": "/chat/perf-chat-1" },
{ "wait": 1500 },
{ "press": "Alt+k", "wait": 800 },
{ "type": "billing", "wait": 500 },
{ "press": "Enter", "wait": 1200 },
{ "press": "Alt+k", "wait": 800 },
{ "shot": "recent-first-previous-selected" },
{ "press": "Enter", "wait": 1200 },
{ "shot": "back-to-previous" },
{ "press": "Alt+k", "wait": 800 },
{ "type": "s", "wait": 500 },
{ "shot": "closed-section" },
{ "type": "earch", "wait": 400 },
{ "press": "Enter", "wait": 1500 },
{ "shot": "closed-reopened" },
{ "press": "Alt+j", "wait": 1500 },
{ "shot": "alt-j-needs-you" },
{ "press": "Alt+n", "wait": 1200 },
{ "shot": "alt-n-new-chat" }
]
}
+20
View File
@@ -17,6 +17,8 @@
// them, and keeps colours picked with chat_color;
// `?activity=1` (with `?chats=N`) lists a running chat, one with
// background tasks and idle ones;
// `?closed=N` (with `?chats=N`) closes the last N chats (chat_reopen
// reopens one);
// `?automations=N` reports N native automations for the selected chat;
// `?msgs=`, `?rich=1`, `?older=1`, `?live=N` vary the chat transcripts for
// scroll captures (tool/perf/chat_scroll_fixture.dart).
@@ -91,8 +93,22 @@ const _colorNames = ['teal', 'purple', null, 'amber', 'red', null, 'blue'];
final Map<String, String?> _pickedColors = {};
final _chatCatalog = ChatCatalogFixture();
/// `?closed=N` (with `?chats=N`): the last N chats are closed until
/// chat_reopen reopens one.
int get _closedCount => int.tryParse(_params['closed'] ?? '') ?? 0;
final Set<String> _reopened = {};
JsonMap _chatRow(int i) {
final id = perfChatId(i);
final closed = i >= _chats - _closedCount && !_reopened.contains(id);
return {
..._openChatRow(i, id),
if (closed)
'closed_at': DateTime.now().millisecondsSinceEpoch - (i + 1) * 60000,
};
}
JsonMap _openChatRow(int i, String id) {
if (!_colors) {
return {
'id': id,
@@ -305,6 +321,10 @@ JsonMap? perfChatReply(JsonMap request) {
'type': 'chat_sessions',
'chat_sessions': [for (var i = 0; i < _chats; i++) _chatRow(i)],
};
case 'chat_reopen':
final query = request['chat_query'];
_reopened.add(query is Map ? '${query['session_id'] ?? ''}' : '');
return {'id': id, 'type': 'chat_reopen'};
case 'chat_color':
final query = request['chat_query'];
final session = query is Map ? '${query['session_id'] ?? ''}' : '';