@narumitw/pi-notify 0.1.0 → 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/README.md CHANGED
@@ -4,18 +4,21 @@
4
4
  [![Pi extension](https://img.shields.io/badge/Pi-extension-blue)](https://pi.dev)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
6
6
 
7
- Send Telegram reminders when Pi stops automatic work, so you can return to review its result.
7
+ Send reminders through Telegram, Gotify, Slack, ntfy, Pushover, Discord, Bark, or a Generic webhook when Pi stops automatic work.
8
8
 
9
9
  ## ✨ Features
10
10
 
11
- - Notify private chats, groups, supergroups, and forum topics, including multiple selected destinations.
11
+ - Notify Telegram chats and forum topics, Gotify applications, Slack or Discord channels, ntfy topics, Pushover users, Bark devices, or your own webhook.
12
+ - Select multiple destinations across all eight providers.
12
13
  - Identify the computer, session, repository, branch, and worktree without forwarding conversations.
13
14
  - Choose immediate notifications or reminders after terminal inactivity.
14
15
  - Configure and test destinations through a masked, menu-first setup flow.
15
16
 
17
+ Telegram uses bold titles and repository names, with inline monospace for branches, paths, and session IDs. Entity-based formatting keeps punctuation literal without Markdown or HTML parsing. Confirmation previews remain plain text.
18
+
16
19
  ## 📦 Install
17
20
 
18
- Extensions run with Pi's permissions. Enable this extension only if the notification metadata may leave your computer. Bot credentials are stored in a private user settings file, not project settings.
21
+ Extensions run with Pi's permissions. Enable this extension only if the notification metadata may leave your computer. Notification tokens, device keys, and complete Slack, Discord, and Generic webhook URLs are secrets stored in a private User settings file, not Project settings.
19
22
 
20
23
  From a local checkout, run these commands from the repository root:
21
24
 
@@ -36,13 +39,17 @@ Restart Pi or run `/reload` after persistent installation. The extension uses Pi
36
39
 
37
40
  ## 🚀 Quick start
38
41
 
39
- Create a bot with Telegram's [BotFather](https://t.me/BotFather), then start a private conversation with it. Obtain that conversation's numeric chat ID through the [Bot API](https://core.telegram.org/bots/api#getupdates) after sending a message; keep the bot token private. For a group, add the bot and permit it to send messages. Stop any other update consumer before manually using `getUpdates`; an active webhook also prevents that method from working.
42
+ 1. Subscribe to a topic in your ntfy client. A topic name is not access control: configure [server authentication and topic permissions](https://docs.ntfy.sh/config/#access-control) before sending private metadata. Public topics can expose messages and permit unwanted publishers.
43
+ 2. Run `/notify`, open destination management, and add an ntfy destination. Enter the topic. In the review, set your server base URL, an optional access token in the masked input, and an optional priority from 1 to 5. Clear priority to use the server default.
44
+ 3. Choose Save and use to save and select the destination for User notifications, or Save only to store it without selecting it. Use Send test to preview the metadata and confirm one external request.
45
+
46
+ Automatic notifications are on by default, so the next eligible settled work period sends a reminder. Settings lets you pause delivery or change selections. Existing Off settings and explicit Project selections are preserved. See [provider setup and revocation](./docs/settings.md#provider-setup-and-revocation) for Telegram, Gotify, ntfy, Pushover, Discord, Bark, and Generic webhook setup.
40
47
 
41
- Run `/notify`, add a Telegram destination, and confirm its settings. Use Send test to preview the disclosed metadata and explicitly send a test. In Settings, select the destination and enable notifications. The next eligible settled work period sends a reminder. Setup alone does not enable automatic notifications.
48
+ For Slack, create a [Slack app](https://api.slack.com/apps), enable Incoming Webhooks, and choose Add New Webhook to Workspace. Authorize the channel that must receive notifications and copy its webhook URL. Enter it only in the masked setup input or User settings, never in Pi chat. The installation fixes the channel; a destination cannot override it. See [Slack setup and revocation](./docs/settings.md#slack-setup-and-revocation).
42
49
 
43
50
  ## 💬 Commands
44
51
 
45
- `/notify` opens destination management, Settings, Status, Help, and confirmed test delivery in TUI mode. It accepts no arguments. Settings changes save immediately; closing the screen does not undo them. Destination edits remain unsaved until confirmation. Escape goes back; Ctrl+C closes the flow. Cancelling a running test closes the menu and cannot recall a message already accepted by Telegram.
52
+ `/notify` opens destination management, Settings, Status, Help, and confirmed test delivery in TUI mode. It accepts no arguments. Settings changes save immediately; closing the screen does not undo them. Destination edits remain unsaved until confirmation. Escape goes back; Ctrl+C closes the flow. Cancelling a running test closes the menu and cannot recall a message already accepted by the provider.
46
53
 
47
54
  RPC receives manual configuration instructions instead of a custom terminal screen. Print and JSON reject interactive setup. Automatic delivery is independent of the menu and requires no model tool or prompt changes.
48
55
 
@@ -50,7 +57,7 @@ RPC receives manual configuration instructions instead of a custom terminal scre
50
57
 
51
58
  User settings are stored at `<getAgentDir()>/pi-notify.json`, normally `~/.pi/agent/pi-notify.json`. Trusted project overrides use `<workspace>/.pi/pi-notify.json`. Choose User or Project scope in `/notify` Settings. Destinations and credentials are always User-scoped.
52
59
 
53
- Notifications default to disabled, with immediate mode and a stored inactivity duration of 30 seconds. Loading defaults does not create a file. Successful menu saves apply immediately; manual edits take effect on session start or `/reload`.
60
+ Notifications default to enabled, with immediate mode and a stored inactivity duration of 30 seconds. Loading defaults does not create a file. Successful menu saves apply immediately; manual edits take effect on session start or `/reload`.
54
61
 
55
62
  ```json
56
63
  {
@@ -60,10 +67,12 @@ Notifications default to disabled, with immediate mode and a stored inactivity d
60
67
  "targetIds": ["personal"],
61
68
  "destinations": {
62
69
  "personal": {
63
- "provider": "telegram",
64
- "label": "Personal Telegram",
65
- "botToken": "<bot-token>",
66
- "chatId": "123456789"
70
+ "provider": "ntfy",
71
+ "label": "Personal ntfy",
72
+ "serverUrl": "https://ntfy.sh",
73
+ "topic": "replace-with-your-topic",
74
+ "accessToken": "<access-token>",
75
+ "priority": 3
67
76
  }
68
77
  }
69
78
  }
@@ -73,24 +82,35 @@ See the bundled [settings and behavior reference](./docs/settings.md) for accept
73
82
 
74
83
  ## 🔒 Security and privacy
75
84
 
76
- Notifications send the operating-system hostname, session name and ID, working directory, available Git repository/worktree/branch, elapsed time, and settlement timestamp to the selected Telegram chats. Paths shorten the home prefix to `~` when possible, but names and paths can still disclose private information. They describe the host running Pi, which can differ from your SSH client computer.
85
+ Notifications send the operating-system hostname, session name and ID, working directory, available Git repository/worktree/branch, elapsed time, and settlement timestamp to the selected notification services or webhook endpoints. Gotify messages are visible to the user who owns the application; Slack messages are visible to people with access to the installed channel. Paths shorten the home prefix to `~` when possible, but names and paths can still disclose private information. They describe the host running Pi, which can differ from your SSH client computer.
86
+
87
+ No prompts, assistant answers, code, tool output, Git remotes, or raw provider errors are sent. Dynamic metadata is bounded and terminal controls are removed; `@` is replaced with `@` to avoid accidental mentions. Telegram link previews are disabled. Gotify sends plain text without Markdown extras. Slack uses `plain_text` blocks without mention or link expansion and a generic fallback. Slack desktop notifications can still show metadata from the blocks. Discord disables mention parsing and link previews, but does not suppress notifications. Credential values, including complete Slack, Discord, and Generic webhook URLs, never appear in review, preview, status, or error output. POSIX settings writes use `0600` permissions and temporary-file-plus-rename publication. JavaScript memory is not secure credential storage; revoke exposed tokens through BotFather or your Gotify server, or revoke the webhook in Slack before replacing its User setting. Removing a saved destination does not revoke its credential. See [provider revocation instructions](./docs/settings.md#provider-setup-and-revocation) for the new services.
88
+
89
+ Gotify sends its application token in the `X-Gotify-Key` header, never in the URL. Use HTTPS: HTTP is supported for private self-hosted servers but sends the token and metadata without encryption. Server URLs cannot contain credentials, query strings, or fragments. Redirects are rejected.
77
90
 
78
- No prompts, assistant answers, code, tool output, Git remotes, or raw provider errors are sent. Dynamic metadata is bounded and terminal controls are removed; `@` is replaced with `@` to avoid accidental mentions. Messages use plain text with link previews disabled. Credential values never appear in preview, status, or error output. POSIX settings writes use `0600` permissions and temporary-file-plus-rename publication. JavaScript memory is not secure credential storage; revoke an exposed bot token through BotFather.
91
+ Prefer HTTPS for ntfy, Bark, and Generic webhooks too: HTTP sends credentials and metadata without encryption. User-configured endpoints can reach local/private addresses on the Pi host's network; Project settings cannot supply endpoints. ntfy topic secrecy is not access control, and access tokens have the user's full access. Configure server ACLs. Bark JSON keeps keys and messages out of URLs but does not prevent the official server from logging request bodies. Do not send metadata to servers you do not trust.
79
92
 
80
93
  ## 🚧 Limitations
81
94
 
82
- Only Telegram is implemented. The provider boundary separates transport from notification policy, but it does not load third-party plugins.
95
+ The eight listed providers are built in; third-party provider plugins are not loaded. Slack supports commercial Incoming Webhooks at `https://hooks.slack.com/services/...` only, with the channel selected during installation. GovSlack, channel overrides, OAuth, bot tokens, replies, and file uploads are not supported. No Slack SDK or extension-specific environment variables are required. Gotify uses application tokens, not client tokens or user passwords. It sends messages only; it does not subscribe to messages or manage applications.
96
+
97
+ Pushover uses normal priority only, without emergency delivery, acknowledgement, or retry parameters. Discord supports official webhooks for normal text channels, not forum/media channels or thread selection. ntfy and Generic webhooks support no authentication or Bearer authentication only; Bark supports its device key, not native server Basic authentication. No custom headers, templates, scripts, or extension-specific environment variables are supported. See [provider fields and limits](./docs/settings.md#new-provider-fields) for exact URL, credential, and payload bounds.
98
+
99
+ Telegram messages are limited to 4,096 UTF-16 code units without splitting a Unicode code point; longer messages end with an unformatted ellipsis. Gotify sends the title and body in separate fields; server and proxy limits apply. Slack clips plain-text blocks to its documented limits without splitting Unicode code points; see the [payload and delivery reference](./docs/settings.md#work-periods-and-delivery).
83
100
 
84
101
  Inactivity means no input reached this extension, not proof that you are away. Pi handles fullscreen focus, mouse, scrolling, and search before extension input listeners. Those actions do not reliably cancel a reminder. Reading without typing can still produce one. Type a key that reaches the editor to cancel a pending reminder. Focus or mouse events count only if Pi forwards them; terminal support alone is not sufficient. This extension does not change Pi's listener order, enable focus reporting, or detect screen locks. RPC, print, and JSON cannot observe terminal input, so inactivity mode delivers at settlement instead.
85
102
 
86
- Notification delivery is best effort with one attempt and a 10-second request timeout. There is no automatic retry, persistent queue, or replay after reload. Accepted means Telegram accepted a message, not that someone read it. Telegram rate limits can reject rapid runs; Status reports a safe error code and available retry-after time. Immediate shutdown can cancel an in-flight notification, especially in a short-lived headless session.
103
+ Notification delivery is best effort with one attempt and a 10-second deadline covering the request and response body, capped at 65,536 bytes. There is no automatic retry, persistent queue, or replay after reload. Accepted means the provider accepted a message, not that someone read it. Rate limits can reject rapid runs; Status reports a safe error code and available retry-after time. Immediate shutdown can cancel an in-flight notification, especially in a short-lived headless session.
87
104
 
88
105
  Manual aborts and interactive confirmation prompts do not notify. `agent_settled` means Pi will not continue automatically, not that the requested task succeeded. Preflight errors that do not produce a settled work period cannot generate a completion notification. No cooldown suppresses distinct eligible work periods.
89
106
 
107
+ Before reverting to a version without the five new providers, remove their IDs from every affected Project selection, User selections, and saved destinations while the current version is installed. Before reverting to a version without Slack support, remove Slack IDs from User and Project selections and remove the Slack destinations while the current version is installed. Older versions disable automatic delivery for unsupported destinations, even when unselected. See [rollback steps](./docs/settings.md#persistence-and-recovery).
108
+
90
109
  ## 🗂️ Package layout
91
110
 
92
111
  - `src/index.ts`: Pi entrypoint forwarding to `src/notify.ts`.
93
- - `src/`: session coordination, metadata, settings, menu, provider contract, and Telegram transport.
112
+ - `src/`: session coordination, metadata, settings, menu, and provider contract.
113
+ - `src/providers/`: provider-specific transports and shared bounded HTTP handling.
94
114
  - `docs/`: installed settings and behavior reference.
95
115
  - `test/`: repository-only deterministic tests.
96
116
 
@@ -98,7 +118,7 @@ The package publishes TypeScript source, documentation, and its license. It does
98
118
 
99
119
  ## 🔎 Keywords
100
120
 
101
- Pi coding agent, Telegram bot, completion notification, inactivity reminder, session, Git worktree.
121
+ Pi coding agent, Telegram bot, Gotify, Slack Incoming Webhooks, ntfy, Pushover, Discord webhook, Bark, Generic webhook, self-hosted notifications, completion notification, inactivity reminder, Git worktree.
102
122
 
103
123
  ## 📄 License
104
124
 
package/docs/settings.md CHANGED
@@ -6,7 +6,7 @@ Use `/notify` for setup or edit the canonical user JSON file. Settings load on s
6
6
 
7
7
  | Field | Accepted values | Default | Scope |
8
8
  | --- | --- | --- | --- |
9
- | `enabled` | Boolean | `false` | User or trusted Project |
9
+ | `enabled` | Boolean | `true` | User or trusted Project |
10
10
  | `mode` | `immediate`, `after-inactivity` | `immediate` | User or trusted Project |
11
11
  | `inactivitySeconds` | Whole number from 1 to 86400 | `30` | User or trusted Project |
12
12
  | `targetIds` | Array of unique existing destination IDs, at most 32 | Empty | User or trusted Project |
@@ -14,19 +14,211 @@ Use `/notify` for setup or edit the canonical user JSON file. Settings load on s
14
14
 
15
15
  Destination IDs contain 1–64 ASCII letters, digits, underscores, or hyphens, starting with a letter or digit; `constructor`, `prototype`, and `__proto__` are reserved. The menu creates IDs automatically.
16
16
 
17
+ Telegram setup requires a bot token and chat ID; Gotify setup requires an application token and server URL; Slack setup requires a complete Incoming Webhook URL. The five additional providers use the [fields below](#new-provider-fields). Add destinations through the provider-choice screen in `/notify`. The menu generates a label and opens a review for edits before saving. Editing an existing destination opens the same review with its current values. Destination changes take effect only after confirmation. For a new destination, Save and use adds it to User `targetIds` in the same atomic save; Save only stores it without selecting it. Editing an existing destination preserves its selection state. Explicit Project selections and saved `enabled: false` values are unchanged. Automatic notifications default to On; Off pauses automatic delivery but still allows manual tests. No delivery occurs without a selected destination.
18
+
17
19
  Each Telegram destination has `provider: "telegram"`, a nonempty `label` of at most 128 characters, `botToken`, a numeric string `chatId`, and optional positive safe-integer `messageThreadId`. A group or supergroup ID can be negative. Store IDs as strings, not JSON numbers. Forum topic IDs use Telegram's `message_thread_id` field. Other Telegram chat products with additional required fields are not supported.
18
20
 
21
+ Each Gotify destination has `provider: "gotify"`, a nonempty `label` of at most 128 characters, `serverUrl`, `appToken`, and optional `priority`. Use an application token created in the server's Apps tab, not a client token or password. Tokens must contain 1–512 printable ASCII characters without spaces. Server URLs must be absolute HTTP(S) URLs, at most 2048 characters before and after URL normalization, without whitespace, control characters, backslashes, credentials, query strings, or fragments. Include any reverse-proxy base path; do not append `/message`. Trailing slashes are removed on save. HTTP is supported for self-hosted deployments but does not encrypt credentials or metadata; prefer HTTPS. Priority must be a safe integer (including zero or negative values). Leave it unset to use the application's default priority; clear the field in review to restore that default.
22
+
23
+ ```json
24
+ {
25
+ "targetIds": ["gotify"],
26
+ "destinations": {
27
+ "gotify": {
28
+ "provider": "gotify",
29
+ "label": "Personal Gotify",
30
+ "serverUrl": "https://push.example.com/gotify",
31
+ "appToken": "<application-token>",
32
+ "priority": 5
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ Each Slack destination has `provider: "slack"`, a nonempty `label` of at most 128 characters, and `webhookUrl`. The complete URL is a credential and belongs only in the canonical User file. The channel comes from the webhook installation, not the label or a settings field. URLs must be at most 2048 characters and match `https://hooks.slack.com/services/T[A-Z0-9]+/B[A-Z0-9]+/[A-Za-z0-9]+` exactly: a `T` workspace segment, a `B` installation segment, and an alphanumeric secret. Ports, URL credentials, query strings, fragments, redirects, alternate hosts, whitespace, control characters, backslashes, and encoded or normalized URL alternatives are rejected. GovSlack is not supported.
39
+
40
+ A User file can select all eight providers together. For example, with existing `personal` Telegram and `gotify` destinations, add a Slack destination and select their IDs:
41
+
42
+ ```json
43
+ {
44
+ "targetIds": ["personal", "gotify", "build-channel"],
45
+ "destinations": {
46
+ "build-channel": {
47
+ "provider": "slack",
48
+ "label": "Build channel",
49
+ "webhookUrl": "https://hooks.slack.com/services/<workspace>/<installation>/<secret>"
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ This fragment shows the Slack addition, not a replacement for the complete User document. Retain the existing destination entries; replace the placeholder URL with the exact URL from Slack. Never put it in Project settings, source control, or Pi chat. No SDK, OAuth flow, bot token, or extension-specific environment variable is used. Saved destinations keep their provider; create a new destination to change providers.
56
+
19
57
  Resolve defaults, User fields, then trusted Project overrides. Project arrays replace rather than merge. Project files cannot define destinations or credentials. Unknown provider IDs do not fall back to Telegram. Invalid fields, unreadable files, unsupported destinations, or missing selected IDs produce diagnostics and disable automatic delivery until repaired; no partial routing is attempted.
20
58
 
21
59
  Project Settings show inherited values and allow restoring inheritance. Removing a destination clears its User selection atomically, but is blocked if the current trusted Project explicitly selects it. Change that Project selection first. Other projects are not edited; repair their selected IDs before enabling notifications there.
22
60
 
61
+ ## New provider fields
62
+
63
+ All destinations require `provider` and a nonempty `label` of at most 128 characters. Destinations, addresses, and credentials belong only in `<getAgentDir()>/pi-notify.json`, normally `~/.pi/agent/pi-notify.json`. Trusted Project files at `<workspace>/.pi/pi-notify.json` can change policy or select existing User destination IDs, but cannot define endpoints or secrets.
64
+
65
+ | Provider | Required fields besides `provider` and `label` | Optional fields |
66
+ | --- | --- | --- |
67
+ | `ntfy` | `serverUrl`, `topic` | `accessToken`, `priority` |
68
+ | `pushover` | `appToken`, `userKey` | None |
69
+ | `discord` | `webhookUrl` | None |
70
+ | `bark` | `serverUrl`, `deviceKey` | None |
71
+ | `webhook` | `webhookUrl` | `bearerToken` |
72
+
73
+ For ntfy and Bark, enter the server base URL including any reverse-proxy base path. Do not append the topic or `/push`. Generic `webhookUrl` is the complete receiving endpoint. These configurable URLs must be absolute HTTP(S) URLs, at most 2048 characters both before and after normalization. URL user information, whitespace, control characters, encoded controls, backslashes (including encoded backslashes), malformed percent escapes, query strings, and fragments are rejected. Bark server bases remove trailing slashes before appending `/push`. ntfy publish URLs and Generic webhook endpoints preserve trailing slashes because they can select a different route. Literal or encoded dot segments and noncanonical numeric IPv4 aliases are rejected instead of silently selecting a different path or host. Prefer HTTPS; HTTP does not encrypt credentials or metadata. Explicit local/private addresses are allowed and can reach the Pi host's network. Use only trusted endpoints.
74
+
75
+ The ntfy `accessToken`, Bark `deviceKey`, and Generic `bearerToken` each have a local limit of 1–512 printable ASCII characters without spaces. This is a header/key safety limit, not a promise that a service accepts every such value. Omit optional credentials in JSON; in review, leave the replacement input empty to clear them. Empty strings are not stored credentials. ntfy and Generic webhooks support only anonymous or Bearer authentication, not Basic, URL credentials, arbitrary headers, or query-based authentication. No custom templates, scripts, or extension-specific environment variables are supported.
76
+
77
+ ### ntfy
78
+
79
+ `topic` must match `[-_A-Za-z0-9]{1,64}`. Reserved names are `docs`, `static`, `file`, `app`, `metrics`, `account`, `settings`, `signup`, `login`, and `v1`; the check is case-sensitive. A self-hosted server can forbid additional names. `priority`, when present, must be an integer from 1 to 5; an omitted or cleared priority uses the server default.
80
+
81
+ The transport sends JSON directly to the normalized server base URL, with `topic`, `title`, `message`, and optional `priority`. A configured `accessToken` is sent only as a Bearer header. Title and body are clipped to 1024 and 4096 UTF-8 bytes. The complete encoded JSON request is also capped at 8192 bytes; escaping can reduce the available body length. Only HTTP 200 with a message object counts as accepted. That object must have a nonempty string `id`, positive safe-integer `time`, `event: "message"`, the expected `topic`, and a string `message`.
82
+
83
+ Topic secrecy is not access control. Without server authentication and topic permissions, public topics can expose metadata and allow unwanted publishers. An ntfy access token has the user's full access; it is not a topic-scoped credential. Configure server ACLs, use a suitably restricted user, and protect the token.
84
+
85
+ ### Pushover
86
+
87
+ `appToken` and `userKey` must each contain exactly 30 ASCII alphanumeric characters. Pushover uses the fixed HTTPS endpoint `https://api.pushover.net/1/messages.json`; no server URL is configurable. It sends JSON fields `token`, `user`, `title`, `message`, and `priority: 0`. There is no emergency priority, acknowledgement, retry parameter, or configurable priority.
88
+
89
+ The local title and body caps are 250 and 1024 UTF-16 code units. These are conservative bounds for the service's character limits; astral characters use two code units. Only HTTP 200 with numeric JSON `status: 1` counts as accepted.
90
+
91
+ ### Discord
92
+
93
+ `webhookUrl` must use one of these exact official endpoint shapes, with a positive decimal webhook ID (no leading zero, at most 20 digits and at most 18446744073709551615) and a nonempty alphanumeric, underscore, or hyphen token:
94
+
95
+ ```text
96
+ https://discord.com/api/webhooks/{id}/{token}
97
+ https://discord.com/api/v10/webhooks/{id}/{token}
98
+ ```
99
+
100
+ The complete URL is a credential. Alternate hosts, ports, URL credentials, queries, fragments, encoded or normalized alternatives, controls, and backslashes are rejected. The transport adds `wait=true` internally, but configured URLs must have no query string.
101
+
102
+ Discord receives title and body as `content`, clipped to 2000 UTF-16 code units. Requests set `allowed_mentions: { "parse": [] }` and `flags: 4` (`SUPPRESS_EMBEDS`), even for direct provider callers. This prevents mention parsing and link previews; it does not suppress notifications. A descriptive User-Agent identifies the integration. Only HTTP 200 with a Message response containing valid positive decimal `id` and `channel_id` values under the same ID bound and an integer `type` counts as accepted. Normal text-channel webhooks are supported; forum/media channels and thread selection are not.
103
+
104
+ ### Bark
105
+
106
+ `serverUrl` can be `https://api.day.app` or a self-hosted server base, including a reverse-proxy path. JSON is sent to `<serverUrl>/push` with `device_key`, `title`, and `body`. The key and message are never placed in a URL path or query. The device key is the only supported Bark credential; there is no Bark bearer field. Servers that require Bark's native Basic authentication are not supported. A separate proxy is outside this integration's contract.
107
+
108
+ Local title and body caps are 256 and 2048 UTF-8 bytes. The encoded `{title,body}` object is capped at 3000 bytes to leave space within Apple's 4096-byte APNs envelope. These are conservative local limits, not universal server limits. Only HTTP 200 with numeric JSON `code: 200` counts as accepted. JSON delivery avoids URL exposure but does not prevent the official Bark server from logging request bodies, including device keys and metadata.
109
+
110
+ ### Generic webhook
111
+
112
+ `webhookUrl` is masked in full, even without a token. Optional `bearerToken` is sent as `Authorization: Bearer <token>`. The fixed JSON payload contains only:
113
+
114
+ ```json
115
+ {
116
+ "id": "notification-id",
117
+ "title": "Pi notification title",
118
+ "body": "Notification metadata",
119
+ "settledAt": 1792281600000
120
+ }
121
+ ```
122
+
123
+ `settledAt` is Unix epoch milliseconds, not seconds. No internal emphasis, destination credentials, or configurable fields are added. Any HTTP 2xx response counts as endpoint acceptance, including empty or non-JSON responses, after the bounded response read completes. This is not proof of downstream delivery. An oversized or stalled 2xx response body can still fail with `response` or `timeout`.
124
+
125
+ ### Mixed User settings example
126
+
127
+ Replace placeholders with real values. `appToken` and `userKey` must meet the Pushover length rule; the Discord URL must be copied from Discord. This fragment does not replace existing Telegram, Gotify, Slack, or unknown settings. Omit optional tokens when using anonymous delivery.
128
+
129
+ ```json
130
+ {
131
+ "targetIds": ["ntfy", "pushover", "discord", "bark", "home-hook"],
132
+ "destinations": {
133
+ "ntfy": {
134
+ "provider": "ntfy",
135
+ "label": "Personal ntfy",
136
+ "serverUrl": "https://ntfy.sh",
137
+ "topic": "replace-with-your-topic",
138
+ "accessToken": "<access-token>",
139
+ "priority": 3
140
+ },
141
+ "pushover": {
142
+ "provider": "pushover",
143
+ "label": "Personal Pushover",
144
+ "appToken": "<30-character-application-token>",
145
+ "userKey": "<30-character-user-key>"
146
+ },
147
+ "discord": {
148
+ "provider": "discord",
149
+ "label": "Build channel",
150
+ "webhookUrl": "https://discord.com/api/webhooks/<id>/<token>"
151
+ },
152
+ "bark": {
153
+ "provider": "bark",
154
+ "label": "Personal Bark",
155
+ "serverUrl": "https://api.day.app",
156
+ "deviceKey": "<device-key>"
157
+ },
158
+ "home-hook": {
159
+ "provider": "webhook",
160
+ "label": "Home automation",
161
+ "webhookUrl": "https://automation.example.com/pi-notify",
162
+ "bearerToken": "<bearer-token>"
163
+ }
164
+ }
165
+ }
166
+ ```
167
+
168
+ ## Provider setup and revocation
169
+
170
+ Use `/notify` to add a destination, complete its review, and choose Save only or Save and use. Labels are generated automatically and can be changed. Secret inputs are masked; complete Discord and Generic webhook URLs remain hidden in lists, reviews, tests, Status, and errors. Optional ntfy tokens and priority, and Generic tokens, can be cleared in review. Send test previews the metadata and requires confirmation before an external request. Unsaved cancellation does not save a draft; cancelling delivery cannot recall an accepted message.
171
+
172
+ ### Telegram and Gotify
173
+
174
+ For Telegram, create a bot with [BotFather](https://t.me/BotFather), then start a private conversation with it. After sending a message, obtain the numeric chat ID through the [Bot API](https://core.telegram.org/bots/api#getupdates). Stop other update consumers first; an active webhook prevents `getUpdates` from working. For groups, add the bot and permit it to send messages. Enter the bot token in the masked input, then the chat ID. Set an optional forum topic in review. Revoke an exposed token through BotFather before replacing it.
175
+
176
+ For Gotify, create an application in the server's Apps tab. Enter its application token in the masked input and the server base URL, including any reverse-proxy path, not `/message`. Review the optional priority. See [Gotify setup](https://gotify.net/docs/pushmsg). Revoke an exposed application token through the server and replace it in User settings.
177
+
178
+ ### ntfy, Pushover, Discord, Bark, and Generic webhook
179
+
180
+ 1. For ntfy, subscribe to a topic with your client and configure server authentication and topic ACLs before sending private metadata. Use `https://ntfy.sh` or your own server base. Add the topic, then review the server, optional access token, and optional priority. Revoke exposed tokens in the ntfy account/server and replace them; changing a public topic name does not establish access control.
181
+ 2. For Pushover, register an application in your [Pushover account](https://pushover.net/), obtain its application/API token and your user key, and enter both in the masked inputs. Revoke or reset exposed credentials through Pushover account/application management before replacing them; remove an application if required to invalidate its token.
182
+ 3. For Discord, create a webhook for a normal text channel through channel or server integration settings, then paste the complete webhook URL into the masked input. Channel/server permissions can restrict creation. Delete a compromised webhook in Discord and create a replacement; changing a label does not change its channel or revoke its URL.
183
+ 4. For Bark, install/register the Bark client, copy its device key, and use `https://api.day.app` or your self-hosted server base. Enter the device key in the masked input. Reset or re-register the device key through the client/server if exposed; verify that the old key no longer works before relying on the replacement.
184
+ 5. For a Generic webhook, provision a trusted receiver for the fixed payload and, if required, a Bearer token. Enter the complete endpoint URL and optional token in masked inputs. Revoke/rotate the token at the receiver, or disable/replace a secret endpoint URL if exposed.
185
+
186
+ Keep secrets out of Project files, source control, and Pi chat. Prefer HTTPS and confirm replacements with Send test. Removing or editing a destination does not revoke its old credential. JavaScript memory is not secure credential storage. See the separate [Slack workflow](#slack-setup-and-revocation) for Slack installation and revocation.
187
+
188
+ ## Slack setup and revocation
189
+
190
+ 1. Create or open an app in [Slack app management](https://api.slack.com/apps) for the commercial workspace that must receive notifications. Workspace policy can require administrator approval.
191
+ 2. Enable Incoming Webhooks, choose Add New Webhook to Workspace, select the destination channel, and authorize it. You must belong to a private channel before selecting it. Copy the generated webhook URL; it is specific to that installation and channel.
192
+ 3. Run `/notify`, add a Slack destination, and paste the complete URL into the masked input. Review the generated `Slack notifications` label or change it. Reviews show only that the webhook is configured, not its URL or path.
193
+ 4. Choose Save only to store without selecting, or Save and use to add the destination to User selections atomically. Existing Off settings and explicit Project selections remain unchanged. Send test shows a metadata preview and requires confirmation before one external request. Closing an unsaved draft does not save it.
194
+
195
+ To change channels, authorize a webhook for the new channel and replace the saved webhook through the destination review, or create a separate destination. The extension cannot override the installed channel, username, or icon. It does not send replies, upload files, or manage Slack apps.
196
+
197
+ Treat an exposed URL as a compromised credential. Revoke or remove that webhook through Slack app management before replacing it in User settings; ask the workspace administrator if you cannot manage the installation. Slack can also revoke leaked webhooks automatically. Merely editing or removing a destination does not revoke the old webhook. Confirm a replacement with Send test. A disabled webhook, archived channel, or workspace restriction can prevent delivery; repair the installation instead of expecting a retry. Cancelling a request cannot recall a message Slack has already accepted.
198
+
23
199
  ## Persistence and recovery
24
200
 
25
201
  Settings operations are ordered within the process, including across store instances for the same user path. Reads wait for pending writes. This is not a cross-process lock: simultaneous menu edits in different Pi processes can conflict.
26
202
 
27
- Writes read the latest valid document, preserve unrelated fields and destination fields, and publish using a same-directory temporary file plus rename. Unknown provider data is retained during unrelated edits. Malformed JSON blocks writes instead of being overwritten with defaults. An existing non-object `destinations` value blocks destination changes. A non-object destination entry cannot be replaced with a new object. Repair these stored structures first; destination setup does not coerce them to empty defaults. A failed save keeps the previous file and effective state; the menu restores the previous displayed setting. A failed operation does not poison subsequent operations. Reload and shutdown await queued settings operations.
203
+ Writes read the latest valid document, preserve unrelated fields and destination fields, and publish using a same-directory temporary file plus rename. User settings writes use private `0600` permissions on POSIX, including replacement files. Unknown provider data is retained during unrelated edits. Malformed JSON blocks writes instead of being overwritten with defaults. An existing non-object `destinations` value blocks destination changes. A non-object destination entry cannot be replaced with a new object. Repair these stored structures first; destination setup does not coerce them to empty defaults. A failed save keeps the previous file and effective state; the menu restores the previous displayed setting. A failed operation does not poison subsequent operations. Reload and shutdown await queued settings operations.
204
+
205
+ If a file is malformed, repair it manually before saving. Disable notifications in every effective scope to stop new attempts and cancel pending reminders. Unloading the extension aborts owned delivery work, but cannot recall accepted messages. Revoke exposed tokens or Slack webhooks before replacing them in User settings.
206
+
207
+ ### Reverting to a version without the new providers
208
+
209
+ 1. While the new build is still installed, remove the IDs of destinations whose provider is `ntfy`, `pushover`, `discord`, `bark`, or `webhook` from explicit Project selections in every affected project. Clear those overrides or select destinations the older version supports; Project arrays replace User selections.
210
+ 2. Remove those IDs from User selections and remove every saved destination with one of these five provider IDs, including unselected destinations. Removal clears User selection atomically, but the current trusted Project must not explicitly select the destination.
211
+ 3. Preserve existing Telegram, Gotify, Slack, and unknown fields. Confirm all saved destinations and effective selections are supported by the older version, then install it and reload.
28
212
 
29
- If a file is malformed, repair it manually before saving. Disable notifications in every effective scope to stop new attempts and cancel pending reminders. Unloading the extension aborts owned delivery work, but cannot recall accepted messages. Revoke exposed tokens before replacing them in User settings.
213
+ Selections alone are insufficient: unsupported saved destinations disable routing even when unselected. No migration is needed for existing destinations. Revoke discarded credentials at each service separately; removing JSON does not revoke them. If the older version also lacks Slack, follow the Slack steps below.
214
+
215
+ ### Reverting to a version without Slack
216
+
217
+ 1. While the Slack-capable version is installed, remove Slack IDs from explicit Project selections in every affected project. Clear those overrides or select supported Telegram/Gotify IDs. Project arrays replace User selections.
218
+ 2. Remove Slack IDs from User selections and remove the Slack destinations. Removing a destination also clears its User selection, but is blocked while the current trusted Project explicitly selects it.
219
+ 3. Confirm that effective selections contain only supported destinations, then install the older version and reload.
220
+
221
+ Removing selections alone is not enough: older versions disable automatic delivery for any unsupported destination, even an unselected one. There is no migration for existing Telegram or Gotify destinations. Revoke webhooks in Slack separately if they are no longer needed.
30
222
 
31
223
  ## Inactivity timing
32
224
 
@@ -46,9 +238,17 @@ The coordinator observes `before_agent_start`, with `agent_start` as a fallback,
46
238
 
47
239
  Metadata is collected at settlement through bounded Git subprocesses. Missing Git information is omitted. Pending metadata work is cancelled with its reminder. Once a delivery attempt starts, new user work does not cancel it; session replacement, reload, shutdown, or explicit test cancellation does. Late results cannot replace newer per-destination status. Test delivery bypasses automatic enablement and inactivity, requires explicit confirmation, and never changes automatic arming or history.
48
240
 
49
- The provider contract validates destinations and sends a provider-neutral notification with a cancellation signal. Providers do not read sessions, change settings, schedule timers, or decide notification policy. The built-in provider map contains only Telegram. Transport results distinguish accepted, failed with a safe code, and cancelled; retry-after is diagnostic, not an automatic retry instruction.
241
+ The provider contract validates destinations and sends a provider-neutral notification with a cancellation signal. Providers do not read sessions, change settings, schedule timers, or decide notification policy. The built-in provider map contains Telegram, Gotify, Slack, ntfy, Pushover, Discord, Bark, and Generic webhook. Transport results distinguish accepted, failed with a safe code, and cancelled; retry-after is diagnostic, not an automatic retry instruction.
242
+
243
+ All transports reject redirects, use a 10-second deadline covering the request and response read, make one attempt, and cap success response reads at 65,536 bytes. Errors expose only fixed codes, never tokens, request URLs, response bodies, or raw transport exceptions. The five new providers report HTTP 429 as `rate-limit`, with a positive integer `Retry-After` in seconds when available; fractional Discord retry values are not displayed. Retry-after is diagnostic only. Service acceptance does not prove device receipt, downstream delivery, or reading. Text clipping preserves Unicode code points; the [provider limits](#new-provider-fields) specify each byte or UTF-16 budget.
244
+
245
+ Telegram requests use its fixed HTTPS origin and do not enable paid broadcasts. Text is clipped to at most 4096 UTF-16 code units without splitting a Unicode code point. Telegram's JSON `ok` field and HTTP status are both checked.
246
+
247
+ Gotify posts JSON to `<serverUrl>/message` with `X-Gotify-Key` application-token authentication. The title and body are separate fields; emphasis metadata is not sent, and Markdown extras are not enabled. An unset priority is omitted so the server uses the application's default. A successful HTTP response must contain a message with positive integer `id` and `appid`, string `message`, and valid `date`. HTTP failures use a safe `http` code; HTTP 429 uses `rate-limit` and includes a positive integer `Retry-After` value when available. Server response text is never displayed.
248
+
249
+ Slack posts JSON to the validated webhook URL. It sends only the same provider-neutral title and metadata body as the other providers: hostname, session name/ID, working directory, available Git repository/worktree/branch, elapsed time, and settlement timestamp. Paths can disclose private information even when the home prefix is shortened. The selected channel's members can read this metadata. Prompts, assistant answers, code, tool output, Git remotes, credentials, and raw errors are not included.
50
250
 
51
- Requests use Telegram's fixed HTTPS origin, reject redirects, and do not enable paid broadcasts. Text is clipped to at most 4096 UTF-16 code units without splitting a Unicode code point. Response reads are capped at 65536 bytes. Telegram's JSON `ok` field and HTTP status are both checked. Errors expose only fixed codes, never tokens, request URLs, response bodies, or raw transport exceptions.
251
+ Slack combines the title and body into one section block with a `plain_text` text object and `emoji: false`, not dynamic `mrkdwn`. Slack control characters `&`, `<`, and `>` are entity-escaped once so existing entity-like metadata also displays literally. The encoded text is capped at 3000 UTF-16 code units without splitting Unicode code points or entities; longer messages end with an ellipsis. Dynamic terminal controls are removed and metadata remains literal; mention and link expansion are disabled. The top-level fallback is the fixed text `Pi notification. Open Pi to review.` with markup and unfurling disabled. Screen readers and notification surfaces that use this fallback receive a generic reminder. Slack desktop notifications can extract block text instead, so metadata can still appear outside the channel view. Only HTTP 200 with the documented plain-text `ok` response counts as accepted; malformed or oversized success responses fail safely. HTTP 429 reports `rate-limit` with a valid positive integer `Retry-After` when available, without retrying. Other HTTP failures and invalid responses use fixed safe codes; response bodies and transport exceptions are never shown. Slack generally permits one webhook message per second, with short bursts; multiple destinations or rapid work periods can exceed workspace/channel limits. There is no automatic retry, queue, cooldown, or replay after reload. Accepted does not mean read.
52
252
 
53
253
  ## Authoritative references
54
254
 
@@ -57,6 +257,18 @@ Requests use Telegram's fixed HTTPS origin, reject redirects, and do not enable
57
257
  - [Telegram getUpdates](https://core.telegram.org/bots/api#getupdates): manual chat-ID discovery; incompatible with active webhooks.
58
258
  - [Telegram ResponseParameters](https://core.telegram.org/bots/api#responseparameters): `retry_after` on flood control.
59
259
  - [Telegram rate limits](https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this): avoid more than one message per second in a chat, 20 per minute in a group, and about 30 per second across free broadcasts.
260
+ - [Gotify push messages](https://gotify.net/docs/pushmsg): application setup and application-token authentication.
261
+ - [Gotify API](https://gotify.net/api-docs) and [server API specification](https://raw.githubusercontent.com/gotify/server/v3.1.1/docs/spec.json): `POST /message`, message fields, and response schema.
262
+ - [Slack Incoming Webhooks](https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/): setup, commercial URL shape, fixed channel, secret handling, HTTP 200 `ok`, and failure conditions.
263
+ - [Slack text objects](https://docs.slack.dev/reference/block-kit/composition-objects/text-object/) and [section blocks](https://docs.slack.dev/reference/block-kit/blocks/section-block/): `plain_text` and the 3000-character text limit.
264
+ - [Slack message formatting](https://docs.slack.dev/messaging/formatting-message-text/#escaping): escaping control characters and disabling markup with `plain_text` and `mrkdwn: false`; desktop notifications can extract block text, while mobile notifications use top-level text.
265
+ - [Slack message posting](https://docs.slack.dev/reference/methods/chat.postMessage/): notification/screen-reader fallback text, parsing, link unfurling, and text limits; Incoming Webhooks follow Slack's messaging format.
266
+ - [Slack rate limits](https://docs.slack.dev/apis/web-api/rate-limits/): Incoming Webhooks, HTTP 429, and `Retry-After` seconds.
267
+ - [ntfy publishing](https://docs.ntfy.sh/publish/): JSON publishing, topic names, priority, and size limits; [access control](https://docs.ntfy.sh/config/#access-control): authentication, topic permissions, and access tokens.
268
+ - [Pushover Messages API](https://pushover.net/api): fixed endpoint, application/user credentials, normal priority, message limits, and numeric status responses.
269
+ - [Discord Execute Webhook](https://discord.com/developers/docs/resources/webhook#execute-webhook): endpoint, `wait=true`, content limits, Message response, and flags; [allowed mentions](https://discord.com/developers/docs/resources/message#allowed-mentions-object): explicit empty mention parsing.
270
+ - [Bark tutorial](https://bark.day.app/#/tutorial) and official server source at commit `640deaa151ddf79193202927b35ca2f14f65ee1d`: [JSON API](https://github.com/Finb/bark-server/blob/640deaa151ddf79193202927b35ca2f14f65ee1d/docs/API_V2.md), [push handler](https://github.com/Finb/bark-server/blob/640deaa151ddf79193202927b35ca2f14f65ee1d/route_push.go), [router](https://github.com/Finb/bark-server/blob/640deaa151ddf79193202927b35ca2f14f65ee1d/router.go), and [Basic authentication](https://github.com/Finb/bark-server/blob/640deaa151ddf79193202927b35ca2f14f65ee1d/route_auth.go). These establish `/push`, `device_key`, numeric acceptance, body logging, and the unsupported native Basic-auth mode.
271
+ - [Apple APNs payloads](https://developer.apple.com/documentation/usernotifications/generating-a-remote-notification): the 4096-byte regular notification payload limit; Bark's smaller local text budgets leave envelope space.
60
272
  - [Pi extension lifecycle](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/extensions.md#agent_start--agent_end--agent_before_settle--agent_settled).
61
273
 
62
274
  Input classification follows the installed Pi `ProcessTerminal` and `StdinBuffer` sequence splitting, Pi's `parseKey`/`isKeyRelease`, and `TuiAltScreen` SGR mouse handling. Pure classifier tests cover keyboard, Unicode, paste, focus, press/release, motion, wheel, legacy mouse, CSI/OSC/DCS/APC replies, and unknown input. These tests do not prove that an event reaches the extension. Installed-runtime tests also pass events through real regular/fullscreen Pi renderers and check listener order, viewport keys, and focused-overlay branches. Physical terminal and multiplexer behavior remains unverified.
package/package.json CHANGED
@@ -1,13 +1,21 @@
1
1
  {
2
2
  "name": "@narumitw/pi-notify",
3
- "version": "0.1.0",
4
- "description": "Telegram notifications when Pi settles, with optional inactivity reminders.",
3
+ "version": "0.3.0",
4
+ "description": "Multi-provider notifications when Pi settles, with optional inactivity reminders.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "keywords": [
8
8
  "pi-package",
9
9
  "pi-extension",
10
10
  "telegram",
11
+ "gotify",
12
+ "slack",
13
+ "ntfy",
14
+ "pushover",
15
+ "discord",
16
+ "bark",
17
+ "webhook",
18
+ "incoming-webhook",
11
19
  "notifications"
12
20
  ],
13
21
  "files": [
@@ -0,0 +1,107 @@
1
+ import { safeText } from "./metadata.js";
2
+ import type { Destination } from "./provider.js";
3
+
4
+ export const providerLabels: Record<Destination["provider"], string> = {
5
+ telegram: "Telegram",
6
+ gotify: "Gotify",
7
+ slack: "Slack",
8
+ ntfy: "ntfy",
9
+ pushover: "Pushover",
10
+ discord: "Discord",
11
+ bark: "Bark",
12
+ webhook: "Generic webhook",
13
+ };
14
+ export const providerLabel = (destination: Destination) => providerLabels[destination.provider];
15
+ export const credentialLabels: Record<Destination["provider"], string> = {
16
+ telegram: "bot token",
17
+ gotify: "application token",
18
+ slack: "webhook URL",
19
+ ntfy: "access token (empty for anonymous)",
20
+ pushover: "application token",
21
+ discord: "webhook URL",
22
+ bark: "device key",
23
+ webhook: "webhook URL",
24
+ };
25
+ export function displayServerUrl(raw: string): string {
26
+ try {
27
+ const url = new URL(raw);
28
+ // Never include URL credentials, query parameters, or fragments in descriptions.
29
+ return safeText(`${url.protocol}//${url.host}${url.pathname}`);
30
+ } catch {
31
+ return "not configured";
32
+ }
33
+ }
34
+ export function destinationDescription(destination: Destination): string {
35
+ switch (destination.provider) {
36
+ case "telegram":
37
+ return `Telegram · ${safeText(destination.chatId)} · token configured`;
38
+ case "gotify":
39
+ return `Gotify · ${displayServerUrl(destination.serverUrl)} · token configured`;
40
+ case "slack":
41
+ return "Slack · webhook configured";
42
+ case "pushover":
43
+ return "Pushover · application token and user key configured";
44
+ case "discord":
45
+ return "Discord · webhook configured";
46
+ case "bark":
47
+ return `Bark · ${displayServerUrl(destination.serverUrl)} · device key configured`;
48
+ case "webhook":
49
+ return `Generic webhook · URL configured · ${destination.bearerToken ? "Bearer token configured" : "no authentication"}`;
50
+ case "ntfy":
51
+ return `ntfy · ${displayServerUrl(destination.serverUrl)} · ${destination.accessToken ? "token configured" : "anonymous"}`;
52
+ }
53
+ }
54
+ export function destinationLines(destination: Destination): string[] {
55
+ const label = `Label: ${safeText(destination.label)}`;
56
+ switch (destination.provider) {
57
+ case "telegram":
58
+ return [
59
+ label,
60
+ `Chat: ${safeText(destination.chatId)}`,
61
+ `Topic: ${destination.messageThreadId ?? "none"}`,
62
+ "Bot token: configured (hidden)",
63
+ ];
64
+ case "gotify":
65
+ return [
66
+ label,
67
+ `Server: ${displayServerUrl(destination.serverUrl)}`,
68
+ `Priority: ${destination.priority ?? "server default"}`,
69
+ "Application token: configured (hidden)",
70
+ ];
71
+ case "slack":
72
+ return [label, "Channel: fixed by webhook installation", "Webhook URL: configured (hidden)"];
73
+ case "pushover":
74
+ return [
75
+ label,
76
+ "Application token: configured (hidden)",
77
+ "User key: configured (hidden)",
78
+ "Priority: normal (0); emergency mode is not supported.",
79
+ ];
80
+ case "discord":
81
+ return [label, "Webhook URL: configured (hidden)", "Mentions and link embeds are disabled."];
82
+ case "bark":
83
+ return [
84
+ label,
85
+ `Server: ${displayServerUrl(destination.serverUrl)}`,
86
+ "Device key: configured (hidden)",
87
+ "Use HTTPS. HTTP sends credentials and metadata without encryption.",
88
+ ];
89
+ case "webhook":
90
+ return [
91
+ label,
92
+ "Webhook URL: configured (hidden)",
93
+ `Bearer token: ${destination.bearerToken ? "configured (hidden)" : "none"}`,
94
+ "User endpoints can reach the Pi host network. Use HTTPS; HTTP is unencrypted.",
95
+ ];
96
+ case "ntfy":
97
+ return [
98
+ label,
99
+ `Server: ${displayServerUrl(destination.serverUrl)}`,
100
+ `Topic: ${safeText(destination.topic)}`,
101
+ `Priority: ${destination.priority ?? "server default"}`,
102
+ `Access token: ${destination.accessToken ? "configured (hidden)" : "none (anonymous)"}`,
103
+ "A topic name is not access control. Configure server authentication and topic permissions.",
104
+ "Use HTTPS. HTTP sends credentials and metadata without encryption.",
105
+ ];
106
+ }
107
+ }