@@ -62,10 +62,10 @@ external JSObject? get _testMockedWindow;
6262external JSBoolean _evalTestQueueExists (String code);
6363
6464bool _hasTestQuickPickResponses () => _evalTestQueueExists (
65- // Use !! to coerce to proper boolean, ensures JS returns true/false
66- '!!(globalThis._testQuickPickResponses && '
67- 'globalThis._testQuickPickResponses.length > 0)' ,
68- ).toDart;
65+ // Use !! to coerce to proper boolean, ensures JS returns true/false
66+ '!!(globalThis._testQuickPickResponses && '
67+ 'globalThis._testQuickPickResponses.length > 0)' ,
68+ ).toDart;
6969
7070/// Shift a value from the test QuickPick queue.
7171@JS ('globalThis._testQuickPickResponses.shift' )
@@ -149,23 +149,30 @@ JSObject _doActivateSync(ExtensionContext context) {
149149 _log ('Auto-connect: $autoConnect ' );
150150 if (autoConnect) {
151151 _log ('Attempting auto-connect...' );
152- unawaited (_storeManager? .connect ().then ((_) {
153- _log ('Auto-connect successful' );
154- }).catchError ((Object e) {
155- _log ('Auto-connect failed: $e ' );
156- }));
152+ unawaited (
153+ _storeManager
154+ ? .connect ()
155+ .then ((_) {
156+ _log ('Auto-connect successful' );
157+ })
158+ .catchError ((Object e) {
159+ _log ('Auto-connect failed: $e ' );
160+ }),
161+ );
157162 }
158163
159164 _log ('Extension activated' );
160165
161166 // Register disposables
162- context.addSubscription (createDisposable (() {
163- unawaited (_storeManager? .disconnect ());
164- statusBar.dispose ();
165- _agentsProvider? .dispose ();
166- _locksProvider? .dispose ();
167- _messagesProvider? .dispose ();
168- }));
167+ context.addSubscription (
168+ createDisposable (() {
169+ unawaited (_storeManager? .disconnect ());
170+ statusBar.dispose ();
171+ _agentsProvider? .dispose ();
172+ _locksProvider? .dispose ();
173+ _messagesProvider? .dispose ();
174+ }),
175+ );
169176
170177 // Return test API
171178 _consoleLog ('DART EXTENSION: Creating TestAPI...' );
@@ -188,8 +195,9 @@ void _registerCommands(ExtensionContext context) {
188195 try {
189196 await _storeManager? .connect ();
190197 _log ('Connected successfully' );
191- vscode.window
192- .showInformationMessage ('Connected to Too Many Cooks server' );
198+ vscode.window.showInformationMessage (
199+ 'Connected to Too Many Cooks server' ,
200+ );
193201 } on Object catch (e) {
194202 _log ('Connection failed: $e ' );
195203 vscode.window.showErrorMessage ('Failed to connect: $e ' );
@@ -203,8 +211,9 @@ void _registerCommands(ExtensionContext context) {
203211 'tooManyCooks.disconnect' ,
204212 () async {
205213 await _storeManager? .disconnect ();
206- vscode.window
207- .showInformationMessage ('Disconnected from Too Many Cooks server' );
214+ vscode.window.showInformationMessage (
215+ 'Disconnected from Too Many Cooks server' ,
216+ );
208217 },
209218 );
210219 context.addSubscription (disconnectCmd);
@@ -373,10 +382,12 @@ void _registerCommands(ExtensionContext context) {
373382
374383 try {
375384 await _storeManager? .sendMessage (fromAgent, toAgent, content);
376- final preview =
377- content.length > 50 ? '${content .substring (0 , 50 )}...' : content;
378- vscode.window
379- .showInformationMessage ('Message sent to $toAgent : "$preview "' );
385+ final preview = content.length > 50
386+ ? '${content .substring (0 , 50 )}...'
387+ : content;
388+ vscode.window.showInformationMessage (
389+ 'Message sent to $toAgent : "$preview "' ,
390+ );
380391 _log ('Message sent from $fromAgent to $toAgent : $content ' );
381392 } on Object catch (e) {
382393 _log ('Failed to send message: $e ' );
@@ -448,45 +459,57 @@ JSObject _createTestAPI() {
448459/// TestAPI implementation that matches the TypeScript interface.
449460class _TestAPIImpl {
450461 // State getters
451- List <Map <String , Object ?>> getAgents () => _storeManager? .state.agents
452- .map ((a) => {
453- 'agentName' : a.agentName,
454- 'registeredAt' : a.registeredAt,
455- 'lastActive' : a.lastActive,
456- })
462+ List <Map <String , Object ?>> getAgents () =>
463+ _storeManager? .state.agents
464+ .map (
465+ (a) => {
466+ 'agentName' : a.agentName,
467+ 'registeredAt' : a.registeredAt,
468+ 'lastActive' : a.lastActive,
469+ },
470+ )
457471 .toList () ??
458472 [];
459473
460- List <Map <String , Object ?>> getLocks () => _storeManager? .state.locks
461- .map ((l) => {
462- 'filePath' : l.filePath,
463- 'agentName' : l.agentName,
464- 'acquiredAt' : l.acquiredAt,
465- 'expiresAt' : l.expiresAt,
466- 'reason' : l.reason,
467- })
474+ List <Map <String , Object ?>> getLocks () =>
475+ _storeManager? .state.locks
476+ .map (
477+ (l) => {
478+ 'filePath' : l.filePath,
479+ 'agentName' : l.agentName,
480+ 'acquiredAt' : l.acquiredAt,
481+ 'expiresAt' : l.expiresAt,
482+ 'reason' : l.reason,
483+ },
484+ )
468485 .toList () ??
469486 [];
470487
471- List <Map <String , Object ?>> getMessages () => _storeManager? .state.messages
472- .map ((m) => {
473- 'id' : m.id,
474- 'fromAgent' : m.fromAgent,
475- 'toAgent' : m.toAgent,
476- 'content' : m.content,
477- 'createdAt' : m.createdAt,
478- 'readAt' : m.readAt,
479- })
488+ List <Map <String , Object ?>> getMessages () =>
489+ _storeManager? .state.messages
490+ .map (
491+ (m) => {
492+ 'id' : m.id,
493+ 'fromAgent' : m.fromAgent,
494+ 'toAgent' : m.toAgent,
495+ 'content' : m.content,
496+ 'createdAt' : m.createdAt,
497+ 'readAt' : m.readAt,
498+ },
499+ )
480500 .toList () ??
481501 [];
482502
483- List <Map <String , Object ?>> getPlans () => _storeManager? .state.plans
484- .map ((p) => {
485- 'agentName' : p.agentName,
486- 'goal' : p.goal,
487- 'currentTask' : p.currentTask,
488- 'updatedAt' : p.updatedAt,
489- })
503+ List <Map <String , Object ?>> getPlans () =>
504+ _storeManager? .state.plans
505+ .map (
506+ (p) => {
507+ 'agentName' : p.agentName,
508+ 'goal' : p.goal,
509+ 'currentTask' : p.currentTask,
510+ 'updatedAt' : p.updatedAt,
511+ },
512+ )
490513 .toList () ??
491514 [];
492515
@@ -504,13 +527,15 @@ class _TestAPIImpl {
504527 final state = _storeManager? .state;
505528 if (state == null ) return [];
506529 return state.agents.map ((agent) {
507- final locks =
508- state.locks.where ((l) => l.agentName == agent.agentName).toList ();
530+ final locks = state.locks
531+ .where ((l) => l.agentName == agent.agentName)
532+ .toList ();
509533 final plan = state.plans
510534 .where ((p) => p.agentName == agent.agentName)
511535 .firstOrNull;
512- final sentMessages =
513- state.messages.where ((m) => m.fromAgent == agent.agentName).toList ();
536+ final sentMessages = state.messages
537+ .where ((m) => m.fromAgent == agent.agentName)
538+ .toList ();
514539 final receivedMessages = state.messages
515540 .where ((m) => m.toAgent == agent.agentName || m.toAgent == '*' )
516541 .toList ();
@@ -521,13 +546,15 @@ class _TestAPIImpl {
521546 'lastActive' : agent.lastActive,
522547 },
523548 'locks' : locks
524- .map ((l) => {
525- 'filePath' : l.filePath,
526- 'agentName' : l.agentName,
527- 'acquiredAt' : l.acquiredAt,
528- 'expiresAt' : l.expiresAt,
529- 'reason' : l.reason,
530- })
549+ .map (
550+ (l) => {
551+ 'filePath' : l.filePath,
552+ 'agentName' : l.agentName,
553+ 'acquiredAt' : l.acquiredAt,
554+ 'expiresAt' : l.expiresAt,
555+ 'reason' : l.reason,
556+ },
557+ )
531558 .toList (),
532559 'plan' : plan != null
533560 ? {
@@ -538,24 +565,28 @@ class _TestAPIImpl {
538565 }
539566 : null ,
540567 'sentMessages' : sentMessages
541- .map ((m) => {
542- 'id' : m.id,
543- 'fromAgent' : m.fromAgent,
544- 'toAgent' : m.toAgent,
545- 'content' : m.content,
546- 'createdAt' : m.createdAt,
547- 'readAt' : m.readAt,
548- })
568+ .map (
569+ (m) => {
570+ 'id' : m.id,
571+ 'fromAgent' : m.fromAgent,
572+ 'toAgent' : m.toAgent,
573+ 'content' : m.content,
574+ 'createdAt' : m.createdAt,
575+ 'readAt' : m.readAt,
576+ },
577+ )
549578 .toList (),
550579 'receivedMessages' : receivedMessages
551- .map ((m) => {
552- 'id' : m.id,
553- 'fromAgent' : m.fromAgent,
554- 'toAgent' : m.toAgent,
555- 'content' : m.content,
556- 'createdAt' : m.createdAt,
557- 'readAt' : m.readAt,
558- })
580+ .map (
581+ (m) => {
582+ 'id' : m.id,
583+ 'fromAgent' : m.fromAgent,
584+ 'toAgent' : m.toAgent,
585+ 'content' : m.content,
586+ 'createdAt' : m.createdAt,
587+ 'readAt' : m.readAt,
588+ },
589+ )
559590 .toList (),
560591 };
561592 }).toList ();
@@ -578,6 +609,7 @@ class _TestAPIImpl {
578609 await _storeManager? .disconnect ();
579610 _consoleLog ('TestAPI.disconnect() completed' );
580611 }
612+
581613 Future <void > refreshStatus () async {
582614 try {
583615 await _storeManager? .refreshStatus ();
@@ -586,6 +618,7 @@ class _TestAPIImpl {
586618 // Swallow errors - callers should check isConnected() if needed
587619 }
588620 }
621+
589622 bool isConnected () => _storeManager? .isConnected ?? false ;
590623 bool isConnecting () => _storeManager? .isConnecting ?? false ;
591624
@@ -602,8 +635,7 @@ class _TestAPIImpl {
602635 String fromAgent,
603636 String toAgent,
604637 String content,
605- ) async =>
606- _storeManager? .sendMessage (fromAgent, toAgent, content);
638+ ) async => _storeManager? .sendMessage (fromAgent, toAgent, content);
607639
608640 // Tree view queries
609641 int getLockTreeItemCount () {
@@ -752,14 +784,13 @@ class _TestAPIImpl {
752784 return result.toJS;
753785 } on Object catch (e) {
754786 // Return error as JSON string so JS side can inspect it
755- final escaped = e. toString (). replaceAll ( r'\' , r'\\' ). replaceAll (
756- '"' ,
757- r'\"' ,
758- );
787+ final escaped = e
788+ . toString ()
789+ . replaceAll ( r'\' , r'\\' )
790+ . replaceAll ( '"' , r'\"' );
759791 return '{"error":"$escaped "}' .toJS;
760792 }
761- })()
762- .toJS;
793+ })().toJS;
763794 }).toJS,
764795 );
765796 _setProp (
@@ -775,12 +806,11 @@ class _TestAPIImpl {
775806 _setProp (
776807 obj,
777808 'sendMessage' ,
778- ((JSString fromAgent, JSString toAgent, JSString content) =>
779- sendMessage (
780- fromAgent.toDart,
781- toAgent.toDart,
782- content.toDart,
783- ).toJS).toJS,
809+ ((JSString fromAgent, JSString toAgent, JSString content) => sendMessage (
810+ fromAgent.toDart,
811+ toAgent.toDart,
812+ content.toDart,
813+ ).toJS).toJS,
784814 );
785815
786816 // Tree view queries
0 commit comments