diff --git a/app/tool/capture/README.md b/app/tool/capture/README.md index 0f3ba690..7610ad78 100644 --- a/app/tool/capture/README.md +++ b/app/tool/capture/README.md @@ -165,4 +165,4 @@ over the inactive pane must change its own offset without activating it; at its bottom `pixels` reaches `max` and its `viewport` equals the small visible height. Use `film=key:chat-peek-` to record the swap. -Chat header grouping: `?chats=2&header=1` supplies a model and permission mode to the fixture chat so the selector island and Files/More island can both be reviewed. +Chat header grouping: `?chats=2&header=1` supplies a model, permission mode and thinking levels (answering `chat_effort`, tool/perf/chat_effort_fixture.dart) to the fixture chat so the selector island and Files/More island can both be reviewed. diff --git a/app/tool/perf/chat_effort_fixture.dart b/app/tool/perf/chat_effort_fixture.dart new file mode 100644 index 00000000..ab5aff4b --- /dev/null +++ b/app/tool/perf/chat_effort_fixture.dart @@ -0,0 +1,47 @@ +import 'package:pipelines_app/core/api_gateway.dart'; + +/// `?header=1` thinking levels: the fixture model's levels as a Codex +/// model/list reports them, and the level each chat last chose. +const _levels = [ + { + 'id': 'low', + 'name': 'Low', + 'description': 'Fast responses with lighter reasoning', + }, + { + 'id': 'medium', + 'name': 'Medium', + 'description': 'Balances speed and reasoning depth', + }, + { + 'id': 'high', + 'name': 'High', + 'description': 'Greater reasoning depth for complex problems', + }, + { + 'id': 'xhigh', + 'name': 'Extra high', + 'description': 'Extra high reasoning depth for complex problems', + }, +]; + +final Map _chosen = {}; + +/// The row fields a server sends for a chat whose model has levels. +JsonMap chatEffortRowFields(String id) => { + 'effort': _chosen[id] ?? '', + 'efforts': _levels, + 'default_effort': 'medium', +}; + +/// The `chat_effort` reply: the stored level with the model's levels. +JsonMap chatEffortReply(JsonMap request) { + final body = request['chat_effort']; + final id = body is Map ? '${body['session_id'] ?? ''}' : ''; + final effort = body is Map ? '${body['effort'] ?? ''}' : ''; + _chosen[id] = effort; + return { + 'type': 'chat_effort', + 'chat_effort': {'session_id': id, ...chatEffortRowFields(id)}, + }; +} diff --git a/app/tool/perf/perf_fixture.dart b/app/tool/perf/perf_fixture.dart index 5bbef864..3ae75cdd 100644 --- a/app/tool/perf/perf_fixture.dart +++ b/app/tool/perf/perf_fixture.dart @@ -22,6 +22,7 @@ // (tool/perf/chat_new_session_fixture.dart). import 'package:pipelines_app/core/api_gateway.dart'; +import 'chat_effort_fixture.dart'; import 'chat_new_session_fixture.dart'; import 'chat_turn_diff_fixture.dart'; import 'chat_question_fixture.dart'; @@ -86,6 +87,7 @@ JsonMap _chatRow(int i) { 'model': 'openai/gpt-6.1', 'mode': 'default', 'mode_name': 'Ask for permission', + ...chatEffortRowFields(id), }, // Server-shaped handoff facts (chat_sessions rows carry them). if (_harness != 'opencode') 'backend': _harness, @@ -238,6 +240,8 @@ JsonMap? perfChatReply(JsonMap request) { if (shell != null) return shell; final id = request['id']; switch ('${request['type']}') { + case 'chat_effort': + return {'id': id, ...chatEffortReply(request)}; case 'chat_sessions': return { 'id': id,