/ core / flight / __pycache__ / protocol.cpython-314.pyc
protocol.cpython-314.pyc
  1  +
  2  ��fi�2���Rt^RIHtHt^RIHtHtHt^RIHt^RI	H
  3  t
  4  HtHtH
t
Ht!RR]4t]!RR44t]P"]!]P"R	]!^	^4R
  5  RR]P$]P&.R
7]P$]!]P$R]!^^4RRR]P"]P&.R
7]P&]!]P&R]!^^4RRR]P$]P(]P*.R
7]P(]!]P(R]!^^4RRR]P*.R
7]P*]!]P*R]!^^4RRR]P".R
7/t]!RR44t]!RR44t!RR4t]R8XEd�]!R 4.tR!R"lt]!R#]R$7t]!R%]P>P@PB24]!R&4]PE4t#]!R'4]#PI4Fwt%t!]!R(]%R)]!24K	]!4]!R*4]P"]P>n ]PL!4]P>n']P$]P&]P(]P*]P"3F5t(]PS](R+R,7t*]*'dK ]!R-](PB24K7	]!4]PW4t,]!R.4]!R/],R0,24]!R1],R2,24]!R34R4#R4#)5u
  6  Flight Protocol
  7  
  8  The cognitive flight cycle for knowledge work:
  9  
 10      FLY HIGH → RETAIN → LAND → BIRTH → SAFETY → repeat
 11  
 12  Each phase has different characteristics:
 13  - Energy level expectations
 14  - Appropriate cognitive activities
 15  - System behavior adaptations
 16  )�	dataclass�field)�datetime�time�	timedelta)�Enum)�Optional�List�Dict�Any�Callablec�Ta�]tRt^toRtRtRtRtRtRt	]
 17  V3RlRl4tR	tVt
R
 18  #)�FlightPhasez)
 19  The five phases of the flight protocol.
 20  �fly_high�retain�land�birth�safetyc� <�V^8�dQhRS[/#���return)�str)�format�
__classdict__s"��7/Users/rcerf/repos/Sovereign_OS/core/flight/protocol.py�__annotate__�FlightPhase.__annotate__s���*�*�S�*�c
 21  ���\PR\PR\PR\PR\P
 22  R/pVP
VR4#)z7Generate, explore, diverge - high energy creative phasez4Mark what resonates, predict edges - selection phasez9Ground in specifics, commit to bullets - commitment phasez(Compaction, synthesis - new nodes emergez*Backup, validation, prepare for next cycle�)r�FLY_HIGH�RETAIN�LAND�BIRTH�SAFETY�get)�self�descriptionss& r�description�FlightPhase.descriptions\��
� � �"[���� V����Y����I���� L�
 23  ������b�)�)r�N)�__name__�
 24  __module__�__qualname__�__firstlineno__�__doc__r!r"r#r$r%�propertyr)�__static_attributes__�__classdictcell__�rs@rrrs7������H�
