Overview

This page is the single contract for the iPhone system surfaces: notification buttons, the Live Activity, the status widget, App Intents and Shortcuts, and the Messages tool on macOS runtimes. The iOS app, the cloud API and the runtime all build against it.
Status: planned. No route, table or field on this page is merged yet. The cloud lane (B) and the runtime lane (R) are building them. Every route below is marked “planned”. Do not rely on any of it until the matching change is merged and this page says so.
Design rules:
  • One action path. Notification buttons call POST /api/v1/inbox/:id/{approve|dismiss|snooze} through the runtime relay. There is no cloud-side approve endpoint, so there is one authority for an approval.
  • Runtime-owned status snapshot. The runtime forwards status.snapshot when state changes. It drives the Live Activity, the widget, the badge and the revoke push. The cloud does not derive state from single events, because it has no run or loop state.
  • Revoke by snapshot diff. When an inbox id leaves needsYou, the cloud sends a background push that removes the delivered notification. The app also reconciles on every foreground.
  • Sensitive text is fetched by the extension. The APNs alert carries a generic body when the item is private. The notification service extension fetches the text by event id with a device read token.
  • Web never approves from a URL. With a window open, the service worker posts the action to it. With none open, it opens the item.

Forwarded event keys (planned)

The runtime event forwarder (runtime_events.rs, DATA_KEYS) adds these keys. The cloud adds runtimeId at ingest. Inbox items also carry contentHash, sessionId and full {to, toName, text}. A new inbox kind, gizzi_permission, covers tool permissions from Gizzi.

Status snapshot (planned)

status.snapshot is a forwarded event type. It is never pushed as an alert. The runtime emits it on change, at most one per 5 seconds. The cloud keeps the latest one per runtime.
  • needsYou is a list of ids. It is the input to the revoke diff.
  • The focus bot is chosen in this order: oldest pending approval, then a bot that needs input, then a blocked or failed bot, then the most recently started working bot.
  • Limits: bots holds at most 20 entries, needsYouRows at most 4, and each line at most 80 characters. progress is optional.
  • Loop source: the snapshot producer polls the Gizzi server’s GET /v1/automations/loops on loopback. It polls every 5 seconds while a loop runs and every 60 seconds otherwise. A failed poll leaves loops out of the snapshot, so a Gizzi restart does not end the activity.

Phone run in the snapshot (new in this release)

While a phone or computer run is live, and shortly after it ends, the snapshot also carries phoneRun:
  • kind is phone or computer. status uses the same values as the phone task card. summary and inboxId are optional.
  • stepLabel follows the step label rule. trail holds the last 6 steps.
  • phoneRun is absent when no run is live or recently ended.
  • The runtime builds the snapshot in cmd/allternit-api/src/status_snapshot.rs and pushes it every 5 seconds on change. Cloud stores it as opaque JSON, so it needs no migration.
  • The iMessage extension reads it through GET /api/v1/status/summary with its existing read token, so no new auth scope exists.
The status to pill and subcaption table is in Phone holds.

Notification categories (planned)

The category comes from inboxKind, not from the event name. An email draft that arrives as thread.needs_user therefore still gets approval buttons. Action identifiers are fixed. Titles and wording come from one strings table in the app. Reply on an approval sends the owner’s message to the bot through POST /api/v1/agent-sessions/:id/messages and leaves the item pending. If the bot revises the item, the hash changes and the old Approve answers 409 changed.

Inline approve rule

An item gets APPROVAL_INLINE only when all of these hold:
  1. The full text and the recipient together fit in 300 characters.
  2. There is no attachment.
  3. contentHash is present.
Otherwise the category is APPROVAL_REVIEW. The approve call carries the hash. If it does not match the current item, the runtime answers 409 {"error":"changed"} and nothing is sent.

APNs alert payload (planned)

Existing keys stay. New keys ride in PushMessage.data, so the struct does not change.
  • A token without the nse capability gets today’s body. A token without actions gets no category.
  • interruption-level is time-sensitive only at level NeedsYou and above.
  • Every alert carries sound.

Other pushes (planned)

Revoke

Sent when an inbox id leaves needsYou. apns-push-type: background, priority 5.

Live Activity

  • Header apns-push-type: liveactivity. Topic com.allternit.mobile.push-type.liveactivity.
  • Events: start, update, end.
  • Payload: {"aps":{"timestamp":..., "event":"start|update|end","content-state":{...},"stale-date":...,"alert":{...,"sound":"default"},"attributes-type":"BotActivityAttributes","attributes":{"mode":"summary"},"input-push-token":1}}.
  • Bot activity content state (BotActivityAttributes.ContentState):
    • Always, as the app has them today: status (String), activityLabel (String, optional in the app), pendingApprovalsCount (Int), activeBotsCount (Int), attentionBotsCount (Int), displayName (String, optional in the app).
    • Optional additions: botId (String), step (String), progress (Double, 0 to 1), othersCount (Int), question (String), inboxId (String), runtimeId (String), sessionId (String), contentHash (String), approveInline (Bool). Absent ones are left out.
    • There are no Date values.
  • Loop activity content state (LoopActivityAttributes.ContentState), unchanged: iterationsCompleted (Int), maxIterations (Int), state (String). Updated and ended by activityKey = loopId; the app starts loops itself.
  • Token keys the app uploads: la_start with attributesType: "BotActivityAttributes"; la_update with activityKey: "summary" for the bot activity and activityKey: <loopId> for a loop; widget. Full rules and examples: iPhone push.
  • The activity is bot first. The cloud fills it from focus. When a bot needs the owner it turns into the question with buttons.
  • Approve and Deny show only when approveInline is true, private is false, and the full text is 140 characters or fewer. Otherwise the activity shows a generic line and Open. Live Activity pushes travel in plain form, so private text never rides in them.
  • Throttles: progress updates use priority 5 and are at least 15 seconds apart. Needs-approval uses priority 10 with an alert; end uses priority 10 without one (the run-finished notification already tells). A start happens only on idle to active, at most once per 10 minutes per device, and never while quiet hours hold the level.
  • The cloud ends and restarts an activity before it reaches 8 hours.
  • NSSupportsLiveActivitiesFrequentUpdates stays off.

