route Claude transcript content through the MessageBus
test / unit + widget + golden + a11y (push) Failing after 26s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 23s
test / unit + widget + golden + a11y (push) Failing after 26s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 23s
The Claude pane owned a TranscriptReader directly via the controller. Insert a TranscriptPublisher that tails the transcript and republishes each ConversationItem onto the kernel MessageBus; the view's controller subscribes through ConversationController.fromBus. The subscription is attached before the reader's first poll, so the initial tail isn't missed on the broadcast bus. This decouples reading from rendering: the team work (T-139/T-140) can run one observer that publishes per-agent channels while the lead tile and each teammate tile subscribe independently. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,9 @@ library;
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:clide/builtin/claude/src/transcript_publisher.dart';
|
||||
import 'package:clide/builtin/claude/src/transcript_reader.dart';
|
||||
import 'package:clide/kernel/src/events/message_bus.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class ConversationController extends ChangeNotifier {
|
||||
@@ -23,11 +25,18 @@ class ConversationController extends ChangeNotifier {
|
||||
_sub = stream.listen(_onItem);
|
||||
}
|
||||
|
||||
/// Convenience: build a controller backed by a live [TranscriptReader]
|
||||
/// for [workspacePath].
|
||||
factory ConversationController.forWorkspace(String workspacePath) {
|
||||
final reader = TranscriptReader(workspacePath);
|
||||
return ConversationController(stream: reader.stream, onDispose: reader.dispose);
|
||||
/// Build a controller fed from the kernel [MessageBus] — it consumes
|
||||
/// the [ConversationItem]s a [TranscriptPublisher] writes onto
|
||||
/// [publisher]/[channel]. Decouples the view from the reader so several
|
||||
/// panels can render the same conversation (team work, T-139/T-140).
|
||||
factory ConversationController.fromBus({
|
||||
required MessageBus messages,
|
||||
String channel = ClaudeConversation.leadChannel,
|
||||
Future<void> Function()? onDispose,
|
||||
}) {
|
||||
final stream =
|
||||
messages.subscribe(publisher: ClaudeConversation.publisher, channel: channel).map((m) => m.data[ClaudeConversation.itemKey] as ConversationItem);
|
||||
return ConversationController(stream: stream, onDispose: onDispose);
|
||||
}
|
||||
|
||||
final Future<void> Function()? _onDispose;
|
||||
|
||||
Reference in New Issue
Block a user