Merge branch 'worktree-agent-ae6543d03d048d81f'

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 16:10:47 +00:00
28 changed files with 1391 additions and 70 deletions
+36 -9
View File
@@ -16,6 +16,10 @@ import '../shell/adaptive_shell.dart';
import '../shell/destination.dart';
import '../features/attention/notify/notification_controller.dart';
import '../features/attention/notify/chat_question_notices.dart';
import '../features/attention/notify/agent_notices.dart';
import '../features/attention/notify/page_signals.dart';
import '../features/attention/ui/agent_notice_toast.dart';
import 'clipboard_failures.dart' show appScaffoldMessengerKey;
import '../features/attention/notify/notification_store.dart';
import '../features/notification_service/notification_service_bridge.dart';
import '../features/notification_service/notification_service_controller.dart';
@@ -269,6 +273,11 @@ class _PipelinesAppState extends State<PipelinesApp>
);
ChatQuestionNotices? _chatQuestionNotices;
/// Agents' notify calls on this device: a system notification, a toast, the
/// tab title count. Subscribed on every connection so missed ones replay.
AgentNotices? _agentNotices;
final PageSignals _pageSignals = createPageSignals();
/// One attention surface for the app: the Runs heading's bell draws from it
/// and the shell mirrors its count on the Runs tab, so the badge is visible
/// from every destination. The Runs list seeds the rows when it loads; pushed
@@ -472,18 +481,22 @@ class _PipelinesAppState extends State<PipelinesApp>
_chatQuestionNotices = ChatQuestionNotices(
gateway: _session.gateway,
canNotify: () => _notifications.canNotify,
activeChatSessionId: () {
final route = _delegate.shellRoute;
return route.kind == AppRouteKind.chat ? route.chatSessionId : null;
},
activeChatSessionId: _activeChatSessionId,
sessionTitle: _chatSessionTitle,
openChat: (id) {
if (!mounted) return;
widget.servers?.requestChatOpen(id);
_delegate.goTo(AppRoute.chatSession(id));
},
openChat: _openNotifiedChat,
bridge: _notifications.bridge,
);
_agentNotices = AgentNotices(
gateway: _session.gateway,
notifications: _notifications,
page: _pageSignals,
activeChatSessionId: _activeChatSessionId,
sessionTitle: _chatSessionTitle,
openChat: _openNotifiedChat,
showToast: (toast) =>
showAgentNoticeToast(appScaffoldMessengerKey.currentState, toast),
sendOnly: _session.client.sendOnly,
);
_config = RouterConfig<AppRoute>(
routeInformationParser: const AppRouteParser(),
routerDelegate: _delegate,
@@ -595,6 +608,8 @@ class _PipelinesAppState extends State<PipelinesApp>
_notifications.dispose();
_deliveryController.dispose();
_chatQuestionNotices?.dispose();
_agentNotices?.dispose();
_pageSignals.dispose();
if (identical(MachineElevation.defaultPrompt, _elevationPrompt)) {
MachineElevation.defaultPrompt = null;
}
@@ -667,6 +682,7 @@ class _PipelinesAppState extends State<PipelinesApp>
// Every connected transition sends acknowledgements queued while offline
// and re-reads the shared set, so a gap cannot leave this device stale.
if (_session.connected) unawaited(_ackSync.connected());
if (_session.connected) unawaited(_agentNotices?.connected());
}
/// Mirrors attention and independent status counts for the shell. The Runs list seeds
@@ -879,6 +895,17 @@ class _PipelinesAppState extends State<PipelinesApp>
setState(() => _pendingRunSearch = null);
}
String? _activeChatSessionId() {
final route = _delegate.shellRoute;
return route.kind == AppRouteKind.chat ? route.chatSessionId : null;
}
void _openNotifiedChat(String id) {
if (!mounted) return;
widget.servers?.requestChatOpen(id);
_delegate.goTo(AppRoute.chatSession(id));
}
Future<String?> _chatSessionTitle(String id) async {
id = widget.chatPool?.gateway.normalizeId(id) ?? id;
final reply = await (widget.chatPool?.gateway ?? _session.gateway).call(