Skip to content

feat(desktop): add approval and completion notifications#1519

Merged
esengine merged 2 commits into
esengine:mainfrom
wade19990814-hue:feat/desktop-notifications
May 22, 2026
Merged

feat(desktop): add approval and completion notifications#1519
esengine merged 2 commits into
esengine:mainfrom
wade19990814-hue:feat/desktop-notifications

Conversation

@wade19990814-hue

Copy link
Copy Markdown
Contributor

Summary

  • add desktop system notifications for new approval requests while the window is unfocused
  • add completion notifications for long-running turns once the app returns to idle
  • localize the new notification copy for English and Simplified Chinese

Details

This keeps the implementation intentionally small:

  • new notifications are derived from existing desktop pending-approval state
  • completion notifications only fire after a busy-to-idle transition lasting at least 15 seconds
  • notifications are suppressed while the window is focused
  • notification delivery is wired through the Tauri notification plugin

Verification

  • npm test -- --run desktop/src/notifications.test.ts desktop/src/App.test.ts desktop/src/ui/thread.test.tsx
  • npm run typecheck
  • npm run build (desktop)
  • npm run verify

Notes

  • this is built on top of current upstream main
  • the branch also includes coverage for language switching so the notification text follows the active desktop UI language

Copy link
Copy Markdown
Contributor Author

This PR closes #1509 with a deliberately small desktop-only implementation.

A few notes for review:

  • Reasonix desktop is Tauri rather than Electron, so the notification delivery is implemented through the Tauri notification plugin instead of Electron's Notification API.
  • The change only covers two cases: new approval requests while the window is unfocused, and completion notifications after a busy-to-idle transition lasting at least 15 seconds.
  • Notification copy now follows the active desktop UI language (English / Simplified Chinese).
  • I re-ran the full verification pass on top of current upstream main before opening this PR (npm run verify), in addition to focused desktop tests and a desktop production build.

If this direction looks right, I can follow up later with a separate discussion for optional sound/badge behavior without expanding the scope of this PR.

Copy link
Copy Markdown
Contributor Author

CI was red on the previous branch head because the new desktop notification plugin was only wired into the desktop package, while the root Vitest setup still lacked a mock/alias for @tauri-apps/plugin-notification. The failing suites were root-level desktop tests resolving desktop/src/App.tsx, so they failed at module resolution time rather than notification behavior.

That is fixed on the current head (3a0c942) by adding a root test mock plus a matching alias in vitest.config.ts, and I re-ran the local verification pass before pushing. The latest commit is now green in upstream CI (CI and CodeQL both succeeded).

@esengine esengine merged commit 7eecebe into esengine:main May 22, 2026
4 checks passed
esengine added a commit that referenced this pull request May 22, 2026
…se (#1565)

* chore(release): 0.49.0 — static-history TUI, queued steers, Bing default, lifecycle plans

Headline themes:
- TUI: Static-history renderer is the only path; virtual-viewport layers removed (#1529 stages 1-4)
- Chat: queued mid-turn steer handling so input mid-render doesn't drop or fight the live frame (#1501)
- Web search: default switches to Bing; dashboard engine switcher; Mojeek dropped (#1558)
- Plans: lifecycle evidence summaries surface why a plan is ready to accept (#1500)
- Desktop: native OS notifications for approvals + completion (#1519)
- i18n: CLI command output (/mcp /sessions /prune /theme) + approval-prompt labels translated (#1524, #1560)
- Security: SSRF block in web_fetch (#1544), edit-snapshot path containment (#1454), shell redirect sandbox (#1457), Task integrity guardrail (#1516)
- Tools: per-turn dispatch-rate limit (#1356); run_command discourages shell-based edits (#1514)
- Client: DeepSeek 429 → concurrency-limit hint (#1526); timeoutMs honored with AbortSignal (#1535); --no-proxy opt-out for direct route (#1507)
- Files: read/edit/restore preserves source encoding (GB18030 / UTF-8 BOM) (#1518)
- Context: pinned constraints survive folds + full tail capture (#1515, #1552)
- Refactor: lifecycle risk policy extracted into its own module (#1557)

See CHANGELOG for the full list.

* fix(context): align fold summary prefix with main agent for cache reuse

The summarizer call was sending a bespoke "You compress conversation
history" system prompt and no tools, guaranteeing a 0% cache hit
against the main agent's just-cached prefix. Reshape the request so
system + tools + head bytes mirror the live agent's last call — the
only novel bytes are the trailing summarize instruction.

Skill-pin handling now collects bodies read-only instead of stubbing
mid-head, so the cache prefix stays unbroken. The summarize
instruction names pinned skills so the model knows not to paraphrase
their bodies (which we append verbatim regardless).

Measured on a real session at 48.7K prompt tokens:
  OLD shape: 0.0% cache hit  → $0.145 per fold
  NEW shape: 99.6% cache hit → $0.015 per fold
  saving: 89.6% per fold

* tools: add fold-cache shape + live benchmarks

bench-fold-cache-shape.mjs replays real session jsonls, simulates
OLD vs NEW summary-call shapes at the fold point, and reports
byte-level shared-prefix with the main agent's preceding request.
Pure local — no API required.

bench-fold-cache-live.mjs sends one priming + two summary calls to
DeepSeek and reports prompt_cache_hit_tokens / cost for each shape.
Used to confirm the shape change actually translates to API-side
cache hits.

---------

Co-authored-by: reasonix <reasonix@deepseek.com>
@wade19990814-hue wade19990814-hue deleted the feat/desktop-notifications branch May 23, 2026 04: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.

2 participants