�F��D��E�
�F�
�*��*rrc�0a�]tRt^*toRtV3RltRtVtR#)�PhaseCharacteristicsz6
 25  Characteristics and expectations for a flight phase.
 26  c�<�V^8�dQh/S[;R&S[;R&S[S[,;R&S[;R&S[;R&S[;R&S[S[,;R&#)r�phase�typical_duration_hours�optimal_time_of_day�energy_level�cognitive_mode�system_behavior�allowed_transitions)r�floatrrrr	)rrs"�rr�!PhaseCharacteristics.__annotate__*si����
 27  ���"�!�
�"�$��'������������k�*�*�rr+N)r,r-r.r/r0�__annotate_func__r2r3r4s@rr6r6*s������rr6g@�high�	divergentzESurface diverse connections, enable exploration, minimize constraints)r8r9r:r;r<r=r>g@�medium�
 28  convergentzCHighlight high-resonance items, suggest connections, enable marking�
 29  analyticalz@Focus on specific items, enable commitment, surface dependenciesg�?�low�restfulz:Run compaction, synthesize, create new nodes automaticallyz;Backup, validate integrity, prepare daily note for tomorrowc�4a�]tRt^jtoRtRtV3RltRtVtR#)�PhaseTransitionz-
 30  Records a transition between flight phases.
 31  Nc�|<�V^8�dQh/S[;R&S[;R&S[;R&S[;R&S[S[S[S[3,,;R&#)r�
 32  from_phase�to_phase�	timestamp�trigger�context)rrrrr
 33  r)rrs"�rr�PhaseTransition.__annotate__jsR����
 34  �����
�����L���d�3��8�n�
%�,�rr+)	r,r-r.r/r0rPrAr2r3r4s@rrJrJjs�����)-�G��rrJc�|a�]tRt^vtoRt]!]R7t]!]R7t	V3RlRlt
 35  R
 36  V3RlRlltV3RltR	t
VtR#)�FlightStatez'
 37  Current state in the flight protocol.
 38  )�default_factoryc� <�V^8�dQhRS[/#r)r)rrs"�rr�FlightState.__annotate__�s���6�6�y�6rc�N�\P!4VP,
 39  #)zHow long in current phase.)r�now�phase_started_at)r's&r�
time_in_phase�FlightState.time_in_phase�s���|�|�~�� 5� 5�5�5rNc�6<�V^8�dQhRS[S[,RS[/#)r�characteristicsr)rr6�bool)rrs"�rrrV�s"���3�3��:N�1O�3�[_�3rc���T;'g \PVP4pV'gR#\VPR,R7pVP4V8�#)z3Check if it's time to transition based on duration.Fg�?��hours)�DEFAULT_PHASE_CHARACTERISTICSr&�
current_phaserr9rZ)r'r]�chars�max_durations&&  r�should_transition�FlightState.should_transition�sP���X�X�#@�#D�#D�T�EW�EW�#X���� �u�'C�'C�c�'I�J���!�!�#�l�2�2rc�<�V^8�dQh/S[;R&S[;R&S[;R&S[S[,;R&S[S[S[S[S[3,3,;R&#)r�operator_idrcrY�transition_history�
phase_metrics)rrrr	rJr
 40  r)rrs"�rrrVvs]����
 41  �����
�����_�-�K����T�#�s�(�^�3�4�R�rr+)N)r,r-r.r/r0r�listrj�dictrkrZrfrAr2r3r4s@rrSrSvs<�����16�d�0K��7<�T�7R�M�6�6�3�3��rrSc�a�]tRt^�toRtRV3RlRlltV3RlRltRV3RlRlltV3R	lR
 42  ltV3RlRlt	V3R
lRlt
 43  RtVtR#)�FlightProtocolz�
 44  Manages the flight protocol for an operator.
 45  
 46  Tracks phase transitions, suggests optimal timing,
 47  and adapts system behavior to current phase.
 48  Nc	�x<�V^8�dQhRS[RS[S[S[S[3,,RS[S[S[.R3,,/#)rri�phase_characteristics�on_phase_changeN)rrr
 49  rr6rrJ)rrs"�rr�FlightProtocol.__annotate__�sK���
 50  �
 51  ��
 52  � (��[�:N�-N�(O�P�
 53  �"�(�O�+<�d�+B�"C�D�	
 54  rc���WnT;'g\P4VnW0n\VVP
4\P!4R7Vn	R#)z�
 55  Initialize flight protocol.
 56  
 57  Args:
 58      operator_id: Identifier for the operator
 59      phase_characteristics: Optional custom characteristics
 60      on_phase_change: Optional callback for phase transitions
 61  )rircrYN)
 62  rirb�copyr]rrrS�_infer_initial_phaserrX�state)r'rirqrrs&&&&r�__init__�FlightProtocol.__init__�sP��'��4�\�\�8U�8Z�8Z�8\���.��!�#��3�3�5�%�\�\�^�
 63  ��
 64  rc� <�V^8�dQhRS[/#r)r)rrs"�rrrs�s�����k�rc���\P!4P4p\Pp\^R7pVPP4F�wrEVP'gK\P!\P!4VP4p\P!\P!4V4p\Wv,
 65  4pW�8gK�TpTpK�	V#)z*Infer initial phase based on current time.r`)rrXrrr!rr]�itemsr:�combine�today�abs)	r'rX�
 66  best_phase�min_diffr8rd�
 67  optimal_dt�now_dt�diffs	&        rrv�#FlightProtocol._infer_initial_phase�s����l�l�n�!�!�#��!�)�)�
 68  ��2�&�� �0�0�6�6�8�L�E��(�(�(�%�-�-�h�n�n�.>��@Y�@Y�Z�
 69  �!�)�)�(�.�.�*:�C�@���6�.�/���?�#�H�!&�J�9��rc	�X<�V^8�dQhRS[RS[RS[S[S[S[3,,RS[/#)r�	new_phaserOrPr)rrrr
 70  rr^)rrs"�rrrs�s@���/�/��/��/��$�s�C�x�.�)�	/�
 71  
 72  �/rc�N�VPPVPP4pV'dWP9dR#\VPPV\P!4VVR7pVPPPV4VPPVPP9d./VPPVPP&VPP4VPPVPP,R&WPn\P!4VPnVP'dVPV4R#)z�
 73  Transition to a new phase.
 74  
 75  Args:
 76      new_phase: Target phase
 77      trigger: What triggered the transition
 78      context: Optional context data
 79  
 80  Returns:
 81      True if transition succeeded
 82  F)rLrMrNrOrP�
last_durationT)r]r&rwrcr>rJrrXrj�appendrkrZrYrr)r'r�rOrP�
current_chars�
 83  transitions&&&&  r�
transition_to�FlightProtocol.transition_to�s(��$�,�,�0�0����1I�1I�J�
��Y�.O�.O�O��%��z�z�/�/���l�l�n���
 84 85  �	
�
 86 87  �%�%�,�,�Z�8��:�:�#�#�4�:�:�+C�+C�C�AC�D�J�J�$�$�T�Z�Z�%=�%=�>�
�J�J�$�$�&�	
�
 88 89  � � ����!9�!9�:�?�K�$-�
 90 91  � �&.�l�l�n��
 92 93  �#������ � ��,�rc�0<�V^8�dQhRS[S[,/#r)rr)rrs"�rrrs�s�����H�[�$9�rc���VPPVPP4pV'gR#VPP	V4'd&VP
 94  'dVP
 95  ^,#\P!4P4pVP
 96  F�pVPPV4pV'gK(VP'gK<VPp\P!\P!4V4p\P!\P!4V4p\Wg,
 97  4\^R78gK�Vu#	R#)zp
 98  Suggest the next phase based on time and state.
 99  
100  Returns:
101      Suggested next phase, or None if current is fine
102  N)�minutes)r]r&rwrcrfr>rrXrr:r}r~rr)r'r�rXr8�phase_chars�optimalr�r�s&       r�suggest_next_phase�!FlightProtocol.suggest_next_phase�s���,�,�0�0����1I�1I�J�
����:�:�'�'�
�6�6��0�0�0�$�8�8��;�;��l�l�n�!�!�#��"�6�6�E��.�.�2�2�5�9�K��{�{�>�>�>�%�9�9��%�-�-�h�n�n�.>��H�
103  �!�)�)�(�.�.�*:�C�@���z�*�+�i��.C�C� �L�7�rc�6<�V^8�dQhRS[S[S[3,/#r�r
104  rr)rrs"�rrrss���
105  �
106  �t�C��H�~�
107  rc��VPPVPP4pV'g/#RVPPPRVPPP
108  RVPRVPRVPR\VPP4P4^<,4RVPRVPUu.uFq"PNK	up/#uupi)	z^
109  Get guidance for system behavior in current phase.
110  
111  Returns:
112      Dict with behavior guidance
113  r8�phase_descriptionr<r;r=�time_in_phase_minutesr9r>)r]r&rwrc�valuer)r<r;r=�intrZ�
total_secondsr9r>)r'rd�ts&  r�get_current_behavior_guidance�,FlightProtocol.get_current_behavior_guidances����$�$�(�(����)A�)A�B����I�
�T�Z�Z�-�-�3�3�����!9�!9�!E�!E��e�2�2��E�.�.��u�4�4�#�S����)A�)A�)C�)Q�)Q�)S�VX�)X�%Y�$�e�&B�&B�!�U�5N�5N�#O�5N��G�G�5N�#O�	
114115  ��$Ps�1D	"c�6<�V^8�dQhRS[S[S[3,/#rr�)rrs"�rrrs+s���
116  �
117  �4��S��>�
118  rc���RVPRVPPPRVPPP4R\
VPP4P4^<,4R\VPP4RVPPP4UUu/uFwrVPVbK	uppRVPPR
RUu.uFWpR	VPPR
119  VPPRVPRVP P4/NKY	up/#uuppiuupi)z*Get summary of all phases and transitions.rircrYr��total_transitionsrk�recent_transitionsN�from�torOrN�����)rirwrcr�rY�	isoformatr�rZr��lenrjrkr|rLrMrOrN)r'�p�mr�s&   r�get_phase_summary� FlightProtocol.get_phase_summary+s4��
�4�+�+��T�Z�Z�5�5�;�;���
120121  � ;� ;� E� E� G�#�S����)A�)A�)C�)Q�)Q�)S�VX�)X�%Y���T�Z�Z�%B�%B�!C��'+�z�z�'?�'?�'E�'E�'G��'G�t�q�����
122  �'G��
!����6�6�r�s�;�#�<�A��A�L�L�.�.��!�*�*�*�*��q�y�y�����!6�!6�!8�	�<�#�
123  �	
124  ����#s
�E(�AE.)r]rrrirw)NN)�manualN)
r,r-r.r/r0rxrvr�r�r�r�r2r3r4s@rroro�sG�����
125  �
126  �2��*/�/�b��>
127  �
128  �,
129  �
130  rro�__main__z=== Flight Protocol Test ===
131  c�$�V^8�dQhR\/#)rr�)rJ)rs"rrrHs��c�c�_�crc	��\PV4\RVPPRVP
132  PRVPR24R#)z  Transition: u → z (trigger: �)N)�transitionsr��printrLr�rMrO)r�s&r�	on_changer�HsL�����1��
��q�|�|�1�1�2�%��
133134  �8H�8H�7I��UV�U^�U^�T_�_`�a�br�rick)rrzInitial phase: zInferred from time of day
135  zCurrent behavior guidance:z  z: z Manual transition through cycle:�test)rOz  Failed to transition to zProtocol summary:z  Current phase: rcz  Total transitions: r�z
136  === Test Complete ===N)-r0�dataclassesrrrrr�enumr�typingrr	r
137  rrrr6r!r"r#r$r%rbrJrSror,r�r�r��protocolrwrcr�r��guidancer|�keyrXrY�
138  next_phaser��resultr��summaryr+rr�<module>r�sp���)�.�.��6�6�*�$�*�,�
139  +�
140  +��
141  +����.��"�"�"� ��A�J��"�_�(�/�/��1A�1A�B�����,�� � �"� ��Q�K��#�]�(�1�1�;�3C�3C�D�����*����"� ��Q�K��#�Z�(�/�/��1B�1B�K�DV�DV�W�����+����"� ��Q�K�� �T�(�/�/�0�����,�� � �"� ��Q�K�� �U�(�1�1�2��K.!��b�-�-��-��3�3��3�0p
142  �p
143  �h�z��	�
144  *�+��K�c�
145  �f�i�@�H�	�O�H�N�N�8�8�>�>�?�
146  @�A�	�'�)��5�5�7�H�	�
147  &�'��n�n�&�
148  ��U�
��3�%�r�%��!�"�'�	�G�
149150  ,�-�$/�#7�#7�H�N�N� �&.�l�l�n�H�N�N�#�"�)�)�;�+;�+;�[�=N�=N�P[�Pb�Pb�do�dx�dx�y�
151  ��'�'�
152  �F�'�C���v��.�z�/?�/?�.@�A�B�z�
153  
154  �G��(�(�*�G�	�
155  ��	��g�o�6�7�
156  8�9�	�!�'�*=�">�!?�
157  @�A�	�
158  #�$�Ur