Per feedback, the model · permission-mode · context line reads better in the status bar than as a strip above the conversation. Adds a generic, publisher-agnostic status-bar context slot: a pane publishes a short string to the `statusbar.context` MessageBus channel and the bar shows the latest. The active Claude sub-tab publishes (inactive panes stay quiet, so no race); switching tabs swaps the slot to the focused pane. Replaces the in-pane ClaudeStatusStrip with a formatStatusLine helper + PaneContextStatusItem (the status-bar widget) and a StatusItemContribution. ClaudeSessionHost passes `active` so only the visible sub-tab publishes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
43 lines
1.6 KiB
Dart
43 lines
1.6 KiB
Dart
/// Tests for the per-session status line formatting (T-145).
|
|
library;
|
|
|
|
import 'package:clide/builtin/claude/src/claude_status.dart';
|
|
import 'package:clide/builtin/claude/src/transcript_reader.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
group('status formatters', () {
|
|
test('shortModelLabel strips the claude- prefix and dots the version', () {
|
|
expect(shortModelLabel('claude-opus-4-7'), 'opus 4.7');
|
|
expect(shortModelLabel('claude-sonnet-4-6'), 'sonnet 4.6');
|
|
expect(shortModelLabel('weird'), 'weird');
|
|
});
|
|
|
|
test('permissionModeLabel humanises CC modes', () {
|
|
expect(permissionModeLabel('acceptEdits'), 'accept-edits');
|
|
expect(permissionModeLabel('bypassPermissions'), 'bypass');
|
|
expect(permissionModeLabel('plan'), 'plan');
|
|
expect(permissionModeLabel('default'), 'default');
|
|
expect(permissionModeLabel('something-new'), 'something-new');
|
|
});
|
|
|
|
test('formatTokenCount uses k / M / raw', () {
|
|
expect(formatTokenCount(500), '500');
|
|
expect(formatTokenCount(765000), '765k');
|
|
expect(formatTokenCount(1200000), '1.2M');
|
|
});
|
|
});
|
|
|
|
group('formatStatusLine', () {
|
|
test('joins the present fields', () {
|
|
const s = SessionStatus(model: 'claude-opus-4-7', permissionMode: 'acceptEdits', contextTokens: 21000);
|
|
expect(formatStatusLine(s), 'opus 4.7 · accept-edits · 21k ctx');
|
|
});
|
|
|
|
test('omits absent fields', () {
|
|
expect(formatStatusLine(const SessionStatus(model: 'claude-sonnet-4-6')), 'sonnet 4.6');
|
|
expect(formatStatusLine(const SessionStatus()), '');
|
|
});
|
|
});
|
|
}
|