Notifications and menu bar
When you are told
The daemon tells you when:
| What | The text |
|---|---|
| a new proposal is waiting | "Waiting for you: <title>" |
| a run failed | "The run failed" |
| the agent stopped with an error | "The agent stopped: |
| a routine has finished | the bot's last line, or "The routine is done" |
The notification carries the bot's name. It is sent from the daemon, so it arrives also when the window is closed.
The text follows the language chosen under ⌘, → Appearance → Language. See Settings.
Only when you are not looking
The app tells the daemon when a Huskarl window comes to the front or goes to the
back (presence). As long as at least one window is in front, no notifications
are sent: you see it in the window. If you close the window or switch to another
app, the notifications come back.
System notifications
The notifications in macOS are sent with osascript, with the title "Huskarl"
and the bot's name below. That is why they appear under Script Editor in
Notification Center, not under Huskarl. HUSKARL_NOTIFY=off turns system
notifications off (the tests do that).
Notifications on your phone
The bot's settings → Phone notifications (all bots) → Turn on. It applies to all the bots, not just the one.
Huskarl uses ntfy. When it is turned on, a random topic is
made, huskarl- and 32 letters and digits. The settings show "On: subscribe to
https://ntfy.sh/huskarl-… in the ntfy app". Subscribe to exactly that topic in
the ntfy app on your phone.
- Every notification arrives on the phone with the same text.
- A new proposal has the buttons Approve and Reject. A tap counts as your decision. See Approvals and rules.
- The topic name is the key: whoever knows it can read the notifications and approve. Do not share it.
- Turn off removes the topic. If you turn it on again with the same server, the topic you subscribe to is kept.
From the terminal, with an ntfy server of your own:
huskarld ntfy on https://ntfy.example.com
huskarld ntfy status # prints server/topic, or off
huskarld ntfy off
Without a server, https://ntfy.sh is used.
Writing to the bots from the phone
With phone notifications on, Write to the bots from the phone in a bot's
settings (or huskarld ntfy chat on) lets you write to them through ntfy. It is
off to begin with.
- In the ntfy app, subscribe to the reply topic too (
<topic>-reply) and write to it, the bot's name first: "Inbox Manager: what is waiting?". The name is matched without regard to case. - The thread gets "📱 From your phone" and your message, and the bot works as if you had written in the window.
- When the run is done, its answer comes back as a notification, whether you are at the Mac or not.
- Without a name, or with one that is no bot's, the answer is "Write the bot's name first: … Your bots: …".
approve <id>andreject <id>still decide proposals. Something that starts with approve or reject but is not a whole id is neither a decision nor a message.
The topic is the key. Anyone who knows it can approve proposals, and with this on, can also write to the bots, and what they write is an instruction. Keep it off if the topic may be known to others.
Siri
Huskarl comes with two shortcuts, in English and Norwegian: What's waiting in Huskarl and Ask Huskarl. Add them under ⌘, → General → Siri, Add to Siri (they open in the Shortcuts app), and say:
- "Hey Siri, what's waiting in Huskarl": Siri reads out what waits for you and which bots are working ("One proposal is waiting for you: Send mail to kari@acme.no.").
- "Hey Siri, ask Huskarl": Siri asks "Who and what?", you say "Inbox Manager: what came from Kari today?", and Siri reads out the bot's answer when its turn is done, with how many proposals it left waiting.
The first time, Shortcuts asks to let them run Huskarl's command (in the Shortcuts app: Settings → Advanced → Allow Running Scripts). What you say goes to the bot on stdin, never into a script. Nothing is approved by voice: that is for the card or the phone. A bot that works long may be cut off by Siri; the answer is then in the thread.
The shortcuts run huskarld status and huskarld ask --stdin, which work from
the terminal too. They are made and signed when the app is built
(scripts/shortcuts/make.py).
The menu bar
Huskarl has an icon in the menu bar (two people). When something is waiting, the count is next to it. The menu has:
- N approvals waiting (or "No approvals waiting"), which opens the approval queue
- Open Huskarl, which opens the window again if it is closed
- Quit Huskarl (⌘Q).
Quitting Huskarl closes the app. The bots keep going in the daemon. The same goes for Quit Huskarl in the app menu and ⌘Q.
The count has a connection to the daemon of its own, so it follows the proposals also while the window is closed. If the daemon restarts, it finds it again within a few seconds.
Opening the queue from elsewhere
huskarl://queue opens the window on the proposals that wait, from a link, a
shortcut, open huskarl://queue in a terminal, or eterm (see
eterm). Any other huskarl:// address opens the window.
While you were away
If the window has been in the background for at least 10 minutes
(HUSKARL_AWAY_SECONDS in the app), it shows a summary above the thread when
you come back: While you were away (2 h). One line per bot that has done
something in the meantime:
| Badge | Means |
|---|---|
| "N waiting for you" | the bot has proposals waiting |
| "failed" | a run failed or was interrupted |
| "working" | the bot is still working |
| "done" | the bot ran and is done |
Those waiting for you come first. Each line has the bot's last reply in the period. At the bottom it says "Spent meanwhile: $0.42".
- Click a line to open the bot.
- N waiting for you opens the approval queue.
- Close closes the summary.
Bots that have done nothing are not included. The summary is for a window that has been in the background. A window that is opened anew does not show it.
Not yet
- System notifications from Huskarl itself, with Huskarl's icon and name.
- An access token for an ntfy server that requires one. The setting exists, but can be set neither in the app nor in the terminal.
- Notifications per bot. Phone notifications apply to all.