@openclaw/matrix 2026.9.1-beta.1 → 2026.9.2
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/dist/{account-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
- package/dist/{account-selection-CWuhuFn1.js → account-selection-DA-jfx22.js} +74 -36
- package/dist/{accounts-BCzyubQt.js → accounts-DR1c4xF_.js} +4 -5
- package/dist/api.js +5 -5
- package/dist/{approval-handler.runtime-G9fLHUWe.js → approval-handler.runtime-BJCD4dLf.js} +34 -11
- package/dist/{approval-ids-C6FD3pVY.js → approval-ids-Bst7HM_o.js} +1 -1
- package/dist/{approval-reaction-auth-60xHiDtQ.js → approval-reaction-auth-DhH8QOSe.js} +2 -2
- package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
- package/dist/{channel-CBEvelTE.js → channel-Bs8VLb6q.js} +63 -58
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-CCJRhdH5.js +76 -0
- package/dist/{channel.setup-sWPOGyQG.js → channel.setup-DhmDXwPp.js} +32 -22
- package/dist/{cli-DrTD2a_q.js → cli-IvDUuiDH.js} +179 -135
- package/dist/{cli-metadata-DrYVwQ_r.js → cli-metadata-BGryAl2e.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-hs1ePy2O.js → client-Dj4mcf-s.js} +73 -22
- package/dist/{client-bootstrap-BxdxjCwA.js → client-bootstrap-n1Rqc8Go.js} +1 -1
- package/dist/{client-BUtHbzib.js → client-oNOlldJI.js} +2 -2
- package/dist/{config-update-Bor_Pjsv.js → config-update-BnX26jCO.js} +48 -31
- package/dist/contract-api.js +2 -2
- package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
- package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
- package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
- package/dist/{crypto-runtime-C4WDYxlP.js → crypto-runtime-m1eplj3b.js} +7 -7
- package/dist/crypto-snapshot-doctor.runtime-D0v841D_.js +91 -0
- package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
- package/dist/{directory-live-D0KfJlby.js → directory-live-DLUgWBhA.js} +8 -6
- package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
- package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
- package/dist/doctor-contract-api.js +89 -109
- package/dist/{draft-stream-B_m79Ynb.js → draft-stream-DglwxWzJ.js} +1 -1
- package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-BNcZNQZI.js} +3 -2
- package/dist/helper-api.js +1 -1
- package/dist/{http-client-D8o8b9u6.js → http-client-DOmFvKvB.js} +10 -7
- package/dist/{idb-persistence-DfgW720p.js → idb-persistence-CU7CNLlX.js} +2 -2
- package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
- package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-Dow9EOoJ.js → messages-Czn8lNEh.js} +154 -5
- package/dist/{monitor-DBB47wTy.js → monitor-DouG43FJ.js} +200 -156
- package/dist/outbound-Co_tJyE6.js +220 -0
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-B1YPxG9x.js +2 -0
- package/dist/{profile-update-C61NR24_.js → profile-update-CAl8nZNG.js} +5 -4
- package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
- package/dist/{reaction-events-BZUgLIZI.js → reaction-events-C_7G7bvI.js} +9 -7
- package/dist/{resolve-targets-DXzZwsIY.js → resolve-targets-B64O69Nd.js} +1 -1
- package/dist/{resolver.runtime-p5qJ3Kst.js → resolver.runtime-TRmePJDV.js} +1 -1
- package/dist/{room-info-BXQA7y10.js → room-info-6viLR3NH.js} +55 -1
- package/dist/runtime-api.js +2 -2
- package/dist/{sdk-CljOKEvc.js → sdk-C1yfda1L.js} +534 -26
- package/dist/{send-BKu9Ghi4.js → send-B5XChnvB.js} +31 -33
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-CpE6C3qV.js → setup-bootstrap-S_loyUyM.js} +3 -3
- package/dist/{setup-core-CyvaCOOr.js → setup-core-XkIfQ65J.js} +8 -7
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DtRvRcCT.js → setup-surface-B2yZ8KGc.js} +84 -79
- package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
- package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
- package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/sync-cache-state-d-A_OhbU.js +234 -0
- package/dist/{thread-bindings-BvyU66kE.js → thread-bindings-BkBnn4te.js} +4 -4
- package/dist/{tool-actions.runtime-DD6jUxFK.js → tool-actions.runtime-a5L5xGSP.js} +226 -215
- package/dist/{verification-BP-3-XYn.js → verification-XJtTc5DI.js} +2 -2
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +216 -183
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -1
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +7 -7
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -1
- package/node_modules/markdown-it/dist/markdown-it.cjs.js +98 -106
- package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -1
- package/node_modules/markdown-it/dist/markdown-it.d.mts +42 -71
- package/node_modules/markdown-it/dist/markdown-it.mjs +98 -106
- package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -1
- package/node_modules/markdown-it/package.json +1 -2
- package/node_modules/matrix-js-sdk/lib/client.d.ts +2 -1
- package/node_modules/matrix-js-sdk/lib/client.js +6 -2
- package/node_modules/matrix-js-sdk/lib/sync.js +8 -8
- package/node_modules/matrix-js-sdk/src/client.ts +7 -3
- package/node_modules/matrix-js-sdk/src/sync.ts +8 -8
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
- package/node_modules/typebox/build/system/memory/create.mjs +3 -4
- package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
- package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/node_modules/typebox/build/system/memory/update.mjs +3 -2
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +17 -3
- package/package.json +8 -7
- package/dist/channel.runtime-CiDl9deX.js +0 -276
- package/dist/env-auth-MVS-Vv41.js +0 -64
- package/dist/file-sync-store-DjskBX2o.js +0 -436
- package/dist/media-text-OR9uoC4W.js +0 -153
- package/dist/probe.runtime-CRM7RIrB.js +0 -2
- package/dist/recovery-key-store-CognuDys.js +0 -276
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { o as sendTypingMatrix, r as sendMessageMatrix, v as cleanupMatrixDeliveryPlans, y as reconcileMatrixUnknownSend } from "./send-B5XChnvB.js";
|
|
2
|
+
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
3
|
+
import { l as resolveMatrixAuth } from "./client-Dj4mcf-s.js";
|
|
4
|
+
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DLUgWBhA.js";
|
|
5
|
+
import { t as matrixOutbound } from "./outbound-Co_tJyE6.js";
|
|
6
|
+
import { t as resolveMatrixTargets } from "./resolve-targets-B64O69Nd.js";
|
|
7
|
+
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
8
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
10
|
+
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
11
|
+
//#region extensions/matrix/src/matrix/probe.ts
|
|
12
|
+
const loadMatrixProbeRuntimeDeps = createLazyRuntimeModule(() => import("./probe.runtime-B1YPxG9x.js").then((runtimeModule) => ({ createMatrixClient: runtimeModule.createMatrixClient })));
|
|
13
|
+
async function probeMatrix(params) {
|
|
14
|
+
return await runChannelProbe(void 0, async () => {
|
|
15
|
+
const result = {
|
|
16
|
+
ok: false,
|
|
17
|
+
status: null,
|
|
18
|
+
error: null
|
|
19
|
+
};
|
|
20
|
+
if (isBunRuntime()) return {
|
|
21
|
+
...result,
|
|
22
|
+
error: "Matrix probe requires Node (bun runtime not supported)"
|
|
23
|
+
};
|
|
24
|
+
if (!params.homeserver?.trim()) return {
|
|
25
|
+
...result,
|
|
26
|
+
error: "missing homeserver"
|
|
27
|
+
};
|
|
28
|
+
if (!params.accessToken?.trim()) return {
|
|
29
|
+
...result,
|
|
30
|
+
error: "missing access token"
|
|
31
|
+
};
|
|
32
|
+
const { createMatrixClient } = await loadMatrixProbeRuntimeDeps();
|
|
33
|
+
const inputUserId = normalizeOptionalString(params.userId);
|
|
34
|
+
const userId = await (await createMatrixClient({
|
|
35
|
+
homeserver: params.homeserver,
|
|
36
|
+
userId: void 0,
|
|
37
|
+
accessToken: params.accessToken,
|
|
38
|
+
deviceId: params.deviceId,
|
|
39
|
+
persistStorage: false,
|
|
40
|
+
localTimeoutMs: params.timeoutMs,
|
|
41
|
+
accountId: params.accountId,
|
|
42
|
+
allowPrivateNetwork: params.allowPrivateNetwork,
|
|
43
|
+
ssrfPolicy: params.ssrfPolicy,
|
|
44
|
+
dispatcherPolicy: params.dispatcherPolicy
|
|
45
|
+
})).getUserId();
|
|
46
|
+
if (inputUserId && inputUserId !== userId) return {
|
|
47
|
+
...result,
|
|
48
|
+
error: "Matrix access token user does not match configured userId"
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
...result,
|
|
52
|
+
ok: true,
|
|
53
|
+
userId
|
|
54
|
+
};
|
|
55
|
+
}, (error) => ({
|
|
56
|
+
ok: false,
|
|
57
|
+
status: typeof error === "object" && error && "statusCode" in error ? Number(error.statusCode) : null,
|
|
58
|
+
error: formatErrorMessage(error)
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region extensions/matrix/src/channel.runtime.ts
|
|
63
|
+
const matrixChannelRuntime = {
|
|
64
|
+
cleanupMatrixDeliveryPlans,
|
|
65
|
+
listMatrixDirectoryGroupsLive,
|
|
66
|
+
listMatrixDirectoryPeersLive,
|
|
67
|
+
matrixOutbound,
|
|
68
|
+
probeMatrix,
|
|
69
|
+
resolveMatrixAuth,
|
|
70
|
+
resolveMatrixTargets,
|
|
71
|
+
reconcileMatrixUnknownSend,
|
|
72
|
+
sendMessageMatrix,
|
|
73
|
+
sendTypingMatrix
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { matrixChannelRuntime };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as resolveMatrixAccountConfig } from "./account-config-
|
|
2
|
-
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-
|
|
3
|
-
import { r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-
|
|
1
|
+
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
|
+
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-DR1c4xF_.js";
|
|
3
|
+
import { r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-XkIfQ65J.js";
|
|
4
4
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
5
5
|
import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -50,22 +50,23 @@ function resolveMatrixAllowListMatch(params) {
|
|
|
50
50
|
matchSource: "wildcard"
|
|
51
51
|
};
|
|
52
52
|
const userId = normalizeMatrixUser(params.userId);
|
|
53
|
+
const candidates = [
|
|
54
|
+
{
|
|
55
|
+
value: userId,
|
|
56
|
+
source: "id"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: userId ? `matrix:${userId}` : "",
|
|
60
|
+
source: "prefixed-id"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: userId ? `user:${userId}` : "",
|
|
64
|
+
source: "prefixed-user"
|
|
65
|
+
}
|
|
66
|
+
];
|
|
53
67
|
return resolveAllowlistMatchByCandidates({
|
|
54
68
|
allowList,
|
|
55
|
-
candidates
|
|
56
|
-
{
|
|
57
|
-
value: userId,
|
|
58
|
-
source: "id"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
value: userId ? `matrix:${userId}` : "",
|
|
62
|
-
source: "prefixed-id"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
value: userId ? `user:${userId}` : "",
|
|
66
|
-
source: "prefixed-user"
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
+
candidates
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
//#endregion
|
|
@@ -98,6 +99,10 @@ const matrixConfigAdapter = createScopedChannelConfigAdapter({
|
|
|
98
99
|
//#endregion
|
|
99
100
|
//#region extensions/matrix/src/config-ui-hints.ts
|
|
100
101
|
const matrixChannelConfigUiHints = {
|
|
102
|
+
joinIntro: {
|
|
103
|
+
label: "Matrix Group Join Introduction",
|
|
104
|
+
help: "Post one brief introduction when the bot joins an allowed group room (default: true). Account settings override the channel-wide setting."
|
|
105
|
+
},
|
|
101
106
|
...createChannelConfigUiHints({
|
|
102
107
|
channelLabel: "Matrix",
|
|
103
108
|
mentionPatterns: {
|
|
@@ -221,12 +226,13 @@ function hasCanonicalMatrixAccountStreaming(account) {
|
|
|
221
226
|
const streaming = account.streaming;
|
|
222
227
|
return typeof streaming === "object" && streaming !== null && !Array.isArray(streaming);
|
|
223
228
|
}
|
|
224
|
-
const
|
|
229
|
+
const MatrixConfigSchema = z.object({
|
|
225
230
|
name: z.string().optional(),
|
|
226
231
|
enabled: z.boolean().optional(),
|
|
227
232
|
configWrites: z.boolean().optional(),
|
|
233
|
+
joinIntro: z.boolean().optional(),
|
|
228
234
|
defaultAccount: z.string().optional(),
|
|
229
|
-
accounts: z.record(z.string(), z.
|
|
235
|
+
accounts: z.record(z.string(), z.object({ joinIntro: z.boolean().optional() }).passthrough().refine(hasCanonicalMatrixAccountStreaming, { message: "flat or scalar streaming values are no longer supported; use streaming.* and run \"openclaw doctor --fix\"" })).optional(),
|
|
230
236
|
markdown: MarkdownConfigSchema,
|
|
231
237
|
homeserver: z.string().optional(),
|
|
232
238
|
network: matrixNetworkSchema,
|
|
@@ -294,7 +300,8 @@ const MatrixChannelConfigSchema = buildChannelConfigSchema(z.object({
|
|
|
294
300
|
groups: z.object({}).catchall(matrixRoomSchema).optional(),
|
|
295
301
|
rooms: z.object({}).catchall(matrixRoomSchema).optional(),
|
|
296
302
|
actions: matrixActionSchema
|
|
297
|
-
})
|
|
303
|
+
});
|
|
304
|
+
const MatrixChannelConfigSchema = buildChannelConfigSchema(MatrixConfigSchema, { uiHints: matrixChannelConfigUiHints });
|
|
298
305
|
const matrixPluginBase = {
|
|
299
306
|
id: "matrix",
|
|
300
307
|
meta: {
|
|
@@ -307,7 +314,7 @@ const matrixPluginBase = {
|
|
|
307
314
|
order: 70,
|
|
308
315
|
quickstartAllowFrom: true
|
|
309
316
|
},
|
|
310
|
-
setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-
|
|
317
|
+
setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-B2yZ8KGc.js").then((n) => n.t)).matrixSetupWizard })),
|
|
311
318
|
setupContract: matrixSetupContract,
|
|
312
319
|
capabilities: {
|
|
313
320
|
chatTypes: [
|
|
@@ -320,7 +327,10 @@ const matrixPluginBase = {
|
|
|
320
327
|
threads: true,
|
|
321
328
|
media: true
|
|
322
329
|
},
|
|
323
|
-
reload: {
|
|
330
|
+
reload: {
|
|
331
|
+
configPrefixes: ["channels.matrix"],
|
|
332
|
+
noopPrefixes: ["messages.ackReactionScope"]
|
|
333
|
+
},
|
|
324
334
|
configSchema: MatrixChannelConfigSchema,
|
|
325
335
|
config: {
|
|
326
336
|
...matrixConfigAdapter,
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { a as resolveMatrixAccountConfig } from "./account-config-
|
|
1
|
+
import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
2
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
|
-
import { i as resolveMatrixAccount } from "./accounts-
|
|
4
|
-
import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-
|
|
5
|
-
import { n as matrixSetupAdapter } from "./setup-core-
|
|
6
|
-
import { n as withResolvedActionClient } from "./client-
|
|
7
|
-
import {
|
|
3
|
+
import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
|
|
4
|
+
import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-BnX26jCO.js";
|
|
5
|
+
import { n as matrixSetupAdapter } from "./setup-core-XkIfQ65J.js";
|
|
6
|
+
import { n as withResolvedActionClient } from "./client-oNOlldJI.js";
|
|
7
|
+
import { u as resolveMatrixAuthContext } from "./client-Dj4mcf-s.js";
|
|
8
8
|
import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.js";
|
|
9
9
|
import { i as setMatrixSdkLogMode, r as setMatrixSdkConsoleLogging } from "./logging-DRjvUOIh.js";
|
|
10
10
|
import { n as isOpenClawManagedMatrixDevice, r as summarizeMatrixDeviceHealth } from "./device-health-B4-YXtJR.js";
|
|
11
|
-
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-
|
|
12
|
-
import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-
|
|
11
|
+
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-CAl8nZNG.js";
|
|
12
|
+
import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-XJtTc5DI.js";
|
|
13
13
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
14
14
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
15
15
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
16
16
|
import { parseStrictInteger, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
17
17
|
import { formatZonedTimestamp } from "openclaw/plugin-sdk/time-runtime";
|
|
18
|
+
import { isDeepStrictEqual } from "node:util";
|
|
18
19
|
import { readByteStreamWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
20
|
+
import { getRuntimeConfigSnapshot, getRuntimeConfigSourceSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
19
21
|
//#region extensions/matrix/src/cli-shared.ts
|
|
20
22
|
let matrixCliExitScheduled = false;
|
|
21
|
-
const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES =
|
|
23
|
+
const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES = 1048576;
|
|
22
24
|
function scheduleMatrixCliExit() {
|
|
23
25
|
if (matrixCliExitScheduled || process.env.VITEST) return;
|
|
24
26
|
matrixCliExitScheduled = true;
|
|
@@ -73,6 +75,31 @@ function resolveMatrixCliAccountContext(accountId) {
|
|
|
73
75
|
cfg
|
|
74
76
|
};
|
|
75
77
|
}
|
|
78
|
+
function createMatrixCliAccountConfigPublisher({ accountId, previousCfg }) {
|
|
79
|
+
const configApi = getMatrixRuntime().config;
|
|
80
|
+
const pairedSource = getRuntimeConfigSnapshot() === previousCfg ? getRuntimeConfigSourceSnapshot() : null;
|
|
81
|
+
const comparisonBase = pairedSource ? "sourceConfig" : "runtimeConfig";
|
|
82
|
+
const comparisonCfg = pairedSource ?? previousCfg;
|
|
83
|
+
const expectedChannelEnabled = comparisonCfg.channels?.matrix?.enabled !== false;
|
|
84
|
+
const expectedExists = hasExplicitMatrixAccountConfig(comparisonCfg, accountId);
|
|
85
|
+
const expectedAccount = structuredClone(resolveMatrixAccountConfig({
|
|
86
|
+
cfg: comparisonCfg,
|
|
87
|
+
accountId
|
|
88
|
+
}));
|
|
89
|
+
return async (update) => {
|
|
90
|
+
await configApi.mutateConfigFile({
|
|
91
|
+
afterWrite: { mode: "auto" },
|
|
92
|
+
mutate: (draft, { snapshot }) => {
|
|
93
|
+
const current = snapshot[comparisonBase];
|
|
94
|
+
if (current.channels?.matrix?.enabled !== false !== expectedChannelEnabled || hasExplicitMatrixAccountConfig(current, accountId) !== expectedExists || !isDeepStrictEqual(resolveMatrixAccountConfig({
|
|
95
|
+
cfg: current,
|
|
96
|
+
accountId
|
|
97
|
+
}), expectedAccount)) throw new Error(`Matrix account "${accountId}" changed during setup; review its configuration and run the setup command again.`);
|
|
98
|
+
draft.channels = update(draft).channels;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
}
|
|
76
103
|
function formatMatrixCliCommand(command, accountId) {
|
|
77
104
|
return formatMatrixCliCommandParts(command.split(" "), accountId);
|
|
78
105
|
}
|
|
@@ -292,10 +319,12 @@ function printBackupSummary(backup) {
|
|
|
292
319
|
function buildVerificationGuidance(status, accountId) {
|
|
293
320
|
const backup = resolveBackupStatus(status);
|
|
294
321
|
const nextSteps = /* @__PURE__ */ new Set();
|
|
295
|
-
if (!status.verified)
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
322
|
+
if (!status.verified) {
|
|
323
|
+
if (status.recoveryKeyAccepted === true && status.backupUsable === true) {
|
|
324
|
+
nextSteps.add(`Recovery key can unlock the room-key backup, but full Matrix identity trust is still incomplete. Run ${formatMatrixCliCommand("verify self", accountId)}, accept the request in another verified Matrix client, and confirm the SAS only if it matches.`);
|
|
325
|
+
nextSteps.add(`If you intend to replace the current cross-signing identity, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify bootstrap --recovery-key-stdin --force-reset-cross-signing", accountId)}.`);
|
|
326
|
+
} else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify device --recovery-key-stdin", accountId)}. If you do not have the recovery key but still have another verified Matrix client, run ${formatMatrixCliCommand("verify self", accountId)} instead.`);
|
|
327
|
+
}
|
|
299
328
|
if (status.serverDeviceKnown === false) nextSteps.add(`This Matrix device is no longer listed on the homeserver. Create a new OpenClaw Matrix device with ${formatMatrixCliCommand("account add --homeserver <url> --user-id <@user:server> --password <password> --device-name OpenClaw-Gateway", accountId)}. If you use token auth, create a fresh Matrix access token in your Matrix client or admin UI, then run ${formatMatrixCliCommand("account add --homeserver <url> --access-token <token>", accountId)}.`);
|
|
300
329
|
for (const step of buildBackupGuidance(backup, accountId, { recoveryKeyStored: status.recoveryKeyStored })) nextSteps.add(step);
|
|
301
330
|
if (status.pendingVerifications > 0) nextSteps.add(`Review pending verification requests with ${formatMatrixCliCommand("verify list", accountId)}. Complete each active request with ${formatMatrixCliCommand("verify sas <id>", accountId)} and ${formatMatrixCliCommand("verify confirm-sas <id>", accountId)}, or cancel stale requests with ${formatMatrixCliCommand("verify cancel <id>", accountId)}.`);
|
|
@@ -305,9 +334,10 @@ function buildBackupGuidance(backup, accountId, options = {}) {
|
|
|
305
334
|
const backupIssue = resolveMatrixRoomKeyBackupIssue(backup);
|
|
306
335
|
const nextSteps = /* @__PURE__ */ new Set();
|
|
307
336
|
if (backupIssue.code === "missing-server-backup") nextSteps.add(`Run ${formatMatrixCliCommand("verify bootstrap", accountId)} to create a room key backup.`);
|
|
308
|
-
else if (backupIssue.code === "key-load-failed" || backupIssue.code === "key-not-loaded" || backupIssue.code === "inactive")
|
|
309
|
-
|
|
310
|
-
|
|
337
|
+
else if (backupIssue.code === "key-load-failed" || backupIssue.code === "key-not-loaded" || backupIssue.code === "inactive") {
|
|
338
|
+
if (options.recoveryKeyStored) nextSteps.add(`Backup key is not loaded on this device. Run ${formatMatrixCliCommand("verify backup restore", accountId)} to load it and restore old room keys. If restore still cannot load the key, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
|
|
339
|
+
else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)} to load the server backup and store the key for future restores.`);
|
|
340
|
+
} else if (backupIssue.code === "key-mismatch") {
|
|
311
341
|
nextSteps.add(`Backup key mismatch on this device. Run the shown printf pipeline with the active server backup recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
|
|
312
342
|
nextSteps.add(`If you want a fresh backup baseline and accept losing unrecoverable history, run ${formatMatrixCliCommand("verify backup reset --yes", accountId)}. Add --rotate-recovery-key only when the old recovery key should stop unlocking the fresh backup.`);
|
|
313
343
|
} else if (backupIssue.code === "untrusted-signature") {
|
|
@@ -325,19 +355,21 @@ function printGuidance(lines) {
|
|
|
325
355
|
function printVerificationStatus(status, verbose = false, accountId) {
|
|
326
356
|
console.log(`Verified by owner: ${status.verified ? "yes" : "no"}`);
|
|
327
357
|
if (status.serverDeviceKnown === false) console.log("Device issue: current Matrix device is missing from the homeserver device list");
|
|
328
|
-
const
|
|
358
|
+
const backup = resolveBackupStatus(status);
|
|
359
|
+
const backupIssue = resolveMatrixRoomKeyBackupIssue(backup);
|
|
329
360
|
printVerificationBackupSummary(status);
|
|
330
361
|
if (backupIssue.message) console.log(`Backup issue: ${backupIssue.message}`);
|
|
362
|
+
console.log(`Recovery key stored: ${status.recoveryKeyStored ? "yes" : "no"}`);
|
|
363
|
+
if (status.recoveryKey) console.log("Recovery key: available (re-run with --json to include the raw key value in output)");
|
|
331
364
|
if (verbose) {
|
|
332
365
|
console.log("Diagnostics:");
|
|
333
366
|
printVerificationIdentity(status);
|
|
334
367
|
if (status.serverDeviceKnown !== void 0) console.log(`Device present on server: ${yesNoUnknown(status.serverDeviceKnown ?? null)}`);
|
|
335
368
|
printVerificationTrustDiagnostics(status);
|
|
336
369
|
printVerificationBackupStatus(status);
|
|
337
|
-
console.log(`Recovery key stored: ${status.recoveryKeyStored ? "yes" : "no"}`);
|
|
338
370
|
printTimestamp("Recovery key created at", status.recoveryKeyCreatedAt);
|
|
339
371
|
console.log(`Pending verifications: ${status.pendingVerifications}`);
|
|
340
|
-
}
|
|
372
|
+
}
|
|
341
373
|
printVerificationGuidance(status, accountId);
|
|
342
374
|
}
|
|
343
375
|
//#endregion
|
|
@@ -364,8 +396,7 @@ async function pruneMatrixStaleGatewayDevices(opts = {}) {
|
|
|
364
396
|
//#region extensions/matrix/src/cli-account.ts
|
|
365
397
|
async function addMatrixAccount(params) {
|
|
366
398
|
const initialSyncLimit = parseOptionalInt(params.initialSyncLimit, "--initial-sync-limit", { min: 0 });
|
|
367
|
-
const
|
|
368
|
-
const cfg = runtime.config.current();
|
|
399
|
+
const cfg = getMatrixRuntime().config.current();
|
|
369
400
|
if (!matrixSetupAdapter.applyAccountConfig) throw new Error("Matrix account setup is unavailable.");
|
|
370
401
|
const input = {
|
|
371
402
|
name: params.name,
|
|
@@ -391,102 +422,108 @@ async function addMatrixAccount(params) {
|
|
|
391
422
|
input
|
|
392
423
|
});
|
|
393
424
|
if (validationError) throw new Error(validationError);
|
|
394
|
-
|
|
395
|
-
cfg,
|
|
425
|
+
const publishConfig = createMatrixCliAccountConfigPublisher({
|
|
396
426
|
accountId,
|
|
397
|
-
|
|
398
|
-
});
|
|
399
|
-
if (params.enableEncryption === true) updated = updateMatrixAccountConfig(updated, accountId, { encryption: true });
|
|
400
|
-
await runtime.config.replaceConfigFile({
|
|
401
|
-
nextConfig: updated,
|
|
402
|
-
afterWrite: { mode: "auto" }
|
|
427
|
+
previousCfg: cfg
|
|
403
428
|
});
|
|
429
|
+
const applyAccountConfig = (current) => {
|
|
430
|
+
const next = matrixSetupAdapter.applyAccountConfig({
|
|
431
|
+
cfg: current,
|
|
432
|
+
accountId,
|
|
433
|
+
input
|
|
434
|
+
});
|
|
435
|
+
return params.enableEncryption === true ? updateMatrixAccountConfig(next, accountId, { encryption: true }) : next;
|
|
436
|
+
};
|
|
437
|
+
let updated = applyAccountConfig(cfg);
|
|
438
|
+
let convertedAvatarUrl;
|
|
404
439
|
const accountConfig = resolveMatrixAccountConfig({
|
|
405
440
|
cfg: updated,
|
|
406
441
|
accountId
|
|
407
442
|
});
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
422
|
-
const desiredDisplayName = input.name?.trim();
|
|
423
|
-
const desiredAvatarUrl = input.avatarUrl?.trim();
|
|
424
|
-
let profile = {
|
|
425
|
-
attempted: false,
|
|
426
|
-
displayNameUpdated: false,
|
|
427
|
-
avatarUpdated: false,
|
|
428
|
-
resolvedAvatarUrl: null,
|
|
429
|
-
convertedAvatarFromHttp: false
|
|
430
|
-
};
|
|
431
|
-
if (desiredDisplayName || desiredAvatarUrl) try {
|
|
432
|
-
const synced = await updateMatrixOwnProfile({
|
|
433
|
-
cfg: updated,
|
|
434
|
-
accountId,
|
|
435
|
-
displayName: desiredDisplayName,
|
|
436
|
-
avatarUrl: desiredAvatarUrl
|
|
437
|
-
});
|
|
438
|
-
let resolvedAvatarUrl = synced.resolvedAvatarUrl;
|
|
439
|
-
if (synced.convertedAvatarFromHttp && synced.resolvedAvatarUrl) {
|
|
440
|
-
const withAvatar = updateMatrixAccountConfig(runtime.config.current(), accountId, { avatarUrl: synced.resolvedAvatarUrl });
|
|
441
|
-
await runtime.config.replaceConfigFile({
|
|
442
|
-
nextConfig: withAvatar,
|
|
443
|
-
afterWrite: { mode: "auto" }
|
|
443
|
+
try {
|
|
444
|
+
let verificationBootstrap = {
|
|
445
|
+
attempted: false,
|
|
446
|
+
success: false,
|
|
447
|
+
recoveryKeyCreatedAt: null,
|
|
448
|
+
backupVersion: null
|
|
449
|
+
};
|
|
450
|
+
if (accountConfig.encryption === true) {
|
|
451
|
+
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-S_loyUyM.js");
|
|
452
|
+
verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
|
|
453
|
+
previousCfg: cfg,
|
|
454
|
+
cfg: updated,
|
|
455
|
+
accountId
|
|
444
456
|
});
|
|
445
|
-
resolvedAvatarUrl = synced.resolvedAvatarUrl;
|
|
446
457
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
resolvedAvatarUrl,
|
|
452
|
-
convertedAvatarFromHttp: synced.convertedAvatarFromHttp
|
|
453
|
-
};
|
|
454
|
-
} catch (err) {
|
|
455
|
-
profile = {
|
|
456
|
-
attempted: true,
|
|
458
|
+
const desiredDisplayName = input.name?.trim();
|
|
459
|
+
const desiredAvatarUrl = input.avatarUrl?.trim();
|
|
460
|
+
let profile = {
|
|
461
|
+
attempted: false,
|
|
457
462
|
displayNameUpdated: false,
|
|
458
463
|
avatarUpdated: false,
|
|
459
464
|
resolvedAvatarUrl: null,
|
|
460
|
-
convertedAvatarFromHttp: false
|
|
461
|
-
error: formatErrorMessage(err)
|
|
465
|
+
convertedAvatarFromHttp: false
|
|
462
466
|
};
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
+
if (desiredDisplayName || desiredAvatarUrl) try {
|
|
468
|
+
const synced = await updateMatrixOwnProfile({
|
|
469
|
+
cfg: updated,
|
|
470
|
+
accountId,
|
|
471
|
+
displayName: desiredDisplayName,
|
|
472
|
+
avatarUrl: desiredAvatarUrl
|
|
473
|
+
});
|
|
474
|
+
if (synced.convertedAvatarFromHttp && synced.resolvedAvatarUrl) {
|
|
475
|
+
convertedAvatarUrl = synced.resolvedAvatarUrl;
|
|
476
|
+
updated = updateMatrixAccountConfig(updated, accountId, { avatarUrl: synced.resolvedAvatarUrl });
|
|
477
|
+
}
|
|
478
|
+
profile = {
|
|
479
|
+
attempted: true,
|
|
480
|
+
displayNameUpdated: synced.displayNameUpdated,
|
|
481
|
+
avatarUpdated: synced.avatarUpdated,
|
|
482
|
+
resolvedAvatarUrl: synced.resolvedAvatarUrl,
|
|
483
|
+
convertedAvatarFromHttp: synced.convertedAvatarFromHttp
|
|
484
|
+
};
|
|
485
|
+
} catch (err) {
|
|
486
|
+
profile = {
|
|
487
|
+
attempted: true,
|
|
488
|
+
displayNameUpdated: false,
|
|
489
|
+
avatarUpdated: false,
|
|
490
|
+
resolvedAvatarUrl: null,
|
|
491
|
+
convertedAvatarFromHttp: false,
|
|
492
|
+
error: formatErrorMessage(err)
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
let deviceHealth;
|
|
496
|
+
try {
|
|
497
|
+
const addedDevices = await listMatrixOwnDevices({
|
|
498
|
+
accountId,
|
|
499
|
+
cfg: updated
|
|
500
|
+
});
|
|
501
|
+
deviceHealth = {
|
|
502
|
+
currentDeviceId: addedDevices.find((device) => device.current)?.deviceId ?? null,
|
|
503
|
+
staleOpenClawDeviceIds: addedDevices.filter((device) => !device.current && isOpenClawManagedMatrixDevice(device.displayName)).map((device) => device.deviceId)
|
|
504
|
+
};
|
|
505
|
+
} catch (err) {
|
|
506
|
+
deviceHealth = {
|
|
507
|
+
currentDeviceId: null,
|
|
508
|
+
staleOpenClawDeviceIds: [],
|
|
509
|
+
error: formatErrorMessage(err)
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
return {
|
|
467
513
|
accountId,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
} catch (err) {
|
|
475
|
-
deviceHealth = {
|
|
476
|
-
currentDeviceId: null,
|
|
477
|
-
staleOpenClawDeviceIds: [],
|
|
478
|
-
error: formatErrorMessage(err)
|
|
514
|
+
configPath: resolveMatrixConfigPath(updated, accountId),
|
|
515
|
+
useEnv: input.useEnv === true,
|
|
516
|
+
encryptionEnabled: accountConfig.encryption === true,
|
|
517
|
+
deviceHealth,
|
|
518
|
+
verificationBootstrap,
|
|
519
|
+
profile
|
|
479
520
|
};
|
|
521
|
+
} finally {
|
|
522
|
+
await publishConfig((current) => {
|
|
523
|
+
const next = applyAccountConfig(current);
|
|
524
|
+
return convertedAvatarUrl ? updateMatrixAccountConfig(next, accountId, { avatarUrl: convertedAvatarUrl }) : next;
|
|
525
|
+
});
|
|
480
526
|
}
|
|
481
|
-
return {
|
|
482
|
-
accountId,
|
|
483
|
-
configPath: resolveMatrixConfigPath(updated, accountId),
|
|
484
|
-
useEnv: input.useEnv === true,
|
|
485
|
-
encryptionEnabled: accountConfig.encryption === true,
|
|
486
|
-
deviceHealth,
|
|
487
|
-
verificationBootstrap,
|
|
488
|
-
profile
|
|
489
|
-
};
|
|
490
527
|
}
|
|
491
528
|
function registerMatrixAccountCommands(root) {
|
|
492
529
|
root.command("account").description("Manage matrix channel accounts").command("add").description("Add or update a matrix account (wrapper around channel setup)").option("--account <id>", "Account ID (default: normalized --name, else default)").option("--name <name>", "Optional display name for this account").option("--avatar-url <url>", "Optional Matrix avatar URL (mxc:// or http(s) URL)").option("--homeserver <url>", "Matrix homeserver URL").option("--proxy <url>", "Optional HTTP(S) proxy URL for Matrix requests").option("--allow-private-network", "Allow Matrix homeserver traffic to private/internal hosts for this account").option("--user-id <id>", "Matrix user ID").option("--access-token <token>", "Matrix access token").option("--password <password>", "Matrix password").option("--device-name <name>", "Matrix device display name").option("--initial-sync-limit <n>", "Matrix initial sync limit").option("--enable-e2ee", "Enable Matrix end-to-end encryption and bootstrap verification").option("--encryption", "Alias for --enable-e2ee").option("--use-env", "Use MATRIX_* env vars (or MATRIX_<ACCOUNT_ID>_* for non-default accounts)").option("--verbose", "Show setup details").option("--json", "Output as JSON").action(async (options) => {
|
|
@@ -513,20 +550,24 @@ function registerMatrixAccountCommands(root) {
|
|
|
513
550
|
console.log(`Config path: ${formatMatrixCliText(result.configPath)}`);
|
|
514
551
|
console.log(`Credentials source: ${result.useEnv ? "MATRIX_* / MATRIX_<ACCOUNT_ID>_* env vars" : "inline config"}`);
|
|
515
552
|
console.log(`Encryption: ${result.encryptionEnabled ? "enabled" : "disabled"}`);
|
|
516
|
-
if (result.verificationBootstrap.attempted)
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
553
|
+
if (result.verificationBootstrap.attempted) {
|
|
554
|
+
if (result.verificationBootstrap.success) {
|
|
555
|
+
console.log("Matrix verification bootstrap: complete");
|
|
556
|
+
printTimestamp("Recovery key created at", result.verificationBootstrap.recoveryKeyCreatedAt);
|
|
557
|
+
if (result.verificationBootstrap.backupVersion) console.log(`Backup version: ${formatMatrixCliText(result.verificationBootstrap.backupVersion)}`);
|
|
558
|
+
} else console.error(`Matrix verification bootstrap warning: ${formatMatrixCliText(result.verificationBootstrap.error)}`);
|
|
559
|
+
}
|
|
521
560
|
if (result.deviceHealth.error) console.error(`Matrix device health warning: ${formatMatrixCliText(result.deviceHealth.error)}`);
|
|
522
561
|
else if (result.deviceHealth.staleOpenClawDeviceIds.length > 0) {
|
|
523
562
|
const staleDeviceIds = result.deviceHealth.staleOpenClawDeviceIds.map((deviceId) => formatMatrixCliText(deviceId)).join(", ");
|
|
524
563
|
console.log(`Matrix device hygiene warning: stale OpenClaw devices detected (${staleDeviceIds}). Run ${formatMatrixCliCommand("devices prune-stale", result.accountId)}.`);
|
|
525
564
|
}
|
|
526
|
-
if (result.profile.attempted)
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
565
|
+
if (result.profile.attempted) {
|
|
566
|
+
if (result.profile.error) console.error(`Profile sync warning: ${formatMatrixCliText(result.profile.error)}`);
|
|
567
|
+
else {
|
|
568
|
+
console.log(`Profile sync: name ${result.profile.displayNameUpdated ? "updated" : "unchanged"}, avatar ${result.profile.avatarUpdated ? "updated" : "unchanged"}`);
|
|
569
|
+
if (result.profile.convertedAvatarFromHttp && result.profile.resolvedAvatarUrl) console.log(`Avatar converted and saved as: ${formatMatrixCliText(result.profile.resolvedAvatarUrl)}`);
|
|
570
|
+
}
|
|
530
571
|
}
|
|
531
572
|
const bindHint = `openclaw agents bind --agent <id> --bind matrix:${result.accountId}`;
|
|
532
573
|
console.log(`Bind this account to an agent: ${bindHint}`);
|
|
@@ -595,8 +636,8 @@ function registerMatrixDeviceCommands(root) {
|
|
|
595
636
|
}
|
|
596
637
|
//#endregion
|
|
597
638
|
//#region extensions/matrix/src/cli-direct.ts
|
|
598
|
-
const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-
|
|
599
|
-
const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-
|
|
639
|
+
const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-oNOlldJI.js").then((n) => n.t));
|
|
640
|
+
const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-B5XChnvB.js").then((n) => n.x));
|
|
600
641
|
function printDirectRoomCandidate(room) {
|
|
601
642
|
const members = room.joinedMembers === null ? "unavailable" : room.joinedMembers.map((member) => formatMatrixCliText(member)).join(", ") || "none";
|
|
602
643
|
console.log(`- ${formatMatrixCliText(room.roomId)} [${room.source}] strict=${room.strict ? "yes" : "no"} joined=${members}`);
|
|
@@ -740,8 +781,11 @@ function buildNoopMatrixVerificationBootstrap(status) {
|
|
|
740
781
|
};
|
|
741
782
|
}
|
|
742
783
|
async function setupMatrixEncryption(params) {
|
|
743
|
-
const runtime = getMatrixRuntime();
|
|
744
784
|
const { accountId, cfg } = resolveMatrixCliAccountContext(params.account);
|
|
785
|
+
const publishConfig = createMatrixCliAccountConfigPublisher({
|
|
786
|
+
accountId,
|
|
787
|
+
previousCfg: cfg
|
|
788
|
+
});
|
|
745
789
|
if (!resolveMatrixAccount({
|
|
746
790
|
cfg,
|
|
747
791
|
accountId
|
|
@@ -751,10 +795,6 @@ async function setupMatrixEncryption(params) {
|
|
|
751
795
|
accountId
|
|
752
796
|
}).encryption !== true;
|
|
753
797
|
const updated = encryptionChanged ? updateMatrixAccountConfig(cfg, accountId, { encryption: true }) : cfg;
|
|
754
|
-
if (encryptionChanged) await runtime.config.replaceConfigFile({
|
|
755
|
-
nextConfig: updated,
|
|
756
|
-
afterWrite: { mode: "auto" }
|
|
757
|
-
});
|
|
758
798
|
const existingStatus = !encryptionChanged && !params.recoveryKey && params.forceResetCrossSigning !== true ? await getMatrixVerificationStatus({
|
|
759
799
|
accountId,
|
|
760
800
|
cfg: updated,
|
|
@@ -767,23 +807,27 @@ async function setupMatrixEncryption(params) {
|
|
|
767
807
|
bootstrap: buildNoopMatrixVerificationBootstrap(existingStatus),
|
|
768
808
|
status: existingStatus
|
|
769
809
|
};
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
810
|
+
try {
|
|
811
|
+
const bootstrap = await bootstrapMatrixVerification({
|
|
812
|
+
accountId,
|
|
813
|
+
cfg: updated,
|
|
814
|
+
recoveryKey: params.recoveryKey,
|
|
815
|
+
forceResetCrossSigning: params.forceResetCrossSigning === true
|
|
816
|
+
});
|
|
817
|
+
const status = await getMatrixVerificationStatus({
|
|
818
|
+
accountId,
|
|
819
|
+
cfg: updated
|
|
820
|
+
});
|
|
821
|
+
return {
|
|
822
|
+
accountId,
|
|
823
|
+
configPath: resolveMatrixConfigPath(updated, accountId),
|
|
824
|
+
encryptionChanged,
|
|
825
|
+
bootstrap,
|
|
826
|
+
status
|
|
827
|
+
};
|
|
828
|
+
} finally {
|
|
829
|
+
if (encryptionChanged) await publishConfig((current) => updateMatrixAccountConfig(current, accountId, { encryption: true }));
|
|
830
|
+
}
|
|
787
831
|
}
|
|
788
832
|
function printMatrixEncryptionSetupResult(result, verbose = false) {
|
|
789
833
|
printAccountLabel(result.accountId);
|
|
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
|
2
2
|
//#region extensions/matrix/src/cli-metadata.ts
|
|
3
3
|
function registerMatrixCliMetadata(api) {
|
|
4
4
|
api.registerCli(async ({ program }) => {
|
|
5
|
-
const { registerMatrixCli } = await import("./cli-
|
|
5
|
+
const { registerMatrixCli } = await import("./cli-IvDUuiDH.js");
|
|
6
6
|
registerMatrixCli({ program });
|
|
7
7
|
}, { descriptors: [{
|
|
8
8
|
name: "matrix",
|
package/dist/cli-metadata.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as registerMatrixCliMetadata, t as cli_metadata_default } from "./cli-metadata-
|
|
1
|
+
import { n as registerMatrixCliMetadata, t as cli_metadata_default } from "./cli-metadata-BGryAl2e.js";
|
|
2
2
|
export { cli_metadata_default as default, registerMatrixCliMetadata };
|