
    `gj                    .   U d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
mZmZ g dZd(dZ ed	       G d
 d             Z edddddddd       edddddddd       edddddddd       eddd d!d"ddd      gZd#ed$<   d%d%d&	 	 	 	 	 d)d'Zy%)*u  Curated catalog of starter cron-job suggestions.

These are the built-in automations Hermes can offer a new user out of the box —
the ``catalog`` source of the unified suggestion surface. Each entry is a
ready-to-run ``cron.jobs.create_job`` spec wrapped as a suggestion; the user
accepts via ``/suggestions``. Nothing here auto-schedules.

The "important-mail monitor" entry is where the old proactive-monitor engine
lives now: its ``classify_items.py`` (poll a source -> LLM-score urgency ->
surface only above-threshold) is ONE catalog automation, not a standalone
feature.

Adding a catalog entry: append a CatalogEntry. Keep prompts self-contained
(cron jobs run with no chat context) and schedules sensible. The ``job_spec``
is passed verbatim to ``create_job`` on accept.
    )annotations)	dataclass)Path)AnyCallableDictListOptional)CatalogEntryCATALOGseed_catalog_suggestionsclassify_items_script_pathc                 n    t        t        t              j                         j                  dz  dz        S )zBAbsolute path to the urgency classifier script shipped with cron/.scriptszclassify_items.py)strr   __file__resolveparent     J/root/.hermes/venv/lib/python3.12/site-packages/cron/suggestion_catalog.pyr   r      s+    X&&(//);>QQSSr   T)frozenc                  :    e Zd ZU dZded<   ded<   ded<   ded<   y)	r   z5A curated starter automation offered as a suggestion.r   keytitledescriptionzDict[str, Any]job_specN)__name__
__module____qualname____doc____annotations__r   r   r   r   r       s    ?	HJr   r   zcatalog:daily-briefingzDaily briefingzfEvery morning at 8am, a short briefing: today's calendar, weather, and anything urgent waiting on you.a/  Produce a concise morning briefing for the user: today's calendar events, the local weather, and any urgent items (unread important email, due tasks). Keep it short and scannable. If you have no connected data sources, give a brief general good-morning with the date and offer to connect calendar/email.z	0 8 * * *origin)promptschedulenamedeliver)r   r   r   r   zcatalog:important-mail-monitorzImportant-mail monitorus   Check your inbox periodically and ping you ONLY about mail that actually needs attention — never the newsletters.u  Check the user's inbox for new messages since the last run. For each candidate, judge urgency against this rule: surface only mail that needs a reply today, is from a manager/family member, or mentions a deadline. Pipe candidates through the urgency classifier (run `python3 -m cron.scripts.classify_items --threshold 7 --criteria ...` from the hermes-agent install — resolve the script path at run time, do not assume a fixed location) and deliver ONLY what it returns. If nothing clears the bar, respond with [SILENT] so the user is not pinged. Requires a connected mail source; if none is configured, explain how to connect one and then stop.z	every 30mzcatalog:weekly-reviewzWeekly reviewzlEvery Sunday evening, a recap of the week: what got done, what's still open, and what's coming up next week.zProduce a weekly review for the user: summarize what was accomplished this week, list still-open items, and preview next week's calendar. Pull from whatever sources are connected (calendar, task tools, recent conversations). Keep it tight.z
0 18 * * 0zcatalog:standup-reminderzWorkday start reminderzWA weekday nudge at 9am with your day's agenda and top priorities, so you start focused.zGive the user a brief weekday start-of-day nudge: their calendar for today and the 1-3 highest-priority things to focus on, inferred from recent context and any task tools. Encouraging, short, one message.z0 9 * * 1-5zList[CatalogEntry]r   N)add_fnkeysc           	        | ddl m}  |rt        |      nd}g }t        D ]e  }||j                  |vr | |j
                  |j                  dt        |j                        |j                        }|U|j                  |       g |S )a  Register catalog entries as pending suggestions.

    ``add_fn`` defaults to ``cron.suggestions.add_suggestion`` (injectable for
    tests). ``keys`` restricts to specific catalog entries; omit to seed all.
    Entries already dismissed/accepted (by dedup key) or beyond the pending cap
    are skipped by the store, so re-seeding is safe and idempotent. Returns the
    list of suggestion records actually created.
    Nr   )add_suggestioncatalog)r   r   sourcer   	dedup_key)
cron.suggestionsr+   setr   r   r   r   dictr   append)r(   r)   wantedcreatedentryrecs         r   r   r   |   s     ~=SYDF$&G  %))6"9++))%..)ii
 ?NN3  Nr   )returnr   )r(   z1Optional[Callable[..., Optional[Dict[str, Any]]]]r)   zOptional[List[str]]r7   zList[Dict[str, Any]])r!   
__future__r   dataclassesr   pathlibr   typingr   r   r   r	   r
   __all__r   r   r   r"   r   r   r   r   <module>r=      s-  " # !  6 6
_T
 $   $7" $$
& ,&C
H $,!
0 #=O
 %#

" &&,3
 &,

{N	 Nf AE $=  	r   