Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a50cf5e
feat: harden pi-knock for product use
Asigers Oct 4, 2026
74ae8a4
feat: harden pi-knock for product use
Asigers Oct 4, 2026
b4e12ae
feat: harden pi-knock for product use
Asigers Oct 4, 2026
a3956f8
feat: harden pi-knock for product use
Asigers Oct 4, 2026
cb7f4af
feat: add retry-aware delivery errors
Asigers Oct 4, 2026
792f982
feat: retry transient notification failures
Asigers Oct 4, 2026
ae13062
feat: add diagnostics and notification preferences
Asigers Oct 4, 2026
dcc5fde
feat: classify provider delivery errors
Asigers Oct 4, 2026
d64ef57
feat: classify provider delivery errors
Asigers Oct 4, 2026
b77fe0d
feat: classify provider delivery errors
Asigers Oct 4, 2026
fb32cec
feat: add notification privacy setting
Asigers Oct 4, 2026
003c6c4
feat: document notification privacy setting
Asigers Oct 4, 2026
96608f5
build: include docs in npm package
Asigers Oct 4, 2026
4c79729
ci: verify npm package contents
Asigers Oct 4, 2026
86e46c3
ci: verify package before publishing
Asigers Oct 4, 2026
1a3734c
docs: record product hardening changes
Asigers Oct 4, 2026
b222140
docs: document lifecycle and package checks
Asigers Oct 4, 2026
ed3bd36
test: cover notification retries
Asigers Oct 4, 2026
8e58455
test: cover notification providers
Asigers Oct 4, 2026
e7e3f1c
test: cover Pi lifecycle behavior
Asigers Oct 4, 2026
46d2dab
feat: default to lock-screen-safe notification content
Asigers Oct 4, 2026
8835751
docs: make project-only the safe default
Asigers Oct 4, 2026
78cfce9
docs: note privacy default
Asigers Oct 4, 2026
bc729e2
test: cover privacy configuration
Asigers Oct 4, 2026
d0c1f47
test: cover private session notifications
Asigers Oct 4, 2026
94827f6
docs: sharpen product positioning
Asigers Oct 4, 2026
a9b91a2
docs: sharpen Chinese product positioning
Asigers Oct 4, 2026
512bd8c
test: compile TypeScript before running tests
Asigers Oct 4, 2026
2d05c4a
fix: avoid strip-only TypeScript syntax
Asigers Oct 4, 2026
51cf2ac
build: ignore compiled test output
Asigers Oct 4, 2026
38227ab
test: use valid 204 response mocks
Asigers Oct 4, 2026
c2df611
test: use valid 204 response mocks
Asigers Oct 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ jobs:
node-version: "22.19.0"
- run: npm ci --ignore-scripts --no-audit --no-fund
- run: npm run check
- name: Verify npm package contents
run: npm pack --dry-run
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- name: Check
run: npm run check

- name: Verify npm package contents
run: npm pack --dry-run

- name: Read package version
id: version
run: node -e "console.log('version=' + require('./package.json').version)" >> "$GITHUB_OUTPUT"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ coverage/
*.log
.env
pi-knock.local.json
.test-dist/
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and

## [Unreleased]

### Added

- Automatic notification delivery retries for transient failures.
- `/knock doctor` diagnostics with last-delivery status and attempt count.
- Notification privacy mode to hide prompt text from lock-screen notifications, with `project-only` as the safe default.
- Session names in notification titles when Pi sessions are named.
- Provider, notifier, and lifecycle test coverage.
- npm package-content verification in CI and release workflows.

### Changed

- Duplicate `agent_settled` events are ignored once a run has already settled.
- Notification setup now includes a dedicated preferences screen.
- Documentation files and the Chinese README are included in the npm package.


## [0.2.1] - 2026-10-03

### Changed
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Behavior changes should include tests. In particular, lifecycle changes must pre

Notification delivery failures must never break the agent run.

Lifecycle changes should be covered in `test/lifecycle.test.ts`. Provider request changes belong in `test/channels.test.ts`, and retry behavior belongs in `test/notifier.test.ts`.

Before releasing, `npm pack --dry-run` must show the README files and `docs/` content expected by links in the package documentation.

## Pull requests

Keep changes focused. Update CHANGELOG.md for user-visible changes and avoid committing credentials, provider tokens, private webhook URLs, or local pi-knock configuration.
Expand Down
101 changes: 38 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,68 @@

English | [简体中文](./README.zh-CN.md)

**Notifications for Pi when a task finishes, fails, or needs your input.**
**Leave the terminal. Pi will knock when it needs you.**

pi-knock is a lightweight Pi extension that sends notifications to **Pushover**, **ntfy**, or a **webhook**, so you do not need to keep watching the terminal while Pi works.

## Features

- ✅ Notify when a conversation finishes
- ❓ Notify when Pi is waiting for input or confirmation
- ❌ Notify when a task fails
- ⏹️ Optional notification for aborted runs
- 📱 Pushover, ntfy, and generic webhooks
- ⌚ Apple Watch via iPhone notification mirroring
- 🔗 Optional session URL for Pi-Web
- 🔐 Separate config and credential storage

