Skip to content

Commit df197c9

Browse files
authored
Release 3.10.4
## [3.10.4] - 2026-08-07 ### Development changes - [instructions]: Add CHIP test and plugin frontend agents (Copilot, Claude and Codex) instruction files and update [Development Guide](./README-DEV.md). ### Development breaking changes - [onOff]: `MatterbridgeOnOffServer` now bakes in the Lighting feature, so always use `MatterbridgeOnOffServer.with()` instead of the bare class for endpoints created without the Lighting feature. ### Added - [frontend]: Add icons for the chapter 16 Camera device types (Camera, FloodlightCamera, VideoDoorbell, Intercom, AudioDoorbell, SnapshotCamera, Chime, CameraController and Doorbell). See `matterbridge-example-camera` for a fully working and Matter compliant example of chapter 16 device types. - [matterbridgeEndpoint]: Document AutoMode thermostat deadband limit requirements. - [onOff]: Implement forward for offWithEffect, onWithRecallGlobalScene and onWithTimedOff commands. - [levelControl]: Implement forward for move, moveWithOnOff, step, stepWithOnOff, stop and stopWithOnOff commands. - [colorControl]: Implement forward for moveHue, stepHue, enhancedMoveHue, enhancedStepHue, moveSaturation, stepSaturation, moveColor, stepColor, moveColorTemperature and stepColorTemperature commands. ### Changed - [matterbridge]: Bump `matterbridge` version to v.3.10.4. - [matterbridge]: Bump `@matter/main` to v.0.17.8. - [matterbridge]: Bump `@matter/main` to v.0.17.9. - [matterbridge]: Bump `@types/node` to v.26.1.2. - [matterbridge]: Bump `marked` to v.18.0.9. - [matterbridge]: Bump `oxfmt` to v.0.62.0. - [matterbridge]: Bump `oxlint` to v.1.77.0. - [core]: Bump `express-rate-limit` to v.8.6.2. - [core]: Bump `ws` to v.8.21.2. - [thread]: Bump `@zip.js/zip.js` to v.2.8.34. - [frontend]: Bump `frontend` version to v.3.5.6. - [frontend]: Bump `@rjsf` packages to v.6.7.1. - [frontend]: Bump `globals` to v.17.9.0. - [frontend]: Bump `jsdom` to v.30.0.1. - [frontend]: Bump `vite` to v.8.2.1. - [frontend]: Bump `@vitejs/plugin-react` to v.6.0.5. - [frontend]: Bump `oxfmt` to v.0.62.0. - [frontend]: Bump `oxlint` to v.1.77.0. - [frontend]: Remove from SystemInfoTable node version and show bun version when running with the bun runtime. - [frontend]: Update MatterbridgeInfoTable and SystemInfoTable. - [frontend]: Update Setting System info table to show bun version when running with the bun runtime. - [docs]: Update statistics in index.html for community plugins and downloads. - [docs]: Update Bun guide. ### Fixed - [AirConditioner]: Use valid default AutoMode thermostat limits for the 1°C deadband. - [publish]: Wait 1 minute for npm registry propagation before triggering Docker builds. - [frontend]: Update MbfScreen desktop layout test for jsdom v.30.x computed style behavior. <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
1 parent e8a4435 commit df197c9

58 files changed

Lines changed: 4685 additions & 1286 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/chip-tests.md

Lines changed: 296 additions & 0 deletions
Large diffs are not rendered by default.

.agents/plugin-frontend.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Matterbridge Plugin Frontend Guide (v.1.0.0)
2+
3+
Use this guide when writing plugin code that interacts with a plugin's own frontend SPA: bundling and serving that SPA and its custom REST API.
4+
5+
This guidance is based on `packages/core/src/frontend.ts` and `packages/core/src/matterbridgePlatform.ts` in the `matterbridge` repository.
6+
7+
## Serving a plugin's bundled frontend SPA
8+
9+
When a plugin package contains a built SPA at `apps/frontend/build/index.html`, `pluginManager.ts` sets `plugin.frontendPath`. Matterbridge then automatically mounts these routes for the plugin:
10+
11+
- `/plugins/<pluginName>/*` serves the plugin's build output as static files.
12+
- `/plugins/<pluginName>/api/:path` exposes the plugin REST namespace backed by `onFetch`, with JSON body parsing included.
13+
- `/plugins/<pluginName>/{*splat}` serves the plugin's `index.html` as the SPA fallback for unmatched routes.
14+
15+
A plugin frontend must call its own `/plugins/<pluginName>/api/...` namespace rather than the core `/api/...` endpoints.
16+
17+
## Use `onFetch` for a plugin's custom API
18+
19+
The frontend WebSocket RPC protocol dispatches a fixed set of built-in `/api/...` methods and does not provide a plugin extension point. Override `onFetch` in the platform class when the plugin's frontend needs to communicate with plugin code.
20+
21+
### `onFetch` signature
22+
23+
```ts
24+
async onFetch(method: string, path?: string, query?: Record<string, unknown>, body?: unknown): Promise<unknown>
25+
```
26+
27+
Matterbridge calls this method for `GET`, `POST`, `PUT`, `PATCH`, and `DELETE` requests to `/plugins/<pluginName>/api/:path` for every enabled, error-free plugin.
28+
29+
- `method` is the HTTP method.
30+
- `path` is the `:path` route parameter, such as `'devices'` or `'devices/42'`. It is optional in the TypeScript signature because tests and other code can call `onFetch` directly without a path. Requests through the mounted Express route always provide a non-empty string because `:path` must match at least one segment.
31+
- `query` contains the query-string parameters.
32+
- `body` contains the parsed request body for `POST`, `PUT`, and `PATCH` requests.
33+
- Return a JSON-serializable value. Return `undefined` to produce a `404` response.
34+
- A thrown error becomes a `500` response with `{ error: 'Internal error in plugin <name>' }`.
35+
- `DELETE` returns `204` with no response body. Every other method returns `res.json(value)`.
36+
- If `plugin.platform` is not running, Matterbridge returns `503` without calling `onFetch`.
37+
38+
The base implementation only logs the request and returns `undefined`, so override it to expose real endpoints.
39+
40+
## Avoid unsupported routing patterns
41+
42+
- Do not invent custom WebSocket method names for plugin frontend traffic. The WebSocket dispatch list is fixed; use `onFetch` through `/plugins/<pluginName>/api/...`.
43+
- Do not call core `/api/...` routes from a plugin's custom frontend. Use the plugin's own `/plugins/<pluginName>/api/...` namespace.

.claude/rules/chip-tests/chip-tests.instructions.md

Lines changed: 307 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
description: 'How a plugin serves its own frontend SPA and custom REST API via onFetch (v.1.0.0)'
3+
paths:
4+
- 'apps/frontend/**'
5+
- 'src/*.ts'
6+
---
7+
8+
# Matterbridge Plugin Frontend Guide
9+
10+
Use this guide when writing plugin code that interacts with a plugin's own frontend SPA: bundling and serving that SPA and its custom REST API.
11+
12+
This guide is based on `packages/core/src/frontend.ts` and `packages/core/src/matterbridgePlatform.ts` in the `matterbridge` repository.
13+
14+
## Serving a plugin's own bundled frontend SPA
15+
16+
If the plugin package ships a built SPA at `apps/frontend/build/index.html`, `pluginManager.ts` sets `plugin.frontendPath` and Matterbridge automatically mounts, per plugin:
17+
18+
- `/plugins/<pluginName>/*` — static hosting of the plugin's build output.
19+
- `/plugins/<pluginName>/api/:path` — the `onFetch`-backed REST namespace described below (JSON body parsing included).
20+
- `/plugins/<pluginName>/{*splat}` — SPA fallback serving the plugin's own `index.html` for unmatched routes.
21+
22+
A plugin's own frontend should call its own namespace (`/plugins/<pluginName>/api/...`), not the core `/api/...` endpoints.
23+
24+
## The plugin-extensible hook: `onFetch`
25+
26+
The frontend's WebSocket RPC protocol is a fixed dispatch of built-in `/api/...` methods, and it has no plugin extension point. The one method that hands control back to plugin code for a plugin's own frontend is `onFetch`, declared on `MatterbridgePlatform` and meant to be overridden in your platform class.
27+
28+
### `onFetch` — custom plugin REST API
29+
30+
```ts
31+
async onFetch(method: string, path?: string, query?: Record<string, unknown>, body?: unknown): Promise<unknown>
32+
```
33+
34+
Called by the Matterbridge frontend for plugin API requests. Reached via `GET|POST|PUT|PATCH|DELETE /plugins/<pluginName>/api/:path`, mounted automatically for every enabled, error-free plugin.
35+
36+
- `method` — HTTP method.
37+
- `path` — the `:path` route param (e.g. `'devices'`, `'devices/42'`). Typed optional on `onFetch` because the method can be called directly (e.g. in tests) without one; via the real mounted route it is always a defined string, since Express requires `:path` to match at least one segment.
38+
- `query` — query string parameters.
39+
- `body` — request body (`POST`/`PUT`/`PATCH`).
40+
- Return a JSON-serializable value, or `undefined` to respond with **404**.
41+
- A thrown error becomes a **500** `{ error: 'Internal error in plugin <name>' }`.
42+
- `DELETE` responds **204** with no body; every other method responds `res.json(value)`.
43+
- If `plugin.platform` isn't running yet, the frontend returns **503** before calling `onFetch`.
44+
45+
The default base-class implementation logs and returns `undefined` (404) — override it to expose real endpoints.
46+
47+
## Avoid these mistakes
48+
49+
- Do not invent a custom WebSocket method name expecting the frontend to route to it — the WS dispatch is a fixed core method list with no plugin extension point. Use `onFetch` under `/plugins/<pluginName>/api/...` for a plugin's own frontend traffic.
50+
- Do not build a plugin's custom frontend to call core `/api/...` routes — use `/plugins/<pluginName>/api/...`, backed by your own `onFetch`.

.dockerbuild.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "3.10.3",
2+
"version": "3.10.4",
33
"sha": "local",
44
"sha7": "local",
55
"event": "local_script",

0 commit comments

Comments
 (0)