# Notification

> Show native Windows notifications; other plugins can call in via invoke('plugin:notification:show', {title, body})

| | |
|---|---|
| Version | 1.0.2 |
| Category | Productivity |
| Depends on | ai-chat |

# Notification

Show native Windows notifications; other plugins can call in via invoke('plugin:notification:show', {title, body})

**Type:** `backend` — see `.claude/skills/kazuo-create-plugin/references/plugin-examples.md`

## Files

- `manifest.json` — metadata, `defaultSettings`, `defaultWidgetConfig`
- `widget.html` / `js/widget.js` / `css/widget.css` — main UI
  - has its own "⚙" button + settings overlay built into widget.html/widget.js (host no longer provides a per-widget gear icon — see references/plugin-runtime-api.md section 1b)
- `settings.html` / `js/settings.js` / `css/settings.css` — same fields as the widget overlay (intentionally duplicated), used by the Plugin Manager screen and the pop-out window
- `locales/en.json5` / `locales/vi.json5` — UI strings, `widget.*`/`settings.*` namespaces
- `main/index.ts` (+ compiled `main/index.js`) — runs in the Electron main process; registers the IPC channels and shows the native notifications

## Public API — how OTHER plugins call in

Any enabled plugin (from its `widget.js`/`settings.js`) shows a notification with:

```js
await window['kazuo-ai'].invoke('plugin:notification:show', {
  title: 'Build finished',
  body: 'image myapp:latest is ready',
  source: 'docker-manager', // optional — shown as "[docker-manager] ..." when Show source is on
  silent: false,            // optional — overrides the default sound setting for this one call
});
// resolves to { ok: true, at: <timestamp> } or { ok: false, error: 'notifications-unsupported' }
```

This works because the host's `invoke` forwards to any `plugin:*` channel and `plugin:notification:show`
is intentionally NOT restricted to the notification plugin itself. Clicking a notification focuses the app.

Self-only channels (used by this plugin's own widget): `plugin:notification:history`,
`plugin:notification:clear` (both require passing `'notification'` as the first arg).

## Default settings

- `showSource` — default: `true` — prefix the body with `[source]` when the caller passes one
- `silent` — default: `false` — default sound behaviour (each call can override via `silent`)

## Test

Open Kazuo AI → Plugin Manager — this plugin appears automatically (the host scans `plugins-library/` on its own, no registration needed) → Install → Enable. Use the widget's compose box to send a test notification; recent notifications appear in the History list.

After editing `main/index.ts`, recompile before testing: `npx tsc -p tsconfig.plugins.json` (run from the project root).
