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:
@@ -114,12 +114,19 @@ final class AssistantTextMessage extends ConversationItem {
|
||||
super.parentUuid,
|
||||
super.parentToolUseId,
|
||||
required this.text,
|
||||
this.synthetic = false,
|
||||
});
|
||||
|
||||
final String text;
|
||||
|
||||
/// CLI-local output, not the model: the wire marks it `model: "<synthetic>"`
|
||||
/// (a forwarded local command's response — /usage output, "/x isn't
|
||||
/// available in this environment", …). clide-injected notices use it too.
|
||||
/// Rendered as a muted "clide" card, never coral Claude prose (T-411).
|
||||
final bool synthetic;
|
||||
|
||||
@override
|
||||
String toString() => 'AssistantTextMessage(${_shortId(uuid)}, ${text.length} chars)';
|
||||
String toString() => 'AssistantTextMessage(${_shortId(uuid)}, ${text.length} chars${synthetic ? ', synthetic' : ''})';
|
||||
}
|
||||
|
||||
/// Extended thinking block from an assistant turn.
|
||||
@@ -582,7 +589,9 @@ void _extractAssistantStatus(Map<String, dynamic> envelope, _StatusAcc status) {
|
||||
final message = envelope['message'] as Map?;
|
||||
if (message == null) return;
|
||||
final model = message['model'] as String?;
|
||||
if (model != null && model.isNotEmpty) status.model = model;
|
||||
// "<synthetic>" marks CLI-local output (a forwarded local command's
|
||||
// response) — not a model switch; it must not clobber the tracked model.
|
||||
if (model != null && model.isNotEmpty && model != kSyntheticModel) status.model = model;
|
||||
final usage = message['usage'] as Map?;
|
||||
if (usage != null) {
|
||||
int n(String k) => (usage[k] as num?)?.toInt() ?? 0;
|
||||
@@ -656,6 +665,9 @@ void _parseUserInto(
|
||||
}
|
||||
}
|
||||
|
||||
/// The model marker on CLI-local output (forwarded local-command responses).
|
||||
const String kSyntheticModel = '<synthetic>';
|
||||
|
||||
void _parseAssistantInto(
|
||||
Map<String, dynamic> envelope,
|
||||
String uuid,
|
||||
@@ -669,6 +681,7 @@ void _parseAssistantInto(
|
||||
if (message == null) return;
|
||||
final content = message['content'];
|
||||
if (content is! List) return;
|
||||
final synthetic = (message['model'] as String?) == kSyntheticModel;
|
||||
|
||||
for (final item in content) {
|
||||
if (item is! Map) continue;
|
||||
@@ -684,6 +697,7 @@ void _parseAssistantInto(
|
||||
parentUuid: parentUuid,
|
||||
parentToolUseId: parentToolUseId,
|
||||
text: text,
|
||||
synthetic: synthetic,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user