Skip to content

About

Hermes Agent plugin for Postal: notifications, Live Activities, calls and native cards

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Postal plugin for Hermes Agent

Connects a Hermes Agent server to Postal, a native app for iPhone, iPad and Mac:

  • push notifications, when a turn started from Postal ends while the app is not in use and when a scheduled job delivers to postal;
  • cards on the Lock Screen (Live Activities) that stay current while the app is not running;
  • a postal_call tool that rings the user's phone: at most four times an hour, two minutes apart, never in the user's quiet hours, and only on a device whose user turned Let Hermes Call on;
  • a skill, postal:artifacts, that teaches the agent to draw native cards in the app and keep them current;
  • categories: the agent files each conversation in one of a few categories shared with the app, reusing one that fits before making a new one, and leaves a conversation where the user put it;
  • initiatives: from what it learns of the user, the agent gives itself errands and runs them on a nightly round (Postal · initiatives, delivered to the Inbox) and on rounds it schedules itself during the day, at most five in 24 hours. It tells the user only what is worth it: the postal_proactive tool keeps what it learns and holds it to two notifications a day and one call a week, never in quiet hours. The app turns the round on; turned off, it stays silent. Other plugins' scheduled jobs are left alone.
  • passkeys of the agent's own: the postal_passkey tool puts a virtual authenticator on the agent's browser tab, so that the agent can create a passkey on a site and sign in with it later without asking. The private keys are encrypted on this server (postal/passkeys.enc, with its own key) and never leave it; Postal lists them and can remove them.
  • automatic model choice: when a conversation is on Auto in Postal, a small, cheap model (the postal_routing auxiliary task, set in Hermes like the others) reads each message and says how much model it needs (light, standard or max). The app runs that message alone on the model and reasoning effort it maps to that level, and asks the user before moving up to the largest. The agent can also say that a task turned out harder than its model with the postal_suggest_model tool; the app offers the switch.
  • answers from the notification: notifications carry the POSTAL_REPLY category, so the user can reply to Hermes without opening the app.

Notifications reach Apple through a relay run by the app's publisher, which holds the key Apple asks for. What a notification says is encrypted on this server with a key the device sent when it registered, and decrypted on the device. The relay and Apple carry it without being able to read it; they see that a notification is going to a device, and when.

Install

Postal installs this plugin itself when you add your server. By hand, on the machine that runs Hermes:

hermes plugins install getlinuxcode/postal-hermes/postal
hermes plugins enable postal

Then open Postal and connect to the server through the dashboard: the app tells the plugin which relay it uses. To use another, set POSTAL_RELAY_URL in ~/.hermes/.env, which takes precedence.

Without a relay

If you built Postal yourself, under your own bundle id, you can send with your own APNs key instead. Create one (Apple Developer → Certificates, IDs & Profiles → Keys → Apple Push Notifications service), put the key file on the Hermes machine, and set POSTAL_APNS_KEY_ID, POSTAL_APNS_TEAM_ID and POSTAL_APNS_KEY_PATH in the same file.

Apple only speaks HTTP/2, which needs one more package in Hermes's environment: h2>=4,<5. A key set this way takes precedence over the relay.

Scheduled jobs

Give a job deliver=postal to have its answer pushed to every registered device, or deliver=postal:<device id> for one. A job that answers [SILENT] sends nothing, as on every Hermes platform.

What the app calls

Methods on the gateway socket, under plugin.postal.:

Method Parameters Purpose
device.register device_id, token, bundle_id, environment, platform, name, server_ref, key, voip_token Add or update a device. key is 32 bytes in Base64: its notifications are then encrypted
device.unregister device_id Remove it
presence device_id, active Say whether the app is in use; turn-end notifications wait while it is
turn.watch session_id Ask to hear about the end of the turn just started
live.register device_id, card_id, token, file, interval Keep a Live Activity current: from the card's JSON file on this machine, or from the agent's answers when it names none
live.unregister device_id, card_id Stop
calls.get, calls.set rules, quiet When the user wants to be called, in their own words, and the hours they never do (from, to, tz)
calls.test device_id, opening Ring that device now
categories.get, categories.set session_id, category_id or name; or category_id with rename, symbol, color, remove The categories and which conversation is in which; the user's filing, which the agent then keeps
proactive.get, proactive.set enabled, voice Whether the agent takes initiatives; turning it on schedules the nightly round. voice says whether the server can speak, without which it does not call
passkeys.list The agent's passkeys: site, account, when made and last used. Never the keys
passkeys.remove id Forget one
route text, recent, current How much model the next message needs: tier (light, standard, max), topic (new or same) and a short reason
route.suggestion session_id The step up the agent suggested in that conversation since the app last asked, said once
setup relay Say which relay (https://…) carries notifications
status The plugin's version, whether it can send, and how many devices are registered
test device_id Send one notification to that device

Tests

python3 -B -m unittest discover -s tests

They run without Hermes: tests/hermes_stubs.py stands in for the parts of Hermes the plugin imports. They check the plugin's logic, not that Hermes still has the shape the stubs assume. Two things are not covered here: sending straight to Apple with your own key, and the encryption itself, whose test compares against bytes the app is known to decrypt but needs the cryptography package, which Hermes has and a bare Python does not.

About

Hermes Agent plugin for Postal: notifications, Live Activities, calls and native cards

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages