Skip to content

Script agent calendar and prompts - #19

Merged
synesthesiam merged 5 commits into
mainfrom
script-agent-calendar-and-prompts
Aug 31, 2026
Merged

synesthesiam merged 5 commits into
mainfrom
script-agent-calendar-and-prompts

Conversation

@synesthesiam

Copy link
Copy Markdown
Contributor

Add calendar blueprint and make it work correctly

synesthesiam and others added 5 commits August 31, 2026 11:53
Add a "Create calendar event" blueprint, and fix the two things that kept
it from working.

The entity selector's pre-`filter` shorthand (`entity: {domain: calendar}`)
was ignored, so the field was offered every exposed entity instead of just
the calendars.

The model was never told today's date, so a date or date & time field came
back with "Saturday" rather than a date. The date goes in the user prompt,
which is evaluated per utterance, rather than the system prompt, which is
the cached prefix and would be rebuilt every midnight. Recognized sentences
are now cached against the rendered prompt so a date-carrying prompt cannot
replay yesterday's answer.

Both prompts are editable on the Settings page and saved in the overrides
file. The system prompt is also reworded to ask for the no-match reply in
the requested language instead of bundling that into one sentence with what
to say; this rebuilds the prompt cache once on upgrade.

Also: a duration reaches a script as an "HH:MM:SS" string from the model but
as a mapping from Home Assistant's UI, and Home Assistant reads a two-part
"01:00" as one minute, so the field description now asks for all three parts
and the blueprint handles both shapes. config.yaml and const.py disagreed
about the version, which was failing test_release; both are now 1.9.0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mypy skips the body of an unannotated function entirely, so most of
web_server.py was never being checked. That only showed up as three
"annotation-unchecked" notes, in the functions that happened to declare an
annotated local.

Annotate all 32 unannotated functions instead: the Flask views return
ResponseReturnValue, and the two websocket helpers take the aiohttp type
that production passes them. Checking those bodies turned up nothing, which
is the point -- there was no way to know before.

disallow_untyped_defs makes a new unannotated function an error rather than
a note that is easy to scroll past.

The WSGI middleware's types exist only in typeshed, so its annotations are
quoted: Python evaluates annotations on a def at definition time, and
importing web_server raised NameError without the quotes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
const.py still said 1.9.0 while config.yaml and the changelog said 1.1.0,
which was failing test_release.

The version is written in three places and only two of them were checked.
The changelog's newest heading is the third, and it is the copy that gets
left behind when the number changes -- which is exactly what happened here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@synesthesiam
synesthesiam merged commit 94bee86 into main Aug 31, 2026
2 checks passed
@synesthesiam
synesthesiam deleted the script-agent-calendar-and-prompts branch August 31, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant