@idoall/dsh-notify 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,13 +4,41 @@ All notable changes to this project are documented here. The format follows [Kee
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.3.0] - 2026-09-20
8
+
9
+ ### Added
10
+
11
+ - **Presentation preferences.** Persisted Enhanced (default) and Soft notification styles, plus a persisted collapsed-stack preference.
12
+ - **A preview-first notification self-test.** Send one local Completed, Confirm, Failed, or Info example; replay all four, fold the active examples, or clear them. Tests never affect a real task or send a system notification.
13
+ - **Storefront screenshot manifest.** `screenshots.json` explicitly declares the current product screenshots for plugin directories and marketplaces.
14
+
15
+ ### Changed
16
+
17
+ - **The default multi-toast experience is now a collapsed pile.** The newest card remains fully readable on top; older complete cards expose equal 18px lower edges beneath it. Pointer entry or keyboard focus expands the pile without discarding cards.
18
+ - **The notification settings interface was redesigned** around display preferences, sound, task reminders, and visual preview controls. Desktop self-test state buttons are compact in one row; narrow screens reflow them to two columns.
19
+ - **README and README.zh are rewritten** to describe the current notification behavior, controls, queue limit, and mobile layout. All screenshots now show the current UI.
20
+
21
+ ### Fixed
22
+
23
+ - Clicking a notification that opens a session now also reveals the selected session row in the left sidebar, including when it belongs to an off-screen workspace.
24
+ - Enhanced local preview examples carry their real state tone rather than rendering as neutral gray.
25
+
26
+ ## [0.2.3] - 2026-09-19 (tagged, not published)
27
+
28
+ `v0.2.3` was tagged with release-workflow and packaging-maintenance changes, but its npm OIDC trusted-publisher step did not publish `@idoall/dsh-notify@0.2.3`. The latest published npm version remains `0.2.2`; do not treat this tag as an npm release.
29
+
30
+ ### Changed
31
+
32
+ - `assets/` no longer ships inside the npm tarball; npm renders relative README images from this repository's raw GitHub URLs instead.
33
+ - CI moves to `actions/checkout@v7` and `actions/setup-node@v7`.
34
+
7
35
  ## [0.2.2] - 2026-09-19
8
36
 
9
37
  Published to npm as **`@idoall/dsh-notify`**, with a tag-driven release pipeline. Nothing about the plugin's behaviour changes: the cordis name, the mount id, the `/plugins/dsh-notify/*` routes and every CSS class keep their short spelling, so profile config and the test suite are untouched.
10
38
 
11
39
  ### Added
12
40
 
13
- - **npm releases.** The package publishes as `@idoall/dsh-notify`. The unscoped `dsh-notify` name belongs to another author's Windows tray plugin, so the scope is what keeps `dsh plugin add dsh-notify` from pulling the wrong package. `package.json` drops `private`, declares `publishConfig.access: public`, and now ships `assets/` so the README screenshots render on the npm package page.
41
+ - **npm releases.** The package publishes as `@idoall/dsh-notify`. The unscoped `dsh-notify` name belongs to another author's Windows tray plugin, so the scope is what keeps `dsh plugin add dsh-notify` from pulling the wrong package. `package.json` drops `private` and declares `publishConfig.access: public`.
14
42
  - **`.github/workflows/release.yml`.** A `v*` tag gates on the `package.json` version, runs `npm run verify`, packs the plugin, publishes through GitHub Actions OIDC (no long-lived token; a version that is already on npm is skipped instead of failing), and creates the GitHub Release with the tarball and its sha256. `release-notes/v<version>.md` supplies the bilingual notes whenever it exists.
15
43
  - **`.github/dependabot.yml`**: monthly grouped npm maintenance plus GitHub Actions updates.
16
44
 
@@ -18,7 +46,7 @@ Published to npm as **`@idoall/dsh-notify`**, with a tag-driven release pipeline
18
46
 
19
47
  - **`cordis.patch.yml` mounts `@idoall/dsh-notify`** — the Node-resolvable package name — while the mount `id` stays `dsh-notify`.
20
48
  - **The client bundle registers under `@idoall/dsh-notify`.** `scripts/build.mjs` derives the `__ModuleLoader__.load({id})` id from `package.json` instead of hardcoding it, because DSH identifies a browser module by its manifest package name.
21
- - **`scripts/pack-check.mjs` also asserts the publish preconditions**: `private` unset, public scoped access, `assets/` shipped, `repository.url` matching the GitHub repository, and both `cordis.patch.yml` and the client registration id tracking `package.json`'s name.
49
+ - **`scripts/pack-check.mjs` also asserts the publish preconditions**: `private` unset, public scoped access, `repository.url` matching the GitHub repository, every relative README image present in the repository, and both `cordis.patch.yml` and the client registration id tracking `package.json`'s name.
22
50
  - Installing from a local clone no longer needs a manual `npm run build`: `npm install` builds through `prepare`, and `prepack` rebuilds before packing or publishing.
23
51
  - README and README.zh document the scoped install name, the npm badge and the release flow.
24
52
 
@@ -128,6 +156,9 @@ First public release. Verified against DeepSeek Harness `0.1.5-rc.1`.
128
156
 
129
157
  - Browser system notifications (channel B), host OS notifications (channel C) and web push / service worker (channel D), along with the `web-push` and `ipaddr.js` dependencies. Those channels failed invisibly (submitted but never seen) and could not be made reliable across browsers and operating systems.
130
158
 
159
+ [0.3.0]: https://github.com/idoall/dsh-notify/releases/tag/v0.3.0
160
+ [0.2.3]: https://github.com/idoall/dsh-notify/releases/tag/v0.2.3
161
+ [0.2.2]: https://github.com/idoall/dsh-notify/releases/tag/v0.2.2
131
162
  [0.2.1]: https://github.com/idoall/dsh-notify/releases/tag/v0.2.1
132
163
  [0.2.0]: https://github.com/idoall/dsh-notify/releases/tag/v0.2.0
133
164
  [0.1.2]: https://github.com/idoall/dsh-notify/releases/tag/v0.1.2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <h1 align="center">DSH Notify</h1>
2
2
 
3
- <p align="center">In-page task notifications for DeepSeek Harness: a toast stack, a sound, and a flashing tab title. Live delivery only — nothing is stored.</p>
3
+ <p align="center">In-page task notifications for DeepSeek Harness: clear status toasts, a collapsible stack, sound, and background-tab attention. Live delivery only — notification records are never stored.</p>
4
4
 
5
5
  <p align="center">
6
6
  <a href="https://github.com/idoall/dsh-notify/actions/workflows/ci.yml"><img src="https://github.com/idoall/dsh-notify/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
@@ -14,38 +14,29 @@
14
14
  <p align="center">
15
15
  <a href="#what-it-does">What it does</a> ·
16
16
  <a href="#quick-start">Quick start</a> ·
17
- <a href="#usage">Usage</a> ·
18
17
  <a href="#settings">Settings</a> ·
19
18
  <a href="#compatibility">Compatibility</a> ·
20
19
  <a href="#uninstall">Uninstall</a> ·
21
20
  <a href="CHANGELOG.md">Changelog</a>
22
21
  </p>
23
22
 
24
- > DSH Notify is a DeepSeek Harness community plugin. It registers exactly two seats — the settings section and the in-page overlay — and does not modify DSH source.
23
+ > DSH Notify is a DeepSeek Harness community plugin. It registers only a settings section and an in-page overlay; it does not modify DSH source.
25
24
 
26
- When a session **really stops**, fails, asks a question, or needs approval, a card appears in the top-right corner of the current page. Intermediate goal rounds and queued follow-up turns stay silent. Clicking a card jumps to the session (and the exact turn) that produced it — or the card stays put and says why it could not; questions and approvals are answered straight from the card. When you are done with a notification you close it, and it is gone — there is no history list behind it.
27
-
28
- Everything happens **inside the page you already have open**. There is no service worker, no web push, no host-side OS notification, and no extra app to install: browser and operating-system notification matrices were removed on purpose, because they fail invisibly (submitted, never seen) and cannot be made reliable across platforms.
25
+ When a session really stops, fails, asks a question, or needs approval, a card appears in the top-right corner of the current page. Intermediate goal rounds and queued follow-up turns stay quiet. Everything happens in the page you already have open: there is no service worker, web push, host OS notification, or notification history.
29
26
 
30
27
  <p align="center">
31
- <img src="./assets/toast.png" width="70%" alt="Notification cards in the top-right corner: arrival time, session name, title, body text and a close button">
28
+ <img src="./assets/toast.png" width="70%" alt="Enhanced notification stack: the newest error card is fully visible and earlier blue, amber and green cards expose equal lower edges">
32
29
  </p>
33
30
 
34
31
  ## What it does
35
32
 
36
- - **Toast on the page**: a stack in the top-right corner, newest on top. Each card carries the arrival time to the second (`00:33:08`, or `02-14 09:05` when it is not from today; the full date is in its tooltip), the session name, the title, the body, a tone colour per kind and a close button. Click the body to jump to the session; click the answers to reply without leaving the page, and the card reports the answer as loading until the host confirms (then ✓ 已完成 or ✗ with a 重试 button). Nothing expires on a clock: a card stays until you close it, open its session, or answer it — and a card whose record the Host has dropped leaves with it.
37
- - **A window onto the queue, not a folded pile**: one through five cards (three on a narrow, touch viewport) are **all fully visible** — they never overlap, whether they arrived together or one by one. The **sixth** card is the first that sits below the fold, one scroll (or one swipe) away, with a sliver of the next card under the window edge. The count on the corner is the whole queue the page is holding (`+8`), not just what is out of sight; click or tap it to jump between the two ends. Nothing is thrown away while the page is open; a refresh clears it.
38
- - **Answer in the toast**: a pending question or approval renders the same options as the composer. Answering here and answering in the composer act on the same pending interaction, so the two stay in sync.
39
- - **Jump to the exact turn**: clicking a card opens its session (through the host's `uiWorkspace.openSession` on current DSH, with the older `sessions.open` still accepted) and scrolls to (and briefly highlights) the turn the notification came from. The card is dismissed only once that really happened, so a jump that could not happen is not silently swallowed: a session that is gone (deleted, archived, or not in this page's list) leaves the card in place reading 这个会话已经不在了,无法打开, a jump that merely failed says 没能打开这个会话,再点一次试试 and clicking again retries, and a self-test card — which has no session on purpose — just closes.
40
- - **One card per ask**: a plan review or a question is one notification even when the host emits it twice — the live `tool/call` and the in-page question waterfall. The corner will not stack two 「计划待审」 cards for the same session.
41
- - **Sound that survives being in the background**: synthesised in-page with WebAudio (no audio files shipped), plus uploadable custom sounds. It plays **even when the page is hidden** — that is the only way to reach you when the browser is behind another app.
42
- - **Flashing tab title**: while the tab is in the background and a card arrived that you have not looked at, the title gets a 🔔 prefix and the favicon alternates to a red dot. It stops the moment you look at the tab.
43
- - **Opt-in noise**: subtask, background-job and workflow completion notifications are **off by default** (they fire for every subagent, every job and every workflow run, which gets noisy fast).
44
- - **Live only — there is no history**: the least surprising thing a notification can do is stop existing once you have dealt with it, so the plugin stores nothing. A page is told about what happens while it is open; nothing is kept to catch up on later, and a page that was not connected never learns about it. That is the trade for having no queue, no read state and no panel to reconcile.
45
-
46
- <p align="center">
47
- <img src="./assets/panel.png" width="46%" alt="Eight notifications in a window five cards tall: the count reads +8 and the sixth card shows its edge below the window">
48
- </p>
33
+ - **Enhanced or soft toast styling.** The default **Enhanced** style gives each notification a clear status colour and a short four-second attention bar; the bar is attention only, not a dismissal timer. **Soft** is a lower-key alternative. A card remains until you close it, open its session, or complete an in-card answer.
34
+ - **A collapsible page-local stack.** With **Collapse multiple notifications** enabled (the default), the second card and onward form a pile: the newest card is fully readable on top, while earlier cards remain complete underneath and expose equal `18px` lower edges. Pointer entry or keyboard focus expands the pile. The page keeps up to 50 live cards; pending actions are prioritised before ordinary cards, then newer cards come first.
35
+ - **Direct, traceable navigation.** Clicking a card opens its session and the exact originating turn. After the host selects that session, the selected row is smoothly revealed in the left session tree, even when it lives in a different off-screen workspace. A card stays put with an explanation if navigation cannot succeed.
36
+ - **Answer in the toast.** A pending question or approval renders the same compatible options as the composer. In-card and composer answers share the same host interaction.
37
+ - **Sound and background attention.** Built-in WebAudio cues and validated custom uploads play for new toasts, including while the page is hidden. A background tab with unseen notifications receives a temporary bell prefix and favicon attention marker.
38
+ - **Task-noise control.** Subtask, background-job, and workflow completion notifications are off by default.
39
+ - **No history by design.** Notification records are held only in the open page's in-memory queue. Refreshing the page clears them; an unopened page is not replayed a backlog.
49
40
 
50
41
  ## Quick start
51
42
 
@@ -53,7 +44,7 @@ Requirements:
53
44
 
54
45
  - DeepSeek Harness with a Web profile
55
46
  - Node.js 20 or newer
56
- - Verified DSH version: `0.1.6-alpha.1` (plugin `0.2.2`)
47
+ - Verified DeepSeek Harness version: `0.1.6-alpha.1`
57
48
 
58
49
  Install from npm into your Web profile:
59
50
 
@@ -67,7 +58,7 @@ Install from GitHub:
67
58
  dsh plugin --profile web add "github:idoall/dsh-notify"
68
59
  ```
69
60
 
70
- From a local clone (what this repository is developed against):
61
+ From a local clone:
71
62
 
72
63
  ```sh
73
64
  git clone https://github.com/idoall/dsh-notify.git
@@ -76,55 +67,45 @@ npm install
76
67
  dsh plugin --profile web add "link:$(pwd)"
77
68
  ```
78
69
 
79
- Restart DSH and refresh the Web UI. The client half registers the settings card in `settings.section` and the toast in `shell.overlay`; the host half mounts through `cordis.patch.yml`.
80
-
81
- > **Name note:** the unscoped npm name `dsh-notify` belongs to a **different** author (a Windows tray/toast plugin). This plugin is published as **`@idoall/dsh-notify`** — always install it with the scope, because a bare `dsh plugin add dsh-notify` would pull the other plugin.
82
- >
83
- > Only the published package name is scoped. The plugin's internal identity — cordis name, the `dsh-notify` mount id and the `/plugins/dsh-notify/*` routes — keeps its short spelling, so profile config and settings are unaffected.
70
+ Reload the profile or restart DSH only when its plugin host has not hot-reloaded the client. The client registers `settings.section` and `shell.overlay`; the host mounts through `cordis.patch.yml`.
84
71
 
85
- ## Usage
86
-
87
- 1. Run a task. When the task **stops**, fails, or asks something, a card appears in the top-right corner carrying the time it arrived.
88
- 2. Click the card to jump to its session and the exact turn it came from, click an answer button to answer in place, or click **×** to dismiss it. A card that cannot go anywhere says so and waits for you instead of vanishing.
89
- 3. Switch to another tab and keep working: while a card is waiting to be looked at, the title gets a 🔔 prefix and the favicon alternates to a red dot, and the sound plays even though the DSH page is in the background.
90
- 4. A refresh clears the corner. Nothing is stored — not here, not on the host — so what this page saw while it was open is all there is, and a page that was not open never learns about it at all.
72
+ > **Name note:** the unscoped npm name `dsh-notify` belongs to another author. Install this plugin as **`@idoall/dsh-notify`**. Its internal Cordis name, mount id, and `/plugins/dsh-notify/*` routes remain `dsh-notify`.
91
73
 
92
74
  ## Settings
93
75
 
94
- **Settings → Notifications**:
76
+ **Settings → Notifications** provides a compact preview-first control surface:
95
77
 
96
78
  <p align="center">
97
- <img src="./assets/settings.png" width="60%" alt="Notification settings: toast position, subtask notifications, the three self-test buttons and the sound card">
79
+ <img src="./assets/settings.png" width="60%" alt="DSH notification settings with enhanced and soft style choice, collapsed-stack toggle, sound, and task reminder controls">
98
80
  </p>
99
81
 
100
82
  | Setting | Default | What it does |
101
83
  | --- | --- | --- |
102
- | Toast position | conversation column, top-right | Anchors the toast to the chat column's top-right. Opening or closing either sidebar (the session list or the right pane) moves the stack with the conversation edge, including through the grid-column animation. |
103
- | Subtask / background job notifications | **off** | Each subagent, each background job and each workflow run would otherwise record an entry (titles often being raw commands). |
104
- | In-page sound | **on** | WebAudio cue on every new toast, **including while the page is hidden**. Built-ins: chime, ping, alert, silent — plus custom uploads. |
105
- | Self-test | — | There is one channel, so there is one test surface: **测试一条**, **测试 5 条** (exactly fills the corner window) and **测试 8 条** (three past it, which is where the count, the window edge and the scrolling show up). Tests never fire on page load. |
84
+ | Toast position | conversation top-right | Anchors the overlay to the chat column and follows sidebar layout changes. |
85
+ | Notification style | **Enhanced** | Enhanced uses clear status colours and a short attention bar; Soft uses a quieter presentation. |
86
+ | Collapse multiple notifications | **on** | From two cards onward, show the newest card fully and stack older cards below it; hover or focus expands them. |
87
+ | In-page sound | **on** | Plays a cue for each new toast, including while DSH is in a background tab. Built-ins: chime, ping, alert, silent; custom uploads are supported. |
88
+ | Subtask / background completion | **off** | Enables notifications for subagents, background jobs, and workflows, which can otherwise be noisy. |
89
+ | Preview and self-test | — | Sends page-local examples only: **Completed**, **Confirm**, **Failed**, **Info**, replay all four styles, fold the active examples, or clear them. No test sends a system notification or changes a real task. |
106
90
 
107
- Custom sounds are uploaded to `<dataDir>/sounds/` in the profile data directory (not the plugin install directory), so reinstalling the plugin keeps them. Uploads are limited to 1 MB and to `mp3 / m4a / aac / wav / ogg / flac`; the file name must be a single path segment (no `../`, no subdirectories).
91
+ Custom sounds are stored in `<dataDir>/sounds/` in the profile data directory, not the plugin installation. Uploads are limited to 1 MB and `mp3 / m4a / aac / wav / ogg / flac`; names must be a single path segment.
108
92
 
109
93
  ## Compatibility
110
94
 
111
- Current release: plugin **`0.2.2`** is verified against DeepSeek Harness **`0.1.6-alpha.1`**.
95
+ Current release target: plugin **`0.3.0`** verified against DeepSeek Harness **`0.1.6-alpha.1`**.
112
96
 
113
97
  | Plugin | Verified DeepSeek Harness |
114
98
  | --- | --- |
99
+ | `0.3.0` | `0.1.6-alpha.1` |
115
100
  | `0.2.2` | `0.1.6-alpha.1` |
116
101
  | `0.2.1` | `0.1.6-alpha.1` |
117
102
  | `0.2.0` | `0.1.6-alpha.1` |
118
103
  | `0.1.2` | `0.1.6-alpha.1` |
119
- | `0.1.1` | `0.1.5-rc.1` |
120
- | `0.1.0` | `0.1.5-rc.1` |
121
-
122
- Newer DSH releases are not auto-declared compatible. If a future DSH breaks the plugin, disable or uninstall it — do not patch DSH core.
123
104
 
124
- Verified on macOS (Chrome and the DSH desktop shell) and remotely through a phone browser on the same Host. The layout adapts to narrow viewports: the corner holds three cards instead of five, the stack becomes full-width, and it is promoted to the browser top layer so a fixed mobile sidebar cannot cover it.
105
+ The layout is also checked at a 390px mobile viewport: the settings controls reflow and the toast becomes full-width without falling behind the mobile sidebar.
125
106
 
126
107
  <p align="center">
127
- <img src="./assets/mobile.png" width="34%" alt="Notification cards on a 390 px phone viewport: full width, drawn above the mobile sidebar">
108
+ <img src="./assets/mobile.png" width="34%" alt="390 pixel mobile viewport showing a full-width enhanced notification stack with equal coloured edges beneath the newest card">
128
109
  </p>
129
110
 
130
111
  ## Uninstall
@@ -133,7 +114,7 @@ Verified on macOS (Chrome and the DSH desktop shell) and remotely through a phon
133
114
  dsh plugin --profile web remove @idoall/dsh-notify
134
115
  ```
135
116
 
136
- Uninstalling deletes nothing that persists: the uploaded sounds and `settings.json` (sound, toast position, subtask noise) live in the data directory your profile patch owns (`config.dataDir`). Delete that directory to wipe them. Notification records never reach the disk, so there is no history to clean up.
117
+ Uninstalling does not delete uploaded sounds or `settings.json` in the profile data directory. Notification records are never written to disk.
137
118
 
138
119
  ## Development
139
120
 
@@ -142,23 +123,19 @@ npm install
142
123
  npm run verify # typecheck + tests + build + package check
143
124
  npm run test # node --test test/*.test.js
144
125
  npm run build # dist/index.js, dist/client.js
145
- npm run pack:check # publish preconditions + the exact client registration
126
+ npm run pack:check # publish preconditions + client registration check
146
127
  ```
147
128
 
148
- The repository keeps the host half (`src/index.js`, `src/core.js`, `src/buffer.js`, `src/sounds.js`, `src/sound-choices.js`), the client half (`src/client.js`), and a dependency-free test suite (`test/`). `dist/` is build output and is not committed.
129
+ ## Releasing
149
130
 
150
- ### Releasing
151
-
152
- Releases are tag-driven. Bump `version` in `package.json`, move the CHANGELOG entry out of `Unreleased`, write bilingual notes in `release-notes/v<version>.md`, then push the tag:
131
+ Releases are tag-driven. Bump `package.json`, move the matching CHANGELOG section out of `Unreleased`, write `release-notes/v<version>.md`, then push the release commit and tag:
153
132
 
154
133
  ```sh
155
- git tag v0.2.2
156
- git push origin v0.2.2
134
+ git tag v0.3.0
135
+ git push origin v0.3.0
157
136
  ```
158
137
 
159
- `.github/workflows/release.yml` then gates the tag against `package.json`, runs `npm run verify`, packs the plugin, publishes to npm through GitHub Actions OIDC (no long-lived token, `repository.url` must match this repository, and an already-published version is skipped instead of failing), and creates the GitHub Release with the tarball and its sha256.
160
-
161
- Publishing needs a **trusted publisher** on npmjs.com for `@idoall/dsh-notify` naming this repository and the exact workflow filename `release.yml`, with a direct `npm publish` allowed (connections created after 2026-09-03 default to staged publishing only).
138
+ The release workflow runs `npm run verify`, packs the plugin, publishes through npm trusted publishing (OIDC), and creates a GitHub Release with the package tarball and sha256.
162
139
 
163
140
  ## License
164
141
 
package/README.zh.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <h1 align="center">DSH Notify</h1>
2
2
 
3
- <p align="center">为 DeepSeek Harness 提供页内任务通知:右上角一叠浮层、提示音,以及后台标签页标题闪动。只做实时投递,不存任何历史。</p>
3
+ <p align="center">为 DeepSeek Harness 提供页内任务通知:清晰状态色、可折叠通知堆叠、提示音与后台标签页提醒。只做实时投递,不保存通知历史。</p>
4
4
 
5
5
  <p align="center">
6
6
  <a href="https://github.com/idoall/dsh-notify/actions/workflows/ci.yml"><img src="https://github.com/idoall/dsh-notify/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
@@ -14,38 +14,29 @@
14
14
  <p align="center">
15
15
  <a href="#能做什么">能做什么</a> ·
16
16
  <a href="#快速开始">快速开始</a> ·
17
- <a href="#使用">使用</a> ·
18
17
  <a href="#设置">设置</a> ·
19
18
  <a href="#兼容性">兼容性</a> ·
20
19
  <a href="#卸载">卸载</a> ·
21
20
  <a href="CHANGELOG.md">更新记录</a>
22
21
  </p>
23
22
 
24
- > DSH Notify 是 DeepSeek Harness 社区插件,只注册两个座位——设置区块与页内浮层——不修改 DSH 源码。
23
+ > DSH Notify 是 DeepSeek Harness 社区插件,只注册设置区块与页内浮层,不修改 DSH 源码。
25
24
 
26
- 会话**真正停下**、运行失败、向你提问或请求审批时,当前页面右上角弹出一张卡片。goal 自动续跑、排队的下一轮不会每轮弹一次。点卡片跳回产生该通知的会话(并定位到那一轮)——跳不过去时卡片会留在原地说明原因;提问与审批还能**直接在卡片上回答**。处理完关掉,它就没了——背后没有历史列表。
27
-
28
- 一切都发生在**你已经打开的这个页面里**。没有 Service Worker、没有 Web Push、不做宿主机系统通知、也不需要安装任何 App——浏览器与操作系统通知矩阵是被**故意删掉**的:它们失败时对用户不可见(提交成功却永远看不到横幅),且无法跨平台做可靠。
25
+ 会话真正停下、运行失败、向你提问或请求审批时,当前页面右上角会出现通知卡片。goal 自动续跑和排队的下一轮保持安静。一切发生在你已打开的页面内:没有 Service Worker、Web Push、宿主机系统通知或通知历史。
29
26
 
30
27
  <p align="center">
31
- <img src="./assets/toast.png" width="70%" alt="右上角通知卡片:到达时刻、会话名、标题、正文与关闭按钮">
28
+ <img src="./assets/toast.png" width="70%" alt="增强版通知堆叠:最新的失败通知完整显示,较早的蓝色、橙色和绿色通知等距露出下边缘">
32
29
  </p>
33
30
 
34
31
  ## 能做什么
35
32
 
36
- - **页内浮层**:右上角一叠卡片,新消息在最上方。每张卡的最前面是**到达时刻**(精确到秒,如 `00:33:08`;不是今天的会显示 `02-14 09:05`,完整日期在悬浮提示里),后面跟着会话名、标题、正文、按类型着色的状态色和关闭按钮。点正文跳到该会话,点选项就地回答,回答期间卡片显示 loading,宿主确认后就地变成 ✓ 已完成或 ✗ 加「重试」。**没有任何东西按时间自动消失**:卡片会一直留着,直到你点 × 关闭、点正文跳会话、或在卡上回答成功;如果宿主那边这条记录已被清空/删除,卡片也会跟着退场。
37
- - **一扇窗,不是叠压**:桌面 **1~5 条全部完整展开**(窄屏/触屏是 1~3 条),不会折叠、不会重叠——一次来 5 条和从 1 条加到 5 条一样。**第 6 条**起才排到窗下面,滚动或手指滑动就能看到,窗沿会露出下一张的边。角上的计数是**本页全部**条数(8 条就是「+8」),不是藏起来的那些;点它可以在队列两端之间跳转。页面开着期间一条都不丢,刷新即清空。
38
- - **在浮层里回答**:待回复的提问/审批会渲染与输入框一致的选项。在这里回答和在输入框里回答操作的是**同一个**待处理交互,两边实时同步。
39
- - **精确跳到那一轮**:点一张卡片会打开对应会话(当前 DSH 走宿主的 `uiWorkspace.openSession`,旧的 `sessions.open` 仍可用),并滚动到(短暂高亮)产生该通知的那一轮。**只有真的跳过去了卡片才会消失**,所以跳不过去不会被悄悄吞掉:会话已经不在了(被删、被归档、或不在本页列表里)会在卡片上写「这个会话已经不在了,无法打开」;只是这次失败会写「没能打开这个会话,再点一次试试」,再点一次就是重试;自测卡本来就没有会话,点了就安静关闭。
40
- - **一次提问只弹一张**:计划待审或提问在宿主里会同时走 live `tool/call` 和页内提问瀑布流,插件会合到同一张卡上,不会同一会话叠两张「计划待审」。
41
- - **后台也能听见的提示音**:用 WebAudio 在页面内合成(不带任何音频文件),也支持上传自定义音。**页面隐藏时照样响**——浏览器被别的应用挡住时,这是唯一能提醒到你的方式。
42
- - **标签标题闪动**:标签在后台、且有你还没看过的新卡片时,标题加 🔔 前缀、favicon 交替成红点;你一切回标签就停。
43
- - **噪声默认关**:子任务、后台任务与工作流完成通知**默认关闭**(每个子代理、每个后台任务、每次工作流运行都会弹一条,开久了很乱)。
44
- - **只有实时,没有历史**:通知最不让人意外的行为是「你处理完它就不存在了」,所以插件什么都不存。页面开着时发生的事才会告诉它;不会留一份给你事后翻,页面不在线时发生的事它也不会知道——这就是换来「没有队列、没有已读状态、没有面板要对账」的代价。
45
-
46
- <p align="center">
47
- <img src="./assets/panel.png" width="46%" alt="八条通知装在一扇五张卡高的窗里:角上计数显示 +8,窗沿露出第六张的边">
48
- </p>
33
+ - **增强版或柔和版通知样式**:默认的**增强版**使用清晰状态色与四秒短暂提醒条;提醒条只用于吸引注意,不负责关闭通知。**柔和版**提供更克制的视觉效果。卡片会保留到你关闭、打开对应会话或完成卡片内回答为止。
34
+ - **可折叠的页内通知栈**:开启默认的**多条通知折叠显示**后,从第 2 条起会折叠:最新卡片完整可读,早期卡片仍保留完整内容并在下方等距露出 `18px` 边缘。鼠标移入或键盘焦点进入时会展开。本页最多保存 50 条活跃卡片;待处理通知优先,其余按最新优先。
35
+ - **可追溯的会话跳转**:点通知会打开对应会话并定位到来源轮次。宿主选中会话后,左侧会话树会自动平滑滚动并展示已选行,即使它位于另一个屏幕外工作区。跳转失败时卡片会留在原地说明原因。
36
+ - **在卡片内回答**:待回复问题或审批会显示可兼容的输入框选项;卡片内回答与输入框操作同一份宿主交互。
37
+ - **提示音与后台提醒**:新通知可以播放内置 WebAudio 或经过校验的自定义提示音,页面在后台时仍可播放。后台标签有未查看通知时,标题和 favicon 会短暂提示。
38
+ - **任务噪声控制**:子任务、后台任务和工作流完成通知默认关闭。
39
+ - **无历史设计**:通知仅保存在当前页面内存中;刷新即清空,未打开的页面不会收到旧消息回放。
49
40
 
50
41
  ## 快速开始
51
42
 
@@ -53,9 +44,9 @@
53
44
 
54
45
  - 带 Web profile 的 DeepSeek Harness
55
46
  - Node.js 20 或更新
56
- - 已验证的 DSH 版本:`0.1.6-alpha.1`(插件 `0.2.2`)
47
+ - 已验证的 DeepSeek Harness:`0.1.6-alpha.1`
57
48
 
58
- 从 npm 装进 Web profile:
49
+ 从 npm 安装:
59
50
 
60
51
  ```sh
61
52
  dsh plugin --profile web add @idoall/dsh-notify@latest
@@ -67,7 +58,7 @@ dsh plugin --profile web add @idoall/dsh-notify@latest
67
58
  dsh plugin --profile web add "github:idoall/dsh-notify"
68
59
  ```
69
60
 
70
- 从本地克隆安装(本仓库的开发方式):
61
+ 从本地克隆安装:
71
62
 
72
63
  ```sh
73
64
  git clone https://github.com/idoall/dsh-notify.git
@@ -76,55 +67,45 @@ npm install
76
67
  dsh plugin --profile web add "link:$(pwd)"
77
68
  ```
78
69
 
79
- 重启 DSH,刷新 Web UI。客户端半边把设置卡片挂到 `settings.section`、浮层挂到 `shell.overlay`;宿主半边通过 `cordis.patch.yml` 挂载。
80
-
81
- > **命名提醒**:无 scope 的 npm 名 `dsh-notify` 属于**另一位作者**(一个 Windows 托盘通知插件)。本插件发布为 **`@idoall/dsh-notify`**——请务必带 scope 安装,因为裸的 `dsh plugin add dsh-notify` 会装成别人的插件。
82
- >
83
- > 只有「发布用的包名」带 scope。插件的内部身份——cordis 名、`dsh-notify` 挂载 id、`/plugins/dsh-notify/*` 路由——都保持原来的短名,profile 配置与设置项不受影响。
70
+ 若插件宿主没有热重载客户端,请重新加载 profile 或重启 DSH。客户端注册到 `settings.section` 与 `shell.overlay`,宿主通过 `cordis.patch.yml` 挂载。
84
71
 
85
- ## 使用
86
-
87
- 1. 跑一个任务。任务**真正停下**、失败或向你提问时,右上角出现一张卡片,带上是几点到的。
88
- 2. 点卡片跳到它的会话与那一轮;点选项就地回答;点 **×** 关掉。**跳不过去的卡片会说明原因并留在原地**,等你关掉它。
89
- 3. 切到别的标签继续干活:有卡片还没被你看过时,标题会加 🔔、favicon 变红点,提示音也会响——即使 DSH 页面在后台。
90
- 4. **刷新即清空**。什么都不存——本页不存、宿主也不存——所以这个页面开着期间看到的就是全部;页面没打开时发生的事,它永远不会知道。
72
+ > **命名提醒**:无 scope 的 npm 名 `dsh-notify` 属于另一位作者。请安装 **`@idoall/dsh-notify`**。内部 Cordis 名、挂载 id 和 `/plugins/dsh-notify/*` 路由仍保持 `dsh-notify`。
91
73
 
92
74
  ## 设置
93
75
 
94
- **设置 → 通知**:
76
+ **设置 → 通知**提供以预览为先的紧凑控制区:
95
77
 
96
78
  <p align="center">
97
- <img src="./assets/settings.png" width="60%" alt="通知设置:Toast 位置、子任务通知、三个自测按钮与提示音卡片">
79
+ <img src="./assets/settings.png" width="60%" alt="DSH 通知设置:增强版与柔和版选择、折叠通知开关、提示音与任务提醒">
98
80
  </p>
99
81
 
100
82
  | 设置项 | 默认 | 作用 |
101
83
  | --- | --- | --- |
102
- | Toast 位置 | 会话区右上 | 浮层贴在聊天区右上角。左侧会话栏或右侧栏展开、收起时都会跟着会话列走,包括 grid 分栏动画过程中。 |
103
- | 子任务 / 后台任务完成时通知 | **关** | 否则每个子代理、每个后台任务、每次工作流运行都会记一条(标题常常是命令行原文)。 |
104
- | 页内提示音 | **开** | 每条新通知响一次,**窗口不在最前也响**。内置 chime / ping / alert / 静音,另可上传自定义音。 |
105
- | 自测 | — | 只有一条通道,所以只有页面浮层这一项:**测试一条**、**测试 5 条**(正好填满角上那一窗)、**测试 8 条**(多出 3 条,看角上「+8」的计数、窗沿和向下滚动)。页面加载**不会**自动发送测试。 |
84
+ | Toast 位置 | 会话区右上 | 浮层贴在聊天区,并跟随左右侧栏布局变化。 |
85
+ | 通知样式 | **增强版** | 增强版使用清晰状态色和短提醒条;柔和版更克制。 |
86
+ | 多条通知折叠显示 | **开** | 从两条开始完整显示最新一条,旧卡叠在下方;悬停或聚焦即可展开。 |
87
+ | 页内提示音 | **开** | 每条新通知播放提示音,即使 DSH 标签在后台。内置 chime / ping / alert / 静音,也可上传自定义声音。 |
88
+ | 子任务 / 后台任务完成时通知 | **关** | 开启子代理、后台任务与工作流的完成通知;默认避免噪声。 |
89
+ | 预览与自测 | — | 仅发送当前页面的完成、确认、失败、信息示例;也可重播四种状态、折叠当前示例或清空。不会发系统通知,也不影响真实任务。 |
106
90
 
107
- 自定义提示音上传到 profile 数据目录下的 `<dataDir>/sounds/`(**不是**插件安装目录),所以重装插件不会丢。上传上限 1 MB,仅支持 `mp3 / m4a / aac / wav / ogg / flac`;文件名必须是单段(不允许 `../` 或子目录)。
91
+ 自定义提示音保存在 profile 数据目录的 `<dataDir>/sounds/`,而非插件安装目录。上传限制 1 MB,支持 `mp3 / m4a / aac / wav / ogg / flac`,文件名必须是单段路径。
108
92
 
109
93
  ## 兼容性
110
94
 
111
- 当前发布:插件 **`0.2.2`** 已在 DeepSeek Harness **`0.1.6-alpha.1`** 上验证。
95
+ 当前发布目标:插件 **`0.3.0`** 已在 DeepSeek Harness **`0.1.6-alpha.1`** 上验证。
112
96
 
113
97
  | 插件 | 已验证的 DeepSeek Harness |
114
98
  | --- | --- |
99
+ | `0.3.0` | `0.1.6-alpha.1` |
115
100
  | `0.2.2` | `0.1.6-alpha.1` |
116
101
  | `0.2.1` | `0.1.6-alpha.1` |
117
102
  | `0.2.0` | `0.1.6-alpha.1` |
118
103
  | `0.1.2` | `0.1.6-alpha.1` |
119
- | `0.1.1` | `0.1.5-rc.1` |
120
- | `0.1.0` | `0.1.5-rc.1` |
121
-
122
- 更新的 DSH 版本不会自动声明兼容。若将来 DSH 变更导致插件失效,请停用或卸载它——不要去改 DSH 核心。
123
104
 
124
- 已在 macOS(Chrome 与 DSH 桌面壳)以及同一 Host 下的手机浏览器远程访问中验证。窄屏会自适应:角上从五张变**三张**、浮层变成全宽,并被提升到浏览器顶层。
105
+ 同时在 390px 手机视口检查:设置控件会重排,Toast 会满宽显示且不会被移动端侧栏遮挡。
125
106
 
126
107
  <p align="center">
127
- <img src="./assets/mobile.png" width="34%" alt="390px 手机视口下的通知卡片:全宽,浮在移动端侧栏之上">
108
+ <img src="./assets/mobile.png" width="34%" alt="390px 手机视口:增强版通知栈满宽显示,最新通知下方有等距状态色边缘">
128
109
  </p>
129
110
 
130
111
  ## 卸载
@@ -133,7 +114,7 @@ dsh plugin --profile web add "link:$(pwd)"
133
114
  dsh plugin --profile web remove @idoall/dsh-notify
134
115
  ```
135
116
 
136
- 卸载**不会**删除任何会留下来的东西:已上传的提示音与 `settings.json`(提示音、Toast 位置、子任务开关)在你自己 profile patch 指定的数据目录(`config.dataDir`)里,要清空就删掉那个目录。通知记录从不落盘,所以没有历史要清。
117
+ 卸载不会删除 profile 数据目录里的自定义声音或 `settings.json`。通知记录从不写入磁盘。
137
118
 
138
119
  ## 开发
139
120
 
@@ -142,23 +123,19 @@ npm install
142
123
  npm run verify # typecheck + 测试 + 构建 + 打包检查
143
124
  npm run test # node --test test/*.test.js
144
125
  npm run build # dist/index.js、dist/client.js
145
- npm run pack:check # 发布前置条件 + 客户端注册 id 校验
126
+ npm run pack:check # 发布前置条件 + 客户端注册校验
146
127
  ```
147
128
 
148
- 仓库包含宿主半边(`src/index.js`、`src/core.js`、`src/buffer.js`、`src/sounds.js`、`src/sound-choices.js`)、客户端半边(`src/client.js`)以及一套零依赖测试(`test/`)。`dist/` 是构建产物,不入库。
129
+ ## 发版
149
130
 
150
- ### 发版
151
-
152
- 发版由 tag 驱动。改 `package.json` 的 `version`、把 CHANGELOG 里 `Unreleased` 段落成正式版本、在 `release-notes/v<版本>.md` 写好双语说明,然后推 tag:
131
+ 发版由 tag 驱动。更新 `package.json`、将对应 CHANGELOG 段落移出 `Unreleased`、编写 `release-notes/v<版本>.md` 后,推送发版提交与 tag:
153
132
 
154
133
  ```sh
155
- git tag v0.2.2
156
- git push origin v0.2.2
134
+ git tag v0.3.0
135
+ git push origin v0.3.0
157
136
  ```
158
137
 
159
- `.github/workflows/release.yml` 会先校验 tag 与 `package.json` 版本一致,再跑 `npm run verify`、打包,通过 GitHub Actions OIDC 发布到 npm(不需要长期令牌;`repository.url` 必须与本仓库一致;版本已存在时跳过而不是报错),最后创建带 `.tgz` 与 sha256 的 GitHub Release。
160
-
161
- 发布前需要在 npmjs.com 给 `@idoall/dsh-notify` 配置 **trusted publisher**:填本仓库、workflow 文件名必须正好是 `release.yml`,并且要勾选允许直接 `npm publish`(2026-09-03 之后新建的连接默认只允许暂存发布)。
138
+ 发版工作流会运行 `npm run verify`、打包插件、通过 npm trusted publishing(OIDC)发布,并创建附带 tarball 与 sha256 的 GitHub Release。
162
139
 
163
140
  ## 许可证
164
141
 
package/dist/client.js CHANGED
@@ -41,9 +41,11 @@ window.__ModuleLoader__.load({
41
41
  SELF_TEST_BATCH: () => SELF_TEST_BATCH,
42
42
  SELF_TEST_STEP_MS: () => SELF_TEST_STEP_MS,
43
43
  SETTINGS_CSS: () => SETTINGS_CSS,
44
+ TOAST_ATTENTION_MS: () => TOAST_ATTENTION_MS,
44
45
  TOAST_CSS: () => TOAST_CSS,
45
46
  TOAST_EXIT_MS: () => TOAST_EXIT_MS,
46
47
  TOAST_QUEUE_MAX: () => TOAST_QUEUE_MAX,
48
+ TOAST_STACK_COLLAPSED_PEEK: () => TOAST_STACK_COLLAPSED_PEEK,
47
49
  TOAST_STACK_GAP: () => TOAST_STACK_GAP,
48
50
  TOAST_STACK_PEEK: () => TOAST_STACK_PEEK,
49
51
  TOAST_STACK_VISIBLE: () => TOAST_STACK_VISIBLE,
@@ -51,10 +53,13 @@ window.__ModuleLoader__.load({
51
53
  TOAST_SUCCESS_MS: () => TOAST_SUCCESS_MS,
52
54
  answerBatch: () => answerBatch,
53
55
  apply: () => apply,
56
+ clearLocalSelfTests: () => clearLocalSelfTests,
57
+ collapsedStackPlan: () => collapsedStackPlan,
54
58
  createAttentionIndicator: () => createAttentionIndicator,
55
59
  createLocalSelfTestBatch: () => createLocalSelfTestBatch,
56
60
  createLocalSelfTestRecord: () => createLocalSelfTestRecord,
57
61
  createSoundPlayer: () => createSoundPlayer,
62
+ foldLocalSelfTests: () => foldLocalSelfTests,
58
63
  inject: () => inject,
59
64
  installAudioUnlock: () => installAudioUnlock,
60
65
  installClientStyles: () => installClientStyles,
@@ -65,6 +70,7 @@ window.__ModuleLoader__.load({
65
70
  publishLocalSelfTest: () => publishLocalSelfTest,
66
71
  queueCards: () => queueCards,
67
72
  resultTone: () => resultTone,
73
+ revealSelectedSidebarSession: () => revealSelectedSidebarSession,
68
74
  revealTurn: () => revealTurn,
69
75
  sessionLabel: () => sessionLabel,
70
76
  setToastConfig: () => setToastConfig,
@@ -116,6 +122,8 @@ window.__ModuleLoader__.load({
116
122
  // src/client.js
117
123
  var BASE = "/plugins/dsh-notify";
118
124
  var LOCAL_TEST_EVENT = "dsh-notify:self-test-local";
125
+ var LOCAL_TEST_CLEAR_EVENT = "dsh-notify:self-test-clear";
126
+ var LOCAL_TEST_FOLD_EVENT = "dsh-notify:self-test-fold";
119
127
  var inject = ["slots"];
120
128
  function toastAnchor({ document: doc = globalThis.document, innerWidth = globalThis.innerWidth, fallbackContentWidth = 720 } = {}) {
121
129
  const rect = doc?.querySelector?.("[data-conversation-scroll]")?.getBoundingClientRect?.();
@@ -200,7 +208,7 @@ window.__ModuleLoader__.load({
200
208
  if (raf && typeof win.cancelAnimationFrame === "function") win.cancelAnimationFrame(raf);
201
209
  };
202
210
  }
203
- var SETTINGS_CSS = `.dsh-notify-settings{display:grid;gap:14px;max-width:640px;min-width:0;padding:4px 0;color:var(--dsw-alias-label-primary)}
211
+ var SETTINGS_CSS = `.dsh-notify-settings{display:grid;gap:15px;max-width:790px;min-width:0;padding:4px 0;color:var(--dsw-alias-label-primary)}
204
212
  .dsh-notify-heading{font-size:16px;font-weight:650;margin:0}
205
213
  .dsh-notify-card{background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:12px;min-width:0;padding:16px 18px}
206
214
  /* The rhythm inside a card. It has to be scoped to the settings section, because as a bare
@@ -244,43 +252,33 @@ window.__ModuleLoader__.load({
244
252
  .dsh-notify-result[data-tone=passed]{color:var(--dsw-alias-state-success-primary,#16a36a)}
245
253
  .dsh-notify-result[data-tone=failed]{color:var(--dsw-alias-state-error-primary,#dc2626)}
246
254
  .dsh-notify-result[data-tone=active]{color:var(--dsw-alias-state-business-primary)}
247
- @media (hover:none) and (pointer:coarse){.dsh-notify-action{line-height:42px;min-height:44px}.dsh-notify-select{min-height:44px}.dsh-notify-settings .dsh-notify-toggle input{flex:0 0 22px;height:22px;max-width:22px;min-height:22px;min-width:22px;width:22px}}`;
248
- var TOAST_CSS = `.dsh-notify-frame{position:fixed;z-index:1100}
255
+ .dsh-notify-settings{gap:15px;max-width:790px}.dsh-notify-heading{font-size:26px;letter-spacing:-.4px;line-height:1.25}.dsh-notify-settings-head{align-items:flex-start;display:flex;gap:16px;justify-content:space-between}.dsh-notify-settings-intro{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.55;margin:8px 0 0}.dsh-notify-settings-status{align-items:center;background:color-mix(in srgb,var(--dsw-alias-state-success-primary,#07865a) 10%,var(--dsw-alias-bg-layer-2));border:1px solid color-mix(in srgb,var(--dsw-alias-state-success-primary,#07865a) 40%,var(--dsw-alias-border-l2));border-radius:999px;color:var(--dsw-alias-state-success-primary,#07865a);display:flex;font-size:12px;gap:7px;line-height:1;padding:8px 10px;white-space:nowrap}.dsh-notify-settings-status::before{background:currentColor;border-radius:50%;content:"";height:7px;width:7px}.dsh-notify-card{border-radius:13px;box-shadow:0 2px 7px rgb(29 41 57 / 6%);padding:19px 20px}.dsh-notify-card-head{align-items:flex-start;display:flex;gap:12px;margin-bottom:17px}.dsh-notify-card-icon{align-items:center;background:color-mix(in srgb,var(--dsw-alias-state-business-primary,#315ee8) 10%,var(--dsw-alias-bg-layer-2));border-radius:9px;color:var(--dsw-alias-state-business-primary,#315ee8);display:flex;flex:none;font-size:16px;height:31px;justify-content:center;width:31px}.dsh-notify-card-head .dsh-notify-card-title{font-size:15px}.dsh-notify-card-head .dsh-notify-hint{margin-top:4px}.dsh-notify-rows{border-top:1px solid var(--dsw-alias-border-l2)}.dsh-notify-setting-row{align-items:center;border-bottom:1px solid var(--dsw-alias-border-l2);display:flex;gap:16px;min-width:0;padding:15px 0}.dsh-notify-setting-row:last-child{border-bottom:0;padding-bottom:0}.dsh-notify-setting-copy{flex:1;min-width:0}.dsh-notify-setting-label{font-size:13px;font-weight:650}.dsh-notify-setting-help{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.55;margin:3px 0 0}.dsh-notify-setting-field{align-items:center;border-bottom:1px solid var(--dsw-alias-border-l2);display:grid;gap:20px;grid-template-columns:minmax(0,1fr) 210px;padding:15px 0}.dsh-notify-setting-field:last-child{border-bottom:0;padding-bottom:0}.dsh-notify-segmented{background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2));border:1px solid var(--dsw-alias-border-l2);border-radius:10px;display:flex;gap:4px;padding:4px}.dsh-notify-segmented button{background:transparent;border:0;border-radius:7px;color:var(--dsw-alias-label-secondary);cursor:pointer;flex:1;font:600 12px inherit;padding:8px 11px;white-space:nowrap}.dsh-notify-segmented button[data-active=true]{background:var(--dsw-alias-bg-layer-2);box-shadow:0 1px 3px rgb(0 0 0 / 10%);color:var(--dsw-alias-state-business-primary,#315ee8)}.dsh-notify-preview{align-items:center;background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2));border-radius:9px;color:var(--dsw-alias-label-secondary);display:flex;font-size:12px;gap:10px;margin-top:14px;padding:12px}.dsh-notify-preview::before{background:var(--dsw-alias-state-success-primary,#07865a);border-radius:50%;box-shadow:0 0 0 3px color-mix(in srgb,var(--dsw-alias-state-success-primary,#07865a) 14%,transparent);content:"";flex:none;height:9px;width:9px}.dsh-notify-preview strong{color:var(--dsw-alias-label-primary);display:block;font-size:12px}.dsh-notify-settings .dsh-notify-toggle{align-items:center;cursor:default}.dsh-notify-settings .dsh-notify-toggle input{appearance:none;background:#aeb8c7;border:0;border-radius:999px;cursor:pointer;flex:0 0 42px;height:24px;margin:0;max-width:42px;min-height:24px;min-width:42px;position:relative;width:42px}.dsh-notify-settings .dsh-notify-toggle input::after{background:#fff;border-radius:50%;box-shadow:0 1px 2px rgb(0 0 0 / 22%);content:"";height:18px;left:3px;position:absolute;top:3px;transition:left .18s;width:18px}.dsh-notify-settings .dsh-notify-toggle input:checked{background:var(--dsw-alias-state-business-primary,#315ee8)}.dsh-notify-settings .dsh-notify-toggle input:checked::after{left:21px}.dsh-notify-settings .dsh-notify-toggle>span{display:none}.dsh-notify-settings .dsh-notify-card>*+*{margin-top:0}
256
+ .dsh-notify-test-panel{display:grid;gap:14px}.dsh-notify-test-caption{font-size:13px;font-weight:650;margin:0}.dsh-notify-test-grid{display:grid;gap:8px;grid-template-columns:repeat(4,minmax(0,1fr))}.dsh-notify-test-action{align-items:center;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:9px;color:var(--dsw-alias-label-primary);cursor:pointer;display:flex;font:600 13px inherit;gap:7px;justify-content:center;min-height:40px;padding:6px 8px;white-space:nowrap}.dsh-notify-test-action:hover{background:var(--dsw-alias-button-floating-hover)}.dsh-notify-test-action::before{background:var(--dsh-test-tone,var(--dsw-alias-label-tertiary));border-radius:50%;content:"";height:8px;width:8px}.dsh-notify-test-action[data-tone=success]{--dsh-test-tone:var(--dsw-alias-state-success-primary,#07865a)}.dsh-notify-test-action[data-tone=warning]{--dsh-test-tone:var(--dsw-alias-state-warn-primary,#bc6508)}.dsh-notify-test-action[data-tone=error]{--dsh-test-tone:var(--dsw-alias-state-error-primary,#cf3044)}.dsh-notify-test-action[data-tone=info]{--dsh-test-tone:var(--dsw-alias-state-business-primary,#2862db)}.dsh-notify-test-primary{background:var(--dsw-alias-state-business-primary,#315ee8);border:0;border-radius:9px;color:#fff;cursor:pointer;font:700 13px inherit;justify-self:start;min-height:40px;min-width:238px;padding:7px 14px;width:auto}.dsh-notify-test-primary:hover{filter:brightness(1.06)}.dsh-notify-test-secondary{background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:9px;color:var(--dsw-alias-label-primary);cursor:pointer;font:600 13px inherit;justify-self:start;min-height:38px;min-width:205px;padding:6px 14px;width:auto}.dsh-notify-test-secondary:hover{background:var(--dsw-alias-button-floating-hover)}
257
+ @media (hover:none) and (pointer:coarse){.dsh-notify-action{line-height:42px;min-height:44px}.dsh-notify-select{min-height:44px}.dsh-notify-settings .dsh-notify-toggle input{flex:0 0 42px;height:24px;max-width:42px;min-height:24px;min-width:42px;width:42px}}@media(max-width:620px){.dsh-notify-settings-head{display:block}.dsh-notify-settings-status{display:inline-flex;margin-top:14px}.dsh-notify-setting-field{grid-template-columns:1fr;gap:11px}.dsh-notify-card{padding:16px}.dsh-notify-test-grid{gap:8px;grid-template-columns:repeat(2,minmax(0,1fr))}.dsh-notify-test-action{min-height:44px;padding:8px}.dsh-notify-test-primary,.dsh-notify-test-secondary{justify-self:stretch;min-width:0;width:100%}}`;
258
+ var TOAST_CSS = `.dsh-notify-frame{position:fixed;z-index:1100;transition:height 390ms cubic-bezier(.16,1,.3,1)}
249
259
  .dsh-notify-stack{height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
260
+ .dsh-notify-stack[data-collapsed=true]{overflow:hidden}
250
261
  .dsh-notify-stack-inner{pointer-events:none;position:relative}
251
- .dsh-notify-slot{inset-inline:0;pointer-events:none;position:absolute;top:0;transform-origin:top center;transition:transform 320ms cubic-bezier(.22,1,.36,1)}
252
- .dsh-notify-count{background:var(--dsw-alias-interactive-bg-hover-solid,var(--dsw-alias-bg-layer-3,rgb(0 0 0 / 6%)));border:0;border-radius:999px;color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;font-size:11px;inset-inline-end:35px;line-height:18px;padding:0 8px;position:absolute;top:13px;z-index:2}
262
+ .dsh-notify-slot{inset-inline:0;pointer-events:none;position:absolute;top:0;transform-origin:top center;transition:transform 360ms cubic-bezier(.16,1,.3,1)}
263
+ .dsh-notify-stack[data-collapsed=true] .dsh-notify-slot{transition:top 340ms cubic-bezier(.22,.88,.38,1),transform 340ms cubic-bezier(.22,.88,.38,1)}
264
+ .dsh-notify-count{background:var(--dsw-alias-interactive-bg-hover-solid,var(--dsw-alias-bg-layer-3,rgb(0 0 0 / 6%)));border:0;border-radius:999px;color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;font-size:11px;inset-inline-end:35px;line-height:18px;padding:0 8px;position:absolute;top:13px;z-index:102}
253
265
  .dsh-notify-count:hover{color:var(--dsw-alias-label-primary)}
254
- .dsh-notify-toast{align-items:flex-start;animation:dsh-notify-card-in 380ms cubic-bezier(.21,1.02,.73,1);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;box-shadow:var(--dsw-elevation-panel,0 6px 20px rgb(0 0 0 / 18%));box-sizing:border-box;color:var(--dsw-alias-label-primary);cursor:pointer;display:flex;gap:10px;margin:0;overflow:hidden;padding:12px 34px 12px 12px;pointer-events:auto;position:relative;width:100%}
266
+ .dsh-notify-toast{align-items:flex-start;animation:dsh-notify-card-in 380ms cubic-bezier(.21,1.02,.73,1);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:11px;box-shadow:0 2px 7px rgb(29 41 57 / 10%),0 1px 2px rgb(29 41 57 / 6%);box-sizing:border-box;color:var(--dsw-alias-label-primary);cursor:pointer;display:flex;gap:11px;margin:0;overflow:hidden;padding:14px 34px 17px 14px;pointer-events:auto;position:relative;width:100%}
267
+ .dsh-notify-toast[data-style=strong]{background:color-mix(in srgb,var(--dsh-notify-tone) 7%,var(--dsw-alias-bg-layer-2));border-color:color-mix(in srgb,var(--dsh-notify-tone) 62%,var(--dsw-alias-border-l2))}
268
+ .dsh-notify-toast[data-style=soft]{box-shadow:0 2px 7px rgb(29 41 57 / 7%),0 1px 2px rgb(29 41 57 / 4%)}
255
269
  .dsh-notify-toast[data-leaving=true]{animation:dsh-notify-card-out 200ms ease-in forwards;pointer-events:none}
270
+ .dsh-notify-toast[data-style=strong][data-attention=true]::after{background:var(--dsh-notify-tone);bottom:0;content:"";height:4px;inset-inline:0;position:absolute;transform-origin:left;animation:dsh-notify-attention 4000ms linear forwards}
256
271
  @keyframes dsh-notify-card-in{0%{opacity:0;transform:translateY(-10px) scale(.9)}62%{opacity:1;transform:translateY(0) scale(1.02)}100%{opacity:1;transform:none}}
257
272
  @keyframes dsh-notify-card-out{to{opacity:0;transform:translateX(115%)}}
273
+ @keyframes dsh-notify-attention{to{transform:scaleX(0);opacity:0}}
258
274
  @keyframes dsh-notify-spin{to{transform:rotate(360deg)}}
259
275
  .dsh-notify-toast-icon{color:var(--dsw-alias-label-tertiary,#7a8494);flex:none;margin-top:1px}
276
+ .dsh-notify-toast[data-tone=success]{--dsh-notify-tone:var(--dsw-alias-state-success-primary,#07865a)}.dsh-notify-toast[data-tone=error]{--dsh-notify-tone:var(--dsw-alias-state-error-primary,#cf3044)}.dsh-notify-toast[data-tone=warning]{--dsh-notify-tone:var(--dsw-alias-state-warn-primary,#bc6508)}.dsh-notify-toast[data-tone=info]{--dsh-notify-tone:var(--dsw-alias-state-business-primary,#2862db)}.dsh-notify-toast[data-tone=neutral]{--dsh-notify-tone:var(--dsw-alias-label-tertiary,#6f7c91)}
277
+ .dsh-notify-toast[data-style=strong] .dsh-notify-toast-icon{color:var(--dsh-notify-tone)}.dsh-notify-toast[data-style=soft][data-tone=success] .dsh-notify-toast-icon{color:var(--dsh-notify-tone)}.dsh-notify-toast[data-style=soft][data-tone=error] .dsh-notify-toast-icon{color:var(--dsh-notify-tone)}.dsh-notify-toast[data-style=soft][data-tone=warning] .dsh-notify-toast-icon{color:var(--dsh-notify-tone)}.dsh-notify-toast[data-style=soft][data-tone=info] .dsh-notify-toast-icon{color:var(--dsh-notify-tone)}
260
278
  .dsh-notify-toast-icon[data-spin=true]{animation:dsh-notify-spin .9s linear infinite}
261
- .dsh-notify-toast[data-tone=success] .dsh-notify-toast-icon{color:var(--dsw-alias-state-success-primary,#16a36a)}
262
- .dsh-notify-toast[data-tone=error] .dsh-notify-toast-icon{color:var(--dsw-alias-state-error-primary,#dc2626)}
263
- .dsh-notify-toast[data-tone=warning] .dsh-notify-toast-icon{color:var(--dsw-alias-state-warn-primary,#d97706)}
264
- .dsh-notify-toast[data-tone=info] .dsh-notify-toast-icon{color:var(--dsw-alias-state-business-primary,#2563eb)}
265
- .dsh-notify-toast-body{display:grid;gap:2px;min-width:0;flex:1 1 auto}
266
- .dsh-notify-toast-head{align-items:center;display:flex;gap:6px;min-width:0}
267
- .dsh-notify-toast-source{color:var(--dsw-alias-label-tertiary,#7a8494);flex:1 1 auto;font-size:11px;line-height:1.4;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
268
- .dsh-notify-toast-time{color:var(--dsw-alias-label-tertiary,#7a8494);flex:none;font-size:11px;font-variant-numeric:tabular-nums;line-height:1.4;white-space:nowrap}
269
- .dsh-notify-toast-title{font-size:13px;font-weight:650;line-height:1.45}
270
- .dsh-notify-toast-text{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.5;margin:0;overflow-wrap:anywhere}
271
- .dsh-notify-toast-answers{align-items:center;display:flex;flex-wrap:wrap;gap:6px;margin-top:2px}
272
- .dsh-notify-toast-answer{background:var(--dsw-alias-button-floating-fill);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;cursor:pointer;font:inherit;font-size:12px;line-height:26px;max-width:100%;min-height:28px;overflow:hidden;padding:0 10px;text-overflow:ellipsis;touch-action:manipulation;white-space:nowrap}
273
- .dsh-notify-toast-answer:hover{background:var(--dsw-alias-button-floating-hover)}
274
- .dsh-notify-toast-answer:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
275
- .dsh-notify-toast-answer[data-variant=quiet]{background:transparent;color:var(--dsw-alias-label-secondary)}
276
- .dsh-notify-toast-answer:disabled{cursor:progress;opacity:.6}
277
- .dsh-notify-toast-error{color:var(--dsw-alias-state-error-primary,#dc2626);font-size:11px;line-height:1.45}
278
- .dsh-notify-toast-hint{color:var(--dsw-alias-label-secondary);font-size:11px;line-height:1.45}
279
- .dsh-notify-toast-close{align-items:center;background:transparent;border:0;border-radius:6px;color:var(--dsw-alias-label-secondary);cursor:pointer;display:inline-flex;font-size:15px;height:22px;inset-inline-end:6px;justify-content:center;line-height:1;padding:0;position:absolute;top:6px;width:22px}
280
- .dsh-notify-toast-close:hover{background:var(--dsw-alias-button-floating-hover);color:var(--dsw-alias-label-primary)}
281
- .dsh-notify-toast-close:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
282
- @media (hover:none) and (pointer:coarse){.dsh-notify-toast{padding:12px 44px 12px 12px}.dsh-notify-toast-close{font-size:17px;height:32px;width:32px}}
283
- @media (prefers-reduced-motion:reduce){.dsh-notify-toast{animation:none}.dsh-notify-toast[data-leaving=true]{animation:none}.dsh-notify-slot{transition:none}.dsh-notify-toast-icon[data-spin=true]{animation:none}}`;
279
+ .dsh-notify-toast-body{display:grid;gap:2px;min-width:0;flex:1 1 auto}.dsh-notify-toast-head{align-items:center;display:flex;gap:6px;min-width:0}.dsh-notify-toast-source{color:var(--dsw-alias-label-tertiary,#7a8494);flex:1 1 auto;font-size:11px;line-height:1.4;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-notify-toast-time{color:var(--dsw-alias-label-tertiary,#7a8494);flex:none;font-size:11px;font-variant-numeric:tabular-nums;line-height:1.4;white-space:nowrap}.dsh-notify-toast-title{font-size:14px;font-weight:700;line-height:1.45}.dsh-notify-toast-text{color:var(--dsw-alias-label-primary);font-size:12px;line-height:1.6;margin:5px 0 0;overflow-wrap:anywhere}.dsh-notify-toast[data-style=soft] .dsh-notify-toast-text{color:var(--dsw-alias-label-secondary)}.dsh-notify-toast-answers{align-items:center;display:flex;flex-wrap:wrap;gap:6px;margin-top:5px}.dsh-notify-toast-answer{background:var(--dsw-alias-button-floating-fill);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;cursor:pointer;font:inherit;font-size:12px;line-height:26px;max-width:100%;min-height:28px;overflow:hidden;padding:0 10px;text-overflow:ellipsis;touch-action:manipulation;white-space:nowrap}.dsh-notify-toast-answer:hover{background:var(--dsw-alias-button-floating-hover)}.dsh-notify-toast-answer:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.dsh-notify-toast-answer[data-variant=quiet]{background:transparent;color:var(--dsw-alias-label-secondary)}.dsh-notify-toast-answer:disabled{cursor:progress;opacity:.6}.dsh-notify-toast-error{color:var(--dsw-alias-state-error-primary,#dc2626);font-size:11px;line-height:1.45}.dsh-notify-toast-hint{color:var(--dsw-alias-label-secondary);font-size:11px;line-height:1.45}.dsh-notify-toast-close{align-items:center;background:transparent;border:0;border-radius:6px;color:var(--dsw-alias-label-secondary);cursor:pointer;display:inline-flex;font-size:18px;height:27px;inset-inline-end:5px;justify-content:center;line-height:1;padding:0;position:absolute;top:5px;width:27px}.dsh-notify-toast-close:hover{background:var(--dsw-alias-button-floating-hover);color:var(--dsw-alias-label-primary)}.dsh-notify-toast-close:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
280
+ @media (hover:none) and (pointer:coarse){.dsh-notify-toast{padding:14px 44px 17px 14px}.dsh-notify-toast-close{font-size:18px;height:32px;width:32px}}
281
+ @media (prefers-reduced-motion:reduce){.dsh-notify-toast,.dsh-notify-toast[data-leaving=true]{animation:none}.dsh-notify-toast[data-attention=true]::after{display:none}.dsh-notify-frame,.dsh-notify-slot,.dsh-notify-stack[data-collapsed=true] .dsh-notify-slot{transition:none}.dsh-notify-toast-icon[data-spin=true]{animation:none}}`;
284
282
  var CLIENT_CSS = `${SETTINGS_CSS}
285
283
  ${TOAST_CSS}`;
286
284
  function installClientStyles({ document: doc = globalThis.document } = {}) {
@@ -296,9 +294,15 @@ window.__ModuleLoader__.load({
296
294
  function layoutFor({ width = 1024, coarse = false } = {}) {
297
295
  return { narrow: width < 760, hitTarget: coarse ? 44 : 32 };
298
296
  }
299
- function createLocalSelfTestRecord({ now = Date.now(), randomUUID = () => globalThis.crypto?.randomUUID?.() || Math.random().toString(36).slice(2) } = {}) {
297
+ function createLocalSelfTestRecord({ tone = "success", now = Date.now(), randomUUID = () => globalThis.crypto?.randomUUID?.() || Math.random().toString(36).slice(2) } = {}) {
300
298
  const id = `self-test:${randomUUID()}`;
301
- return { eventId: id, mergeKey: id, kind: "test", title: "\u81EA\u6D4B\uFF1A\u9875\u9762\u6D6E\u5C42", body: "\u53EA\u663E\u793A\u5728\u5F53\u524D\u9875\u9762\uFF0C\u4E0D\u4F1A\u53D1\u9001\u7CFB\u7EDF\u901A\u77E5", at: now, phase: "settled", localOnly: true };
299
+ const examples = {
300
+ success: { kind: "completed", title: "\u7A0B\u5E8F\u4FEE\u590D\u5DF2\u5B8C\u6210", body: "\u9A8C\u8BC1\u901A\u8FC7\u3002\u63D0\u9192\u6761\u7ED3\u675F\u540E\uFF0C\u8FD9\u6761\u901A\u77E5\u4ECD\u4F1A\u4FDD\u7559\u3002" },
301
+ warning: { kind: "approval", title: "\u9700\u8981\u4F60\u786E\u8BA4\u4E0B\u4E00\u6B65", body: "\u4FEE\u590D\u65B9\u6848\u5DF2\u51C6\u5907\u597D\uFF0C\u8BF7\u786E\u8BA4\u540E\u518D\u7EE7\u7EED\u3002" },
302
+ error: { kind: "failed", title: "\u9A8C\u8BC1\u672A\u901A\u8FC7", body: "\u53D1\u73B0\u4E00\u9879\u963B\u65AD\u95EE\u9898\uFF0C\u8BF7\u67E5\u770B\u9519\u8BEF\u8BE6\u60C5\u540E\u518D\u91CD\u8BD5\u3002" },
303
+ info: { kind: "question", title: "\u540E\u53F0\u4EFB\u52A1\u6709\u65B0\u7ED3\u679C", body: "\u4EE3\u7801\u68C0\u67E5\u7ED3\u679C\u5DF2\u8FD4\u56DE\uFF0C\u62A5\u544A\u5DF2\u5C31\u7EEA\u3002" }
304
+ };
305
+ return { ...examples[tone] ?? examples.success, eventId: id, mergeKey: id, at: now, phase: "settled", localOnly: true };
302
306
  }
303
307
  var SELF_TEST_BATCH = Object.freeze([
304
308
  { kind: "completed", title: "\u4EFB\u52A1\u5B8C\u6210", body: "\u4FEE\u590D\u63D2\u4EF6\u672C\u673A\u8BBF\u95EE\u5E03\u5C40\u95EE\u9898" },
@@ -321,6 +325,12 @@ window.__ModuleLoader__.load({
321
325
  function publishLocalSelfTest(record, dispatch = (event) => globalThis.dispatchEvent(event)) {
322
326
  dispatch(typeof CustomEvent === "function" ? new CustomEvent(LOCAL_TEST_EVENT, { detail: record }) : { type: LOCAL_TEST_EVENT, detail: record });
323
327
  }
328
+ function clearLocalSelfTests(dispatch = (event) => globalThis.dispatchEvent(event)) {
329
+ dispatch(typeof Event === "function" ? new Event(LOCAL_TEST_CLEAR_EVENT) : { type: LOCAL_TEST_CLEAR_EVENT });
330
+ }
331
+ function foldLocalSelfTests(dispatch = (event) => globalThis.dispatchEvent(event)) {
332
+ dispatch(typeof Event === "function" ? new Event(LOCAL_TEST_FOLD_EVENT) : { type: LOCAL_TEST_FOLD_EVENT });
333
+ }
324
334
  function validSessionId(value) {
325
335
  return typeof value === "string" && value.length > 0 && value.length <= 256 && /^[A-Za-z0-9._:-]+$/.test(value);
326
336
  }
@@ -371,6 +381,29 @@ window.__ModuleLoader__.load({
371
381
  if (snap?.current === sessionId) return true;
372
382
  return (snap?.byId?.[sessionId]?.retainedBy?.mainView ?? 0) > 0;
373
383
  }
384
+ function revealSelectedSidebarSession({ document: doc = globalThis.document, setTimer = globalThis.setTimeout, clearTimer = globalThis.clearTimeout, attempts = 8, intervalMs = 50 } = {}) {
385
+ let timer = null;
386
+ let cancelled = false;
387
+ let remaining = Math.max(1, attempts);
388
+ const before = doc?.querySelector?.('[role="treeitem"][aria-selected="true"]') ?? null;
389
+ const reveal = () => {
390
+ if (cancelled) return;
391
+ const selected = doc?.querySelector?.('[role="treeitem"][aria-selected="true"]');
392
+ if (selected && selected !== before) {
393
+ try {
394
+ selected.scrollIntoView?.({ block: "center", inline: "nearest", behavior: "smooth" });
395
+ } catch {
396
+ }
397
+ return;
398
+ }
399
+ if (--remaining > 0) timer = setTimer?.(reveal, intervalMs);
400
+ };
401
+ timer = setTimer?.(reveal, 80);
402
+ return () => {
403
+ cancelled = true;
404
+ if (timer !== null) clearTimer?.(timer);
405
+ };
406
+ }
374
407
  async function navigateNotificationRecord(record, { sessions, uiWorkspace, acknowledge } = {}) {
375
408
  const sessionId = record?.sessionId;
376
409
  const snapshot = sessions?.list?.getSnapshot?.();
@@ -389,6 +422,7 @@ window.__ModuleLoader__.load({
389
422
  return { status: "navigation-failed" };
390
423
  }
391
424
  if (!isMainView(sessions, sessionId)) return { status: "navigation-failed" };
425
+ revealSelectedSidebarSession();
392
426
  if (Number.isSafeInteger(record.turn) && record.turn > 0) revealTurn(record.turn);
393
427
  await acknowledge?.(record);
394
428
  return { status: "acknowledged" };
@@ -479,7 +513,7 @@ window.__ModuleLoader__.load({
479
513
  if (tone === "info") return import_react.default.createElement("svg", shared, import_react.default.createElement("circle", { cx: 10, cy: 10, r: 7 }), import_react.default.createElement("path", { d: "M10 9.2v4M10 6.7h.01" }));
480
514
  return import_react.default.createElement("svg", shared, import_react.default.createElement("path", { d: "M10 3.2a4.3 4.3 0 0 0-4.3 4.3c0 3.2-1.2 4.2-1.2 4.2h11s-1.2-1-1.2-4.2A4.3 4.3 0 0 0 10 3.2z" }), import_react.default.createElement("path", { d: "M8.6 14.4a1.6 1.6 0 0 0 2.8 0" }));
481
515
  }
482
- var toastConfig = { toastPosition: "conversation", toastEnabled: true, soundEnabled: true, sound: "chime" };
516
+ var toastConfig = { toastPosition: "conversation", toastEnabled: true, notificationStyle: "strong", stackCollapsed: true, soundEnabled: true, sound: "chime" };
483
517
  function createSoundPlayer({ audio = globalThis, AudioContextClass, AudioElementClass } = {}) {
484
518
  let context = null;
485
519
  let unlocked = false;
@@ -651,6 +685,8 @@ window.__ModuleLoader__.load({
651
685
  var TOAST_STACK_GAP = 12;
652
686
  var TOAST_STACK_PEEK = 10;
653
687
  var TOAST_QUEUE_MAX = 50;
688
+ var TOAST_STACK_COLLAPSED_PEEK = 18;
689
+ var TOAST_ATTENTION_MS = 4e3;
654
690
  var TOAST_EXIT_MS = 200;
655
691
  var TOAST_SUCCESS_MS = 900;
656
692
  function queueCards(cards = [], max = TOAST_QUEUE_MAX) {
@@ -677,6 +713,11 @@ window.__ModuleLoader__.load({
677
713
  return plan;
678
714
  });
679
715
  }
716
+ function collapsedStackPlan({ heights = [], peek = TOAST_STACK_COLLAPSED_PEEK } = {}) {
717
+ const list = (Array.isArray(heights) ? heights : []).map((height) => Number(height) || 0);
718
+ const first = list[0] ?? 0;
719
+ return list.map((height, index) => ({ offsetY: index === 0 ? 0 : first + index * peek - height }));
720
+ }
680
721
  function stackWindow({ heights = [], visible = TOAST_STACK_VISIBLE, gap = TOAST_STACK_GAP, peek = TOAST_STACK_PEEK } = {}) {
681
722
  const list = (Array.isArray(heights) ? heights : []).map((height) => Number(height) || 0);
682
723
  const count = Math.max(1, visible);
@@ -691,6 +732,8 @@ window.__ModuleLoader__.load({
691
732
  const [, refresh] = import_react.default.useState(0);
692
733
  const [cards, setCards] = import_react.default.useState([]);
693
734
  const [anchor, setAnchor] = import_react.default.useState(() => toastAnchor());
735
+ const [expanded, setExpanded] = import_react.default.useState(false);
736
+ const [forcedCollapsed, setForcedCollapsed] = import_react.default.useState(false);
694
737
  const [, rerender] = import_react.default.useState(0);
695
738
  const toasted = import_react.default.useRef(/* @__PURE__ */ new Set());
