Merge: chat colours, Ctrl+1-9, starred chats alphabetical
# Conflicts: # app/lib/features/chat/conversation/chat_thread_view.dart # app/tool/perf/perf_fixture.dart # internal/protocol/chat.go # internal/server/chat_close.go # internal/server/chat_sessions.go
This commit is contained in:
@@ -98,10 +98,7 @@ class _ApprovalsGateway implements ApiGateway {
|
||||
'session_id': 'probe-session',
|
||||
'request_id': 'probe-permission',
|
||||
'action': 'bash',
|
||||
'resources': [
|
||||
'command: rm -rf build',
|
||||
'cwd: /workspace/demo',
|
||||
],
|
||||
'resources': ['command: rm -rf build', 'cwd: /workspace/demo'],
|
||||
'message': 'This deletes the build output.',
|
||||
'source': {'type': 'tool'},
|
||||
};
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
// `?graph=1` run 7 carries its pinned graph (plan -> build);
|
||||
// `?quota=claude|opencode` (with `?chats=N`) pushes a usage frame with
|
||||
// that harness's account quota after a chat subscribes.
|
||||
// `?colors=1` (with `?chats=N`) names the chats, stars and colours some of
|
||||
// them, and keeps colours picked with chat_color;
|
||||
// `?msgs=`, `?rich=1`, `?older=1`, `?live=N` vary the chat transcripts for
|
||||
// scroll captures (tool/perf/chat_scroll_fixture.dart).
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
@@ -25,6 +27,50 @@ void configurePerfFixture(Map<String, String> params) {
|
||||
int get _hits => int.tryParse(_params['hits'] ?? '') ?? 0;
|
||||
int get _chats => int.tryParse(_params['chats'] ?? '') ?? 0;
|
||||
bool get perfRunGraph => _params['graph'] == '1';
|
||||
bool get _colors => _params['colors'] == '1';
|
||||
|
||||
/// `?colors=1`: titles, directories, stars and colours per chat index.
|
||||
const _colorTitles = [
|
||||
'Release notes',
|
||||
'api refactor',
|
||||
'Billing bug',
|
||||
'Docs pass',
|
||||
'Flaky test',
|
||||
'Onboarding',
|
||||
'Perf sweep',
|
||||
'Search UX',
|
||||
];
|
||||
const _colorStarred = {0, 1, 3};
|
||||
const _colorNames = ['teal', 'purple', null, 'amber', 'red', null, 'blue'];
|
||||
final Map<String, String?> _pickedColors = {};
|
||||
|
||||
JsonMap _chatRow(int i) {
|
||||
final id = 'perf-chat-$i';
|
||||
if (!_colors) {
|
||||
return {
|
||||
'id': id,
|
||||
'title': 'Fixture chat ${i + 1}',
|
||||
'directory': '/workspace/demo',
|
||||
// Server-shaped handoff facts (chat_sessions rows carry them).
|
||||
if (_harness != 'opencode') 'backend': _harness,
|
||||
'resume_command': _resumeCommand(id),
|
||||
'native_export': _harness == 'claude',
|
||||
};
|
||||
}
|
||||
final color = _pickedColors.containsKey(id)
|
||||
? _pickedColors[id]
|
||||
: _colorNames[i % _colorNames.length];
|
||||
return {
|
||||
'id': id,
|
||||
'title': _colorTitles[i % _colorTitles.length],
|
||||
'directory': i.isEven ? '/workspace/demo' : '/workspace/site',
|
||||
'model': 'claude-opus',
|
||||
'backend': 'claude',
|
||||
'updated_at': DateTime.now().millisecondsSinceEpoch - (i + 1) * 600000,
|
||||
if (_colorStarred.contains(i)) 'starred': true,
|
||||
'color': ?color,
|
||||
};
|
||||
}
|
||||
|
||||
/// `?harness=claude|codex` makes the chats that harness's (default OpenCode),
|
||||
/// with the resume command the server would send for it.
|
||||
@@ -146,18 +192,20 @@ JsonMap? perfChatReply(JsonMap request) {
|
||||
return {
|
||||
'id': id,
|
||||
'type': 'chat_sessions',
|
||||
'chat_sessions': [
|
||||
for (var i = 0; i < _chats; i++)
|
||||
{
|
||||
'id': 'perf-chat-$i',
|
||||
'title': 'Fixture chat ${i + 1}',
|
||||
'directory': '/workspace/demo',
|
||||
// Server-shaped handoff facts (chat_sessions rows carry them).
|
||||
if (_harness != 'opencode') 'backend': _harness,
|
||||
'resume_command': _resumeCommand('perf-chat-$i'),
|
||||
'native_export': _harness == 'claude',
|
||||
},
|
||||
],
|
||||
'chat_sessions': [for (var i = 0; i < _chats; i++) _chatRow(i)],
|
||||
};
|
||||
case 'chat_color':
|
||||
final query = request['chat_query'];
|
||||
final session = query is Map ? '${query['session_id'] ?? ''}' : '';
|
||||
final color = query is Map ? query['color'] as String? : null;
|
||||
_pickedColors[session] = color;
|
||||
final index = int.tryParse(session.replaceFirst('perf-chat-', '')) ?? 0;
|
||||
final row = _chatRow(index);
|
||||
return {
|
||||
'id': id,
|
||||
'type': 'chat_color',
|
||||
'chat_session': row,
|
||||
'chat_sessions': [row],
|
||||
};
|
||||
case 'chat_export':
|
||||
final body = request['chat_export'];
|
||||
|
||||
Reference in New Issue
Block a user