Widget

  • Header apns-push-type: widgets. Topic com.allternit.mobile.push-type.widgets. Requires iOS 26.
  • Payload {"aps":{"content-changed":true}}. At most one per 5 minutes per device; a change inside the window is sent when it ends.
  • Sent when what the widget shows changes: the counts, needsYouRows, paused or lastRoutine. A new step or progress is not a widget change. Tokens: kind: "widget", on devices with the widget_push capability. Details: iPhone push.
  • The widget is one flipping widget. The front shows status and the back shows actions. A flip button turns it over, and the front returns after 10 minutes. The accessory (Lock Screen) family shows the status face only.

Cloud routes (planned)

The read token works on GET /api/v1/status/summary and GET /api/v1/notifications/content/:eventId only, and only for its own user. Web Push subscribe adds platform: ios-pwa, android or desktop.

Runtime routes (planned)

Pause all bots

GET /api/v1/bots/pause answers:
  • paused: boolean.
  • since: Unix seconds when the switch was turned on, or null when not paused.
  • by: the surface that turned it on, or null. Values in use: web, phone, desktop, ios, shortcut, control, gizzi.
PUT /api/v1/bots/pause takes {"paused": true, "by": "phone"} (by is optional) and answers the same object as GET. Pausing again keeps the first since and by. Resuming sets both to null. A body with no paused answers 422. While paused:
  • A due routine or loop is skipped, not run. It keeps its schedule and runs at its next slot after resume, so there is never a burst of missed runs. A skipped routine gets a run row with status skipped and outcome_reason bots_paused. Startup routines do not run.
  • Channel messages from people (Telegram, Discord, WhatsApp, Teams, SMS, Slack, bot email) are kept but get no auto-reply. They show as unanswered in Needs you. A message from the account’s verified owner still runs.
  • The main bot does not reach out on its own.
  • A run already in progress finishes. Pause is not stop.
  • The owner’s own messages in the app, Run now, and approvals still work.
The status snapshot (status.snapshot) carries paused from this switch. A change wakes the snapshot producer, which sends within 5 seconds.

Messages on the Mac

Built in cmd/allternit-api/src/messages_mac.rs. User guide: Messages on your Mac.
  • access.fullDisk is true when the runtime can open ~/Library/Messages/chat.db. It opens the file read-only and immutable and never writes it.
  • access.automation is the result of a harmless AppleScript probe to Messages. It is probed only while the setting is on, so a GET never raises the macOS prompt for someone who has not opted in. A yes is cached; a no is retried after a minute.
  • A send hold is a gateway_approvals row with action send imessage and detail {to, toName, text, channel: "imessage", provenance}, made through the same path as held channel posts. Needs you lists it as held_send with source imessage, contentHash, and full {to, toName, text}.
  • The send runs only when the hold is approved (respond_approval, any approve path). It re-reads the row, checks state = approved and consumed = 0, sets consumed = 1 in the same transaction, then runs osascript with the recipient and text as arguments. A second approve never sends twice. The approve answer carries send {state: "sent" | "error" | "already_sent"}.
  • Recipients are one phone number or email address. Group chat ids are refused.
  • Every search, hold and send writes a row to messages_mac_audit.
Internal MCP tools, served at /internal/connectors/mcp:
  • messages_search {contact?, query?, sinceDays (max 30), limit (max 50)}. Listed only on a macOS runtime with the setting on. Answers {ok, rows: [{handle, name, fromMe, at, text, provenance}], provenance}; at is Unix seconds and each text is fenced as outside text. 1:1 chats only.
  • messages_send {to, text}. Listed only on a macOS runtime with the setting on. Returns {held: true, inboxId}. It always creates a gateway_approvals hold and bypasses channel transports and autonomy levels.
  • message_draft {to, text}. Listed on every runtime. Emits the card {"type":"message_draft","to","toName","text"}. Nothing is held or sent.
The iPhone actions Ask, Send, Hand off, Code task, Remember, Stop, Set brain, Switch computer and Quiet hours add no route. They use existing ones.

Provenance of Messages search results

Search results go to the model fenced as outside text, with provenance {trust, sourceKind: "imessage"}. trust is contact when the handle belongs to someone in the owner’s People (a linked identity) and stranger otherwise. The runtime does not read the macOS Contacts database. A message that trips the injection scanner is down-ranked to stranger. When the search ran inside a bot conversation, each result is recorded as content provenance on that thread. A hold made in a turn that read such text stores the lowest trust seen in detail.provenance. The inbox shows it.

Migration 120 (planned)

File: migrations_pg/120_ios_system_surfaces.sql. The file is additive and idempotent, and is never edited after it ships. Production applies it with deploy-contabo.sh, which applies files missing from public.ops_applied_migrations before the binary swap.

Device capabilities and old clients (planned)

Each device registers a capability list with its token. A client that sends no capabilities is treated as having none. It keeps today’s alerts and loses nothing. Old runtimes that do not forward the new keys produce Review or plain alerts, never inline Approve.