696
739
  const primed = import_react.default.useRef(false);
@@ -794,7 +837,7 @@ window.__ModuleLoader__.load({
794
837
  if (!record?.eventId) return;
795
838
  if (globalThis.document?.hidden) unseen.current.add(record.eventId);
796
839
  toasted.current.add(record.eventId);
797
- const incoming = [{ record, status: "idle", error: null, lastLabel: null, leaving: false }, ...cardsRef.current.filter((card) => card.record.eventId !== record.eventId)];
840
+ const incoming = [{ record, status: "idle", error: null, lastLabel: null, leaving: false, attention: true }, ...cardsRef.current.filter((card) => card.record.eventId !== record.eventId)];
798
841
  const next = queueCards(incoming);
799
842
  for (const card of incoming) if (!next.includes(card)) forget(card.record.eventId);
800
843
  commit(next);
@@ -802,10 +845,32 @@ window.__ModuleLoader__.load({
802
845
  };
803
846
  import_react.default.useEffect(() => {
804
847
  const local = (event) => {
805
- if (event?.detail?.localOnly) showToast(event.detail);
848
+ if (event?.detail?.localOnly) {
849
+ setForcedCollapsed(false);
850
+ setExpanded(false);
851
+ showToast(event.detail);
852
+ }
853
+ };
854
+ const clearLocal = () => {
855
+ for (const card of cardsRef.current) forget(card.record.eventId);
856
+ commit([]);
857
+ setForcedCollapsed(false);
858
+ setExpanded(false);
859
+ };
860
+ const foldLocal = () => {
861
+ if (cardsRef.current.length > 1) {
862
+ setExpanded(false);
863
+ setForcedCollapsed(true);
864
+ }
806
865
  };
807
866
  globalThis.addEventListener?.(LOCAL_TEST_EVENT, local);
808
- return () => globalThis.removeEventListener?.(LOCAL_TEST_EVENT, local);
867
+ globalThis.addEventListener?.(LOCAL_TEST_CLEAR_EVENT, clearLocal);
868
+ globalThis.addEventListener?.(LOCAL_TEST_FOLD_EVENT, foldLocal);
869
+ return () => {
870
+ globalThis.removeEventListener?.(LOCAL_TEST_EVENT, local);
871
+ globalThis.removeEventListener?.(LOCAL_TEST_CLEAR_EVENT, clearLocal);
872
+ globalThis.removeEventListener?.(LOCAL_TEST_FOLD_EVENT, foldLocal);
873
+ };
809
874
  }, []);
810
875
  const scrollWindow = () => {
811
876
  const element = stackRef.current;
@@ -911,13 +976,14 @@ window.__ModuleLoader__.load({
911
976
  if (!buttons.length && !note) return null;
912
977
  return import_react.default.createElement("div", { className: "dsh-notify-toast-answers" }, buttons, note);
913
978
  };
914
- const cardView = (card, plan) => {
979
+ const cardView = (card, plan, index) => {
915
980
  const record = card.record;
916
981
  const status = card.status;
917
982
  const tone = status === "error" ? "error" : status === "success" ? "success" : toastTone(record.kind);
918
983
  const source = sessionLabel(sessions, record.sessionId);
919
984
  const stamp = toastTime(record.at);
920
- const slotStyle = { transform: `translateY(${plan.offsetY}px)` };
985
+ const pileHidden = collapsed && index > 0;
986
+ const slotStyle = { transform: `translateY(${plan.offsetY}px)`, zIndex: 100 - (index < 0 ? 99 : index) };
921
987
  return import_react.default.createElement(
922
988
  "div",
923
989
  { key: record.eventId, className: "dsh-notify-slot", style: slotStyle },
@@ -926,11 +992,18 @@ window.__ModuleLoader__.load({
926
992
  {
927
993
  ref: measure(record.eventId),
928
994
  role: "status",
929
- "aria-live": "polite",
995
+ "aria-live": pileHidden ? "off" : "polite",
996
+ "aria-hidden": pileHidden ? "true" : void 0,
997
+ inert: pileHidden ? "" : void 0,
930
998
  className: "dsh-notify-toast",
931
999
  "data-tone": tone,
1000
+ "data-style": toastConfig.notificationStyle === "soft" ? "soft" : "strong",
1001
+ "data-attention": card.attention ? "true" : "false",
932
1002
  "data-status": status,
933
1003
  "data-leaving": card.leaving ? "true" : "false",
1004
+ onAnimationEnd: (event) => {
1005
+ if (event.animationName === "dsh-notify-attention" && card.attention) patchCard(record.eventId, { attention: false });
1006
+ },
934
1007
  onClick: () => {
935
1008
  if (!card.leaving) void activate(card);
936
1009
  }
@@ -962,8 +1035,14 @@ window.__ModuleLoader__.load({
962
1035
  };
963
1036
  const liveCards = cards.filter((card) => !card.leaving);
964
1037
  const liveHeights = liveCards.map((card) => heights.current.get(card.record.eventId) ?? 0);
965
- const plans = toastStackPlan({ heights: liveHeights });
966
- const frame = stackWindow({ heights: liveHeights, visible: narrow ? TOAST_STACK_VISIBLE_NARROW : TOAST_STACK_VISIBLE });
1038
+ const collapsed = (forcedCollapsed || toastConfig.stackCollapsed !== false) && !expanded && liveCards.length > 1;
1039
+ const expandedPlans = toastStackPlan({ heights: liveHeights });
1040
+ const firstHeight = liveHeights[0] ?? 0;
1041
+ const collapsedPlans = collapsedStackPlan({ heights: liveHeights });
1042
+ const expandedFrame = stackWindow({ heights: liveHeights, visible: narrow ? TOAST_STACK_VISIBLE_NARROW : TOAST_STACK_VISIBLE });
1043
+ const collapsedHeight = firstHeight + Math.min(Math.max(0, liveCards.length - 1), 3) * TOAST_STACK_COLLAPSED_PEEK + 4;
1044
+ const frame = collapsed ? { total: liveCards.length, hidden: Math.max(0, liveCards.length - 4), windowHeight: collapsedHeight, contentHeight: collapsedHeight, overflow: false } : expandedFrame;
1045
+ const plans = collapsed ? collapsedPlans : expandedPlans;
967
1046
  const planById = new Map(liveCards.map((card, index) => [card.record.eventId, plans[index]]));
968
1047
  for (const [eventId, plan] of planById) slots.current.set(eventId, plan);
969
1048
  const queueCount = frame.overflow ? frame.total : 0;
@@ -983,11 +1062,15 @@ window.__ModuleLoader__.load({
983
1062
  } }, `+${queueCount}`) : null,
984
1063
  import_react.default.createElement(
985
1064
  "div",
986
- { ref: stackRef, className: "dsh-notify-stack", "data-overflow": frame.overflow ? "true" : "false" },
1065
+ { ref: stackRef, className: "dsh-notify-stack", "data-overflow": frame.overflow ? "true" : "false", "data-collapsed": collapsed ? "true" : "false", onPointerEnter: () => {
1066
+ if (collapsed) setExpanded(true);
1067
+ }, onFocusCapture: () => {
1068
+ if (collapsed) setExpanded(true);
1069
+ } },
987
1070
  import_react.default.createElement(
988
1071
  "div",
989
1072
  { className: "dsh-notify-stack-inner", style: { height: `${frame.contentHeight}px` } },
990
- rendered.map((card) => cardView(card, planById.get(card.record.eventId) ?? slots.current.get(card.record.eventId) ?? { offsetY: frame.contentHeight }))
1073
+ rendered.map((card) => cardView(card, planById.get(card.record.eventId) ?? slots.current.get(card.record.eventId) ?? { offsetY: frame.contentHeight }, liveCards.findIndex((live) => live.record.eventId === card.record.eventId)))
991
1074
  )
992
1075
  )
993
1076
  );
@@ -1037,28 +1120,34 @@ window.__ModuleLoader__.load({
1037
1120
  var hint = (children) => import_react.default.createElement("p", { className: "dsh-notify-hint" }, children);
1038
1121
  function NotificationSelfTests() {
1039
1122
  const [state, setState] = import_react.default.useState(null);
1040
- const fireOne = () => {
1041
- publishLocalSelfTest(createLocalSelfTestRecord());
1042
- setState({ status: "passed", reason: "\u9875\u9762\u6D6E\u5C42\u5DF2\u6E32\u67D3\uFF08\u4E00\u6761\uFF09" });
1123
+ const single = (tone) => {
1124
+ publishLocalSelfTest(createLocalSelfTestRecord({ tone }));
1125
+ setState({ status: "passed", reason: `\u5DF2\u53D1\u9001${{ success: "\u5B8C\u6210", warning: "\u786E\u8BA4", error: "\u5931\u8D25", info: "\u4FE1\u606F" }[tone]}\u6A21\u62DF\u901A\u77E5` });
1126
+ };
1127
+ const replayAll = () => {
1128
+ clearLocalSelfTests();
1129
+ for (const record of createLocalSelfTestBatch({ count: 4 })) publishLocalSelfTest(record);
1130
+ setState({ status: "passed", reason: "\u5DF2\u91CD\u64AD\u56DB\u79CD\u72B6\u6001\u4E0E\u589E\u5F3A\u7248\u63D0\u9192\u52A8\u6548" });
1043
1131
  };
1044
- const fire = (count) => {
1045
- for (const record of createLocalSelfTestBatch({ count })) publishLocalSelfTest(record);
1046
- setState({ status: "passed", reason: `\u9875\u9762\u6D6E\u5C42\u5DF2\u6E32\u67D3\uFF08${Math.min(count, SELF_TEST_BATCH.length)} \u6761\uFF09` });
1132
+ const fold = () => {
1133
+ foldLocalSelfTests();
1134
+ setState({ status: "passed", reason: "\u5DF2\u5207\u6362\u901A\u77E5\u5806\u53E0\uFF1B\u79FB\u5165\u901A\u77E5\u533A\u5373\u53EF\u5C55\u5F00" });
1047
1135
  };
1136
+ const clear = () => {
1137
+ clearLocalSelfTests();
1138
+ setState({ status: "passed", reason: "\u5DF2\u6E05\u7A7A\u672C\u9875\u6A21\u62DF\u901A\u77E5" });
1139
+ };
1140
+ const testButton = (tone, label) => import_react.default.createElement("button", { type: "button", className: "dsh-notify-test-action", "data-tone": tone, onClick: () => single(tone) }, label);
1048
1141
  return import_react.default.createElement(
1049
- "section",
1050
- { className: "dsh-notify-card", "aria-label": "\u901A\u77E5\u81EA\u6D4B" },
1051
- import_react.default.createElement("h3", { className: "dsh-notify-card-title" }, "\u81EA\u6D4B"),
1052
- hint("\u53EA\u6709\u9875\u9762\u91CC\u8FD9\u4E00\u6761\u901A\u9053\uFF1A\u53F3\u4E0A\u89D2\u6D6E\u5C42 + \u63D0\u793A\u97F3 + \u540E\u53F0\u6807\u7B7E\u9875\u95EA\u52A8\u3002\u8FD9\u91CC\u53D1\u51FA\u7684\u5361\u7247\u53EA\u6E32\u67D3\u5728\u5F53\u524D\u9875\u9762\uFF0C\u4E0D\u4F1A\u5916\u53D1\u7CFB\u7EDF\u901A\u77E5\u3002"),
1053
- import_react.default.createElement(
1054
- "div",
1055
- { className: "dsh-notify-actions" },
1056
- action("\u6D4B\u8BD5\u4E00\u6761", fireOne),
1057
- action(`\u6D4B\u8BD5 ${TOAST_STACK_VISIBLE} \u6761`, () => fire(TOAST_STACK_VISIBLE)),
1058
- action(`\u6D4B\u8BD5 ${SELF_TEST_BATCH.length} \u6761`, () => fire(SELF_TEST_BATCH.length))
1059
- ),
1060
- hint(`\u300C\u6D4B\u8BD5 ${TOAST_STACK_VISIBLE} \u6761\u300D\u6B63\u597D\u586B\u6EE1\u89D2\u4E0A\u90A3\u4E00\u7A97\uFF1B\u300C\u6D4B\u8BD5 ${SELF_TEST_BATCH.length} \u6761\u300D\u591A\u51FA ${SELF_TEST_BATCH.length - TOAST_STACK_VISIBLE} \u6761\uFF0C\u89D2\u4E0A\u4ECD\u7136\u53EA\u5360\u4E00\u7A97\u7684\u9AD8\u5EA6\uFF0C\u524D\u9762\u90A3\u5F20\u5361\u53F3\u4E0A\u89D2\u663E\u793A\u603B\u6570\u300C+${SELF_TEST_BATCH.length}\u300D\uFF0C\u5728\u901A\u77E5\u533A\u91CC\u5411\u4E0B\u6EDA\u52A8\u5C31\u80FD\u770B\u5230\u5269\u4E0B\u7684 ${SELF_TEST_BATCH.length - TOAST_STACK_VISIBLE} \u6761\u3002`),
1061
- state ? import_react.default.createElement("p", { className: "dsh-notify-result", role: "status", "data-tone": resultTone(state.status) }, `${state.status}: ${state.reason}`) : null
1142
+ "div",
1143
+ { className: "dsh-notify-test-panel", "aria-label": "\u901A\u77E5\u81EA\u6D4B" },
1144
+ import_react.default.createElement("p", { className: "dsh-notify-test-caption" }, "\u70B9\u51FB\u53D1\u9001\u4E00\u6761\u6A21\u62DF\u901A\u77E5"),
1145
+ import_react.default.createElement("div", { className: "dsh-notify-test-grid" }, testButton("success", "\u5B8C\u6210"), testButton("warning", "\u786E\u8BA4"), testButton("error", "\u5931\u8D25"), testButton("info", "\u4FE1\u606F")),
1146
+ import_react.default.createElement("button", { type: "button", className: "dsh-notify-test-primary", onClick: replayAll }, "\u67E5\u770B\u56DB\u79CD\u72B6\u6001 / \u91CD\u64AD\u52A8\u6548"),
1147
+ import_react.default.createElement("button", { type: "button", className: "dsh-notify-test-secondary", onClick: fold }, "\u6298\u53E0\u901A\u77E5\u4E3A\u4E00\u645E"),
1148
+ import_react.default.createElement("button", { type: "button", className: "dsh-notify-test-secondary", onClick: clear }, "\u6E05\u7A7A\u901A\u77E5\uFF0C\u5148\u770B\u6587\u6863"),
1149
+ hint("\u6240\u6709\u6D4B\u8BD5\u901A\u77E5\u53EA\u6E32\u67D3\u5728\u5F53\u524D\u9875\u9762\uFF0C\u4E0D\u53D1\u9001\u7CFB\u7EDF\u901A\u77E5\uFF0C\u4E5F\u4E0D\u5F71\u54CD\u771F\u5B9E\u4EFB\u52A1\u3002\u589E\u5F3A\u7248\u4F1A\u663E\u793A\u5BF9\u5E94\u72B6\u6001\u8272\u548C\u77ED\u6682\u63D0\u9192\u6761\u3002"),
1150
+ state ? import_react.default.createElement("p", { className: "dsh-notify-result", role: "status", "data-tone": resultTone(state.status) }, state.reason) : null
1062
1151
  );
1063
1152
  }
1064
1153
  function SettingsSection() {
@@ -1105,54 +1194,36 @@ window.__ModuleLoader__.load({
1105
1194
  setStatus("\u8BBE\u7F6E\u4FDD\u5B58\u5931\u8D25");
1106
1195
  }
1107
1196
  };
1197
+ const card = (icon, title, description, content) => import_react.default.createElement("div", { className: "dsh-notify-card" }, import_react.default.createElement("div", { className: "dsh-notify-card-head" }, import_react.default.createElement("span", { className: "dsh-notify-card-icon", "aria-hidden": true }, icon), import_react.default.createElement("div", null, import_react.default.createElement("h3", { className: "dsh-notify-card-title" }, title), hint(description))), content);
1198
+ const copy = (label, description) => import_react.default.createElement("div", { className: "dsh-notify-setting-copy" }, import_react.default.createElement("div", { className: "dsh-notify-setting-label" }, label), import_react.default.createElement("p", { className: "dsh-notify-setting-help" }, description));
1199
+ const toggle = (label, description, checked, onChange, ariaLabel) => import_react.default.createElement("div", { className: "dsh-notify-setting-row" }, copy(label, description), import_react.default.createElement("label", { className: "dsh-notify-toggle" }, import_react.default.createElement("input", { type: "checkbox", checked, onChange, "aria-label": ariaLabel }), import_react.default.createElement("span", null, label)));
1200
+ const style = config?.notificationStyle === "soft" ? "soft" : "strong";
1201
+ const collapsed = config?.stackCollapsed !== false;
1108
1202
  return import_react.default.createElement(
1109
1203
  "section",
1110
1204
  { className: "dsh-notify-settings", "aria-label": "\u901A\u77E5\u8BBE\u7F6E" },
1111
- import_react.default.createElement("h2", { className: "dsh-notify-heading" }, "\u901A\u77E5"),
1112
- import_react.default.createElement("p", { className: "dsh-notify-status", role: "status", "data-tone": statusTone(status) }, status),
1113
- config && import_react.default.createElement(
1114
- "div",
1115
- { className: "dsh-notify-card" },
1116
- import_react.default.createElement("h3", { className: "dsh-notify-card-title" }, "\u63D0\u793A\u901A\u9053"),
1117
- import_react.default.createElement("label", { className: "dsh-notify-field" }, import_react.default.createElement("span", null, "Toast\u4F4D\u7F6E"), import_react.default.createElement("select", { className: "dsh-notify-select", "aria-label": "Toast\u4F4D\u7F6E", value: config.toastPosition || "conversation", onChange: (event) => update({ toastPosition: event.target.value }) }, import_react.default.createElement("option", { value: "conversation" }, "\u4F1A\u8BDD\u533A\u53F3\u4E0A\uFF08\u9ED8\u8BA4\uFF09"), import_react.default.createElement("option", { value: "viewport" }, "\u5C4F\u5E55\u53F3\u4E0A"), import_react.default.createElement("option", { value: "off" }, "\u5173\u95ED\uFF08\u4EC0\u4E48\u90FD\u4E0D\u63D0\u793A\uFF09"))),
1118
- hint("\u6D6E\u5C42\u53EA\u662F\u9875\u5185\u63D0\u793A\u3002\u5173\u6389\u4E4B\u540E\u4E0D\u518D\u5F39\u5361\u3001\u4E5F\u4E0D\u518D\u95EA\u52A8\u6807\u7B7E\u9875\u2014\u2014\u300C\u4EFB\u52A1\u5B8C\u6210\u65F6\u544A\u8BC9\u6211\u300D\u8FD9\u4EF6\u4E8B\u5C31\u6CA1\u6709\u522B\u7684\u901A\u9053\u4E86\u3002"),
1119
- import_react.default.createElement("label", { className: "dsh-notify-toggle" }, import_react.default.createElement("input", { type: "checkbox", checked: Boolean(config.subtaskNotify), onChange: (event) => update({ subtaskNotify: event.target.checked }) }), import_react.default.createElement("span", null, "\u5B50\u4EFB\u52A1 / \u540E\u53F0\u4EFB\u52A1\u5B8C\u6210\u65F6\u901A\u77E5")),
1120
- hint("\u9ED8\u8BA4\u5173\u95ED\uFF1A\u6BCF\u4E2A\u5B50\u4EE3\u7406\u3001\u540E\u53F0\u4EFB\u52A1\u7ED3\u675F\u90FD\u4F1A\u5404\u5F39\u4E00\u6761\uFF08\u6807\u9898\u5E38\u5E38\u662F\u547D\u4EE4\u539F\u6587\uFF09\uFF0C\u5F00\u4E45\u4E86\u4F1A\u5F88\u4E71\u3002\u9700\u8981\u65F6\u518D\u6253\u5F00\u3002"),
1121
- hint("\u4E0D\u4FDD\u5B58\u5386\u53F2\uFF1A\u5361\u7247\u5C31\u662F\u4F60\u770B\u5230\u7684\u90A3\u4E00\u6761\uFF0C\u5173\u6389\u5373\u7ED3\u675F\u3002\u9875\u9762\u6CA1\u6253\u5F00\u65F6\u53D1\u751F\u7684\u901A\u77E5\u4E0D\u4F1A\u8865\u53D1\u2014\u2014\u8FD9\u662F\u53BB\u6389\u5B58\u50A8\u6362\u6765\u7684\u7B80\u5316\u3002")
1122
- ),
1123
- config && import_react.default.createElement(NotificationSelfTests),
1124
- config && import_react.default.createElement(
1125
- "div",
1126
- { className: "dsh-notify-card" },
1127
- import_react.default.createElement("h3", { className: "dsh-notify-card-title" }, "\u63D0\u793A\u97F3"),
1128
- import_react.default.createElement("label", { className: "dsh-notify-toggle" }, import_react.default.createElement("input", { type: "checkbox", checked: config.soundEnabled !== false, onChange: (event) => update({ soundEnabled: event.target.checked }) }), import_react.default.createElement("span", null, "\u9875\u5185\u63D0\u793A\u97F3\uFF08\u7A97\u53E3\u4E0D\u5728\u6700\u524D\u4E5F\u4F1A\u54CD\uFF09")),
1129
- import_react.default.createElement(
1130
- "label",
1131
- { className: "dsh-notify-field" },
1132
- import_react.default.createElement("span", null, "\u58F0\u97F3"),
1133
- import_react.default.createElement(
1134
- "select",
1135
- { className: "dsh-notify-select", "aria-label": "\u63D0\u793A\u97F3", value: config.sound || "chime", onChange: (event) => update({ sound: event.target.value }) },
1136
- BUILTIN_SOUNDS.map((id) => import_react.default.createElement("option", { key: id, value: id }, SOUND_LABELS[id] ?? id)),
1137
- ...customSounds.map((sound) => import_react.default.createElement("option", { key: `custom:${sound.name}`, value: `custom:${sound.name}` }, `\u81EA\u5B9A\u4E49\uFF1A${sound.name}`))
1138
- )
1139
- ),
1205
+ import_react.default.createElement("div", { className: "dsh-notify-settings-head" }, import_react.default.createElement("div", null, import_react.default.createElement("div", { className: "dsh-notify-eyebrow" }, "NOTIFICATIONS"), import_react.default.createElement("h2", { className: "dsh-notify-heading" }, "\u901A\u77E5"), import_react.default.createElement("p", { className: "dsh-notify-settings-intro" }, "\u51B3\u5B9A\u4EC0\u4E48\u65F6\u5019\u63D0\u9192\u4F60\uFF0C\u4EE5\u53CA\u901A\u77E5\u5728\u9875\u9762\u4E2D\u5982\u4F55\u663E\u793A\u3002")), import_react.default.createElement("p", { className: "dsh-notify-settings-status", role: "status" }, status)),
1206
+ config && card("\u25C9", "\u901A\u77E5\u663E\u793A", "\u663E\u793A\u4F4D\u7F6E\u3001\u89C6\u89C9\u6837\u5F0F\u4E0E\u591A\u6761\u901A\u77E5\u7684\u5448\u73B0\u65B9\u5F0F\u3002", import_react.default.createElement(
1207
+ import_react.default.Fragment,
1208
+ null,
1140
1209
  import_react.default.createElement(
1141
1210
  "div",
1142
- { className: "dsh-notify-actions" },
1143
- import_react.default.createElement("button", { className: "dsh-notify-action", type: "button", onClick: () => {
1144
- void soundPlayer.unlock().then(() => soundPlayer.play(config.sound || "chime", { enabled: true })).then((result) => setSoundNotice(result?.reason === "locked" ? "\u6D4F\u89C8\u5668\u8981\u6C42\u5148\u70B9\u4E00\u4E0B\u9875\u9762\u624D\u80FD\u51FA\u58F0\uFF1A\u8BF7\u518D\u70B9\u4E00\u6B21\u300C\u8BD5\u542C\u300D" : result?.played ? "\u5DF2\u8BD5\u542C" : `\u6CA1\u51FA\u58F0\uFF08${result?.reason || "unknown"}\uFF09`));
1145
- } }, "\u8BD5\u542C"),
1146
- import_react.default.createElement("label", { className: "dsh-notify-action", style: { cursor: "pointer" } }, "\u4E0A\u4F20\u58F0\u97F3\u2026", import_react.default.createElement("input", { type: "file", accept: "audio/*,.mp3,.m4a,.wav,.ogg,.flac", style: { display: "none" }, onChange: (event) => {
1147
- const file = event.target.files?.[0];
1148
- event.target.value = "";
1149
- if (file) void uploadSound(file);
1150
- } }))
1211
+ { className: "dsh-notify-rows" },
1212
+ import_react.default.createElement("div", { className: "dsh-notify-setting-field" }, copy("\u901A\u77E5\u4F4D\u7F6E", "\u9ED8\u8BA4\u51FA\u73B0\u5728\u4F1A\u8BDD\u533A\u53F3\u4E0A\u89D2\uFF0C\u4E0D\u906E\u4F4F\u4FA7\u680F\u3002"), import_react.default.createElement("select", { className: "dsh-notify-select", "aria-label": "\u901A\u77E5\u4F4D\u7F6E", value: config.toastPosition || "conversation", onChange: (event) => update({ toastPosition: event.target.value }) }, import_react.default.createElement("option", { value: "conversation" }, "\u4F1A\u8BDD\u533A\u53F3\u4E0A\uFF08\u63A8\u8350\uFF09"), import_react.default.createElement("option", { value: "viewport" }, "\u5C4F\u5E55\u53F3\u4E0A"), import_react.default.createElement("option", { value: "off" }, "\u5173\u95ED\u9875\u9762\u901A\u77E5"))),
1213
+ import_react.default.createElement("div", { className: "dsh-notify-setting-field" }, copy("\u901A\u77E5\u6837\u5F0F", "\u589E\u5F3A\u7248\u4F7F\u7528\u6E05\u6670\u72B6\u6001\u8272\u4E0E\u77ED\u6682\u63D0\u9192\u6761\uFF1B\u67D4\u548C\u7248\u66F4\u63A5\u8FD1\u5F53\u524D\u98CE\u683C\u3002"), import_react.default.createElement("div", { className: "dsh-notify-segmented", role: "group", "aria-label": "\u901A\u77E5\u6837\u5F0F" }, ...["strong", "soft"].map((value) => import_react.default.createElement("button", { key: value, type: "button", "data-active": style === value ? "true" : "false", onClick: () => update({ notificationStyle: value }) }, value === "strong" ? "\u589E\u5F3A\u7248" : "\u67D4\u548C\u7248")))),
1214
+ toggle("\u591A\u6761\u901A\u77E5\u6298\u53E0\u663E\u793A", "\u6709\u591A\u6761\u672A\u5173\u95ED\u901A\u77E5\u65F6\uFF0C\u6700\u65B0\u4E00\u6761\u5B8C\u6574\u663E\u793A\uFF0C\u5176\u4F59\u901A\u77E5\u5728\u4E0B\u65B9\u7B49\u8DDD\u9732\u8FB9\uFF1B\u79FB\u5165\u540E\u5C55\u5F00\u3002", collapsed, (event) => update({ stackCollapsed: event.target.checked }), "\u591A\u6761\u901A\u77E5\u6298\u53E0\u663E\u793A")
1151
1215
  ),
1152
- hint("\u7A97\u53E3\u4E0D\u5728\u6700\u524D\u3001\u6807\u7B7E\u5728\u540E\u53F0\u65F6\u4E5F\u4F1A\u54CD\u2014\u2014\u8FD9\u662F\u300C\u6D4F\u89C8\u5668\u88AB\u522B\u7684\u5E94\u7528\u6321\u4F4F\u300D\u65F6\u552F\u4E00\u80FD\u63D0\u9192\u4F60\u7684\u65B9\u5F0F\u3002\u5185\u7F6E\u97F3\u7531\u6D4F\u89C8\u5668\u5408\u6210\uFF08\u4E0D\u4E0B\u8F7D\u4EFB\u4F55\u6587\u4EF6\uFF09\uFF1B\u81EA\u5B9A\u4E49\u97F3\u4E0A\u4F20\u5230\u672C profile \u7684\u6570\u636E\u76EE\u5F55\uFF0C\u91CD\u88C5\u63D2\u4EF6\u4E0D\u4F1A\u4E22\u3002\u4E0A\u4F20\u4E0A\u9650 1 MB\uFF0C\u4EC5\u652F\u6301 mp3 / m4a / aac / wav / ogg / flac\u3002"),
1153
- soundNotice ? import_react.default.createElement("p", { className: "dsh-notify-result", role: "status" }, soundNotice) : null,
1154
- customSounds.length > 0 && import_react.default.createElement("div", { className: "dsh-notify-actions" }, customSounds.map((sound) => import_react.default.createElement("button", { key: sound.name, type: "button", className: "dsh-notify-action", "data-variant": "danger", onClick: () => void removeSound(sound.name) }, `\u5220\u9664 ${sound.name}`)))
1155
- )
1216
+ import_react.default.createElement("div", { className: "dsh-notify-preview" }, import_react.default.createElement("span", null, import_react.default.createElement("strong", null, `${style === "strong" ? "\u589E\u5F3A\u7248" : "\u67D4\u548C\u7248"} \xB7 \u6298\u53E0\u663E\u793A${collapsed ? "\u5DF2\u5F00\u542F" : "\u5DF2\u5173\u95ED"}`), collapsed ? "\u72B6\u6001\u8272\u6E05\u6670\uFF0C\u63D0\u9192\u6761\u7ED3\u675F\u540E\u901A\u77E5\u4ECD\u4F1A\u4FDD\u7559\u3002" : "\u591A\u6761\u901A\u77E5\u4F1A\u4F9D\u6B21\u5B8C\u6574\u663E\u793A\u3002"))
1217
+ )),
1218
+ config && card("\u266C", "\u63D0\u793A\u97F3", "\u5728\u4F60\u9605\u8BFB\u5176\u4ED6\u5185\u5BB9\u6216\u5207\u5230\u540E\u53F0\u65F6\uFF0C\u7528\u58F0\u97F3\u63D0\u9192\u4F60\u6709\u65B0\u7ED3\u679C\u3002", import_react.default.createElement(import_react.default.Fragment, null, import_react.default.createElement("div", { className: "dsh-notify-rows" }, toggle("\u9875\u5185\u63D0\u793A\u97F3", "\u7A97\u53E3\u4E0D\u5728\u6700\u524D\u3001\u6807\u7B7E\u5728\u540E\u53F0\u65F6\u4E5F\u4F1A\u64AD\u653E\u3002", config.soundEnabled !== false, (event) => update({ soundEnabled: event.target.checked }), "\u9875\u5185\u63D0\u793A\u97F3"), import_react.default.createElement("div", { className: "dsh-notify-setting-field" }, copy("\u63D0\u793A\u97F3", "\u53EF\u8BD5\u542C\u3001\u4E0A\u4F20\u6216\u5220\u9664\u81EA\u5B9A\u4E49\u58F0\u97F3\u3002"), import_react.default.createElement("select", { className: "dsh-notify-select", "aria-label": "\u63D0\u793A\u97F3", value: config.sound || "chime", onChange: (event) => update({ sound: event.target.value }) }, BUILTIN_SOUNDS.map((id) => import_react.default.createElement("option", { key: id, value: id }, SOUND_LABELS[id] ?? id)), ...customSounds.map((sound) => import_react.default.createElement("option", { key: `custom:${sound.name}`, value: `custom:${sound.name}` }, `\u81EA\u5B9A\u4E49\uFF1A${sound.name}`))))), import_react.default.createElement("div", { className: "dsh-notify-actions", style: { marginTop: "15px" } }, action("\u8BD5\u542C", () => {
1219
+ void soundPlayer.unlock().then(() => soundPlayer.play(config.sound || "chime", { enabled: true })).then((result) => setSoundNotice(result?.reason === "locked" ? "\u6D4F\u89C8\u5668\u8981\u6C42\u5148\u70B9\u4E00\u4E0B\u9875\u9762\u624D\u80FD\u51FA\u58F0\uFF1A\u8BF7\u518D\u70B9\u4E00\u6B21\u300C\u8BD5\u542C\u300D" : result?.played ? "\u5DF2\u8BD5\u542C" : `\u6CA1\u51FA\u58F0\uFF08${result?.reason || "unknown"}\uFF09`));
1220
+ }), import_react.default.createElement("label", { className: "dsh-notify-action", style: { cursor: "pointer" } }, "\u4E0A\u4F20\u58F0\u97F3\u2026", import_react.default.createElement("input", { type: "file", accept: "audio/*,.mp3,.m4a,.wav,.ogg,.flac", style: { display: "none" }, onChange: (event) => {
1221
+ const file = event.target.files?.[0];
1222
+ event.target.value = "";
1223
+ if (file) void uploadSound(file);
1224
+ } }))), soundNotice ? import_react.default.createElement("p", { className: "dsh-notify-result", role: "status" }, soundNotice) : null, customSounds.length > 0 && import_react.default.createElement("div", { className: "dsh-notify-actions" }, customSounds.map((sound) => action(`\u5220\u9664 ${sound.name}`, () => void removeSound(sound.name), { "data-variant": "danger" }))))),
1225
+ config && card("\u2713", "\u4EFB\u52A1\u63D0\u9192", "\u9009\u62E9\u54EA\u4E9B\u4EFB\u52A1\u7ED3\u679C\u4F1A\u4E3B\u52A8\u51FA\u73B0\u5728\u4F60\u7684\u901A\u77E5\u5217\u8868\u4E2D\u3002", import_react.default.createElement("div", { className: "dsh-notify-rows" }, toggle("\u5B50\u4EFB\u52A1 / \u540E\u53F0\u4EFB\u52A1\u5B8C\u6210\u65F6\u901A\u77E5", "\u9ED8\u8BA4\u5173\u95ED\u3002\u5F00\u542F\u540E\uFF0C\u6BCF\u4E2A\u5B50\u4EE3\u7406\u6216\u540E\u53F0\u4EFB\u52A1\u7ED3\u675F\u65F6\u90FD\u4F1A\u901A\u77E5\u4F60\u3002", Boolean(config.subtaskNotify), (event) => update({ subtaskNotify: event.target.checked }), "\u5B50\u4EFB\u52A1 / \u540E\u53F0\u4EFB\u52A1\u5B8C\u6210\u65F6\u901A\u77E5"))),
1226
+ config && card("\u2197", "\u9884\u89C8\u4E0E\u81EA\u6D4B", "\u4EC5\u5728\u5F53\u524D\u9875\u9762\u5C55\u793A\u6A21\u62DF\u901A\u77E5\uFF0C\u4E0D\u53D1\u9001\u7CFB\u7EDF\u901A\u77E5\uFF0C\u4E5F\u4E0D\u5F71\u54CD\u771F\u5B9E\u4EFB\u52A1\u3002", import_react.default.createElement(NotificationSelfTests))
1156
1227
  );
1157
1228
  }
1158
1229
  var CLIENT_COMPOSITION = Object.freeze({ service: "slots", modules: Object.freeze(["@deepseek-ai/dsh-client-ui-renderer", "@deepseek-ai/dsh-client-ui-layout", "@deepseek-ai/dsh-client-ui-settings", "@deepseek-ai/dsh-client-ui-settings-general"]), seats: Object.freeze(["settings.section", "shell.overlay"]) });
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ export function jobNotification(snapshot = {}) {
33
33
  const outcome = JOB_STATUS_LABEL[status] ?? status;
34
34
  return { title: failed ? '后台任务失败' : '后台任务结束', body: readable ? label : (outcome || undefined) };
35
35
  }
36
- const DEFAULT_SETTINGS = Object.freeze({ verbosity: 'normal', toastPosition: 'conversation', toastEnabled: true, subtaskNotify: false, soundEnabled: true, sound: 'chime' });
36
+ const DEFAULT_SETTINGS = Object.freeze({ verbosity: 'normal', toastPosition: 'conversation', toastEnabled: true, notificationStyle: 'strong', stackCollapsed: true, subtaskNotify: false, soundEnabled: true, sound: 'chime' });
37
37
  const SETTING_KEYS = Object.freeze(Object.keys(DEFAULT_SETTINGS));
38
38
  /**
39
39
  * Only the settings this version knows about are adopted — or written back. A file left by an older
@@ -41,6 +41,21 @@ const SETTING_KEYS = Object.freeze(Object.keys(DEFAULT_SETTINGS));
41
41
  * plugin would then hand straight back to the page.
42
42
  */
43
43
  const pickSettings = (value = {}) => Object.fromEntries(Object.entries(value ?? {}).filter(([key]) => SETTING_KEYS.includes(key)));
44
+ function validSettingsPatch(value = {}) {
45
+ if ('notificationStyle' in value && !['strong', 'soft'].includes(value.notificationStyle)) return false;
46
+ if ('stackCollapsed' in value && typeof value.stackCollapsed !== 'boolean') return false;
47
+ if ('toastEnabled' in value && typeof value.toastEnabled !== 'boolean') return false;
48
+ if ('subtaskNotify' in value && typeof value.subtaskNotify !== 'boolean') return false;
49
+ if ('soundEnabled' in value && typeof value.soundEnabled !== 'boolean') return false;
50
+ if ('verbosity' in value && !['normal', 'detailed'].includes(value.verbosity)) return false;
51
+ if ('toastPosition' in value && !['conversation', 'viewport', 'off'].includes(value.toastPosition)) return false;
52
+ if ('sound' in value && (typeof value.sound !== 'string' || value.sound.length > 96)) return false;
53
+ return true;
54
+ }
55
+ function normalizeSettings(value = {}) {
56
+ const picked = pickSettings(value);
57
+ return Object.fromEntries(Object.entries(picked).filter(([key, setting]) => validSettingsPatch({ [key]: setting })));
58
+ }
44
59
 
45
60
  function contextService(ctx, name) {
46
61
  const explicit = ctx?.get?.(name);
@@ -153,7 +168,7 @@ export async function apply(ctx, config = {}) {
153
168
  // only thing that outlives the process.
154
169
  const buffer = createBuffer();
155
170
  const preferences = createSettings({ dataDir: config.dataDir, keys: SETTING_KEYS });
156
- const settings = { ...DEFAULT_SETTINGS, ...pickSettings(preferences.get()) };
171
+ const settings = { ...DEFAULT_SETTINGS, ...normalizeSettings(preferences.get()) };
157
172
  const reducer = new EventReducer(() => Date.now());
158
173
  const diagnostics = { eventErrors: 0, services: {} };
159
174
  const sounds = createSoundLibrary({ dataDir: config.dataDir });
@@ -429,8 +444,7 @@ export async function apply(ctx, config = {}) {
429
444
  registerSensitive(lifecycleCtx, webServer, connection, '/config', ['GET', 'POST'], async (req, res) => {
430
445
  if (req.method === 'GET') { sendJson(res, 200, { ...settings, storage: preferences.status }); return; }
431
446
  const { value } = await readJson(req);
432
- if (schemaStatus(value, SETTING_KEYS) !== 200
433
- || ('sound' in value && typeof value.sound === 'string' && value.sound.length > 96)) { sendJson(res, 400, { error: 'invalid config' }); return; }
447
+ if (schemaStatus(value, SETTING_KEYS) !== 200 || !validSettingsPatch(value)) { sendJson(res, 400, { error: 'invalid config' }); return; }
434
448
  Object.assign(settings, value);
435
449
  preferences.set(pickSettings(value));
436
450
  sendJson(res, 200, { ...settings, storage: preferences.status });
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@idoall/dsh-notify",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
- "description": "DSH web plugin: in-page task notifications for DeepSeek Harness — a stacking top-right toast (answer buttons, live action state, background-tab flash and a WebAudio cue that also plays while the page is hidden). Live delivery only: no history, no service worker, no web push, no OS notification matrix.",
5
+ "description": "DSH web plugin: in-page task notifications for DeepSeek Harness — enhanced or soft status toasts, a collapsible top-right stack, answer buttons, background-tab attention, and a WebAudio cue that also plays while the page is hidden. Live delivery only: no history, no service worker, no web push, no OS notification matrix.",
6
6
  "main": "./dist/index.js",
7
7
  "exports": {
8
8
  ".": "./dist/index.js",
@@ -11,7 +11,6 @@
11
11
  },
12
12
  "files": [
13
13
  "dist",
14
- "assets",
15
14
  "cordis.patch.yml",
16
15
  "README.md",
17
16
  "README.zh.md",
package/assets/mobile.png DELETED
Binary file
package/assets/panel.png DELETED
Binary file
Binary file
package/assets/toast.png DELETED
Binary file