## Install

Recommended:
pi-knock sends remote notifications when a Pi task **finishes, fails, or needs your input**. Use Pushover for iPhone / Apple Watch, ntfy for hosted or self-hosted push, or a webhook for your own automation.

```bash
pi install npm:@asigers/pi-knock
```

Or install directly from GitHub:
## Why pi-knock

```bash
pi install git:github.com/Asigers/pi-knock
```

Then restart Pi or run:

```text
/reload
```

Requires **Pi 0.87+**.
- **Actually waits for completion** — completion alerts are sent at `agent_settled`, after Pi has finished automatic retries and queued work.
- **Works away from your desk** — notifications can reach your phone or watch instead of only the local terminal.
- **Reliable delivery** — transient failures are retried automatically.
- **Lock-screen safe by default** — prompt text is hidden unless you opt in.
- **Session-aware** — named Pi sessions appear in notification titles.
- **No push server required** — pi-knock sends directly to your configured provider.

## Quick start

Run:
After installation, restart Pi or run `/reload`, then:

```text
/knock setup
```

Choose a provider and enter the required settings. pi-knock sends a test notification after setup.

Useful commands:
Choose a provider and enter the required settings. pi-knock immediately sends a test notification.

| Command | Description |
| --- | --- |
| `/knock setup` | Configure a notification provider |
| `/knock setup` | Configure providers and notification preferences |
| `/knock status` | Show current configuration |
| `/knock test` | Send a test notification |
| `/knock test` | Send a live test notification |
| `/knock doctor` | Show provider and last-delivery diagnostics |

Requires **Pi 0.87+**.

## Providers

| Provider | Best for |
| --- | --- |
| **Pushover** | iPhone / Apple Watch |
| **ntfy** | Simple self-hosted or hosted push |
| **Webhook** | Custom integrations |

For Apple Watch, install Pushover on your iPhone and enable notification mirroring in the Watch app.
| **ntfy** | Hosted or self-hosted push |
| **Webhook** | Custom integrations and automation |

New to Pushover? See the [Pushover setup guide (简体中文)](./docs/pushover-setup.zh-CN.md) for account registration, app installation, User Key, and Application API Token setup.
New to Pushover? See the [Pushover setup guide (简体中文)](./docs/pushover-setup.zh-CN.md).

## Notification behavior

By default:
Default behavior:

| Event | Notify |
| --- | --- |
| Conversation completed | Yes |
| Input / confirmation required | Yes |
| Conversation failed | Yes |
| Conversation aborted | No |
| `/knock test` | Immediately |

Completion notifications are sent after Pi reaches `agent_settled`, so retries, queued work, or other automatic continuation do not cause premature “finished” alerts.
Notifications use the project name and, when available, the Pi session name. By default prompt text is **not** included on the lock screen.

A completion notification contains the project name, the original prompt in compact form, and elapsed time.
To change this, run `/knock setup` and choose **Notification preferences**.

Delivery uses up to three attempts for transient network errors and retryable provider responses such as HTTP 429 / 5xx. Permanent 4xx errors fail immediately. Use `/knock doctor` to inspect the most recent delivery result.

## Configuration

Expand All @@ -101,60 +81,55 @@ Example:
{
"projectName": "",
"openUrl": "",
"contentMode": "project-only",
"notify": {
"completed": true,
"error": true,
"aborted": false,
"input": true
},
"ntfy": {
"enabled": false,
"server": "https://ntfy.sh",
"topic": ""
},
"pushover": {
"enabled": true
},
"webhook": {
"enabled": false,
"url": ""
}
}
```

See [`pi-knock.example.json`](./pi-knock.example.json) and [`config.schema.json`](./config.schema.json) for the full configuration.
See [`pi-knock.example.json`](./pi-knock.example.json) and [`config.schema.json`](./config.schema.json) for the complete configuration.

Environment variables are also supported, which is useful for Pi-Web, containers, CI, and secret managers.
Environment variables are supported for Pi-Web, containers, CI, and external secret managers.

> Credentials entered through Pi's standard input are visible while typing. Run `/knock setup` only in a private terminal or session.
> Pi's standard input is not masked. Run `/knock setup` only in a private terminal or session when entering credentials.

## Update / remove
## Install from GitHub

Latest `main`:

```bash
pi update --extensions
pi install git:github.com/Asigers/pi-knock
```

Remove the npm package:
Update installed extensions:

```bash
pi remove npm:@asigers/pi-knock
pi update --extensions
```

Remove the Git package:
Remove:

```bash
pi remove git:github.com/Asigers/pi-knock
pi remove npm:@asigers/pi-knock
```

## Development

```bash
npm ci --ignore-scripts
npm run check
npm pack --dry-run
pi -ne -e ./src/index.ts
```

Using `-ne` prevents another installed copy of pi-knock from being loaded during local testing.
Using `-ne` prevents another installed copy of pi-knock from loading during local testing.

## More

Expand Down
Loading
Loading