route slash commands: TUI-only builtins become local notices (T-411)
clide forwards composer input to a headless (stream-json) CLI, where the
TUI's interactive commands don't exist. A known-but-TUI-only command
errored raw ("/x isn't available in this environment", rendered as fake
claude prose); an un-advertised one (e.g. /effort on 2.1.175) was worse —
bracket-pasted to the model as literal text, burning a real turn.
Probed claude 2.1.175 for ground truth: the initialize handshake's
slash_commands advertises skills + the headless builtins only; forwarded
local-command output comes back as an assistant message with model
"<synthetic>"; set_effort is not a control subtype; /usage works headless.
- slash_commands.dart: SlashRoute routing table (owned > advertised >
TUI-only catalog > forward) + kTuiOnlyCommands with clide-native hints
+ tuiOnlyNotice(). One source of truth replacing ad-hoc checks.
- claude_pane._send routes 'unavailable' to a local notice card; nothing
reaches the session.
- transcript_reader: AssistantTextMessage.synthetic ("<synthetic>" model)
so CLI-local output is distinguishable; "<synthetic>" no longer
clobbers the tracked model in SessionStatus (latent /usage bug).
- conversation_view: synthetic output renders as a muted framed "clide"
card (T-306 styling), never coral Claude prose.
- kFallbackSlashCommands trimmed to the genuinely-headless builtin set —
it doubles as the router's advertised fallback, and the old list's
TUI-only entries would have routed to a raw CLI error.
Board (rides this commit): T-414 gains the user's sidebar styling-pass
note; T-416 filed — surface Claude Code Workflow runs in convo/status.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -524,6 +524,51 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
group('synthetic CLI-local output (T-411)', () {
|
||||
String syntheticEvent(String text) => jsonEncode({
|
||||
'type': 'assistant',
|
||||
'uuid': 'syn1',
|
||||
'timestamp': '2026-06-12T10:00:00.000Z',
|
||||
'message': {
|
||||
'role': 'assistant',
|
||||
'model': '<synthetic>',
|
||||
'content': [
|
||||
{'type': 'text', 'text': text},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
test('a "<synthetic>" assistant message parses with synthetic: true', () {
|
||||
final parsed = parseTranscriptChunk(syntheticEvent("/effort isn't available in this environment."));
|
||||
final msg = parsed.items.whereType<AssistantTextMessage>().single;
|
||||
expect(msg.synthetic, isTrue);
|
||||
expect(msg.text, contains("isn't available"));
|
||||
});
|
||||
|
||||
test('"<synthetic>" never clobbers the tracked model', () {
|
||||
final parsed = parseTranscriptChunk(syntheticEvent('usage text'));
|
||||
expect(parsed.status.model, isNull);
|
||||
});
|
||||
|
||||
test('a real assistant message stays non-synthetic', () {
|
||||
final chunk = jsonEncode({
|
||||
'type': 'assistant',
|
||||
'uuid': 'a2',
|
||||
'timestamp': '2026-06-12T10:00:00.000Z',
|
||||
'message': {
|
||||
'role': 'assistant',
|
||||
'model': 'claude-fable-5',
|
||||
'content': [
|
||||
{'type': 'text', 'text': 'hello'},
|
||||
],
|
||||
},
|
||||
});
|
||||
final parsed = parseTranscriptChunk(chunk);
|
||||
expect(parsed.items.whereType<AssistantTextMessage>().single.synthetic, isFalse);
|
||||
expect(parsed.status.model, 'claude-fable-5');
|
||||
});
|
||||
});
|
||||
|
||||
group('TranscriptReader — append streaming (filesystem)', () {
|
||||
late Directory tempBase;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user