Commit Graph
5 Commits
Author SHA1 Message Date
f0ab4ba79d feat(cursor): detect inline model errors, surface, notify, and bridge (#878) (#987)
Cursor ACP sessions can fail mid-turn with a transient model error that the
agent reports inline rather than as an RPC rejection. HAPI treated those turns
as successful, so the session went quiet with no banner, no push, and no way to
resume without retyping the prompt.

This adds the full path:

- detect: classify inline/stderr model errors from the Cursor ACP stream,
  requiring strong signatures before typing a failure as a model error
- surface: persist `lastModelError` on session metadata; render a chat banner
  and a session-list indicator, with the prompt text kept out of list/SSE
  summaries so they never ship up to 32 KB of user prompt
- notify: deliver a push for an unacknowledged error, watermarked on the hub
  copy so a restart does not re-page the same eventId
- bridge & retry: offer a one-shot recovery prompt that replays the failed
  turn, bound to the originating eventId and gated so a real user turn always
  supersedes it. Auto-bridge is opt-in and defaults to OFF, persisted in hub
  settings and fanned out to live Cursor CLIs.

Re-cut onto current upstream/main. The branch had accumulated 108 iterative
hardening commits against a 289-commit-older base; replaying them individually
would have re-resolved the same conflicts ~100 times. The pre-re-cut tip was
2c28a1365 if the granular history is ever needed.

Absorbing upstream required adapting to three refactors that landed meanwhile:

- `MessageQueue2` grew an `internal?: boolean` control-message flag upstream
  while this branch added richer `internal` provenance. Unified on a tagged
  `QueueItemInternal` union (`control` | `model-error-bridge`) so one field
  carries one concept. `hasPendingNonBridgeTurn()` now treats *any* internal
  item as non-user: otherwise a queued `/auto-review` control slash would have
  counted as a user turn and wrongly superseded a live bridge.
- `AcpSdkBackend.prompt()` gained a `timing` callback upstream; merged it with
  this branch's `shouldSend` gate into a single options object.
- The hub settings route moved to a unified `updateSettings` transaction.
  `autoBridgeTransientModelErrors` is applied outside that transaction because
  SyncEngine owns its CLI fan-out and rollback under its own lock.

via [HAPI](https://hapi.run)

Co-authored-by: HAPI <noreply@hapi.run>
2026-11-13 18:50:09 +08:00
weishu 1432a71bd1 refactor(native): drop task-notification push handling
The hub no longer sends `task-notification` pushes (961f2fd0), so remove
the client handling on both platforms:

- iOS: drop PushType.taskNotification, its Reply notification category,
  and the NSE category stamping; Reply now applies to `ready` only.
- Android: drop PushType.TASK_NOTIFICATION; Reply attaches to `ready`
  only. The `task_notifications` channel stays as the bucket for unknown
  types / contract versions, renamed to "Other notifications"
  (CHANNEL_OTHER). Its system channel ID is unchanged so operators'
  per-channel settings survive.
- Drop the task-only `success` / `error` severities from both clients and
  the hub's FCM/APNs payload types.

Chat timeline parsing of `<task-notification>` is unchanged.
2026-11-10 17:26:49 +08:00
weishu e1093466c9 feat(ios): support macOS through Mac Catalyst
Build the app and notification extension for Mac Catalyst with the Mac
idiom, so Macs get a 1:1 native window instead of the scaled iPad app.
The Mac build keeps the run.hapi.app bundle ID and adds Mac entitlements
(sandbox, network, microphone, user-selected files, Mac APNs).

- Always use the split on Mac with a sidebar list style, denser rows,
  14pt reading text, a hidden duplicate titlebar title, a minimum window
  size and page-sized sheets; open web links in the default browser and
  hide the unavailable live QR scanner.
- Add menu bar / hardware-keyboard commands: New Session, Settings,
  Toggle Sidebar, a Session menu (settings, files, rename, export, stop,
  previous/next session) and a guide link.
- Composer: Return sends on Mac (Shift/Option-Return for a newline, IME
  untouched, first suggestion picked); dropped files and pasted images or
  copied files become attachments on all platforms.
- CI builds Mac Catalyst and runs the navigation, split and transcript
  geometry tests there; README documents the Mac build.
2026-11-03 11:15:11 +08:00
weishu e0db9c6815 fix(notifications): distinguish user questions from permission requests 2026-09-13 12:41:38 +08:00
weishu e289a0a776 feat(ios): push — APNs registration, E2E notification service extension, actions (P3) 2026-08-18 21:07:15 +08:00