Matrix: polish config docs and setup adapter

This commit is contained in:
Gustavo Madeira Santana
2026-03-30 02:33:20 -04:00
parent fa7d1959eb
commit facdf94b65
2 changed files with 39 additions and 27 deletions

View File

@@ -571,6 +571,45 @@ exec ssh -T gateway-host imsg "$@"
</Accordion>
### Matrix
Matrix is extension-backed and configured under `channels.matrix`.
```json5
{
channels: {
matrix: {
enabled: true,
homeserver: "https://matrix.example.org",
accessToken: "syt_bot_xxx",
proxy: "http://127.0.0.1:7890",
encryption: true,
initialSyncLimit: 20,
defaultAccount: "ops",
accounts: {
ops: {
name: "Ops",
userId: "@ops:example.org",
accessToken: "syt_ops_xxx",
},
alerts: {
userId: "@alerts:example.org",
password: "secret",
proxy: "http://127.0.0.1:7891",
},
},
},
},
}
```
- Token auth uses `accessToken`; password auth uses `userId` + `password`.
- `channels.matrix.proxy` routes Matrix HTTP traffic through an explicit HTTP(S) proxy. Named accounts can override it with `channels.matrix.accounts.<id>.proxy`.
- `channels.matrix.allowPrivateNetwork` allows private/internal homeservers. `proxy` and `allowPrivateNetwork` are independent controls.
- `channels.matrix.defaultAccount` selects the preferred account in multi-account setups.
- Matrix status probes and live directory lookups use the same proxy policy as runtime traffic.
- Full Matrix configuration, targeting rules, and setup examples are documented in [Matrix](/channels/matrix).
### Microsoft Teams
Microsoft Teams is extension-backed and configured under `channels.msteams`.

View File

@@ -4,7 +4,6 @@ import {
prepareScopedSetupConfig,
type ChannelSetupAdapter,
} from "openclaw/plugin-sdk/setup";
import { updateMatrixAccountConfig } from "./matrix/config-update.js";
import { applyMatrixSetupAccountConfig, validateMatrixSetupInput } from "./setup-config.js";
import type { CoreConfig } from "./types.js";
@@ -14,32 +13,6 @@ function resolveMatrixSetupAccountId(params: { accountId?: string; name?: string
return normalizeAccountId(params.accountId?.trim() || params.name?.trim() || DEFAULT_ACCOUNT_ID);
}
export function buildMatrixConfigUpdate(
cfg: CoreConfig,
input: {
homeserver?: string;
allowPrivateNetwork?: boolean;
proxy?: string;
userId?: string;
accessToken?: string;
password?: string;
deviceName?: string;
initialSyncLimit?: number;
},
): CoreConfig {
return updateMatrixAccountConfig(cfg, DEFAULT_ACCOUNT_ID, {
enabled: true,
homeserver: input.homeserver,
allowPrivateNetwork: input.allowPrivateNetwork,
proxy: input.proxy,
userId: input.userId,
accessToken: input.accessToken,
password: input.password,
deviceName: input.deviceName,
initialSyncLimit: input.initialSyncLimit,
});
}
export const matrixSetupAdapter: ChannelSetupAdapter = {
resolveAccountId: ({ accountId, input }) =>
resolveMatrixSetupAccountId({