/ core / attention / __pycache__ / orchestrator.cpython-314.pyc
orchestrator.cpython-314.pyc
  1  +
  2  �higc���Rt^RIHtHt^RIHtHt^RIHtHtH	t	H
  3  t
  4  Ht^RIH
t
^RIHt^RIt^RIt^RIt^RIHtHtHt^RIHtHtHtHt^R	IHtHtHt^R
  5  I H!t!H"t"H#t#^RI$H%t%H&t&H't'^RI(H)t)H*t*!R
R]
4t+]!RR44t,]!RR44t-!RR4t.R5RRllt/]0R8XEd-^RI1t1]2!R4]3!]1Ph!44R,t5]/!]5RRRRRR/R 7t6R!R"lt7R#R$lt8R%R&lt9]6Pu]74]6Pw]84]6Py]94]6P{]!R'R(R(R)R*R+R,R-74]6P{]!R.R)R(R*R*R/R0R-74]2!R14]2!R24]2!R34]6P}4'd:]P~!^4]6P�4tA]6P�4wtCtDK8]2!R44R#R# ]EdMi;i]6P�4L*)6u|
  6  Attention Orchestrator - Unified Multi-Modal Attention System
  7  
  8  Integrates all attention sources into a coherent system:
  9  1. Eye Tracking (Tobii via Talon) - where you're looking
 10  2. Head Pose (Vision framework) - which screen you're attending
 11  3. Device Focus (NSWorkspace) - what application is active
 12  4. Session Membrane - cross-session awareness
 13  
 14  The orchestrator:
 15  - Fuses all attention signals into unified AttentionState
 16  - Updates session topics based on gaze patterns
 17  - Triggers cross-session signals when attention converges
 18  - Provides the "single pane of attention" view
 19  
 20  Architecture:
 21      ┌─────────────────────────────────────────────────────────┐
 22      │                  AttentionOrchestrator                   │
 23      │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────┐  │
 24      │  │ Eye Tracker │  │ Head Pose   │  │ Device Focus    │  │
 25      │  │ (Talon)     │  │ (Vision)    │  │ (NSWorkspace)   │  │
 26      │  └──────┬──────┘  └──────┬──────┘  └────────┬────────┘  │
 27      │         │                │                   │           │
 28      │         └────────────────┼───────────────────┘           │
 29      │                          ▼                               │
 30      │              ┌───────────────────────┐                   │
 31      │              │   AttentionFusion     │                   │
 32      │              │   - Multi-screen      │                   │
 33      │              │   - Gaze + App        │                   │
 34      │              │   - Semantic mapping  │                   │
 35      │              └───────────┬───────────┘                   │
 36      │                          │                               │
 37      │         ┌────────────────┼────────────────┐              │
 38      │         ▼                ▼                ▼              │
 39      │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────┐  │
 40      │  │ Attention   │  │ Session     │  │ Daily Note      │  │
 41      │  │ Tracker     │  │ Membrane    │  │ Integration     │  │
 42      │  └─────────────┘  └─────────────┘  └─────────────────┘  │
 43      └─────────────────────────────────────────────────────────┘
 44  
 45  "The boundary between you and your extended cognition is defined by attention."
 46  )�	dataclass�field)�datetime�	timedelta)�Optional�List�Dict�Callable�Any)�Enum)�PathN)�AttentionTracker�AttentionEvent�AttentionState)�TalonIntegration�Fixation�ScreenRegion�	GazePoint)�HeadPoseTracker�HeadPose�AttentionScreen)�LocalFocusTracker�AppFocus�MultiDeviceFocusTracker)�SessionMembrane�CrossSessionSignal�PermeabilityLevel)�MultiMonitorDetector�ScreenAttentionc�.�]tRt^=tRtRtRtRtRtRt	Rt
 47  R#)	�AttentionModalityzSources of attention signals.�gaze�	head_pose�	app_focus�device�semantic�N)�__name__�
 48  __module__�__qualname__�__firstlineno__�__doc__�GAZE�	HEAD_POSE�	APP_FOCUS�DEVICE�SEMANTIC�__static_attributes__r&��>/Users/rcerf/repos/Sovereign_OS/core/attention/orchestrator.pyr r =s��'��D��I��I�
�F��Hr2r c�a�]tRt^FtoRtRtRtRtRtRt	Rt
 49  RtRtRt
