
      iA                        U d dl mZmZmZmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZmZ ddlmZ ddlmZmZ ddddddddidgdddddddddddddddddg ddddddddddddddd d!d"gddddd#d$ddd%ddd&dd'd(did)d*d+g ddddd,d-ddddddddg d.d/d0d1d!d"gddddd2d3dd(did(didg d4d5dd6dd7dd8gddddd9d:dd(did(did(didd6dd;g d<ddddd=d>dd(did(did(didd6dd?g d@dddddAdBdd(did(didCdDdd(didd6ddEg dFdddddGdHdd(diddIddJddKgdddddLdMddd(diidgdddddNdOddddPdig dddddQdRdddSddCdTddUdVgdddddWdXdddYdddZddd[d\gd]d0dCd^dd_g d`dddddadbddcddddidcgdddddedfdddgddhdidjdkdldmgdddddndoddpddqdidpgdddddrdsdddtddduddvdwddxdpdygdddddzd{di g ddddd|d}ddCd~ddddgddddgdddddddddddCdddg dddgZi dej        dej        dej        d,ej        d#ej         d2ej!        d9ej"        d=ej#        dAej$        dGej%        dLe
j&        dNej'        dQej(        dWej)        daej*        deedneeeeedZ+ee,ef         e-d<   dS )    )ListDictAnyCallable   )HealthReader)HealthWriter)ObsidianTool)
GarminTool)AnalyticsTool)WebSearchTool)execute_shell)download_file	save_file)get_system_status)kill_processget_process_listfunctionget_daily_detailed_statszGet a comprehensive ONE-DAY SUMMARY (Metrics + Activity + Log Counts). Use for 'how was my day'. Do NOT use for filtering specific logs (use get_manual_history).objecttarget_datestringz
YYYY-MM-DD)typedescription)r   
propertiesrequired)namer   
parameters)r   r   get_metric_historyu  **USE THIS when user asks about time-based trends**: 'past X days/weeks/months', 'recent changes', 'last year', 'how has X changed', 'X trend over time'. Returns analyzed trends with statistics for time ranges >7 days, raw data for ≤7 days. Supported metrics: rhr (resting heart rate), hrv, sleep, stress, steps, heart_rate, weight. Example: user asks 'past 2 months RHR' → call this with metric_type='rhr', start_date=60 days ago, end_date=today.z?Metric name: rhr, hrv, sleep, stress, steps, heart_rate, weightz\Start date YYYY-MM-DD (calculate from user's time range, e.g. 'past 2 months' = 60 days ago)z%End date YYYY-MM-DD (typically today))metric_type
start_dateend_dateget_activity_historyz0Get list of workouts/activities in a date range.)r!   r"   r!   r"   get_aggregated_analysisaf  **REQUIRED for time-range questions**: When user asks 'past X days/weeks/months/years', 'recent trend', 'change over time', 'how has X changed', use THIS tool (not get_metric_history). Returns analyzed trends with statistics, yearly comparisons, and 30-day rolling averages. Examples: 'past 2 months RHR', 'HRV trend this year', 'sleep quality last 90 days'.z9Start date YYYY-MM-DD (optional, defaults to 2 years ago)z1End date YYYY-MM-DD (optional, defaults to today)arrayr   zYMetrics to analyze: ['rhr', 'hrv', 'sleep', 'stress', 'steps']. If omitted, analyzes all.)r   itemsr   )r!   r"   metricsget_manual_historyz4query manual logs (diet, alcohol, etc) over a range.)dietalcoholsupplementsfeelingsfastingallzCategory of logs to retrieve)r   enumr   )r!   r"   categorylog_dietzLog food/meal.)	breakfastlunchdinnersnack)r   r/   zHH:MM (optional))r   r   	meal_typetimer   log_alcoholzLog alcohol.)r   alcohol_typeamountr7   )r   r9   r:   log_supplementzLog supplement.)r   r   dosager7   )r   r   r<   log_feelingzLog body feeling or symptom.integerz1-10)r   feeling_typeseverityr   r7   )r   r?   r@   r   log_fastingzLog fasting mode.zOMAD, PSMF, etc)r   moderB   sync_obsidianzSync Obsidian note.sync_garminzAction to synchronize the latest health data from Garmin Connect. You MUST use this tool when the user asks to 'sync', 'update', or 'fetch' data. Do not assume data is already up-to-date.z'YYYY-MM-DD (optional, default to today)get_health_insightszjGet advanced health insights, correlations, and trends (e.g., alcohol impact on sleep, heart rate trends).zType of analysis: 'recovery_correlations' (alcohol/activity impact), 'fitness_trends' (RHR/fitness), 'lifestyle_impact' (fasting/supplements).zCNumber of days to analyze (default 30, recommend 30-90 for trends).)analysis_typelookback_daysrF   analyze_driverznAnalyze if a specific factor (Driver) impacts a health metric (Target). e.g., 'Does Magnesium improve sleep?'.zvThe cause/driver column. Examples: 'alcohol_units', 'stress', 'steps', 'fasting_mode', 'has_magnesium', 'has_alcohol'.zJThe effect/target column. Examples: 'sleep', 'rhr', 'hrv', 'body_battery'.correlationgroup_comparez{Use 'correlation' for continuous values (alcohol units vs sleep) or 'group_compare' for events (Magnesium YES/NO vs Sleep).zDays to analyze (default 30).)driver_metrictarget_metricmethodrG   )rK   rL   rM   
search_webz_Search the web for real-time information, latest scientific research, or biohacker experiences.queryz2Search query (e.g. 'latest study on NAD+ effects')r   zExecute a shell command (zsh) in a persistent session. Use for system questions, file checks, or running scripts. If user asks 'how to X', providing a numbered list, you can use this to execute the user's choice.zECommand to execute (e.g. 'ls -la', 'git status', 'python3 script.py')numberzTimeout in seconds to wait for output (default 2.0). Increase for long-running commands like 'top' (to get a snapshot) or 'sleep 5'.g       @)r   r   default)commandtimeoutrR   r   zXUpload a file from the server to Slack. Use when user wants to see a log file or config.	file_pathzAbsolute path to the filer   zASave content to a file on the server. Use to create/edit configs.zTarget absolute pathzText content to savebooleanzAllow overwriting existing file)rT   content	overwriterV   r   zKGet a visual dashboard of system health (CPU, Memory, Disk, Top Processes).r   zTerminate a process by PID.z
Process IDSIGTERMSIGKILL)r   r/   rQ   )pidsignal_typerZ   r   z4List running processes with optional name filtering.z)Filter by process name (case-insensitive)   )r   rQ   )filter_namelimit)r   r   r   r   TOOL_FUNCTIONSN).typingr   r   r   r   health_readr   health_writer	   obsidianr
   garminr   	analyticsr   webr   
shell_toolr   file_opsr   r   
system_opsr   process_opsr   r   TOOLS_SCHEMAr   r   r#   r(   r$   r1   r8   r;   r=   rA   rC   rD   rE   rH   rN   r_   str__annotations__     1/root/projects/butler/slack_bot/tools/registry.py<module>rq      s
   , , , , , , , , , , , , , % % % % % % & & & & & & " " " " " "             $ $ $ $ $ $       % % % % % % . . . . . . . . ) ) ) ) ) ) 7 7 7 7 7 7 7 7 .  ,xP\.].]^*O 
 
  ( a ,4  FG  $H  $H+3  Ec  #d  #d)1Bi j j 
 FEE 
 
 " *M +3L"Q"Q)1, O O  *:6 
 
   - D  !)'b# #
 !)'Z! !
 !("((!3 (C     # 
 
 8 (Q +3L"Q"Q)1, O O ( ` ` `'E! !  *:6 
 
 , + $*H#5$*H#5*2<e<e<e!f!f%->PQQ	  +M:	 	
 
 $ !) $*H#5%+X$6%x0%->PQQ	  FEE	 	
 
 $ $, $*H#5#X.%x0%->PQQ	  >==	 	
 
 $ !9 $*H#5%+X$6)26 J J$*H#5%->PQQ  WVV
 

 
 & !. $*H#5%->OPP  +F3 
 
 " #0 ,vx.@A*O 
 
  ! Y !HEn#o#o  

 

  ) H  !) (x& &
 !*'l& &	 	 -- 
 
 , $ L  !) (`& &
 !)'s& &
 !)!. @ (e  !*'F& & & IHH+ 
 
 >  |  ('[  %I	 	
 
 $ # r  !)'n   
 !) (n#&   
 
 'K 
 
 0 #u (C^!_!_ )M 

 

  ^ *2CY!Z!Z(0AWXX*3De!f!f 
 ))4 
 
 " 'h   
 
  "8 $-lKK,4y)>Taj#k#k  #G 
 
   &Q ,4Ep#q#q&/B??   
 
 Aod' E',9' L=' ,9	'
 |C' %' <+' l1' <+' <+' \/' :)'  =<!'" m2#'& -*''* ]+', ]-'. * (5' ' 'S(]#     ro   