RtRt]!]R7tV3RlRltV3RlRltV3R	ltR
 50  tVtR#)�FusedAttentionEventz�
 51  Attention event fusing multiple modalities.
 52  
 53  Combines gaze, head pose, app focus, and device into
 54  a single coherent attention signal.
 55  N��?��default_factoryc� <�V^8�dQhRS[/#���return)r)�format�
__classdict__s"�r3�__annotate__� FusedAttentionEvent.__annotate__is���
 56  �
 57  �N�
 58  r2c
���VP;'g+VP;'gVPPpVP;'gRp\
 59  PVP9dRMRp\VPTTTVP'dVPR,MRVPRRPRVP442R	7#)
 60  z/Convert to standard AttentionEvent for tracker.�screenr!�inferred��Nz
orchestrator:�,c3�8"�TFqPx�K	R#5i�N��value��.0�ms& r3�	<genexpr>�9FusedAttentionEvent.to_attention_event.<locals>.<genexpr>vs���+M�_��G�G�_���)�	timestamp�	target_id�target_type�modality�duration_seconds�	intensity�source)
�
target_region�app_namerBrIrRr r,�
 61  modalitiesrrP�fixation_duration_msrU�join)�selfrQrRrSs&   r3�to_attention_event�&FusedAttentionEvent.to_attention_eventis����&�&�L�L�$�-�-�L�L�4�;�;�;L�;L�	��&�&�2�2�(��.�3�3�t���F�6�J����n�n��#��AE�AZ�AZ�AZ�T�6�6��=�`d��n�n�"�3�8�8�+M�T�_�_�+M�#M�"N�O�
 62  �	
 63  r2c�0<�V^8�dQhRS[S[,/#r:)r�str)r=r>s"�r3r?r@ys�����4��9�r2c��.pVP'd�VPP4pRV9gRV9dVPR4M�RV9gRV9dVPR4M�RV9gRV9gRV9dVPR	4M_R
 64  V9gRV9dVPR4M?R
V9gRV9dVPR4MRV9gRV9dVPR4VPRVP24VP'dVPRVP24VP\
 65  P8wd)VPRVPP24V#)z+Extract topic signals for session membrane.�code�cursor�coding�terminal�iterm�chrome�safari�firefox�browsing�slack�discord�
communication�notion�obsidian�notes�figma�sketch�designzapp:zregion:zscreen:)rX�lower�appendrWrBr�UNKNOWNrI)r\�topics�	app_lowers&  r3�to_session_topics�%FusedAttentionEvent.to_session_topicsys>�����=�=�=��
�
�+�+�-�I���"�h�)�&;��
�
�h�'��y�(�G�y�,@��
�
�j�)��Y�&�(�i�*?�9�PY�CY��
�
�j�)��I�%��i�)?��
�
�o�.��Y�&�*�	�*A��
�
�g�&��I�%��Y�)>��
�
�h�'��M�M�D�����0�1������M�M�G�D�$6�$6�#7�8�9��;�;�/�1�1�1��M�M�G�D�K�K�$5�$5�#6�7�8��
r2c�b<�V^8�dQh/S[;R&S[;R&S[S[,;R&S[S[,;R&S[S[,;R&S[S[,;R&S[S[,;R&S[S[,;R&S[S[,;R	&S[S[,;R
 66  &S[S[,;R&S[;R&S[;R
&S[S[,;R&#)r;rPrB�device_name�gaze_x�gaze_yrZrX�
app_bundle_id�window_titlerWrR�
 67  confidencerUrY)rrrr`�floatrr )r=r>s"�r3r?r@Fs��������
����#��%��
�U�O�"�� 
�U�O�"�!�"#�5�/�0�#�(�s�m�"�)�*�C�=�'�+�,�3�-�&�-�2�C�=�'�3�4�#��%�5�:��;�<��=�B�&�'�E�Cr2r&)r'r(r)r*r+r|r}r~rZrXrr�rWrRr�rUr�listrYr]ry�__annotate_func__r1�__classdictcell__�r>s@r3r5r5Fst�����"&�K�#�F�"�F�,0��#�H�#'�M�"&�L�$(�M�!%�K��J��I�+0��*E�J�
 68  �
 69  � ��g�r2r5c�a�]tRt^�toRtRtRtRtRtR
 70  t	Rt
 71  ]!RR7tRt
Rt]P t^dtV3RltR	tVtR#)�OrchestratorConfigz-Configuration for the attention orchestrator.TFg�?c��RRRRRR/#)�left�MacBook�center�Main Monitor�right�iPadr&r&r2r3�<lambda>�OrchestratorConfig.<lambda>�s���	��.���Br2r7Nc��<�V^8�dQh/S[;R&S[;R&S[;R&S[;R&S[;R&S[;R&S[S[S[3,;R&S[S[,;R&S[S[,;R	&S[;R
 72  &S[;R&#)r;�enable_eye_tracking�enable_head_pose�enable_device_focus�enable_multi_device�left_screen_threshold�right_screen_threshold�screen_names�
 73  session_id�sessions_dir�membrane_permeability�fusion_interval_ms)�boolr�rr`rr)r=r>s"�r3r?�OrchestratorConfig.__annotate__�s������$�	�
 74  �!���$�
��%��!�(��"�(���s�C�x�.���*��
�$�+�,�3�-�&�-�2-�K�3�8�#�9r2r&gп)r'r(r)r*r+r�r�r�r�r�r�rr�r�r�r�
 75  ATTRACTORSr�r�r�r1r�r�s@r3r�r��si����7� $��!�� $�� %��$)��$(��$)�:�$�L�!%�J�"&�L�0A�/K�/K��!$��9�r2r�c�^a�]tRt^�toRtR'V3RlRlltV3RlRltRtV3RlR	ltV3R
 76  lRlt	V3RlR
lt
 77  V3RlRltV3RlRltV3RlRlt
V3RlRltV3RlRltV3RlRltV3RlRltV3RlRltV3RlRltR(V3R lR!lltR"tR#tV3R$lR%ltR&tVtR#))�AttentionOrchestratora;
 78  Orchestrates all attention tracking systems.
 79  
 80  Provides unified interface to:
 81  - Eye tracking (gaze fixations)
 82  - Head pose (screen inference)
 83  - Device/app focus
 84  - Cross-session membrane
 85  
 86  Usage:
 87      config = OrchestratorConfig(
 88          session_id="my_session",
 89          sessions_dir="/path/to/sessions/"
 90      )
 91  
 92      orchestrator = AttentionOrchestrator(config)
 93      orchestrator.start()
 94  
 95      # Get unified attention state
 96      state = orchestrator.get_state()
 97  
 98      # Register for events
 99      orchestrator.on_attention_change(lambda event: print(event))
100  
101      orchestrator.stop()
102  Nc� <�V^8�dQhRS[/#)r;�config)r�)r=r>s"�r3r?�"AttentionOrchestrator.__annotate__�s���'D�'D�1�'Dr2c��T;'g\4Vn\4Vn\	VPP
103  R7VnRVnRVnRVn	RVn
104  RVnRVnRVn
\P!4VnRVnRVnRVn\(P*Vn\P.!4Vn.VnRVn.Vn.Vn.VnVPP<'d2VPP?VPP<4R#R#))�permeabilityNFrD) r�r�r
�_attention_trackerrr��	_membrane�_eye_tracker�
_head_tracker�_focus_tracker�
_multi_device�_multi_monitor�_running�_fusion_thread�	threading�Event�_stop_event�_latest_gaze�_latest_head_pose�_latest_app_focusr�CENTER�_latest_screen�Lock�_lock�
_fused_events�_max_events�_on_attention_change�_on_screen_change�_on_cross_session_signalr��register_session)r\r�s&&r3�__init__�AttentionOrchestrator.__init__�s���4�4� 2� 4���#3�"4���(�d�k�k�6W�6W�X���9=���8<���;?���@D���?C�����
�:>���$�?�?�,���15���59���59���/>�/E�/E����^�^�%��
105  �9;������RT��!�OQ���TV��%��;�;�!�!�!��N�N�+�+�D�K�K�,B�,B�C�"r2c� <�V^8�dQhRS[/#r:)r�)r=r>s"�r3r?r��s���J�J�t�Jr2c�(�VP'dR#RpVPP'Edl\4VnVPP4'Ed*VPP
VP4VPP4Rp\R4\\PVPPPRR4\PVPPPRR4\P VPPPRR	4/R
106  7VnVPP%VP"P&4M\R4RVnVPP('d�\+VPP,VPP.R
7VnVP0P4'dYVP0P3VP44VP0P7VP84Rp\R4M\R4RVnVPP:'du\=4VnVP>P4'd4VP>PAVPB4Rp\R4M\R4RVnV'g\R4R#RVnVPDPG4\HPJ!VPLRRR7Vn'VPNP4\R4R#)zb
107  Start all attention tracking systems.
108  
109  Returns True if at least one system started successfully.
110  TFz#[Orchestrator] Eye tracking startedr��Leftr��Centerr��Right)r�z)[Orchestrator] Eye tracking not availableN)�left_threshold�right_thresholdz)[Orchestrator] Head pose tracking startedz/[Orchestrator] Head pose tracking not availablez)[Orchestrator] App focus tracking startedz/[Orchestrator] App focus tracking not availablez6[Orchestrator] No attention tracking systems available�AttentionFusion)�target�daemon�namez'[Orchestrator] Started - fusion running)(r�r�r�rr��connect�on_fixation�_on_fixation�start�printrr�LEFTr��getr��RIGHTr��
on_gaze_point�update_gazer�rr�r�r��on_pose�
_on_head_pose�on_screen_change�_on_head_screen_changer�rr��on_focus_change�_on_app_focus_changer��clearr��Thread�_fusion_loopr�)r\�started_anys& r3r��AttentionOrchestrator.start�s����=�=�=�����;�;�*�*�*� 0� 2�D��� � �(�(�*�*��!�!�-�-�d�.?�.?�@��!�!�'�'�)�"���;�<�';�'�,�,�d�k�k�.F�.F�.J�.J�6�SY�.Z�'�.�.����0H�0H�0L�0L�X�W_�0`�'�-�-�t�{�{�/G�/G�/K�/K�G�U\�/]�"�'��#��!�!�/�/��0C�0C�0O�0O�P��A�B�$(��!��;�;�'�'�'�!0�#�{�{�@�@� $��� B� B�"�D���!�!�'�'�)�)��"�"�*�*�4�+=�+=�>��"�"�3�3�D�4O�4O�P�"���A�B��G�H�%)��"��;�;�*�*�*�"3�"5�D���"�"�(�(�*�*��#�#�3�3�D�4M�4M�N�"���A�B��G�H�&*��#���J�K����
������ �'�.�.��$�$��"�
111  ���
112  	
���!�!�#�
�7�8�r2c���RVnVPP4VP'd"VPP	4RVnVP
113  'd"VP
114  P	4RVnVP'd"VPP	4RVnVP'd$VPP^R7RVn\R4R#)z$Stop all attention tracking systems.FN)�timeoutz[Orchestrator] Stopped)
115  r�r��setr��stopr�r�r�r[r��r\s&r3r��AttentionOrchestrator.stopHs�����
��������������"�"�$� $�D���������#�#�%�!%�D���������$�$�&�"&�D���������$�$�Q�$�/�"&�D��
�&�'r2c� <�V^8�dQhRS[/#r:)r)r=r>s"�r3r?r�_s���3�3�>�3r2c�6�VPP4#)z$Get current unified attention state.)r��	get_stater�s&r3r��AttentionOrchestrator.get_state_s���&�&�0�0�2�2r2c�0<�V^8�dQhRS[S[,/#r:)rr5)r=r>s"�r3r?r�cs���J�J��1D�(E�Jr2c��VP;_uu_4VP'dVPR,MRuuRRR4# +'giR#;i)z&Get most recent fused attention event.N�����)r�r�r�s&r3�get_latest_fused_event�,AttentionOrchestrator.get_latest_fused_eventcs2��
�Z�Z�Z�-1�-?�-?�-?�4�%�%�b�)�T��Z�Z�Z�s�'A�A	c�6<�V^8�dQhRS[S[S[3,/#r:)�tuplerr`)r=r>s"�r3r?r�hs���-�-�E�/�3�*>�$?�-r2c� �VP;_uu_4VPPPVPP
116  VPP
117  4pVPV3uuRRR4# +'giR#;i)z+Get which screen the operator is attending.N)r�r�r�r�r�rI)r\r�s& r3�get_current_screen�(AttentionOrchestrator.get_current_screenhs_��
�Z�Z�Z��;�;�+�+�/�/��#�#�)�)��#�#�)�)��D��&�&��,��Z�Z�Z�s�AA<�<B
	c� <�V^8�dQhRS[/#r:)r`)r=r>s"�r3r?r�qs���*�*�3�*r2c��VPP'gR#VPPVPP4pVP	4#)z2Get cross-session awareness context for injection.�)r�r�r��get_context_for_session�to_context_block)r\�contexts& r3�get_cross_session_context�/AttentionOrchestrator.get_cross_session_contextqsB���{�{�%�%�%���.�.�8�8����9O�9O�P���'�'�)�)r2c� <�V^8�dQhRS[/#)r;�region)r)r=r>s"�r3r?r�ys���6�6�l�6r2c�d�VP'dVPPV4R#R#)z.Register a screen region for semantic mapping.N)r��register_region)r\rs&&r3r�%AttentionOrchestrator.register_regionys'���������-�-�f�5�r2c�6<�V^8�dQhRS[S[.R3,/#�r;�callbackN)r	r5)r=r>s"�r3r?r�~s"���3�3�H�6I�5J�D�5P�,Q�3r2c�<�VPPV4R#)z.Register callback for attention change events.N)r�ru�r\rs&&r3�on_attention_change�)AttentionOrchestrator.on_attention_change~s���!�!�(�(��2r2c�:<�V^8�dQhRS[S[S[.R3,/#r)r	rr`)r=r>s"�r3r?r��s#���0�0��?�C�2H�$�2N�)O�0r2c�<�VPPV4R#)z+Register callback for screen change events.N)r�rurs&&r3r��&AttentionOrchestrator.on_screen_change�s�����%�%�h�/r2c�6<�V^8�dQhRS[S[.R3,/#r)r	r)r=r>s"�r3r?r��s"���7�7��:L�9M�t�9S�0T�7r2c�<�VPPV4R#)z,Register callback for cross-session signals.N)r�rurs&&r3�on_cross_session_signal�-AttentionOrchestrator.on_cross_session_signal�s���%�%�,�,�X�6r2c� <�V^8�dQhRS[/#)r;�fixation)r)r=r>s"�r3r?r��s���9�9�X�9r2c��VP;_uu_4Wn\PVnRRR4R# +'giR#;i)z+Called when eye tracker detects a fixation.N)r�r�rr�r�)r\rs&&r3r��"AttentionOrchestrator._on_fixation�s+��
�Z�Z�Z� (��"1�"8�"8�D���Z�Z�Z�s	�;�A	c� <�V^8�dQhRS[/#)r;�pose)r)r=r>s"�r3r?r��s���*�*�(�*r2c�t�VP;_uu_4WnRRR4R# +'giR#;i)zCalled when head pose updates.N)r�r�)r\rs&&r3r��#AttentionOrchestrator._on_head_pose�s��
�Z�Z�Z�%)�"��Z�Z�Z���&�7	c�&<�V^8�dQhRS[RS[/#)r;�
118  old_screen�
119  new_screen)r)r=r>s"�r3r?r��s���K�K��K�o�Kr2c��VP;_uu_4VPeVP4'gW nRRR4VPP
120  P
VPVP4pVPFpV!W#4K	R# +'giLh;i \dp\RT24Rp?KDRp?ii;i)z.Called when head pose indicates screen change.Nz-[Orchestrator] Screen change callback error: )r�r��_is_recent_gazer�r�r�r�rIr��	Exceptionr�)r\rrr�r�es&&&   r3r��,AttentionOrchestrator._on_head_screen_change�s����Z�Z�Z�� � �(��0D�0D�0F�0F�&0�#��
121  �{�{�'�'�+�+�J�,<�,<�j�>N�>N�O���.�.�H�
K���*�/�
�Z���
K��E�a�S�I�J�J��
K�s(�$B �B �B3� B0	�3C�>C�Cc�6<�V^8�dQhRS[S[,RS[/#)r;�	old_focus�	new_focus)rr)r=r>s"�r3r?r��s ���/�/�h�x�.@�/�X�/r2c�t�VP;_uu_4W nRRR4R# +'giR#;i)z'Called when active application changes.N)r�r�)r\r$r%s&&&r3r��*AttentionOrchestrator._on_app_focus_change�s��
�Z�Z�Z�%.�"��Z�Z�Z�rc�&<�V^8�dQhRS[RS[/#)r;�threshold_msr<)r�r�)r=r>s"�r3r?r��s���&�&�E�&�D�&r2c��VP'gR#\P!4VPP,
122  P	4R,pW!8#)z2Check if latest gaze is recent (within threshold).FrD)r�r�now�end_time�
total_seconds)r\r)�elapseds&& r3r�%AttentionOrchestrator._is_recent_gaze�sE��� � � ���<�<�>�D�$5�$5�$>�$>�>�M�M�O�RV�V���%�%r2c�\�\P!4pVPP4'gw\P!4pW!,
123  P	4R,pW0P
124  P8�dVP4Tp\P!R4K�R#)z/Background thread that fuses attention signals.rDg{�G�z�?N)
125  rr+r��is_setr-r�r��
_fuse_signals�time�sleep)r\�last_fusionr+�
126  elapsed_mss&   r3r��"AttentionOrchestrator._fusion_loop�su���l�l�n���"�"�)�)�+�+��,�,�.�C��+�:�:�<�t�C�J��[�[�;�;�;��"�"�$�!���J�J�t��,r2c��VP;_uu_4.p\PpRpVP'dIVP	4'd3\PpVP\P4RpM�VP'd�VPP'dfVPPVPPVPP4pVP\P4RpRpRpRpVP'dbVPP pVPP"pVPP$pVP\P&4RpRpRp	VP'dYVP	4'dCVPP(pVPP*pVPP,p	Rp
127  RpVP.'d�VP'd�VP.P0F|pVP3VPP(VPP*4'gKEVP4p
128  VP6pVP\P84M	Rp
V	'd\;RV	R,4p
\=\>P@!4VVPPBPEVPF4VVV	VVVV
129  VVV
VR7pW n$VPJPV4\MVPJ4VPN8�d'VPJVPN)^,RVn%RRR4VPQX4R# +'giL#;i)	z/Fuse all attention signals into a single event.g333333�?g�������?�ffffff�?Nr6��?rD)rPrBr|r}r~rZrXrr�rWrRr�rUrY))r�rr�r�rrur r,r��valid�infer_screenr�r�r�r-r�rXrr�r.�x�y�duration_msr��_regions�containsr�rRr0�minr5rr+r�r�rIr�r��lenr��_process_fused_event)r\rYrBr�rX�
130  app_bundler�r}r~�fixation_durationrWrRrrU�events&              r3r2�#AttentionOrchestrator._fuse_signals�s��
�Z�Z�Z��J�%�+�+�F��J�� � � �T�%9�%9�%;�%;�(�/�/���!�!�"3�"8�"8�9� �
131  ��'�'�'�D�,B�,B�,H�,H�,H��/�/�<�<��K�K�5�5��K�K�6�6����!�!�"3�"=�"=�>� �
132  ��H��J��L��%�%�%��1�1�:�:��!�3�3�A�A�
133  �#�5�5�B�B���!�!�"3�"=�"=�>��F��F� $��� � � �T�%9�%9�%;�%;��*�*�,�,���*�*�,�,��$(�$5�$5�$A�$A�!�!�M��K�� � � �T�%6�%6�%6�"�/�/�8�8�F����t�'8�'8�':�':�D�<M�<M�<O�<O�P�P�(.���
�&,�&8�&8��"�)�)�*;�*D�*D�E��9��I� ���%6��%=�>�	�(�"�,�,�.�� �K�K�4�4�8�8����F���%6�!�(�)�+�'�%�#�%��E�"#)�����%�%�e�,��4�%�%�&��)9�)9�9�%)�%7�%7��9I�9I�8I�Q�8N�8O�%P��"�[�`	
�!�!�%�(�a�Z�sN�<N:�AN:�N:�2A<N:�/A8N:�(N:�>AN:�N:�(AN:�AN:�CN:�:O
134  	c� <�V^8�dQhRS[/#�r;rG�r5)r=r>s"�r3r?r�s���N�N�*=�Nr2c�B�VP4pVPPV4VPP'dnVP4pV'dVVPPVPPV4pVFpVPFpV!V4K	K!	VPFpV!V4K	R# \dp\RT24Rp?KQRp?ii;i \dp\RT24Rp?KXRp?ii;i)z Process a fused attention event.z-[Orchestrator] Cross-session callback error: Nz0[Orchestrator] Attention change callback error: )r]r��recordr�r�ryr��update_session_topicsr�r r�r�)r\rG�attention_eventrw�signals�signalrr!s&&      r3rD�*AttentionOrchestrator._process_fused_events�� �2�2�4�����&�&��7��;�;�!�!�!��,�,�.�F���.�.�>�>��K�K�*�*����&�F�$(�$A�$A��W�$�V�,�%B�&��1�1�H�
N����2��	 )�W�!�$Q�RS�QT�"U�V�V��W���
N��H���L�M�M��
N�s0�%C�C:�C7�C2�2C7�:D�D�D)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rG)i�)r'r(r)r*r+r�r�r�r�r�r�r�rr	r�rr�r�r�r�rr�r2rDr1r�r�s@r3r�r��s������6'D�'D�RJ�J�X(�.3�3�J�J�
135  -�-�*�*�6�6�
136  3�3�0�0�7�7�9�9�*�*�
137  K�K� /�/�
138  &�&��R)�hN�Nr2r�c�j�V^8�dQhR\R\R\\\3,R\/#)r;r�r��
screen_layoutr<)r`rr�)r=s"r3r?r?7s8��)�)��)��)���S��>�)��	)r2c
139  �T�\TTT;'g	RRRRRR/R7p\V4#)a'
140  Create a fully configured attention orchestrator.
141  
142  Args:
143      session_id: ID for this session (for membrane tracking)
144      sessions_dir: Directory where session files are stored
145      screen_layout: Mapping of screen positions to names
146  
147  Returns:
148      Configured AttentionOrchestrator ready to start
149  r�r�r�r�r�r�)r�r�r�)r�r�)r�r�rTr�s&&& r3�create_orchestratorrV7sB��  ��!�"�
150  �
151  ��I��n��V�'
152  ��F�!��(�(r2�__main__z$=== Attention Orchestrator Test ===
153  :N�Nr�zMacBook Pror�zStudio Displayr�ziPad Pro)r�rTc�$�V^8�dQhR\/#rJrK)r=s"r3r?r?es��i�i�/�ir2c���RPRVP44pVP'dC\RVPP
154  RVPRVRVPR
24R#R#)rEc3�8"�TFqPx�K	R#5irGrHrJs& r3rM�on_attention.<locals>.<genexpr>fs���@�/?�!�g�g�/?�rO�[z] � (z) conf=z.2fN)r[rYrXr�rBrIr�)rGrYs& r3�on_attentionr_esf���X�X�@�u�/?�/?�@�@�
155  ��>�>�>��A�e�l�l�(�(�)��E�N�N�+;�2�j�\��QV�Qa�Qa�be�Pf�g�h�r2c�0�V^8�dQhR\R\/#)r;rBr�)rr`)r=s"r3r?r?js��F�F�/�F��Fr2c�>�\RVRVPR24R#)z
156  *** Screen changed: r^z) ***
157  N)r�rI)rBr�s&&r3�	on_screenrbjs��
�&�t�f�B�v�|�|�n�G�D�Er2c�$�V^8�dQhR\/#)r;rQ)r)r=s"r3r?r?ms��E�E�!3�Er2c�8�\RVPR24R#)z
158  !!! Cross-session signal: z !!!
159  N)r��content)rQs&r3�on_cross_sessionrfms��
�,�V�^�^�,<�F�C�Dr2�editorgr9r:rb�main_editor)r��x_min�y_min�x_max�y_maxrRrQ�sidebar�
160  navigation�file_browserzStarting orchestrator...z9Move your eyes, turn your head, switch apps to see fusionzPress Ctrl+C to stop
161  z
162  === Test Complete ===)NNN)Gr+�dataclassesrrrr�typingrrrr	r
163  �enumr�pathlibrr�r3�json�trackerr
rr�eye_trackingrrrrr"rrr�device_focusrrr�membranerrr�
multi_monitorrrr r5r�r�rVr'�uuidr�r`�uuid4r��orchestratorr_rbrfr	r�rrr�r4r��stater�rB�screen_name�KeyboardInterruptr�r&r2r3�<module>r�s��)�V)�(�6�6������E�E�M�M�A�A�N�N�L�L�@�����N�N��N�b�$�$��$�<}N�}N�@)�:�z���	�
164  1�2��T�Z�Z�\�"�2�&�J�&���M��&��Z�
165  ��L�i�
166  F�E��$�$�\�2��!�!�)�,��(�(�)9�:�� � ��
�������"��� � ��
����� � �"��
167168  $�%�	�
169  E�F�	�
170  "�#������		���
171172  �1�
�%�.�.�0��&2�&E�&E�&G�#���
173174  #�$�G��|!�	��	��	���s�"8G&�&G0�/G0