@openclaw/matrix 2026.7.2-beta.7 → 2026.8.1-beta.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-selection-kqquRzCf.js → account-selection-CWuhuFn1.js} +7 -8
- package/dist/{accounts-DfngqebB.js → accounts-BCzyubQt.js} +3 -3
- package/dist/api.js +7 -10
- package/dist/{approval-handler.runtime-DSeaIsGa.js → approval-handler.runtime-CJXCUdRg.js} +5 -5
- package/dist/{approval-ids-BdJGPAJT.js → approval-ids-7rf7etWE.js} +1 -1
- package/dist/{approval-reaction-auth-BjOpELxu.js → approval-reaction-auth-wBwbEDpZ.js} +2 -2
- package/dist/{approval-reactions-D-BxBK_L.js → approval-reactions-tXh9KYrW.js} +2 -8
- package/dist/auth-presence.js +2 -2
- package/dist/{channel-vj788dNZ.js → channel-VSrHgTON.js} +156 -136
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-CLoF2S9T.js → channel.runtime-pOOL0uT_.js} +70 -56
- package/dist/{config-schema-Djxw3C6b.js → channel.setup-PpxRP9Du.js} +50 -3
- package/dist/{cli-DMqfDE-q.js → cli-CkTfKC_c.js} +16 -16
- package/dist/{cli-metadata-C7D53SND.js → cli-metadata-B1d1aGM5.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-CeGw0G5S.js +784 -0
- package/dist/{client-bootstrap-XsIkHNt0.js → client-bootstrap-BFwT_2VT.js} +25 -61
- package/dist/{client-6eRENr7k.js → client-sJesKQmp.js} +4 -4
- package/dist/client-support-DLj4vDeu.js +93 -0
- package/dist/config-update-Bor_Pjsv.js +150 -0
- package/dist/contract-api.js +2 -2
- package/dist/{credentials-W2EmwRhu.js → credentials-BdAaWuiR.js} +2 -1
- package/dist/credentials-read-B37cQknZ.js +51 -0
- package/dist/credentials-state-B3cuUFwZ.js +27 -0
- package/dist/{credentials-write.runtime-Be9zNSUw.js → credentials-write.runtime-nAV2-5uR.js} +1 -1
- package/dist/{crypto-runtime-D9_6J5tZ.js → crypto-runtime-Bnz3zEcS.js} +55 -32
- package/dist/direct-room-RinHjtqX.js +71 -0
- package/dist/{directory-live-C8dVBiCc.js → directory-live-Bvg2wAnR.js} +1 -2
- package/dist/{doctor-CM8ijNpW.js → doctor-EWf9CDso.js} +2 -2
- package/dist/{doctor-contract-BMSJkkAE.js → doctor-contract-DEt4O4Zt.js} +2 -3
- package/dist/doctor-contract-api.js +202 -90
- package/dist/{draft-stream-CtvOXq0Z.js → draft-stream-BRi7PRRS.js} +20 -23
- package/dist/{encryption-guidance-CbEFe38F.js → encryption-guidance-DmLY8NiO.js} +1 -1
- package/dist/{env-auth-CQsYbz-p.js → env-auth-MVS-Vv41.js} +4 -3
- package/dist/{env-vars-B0NxQnPk.js → env-vars-dGqak9dN.js} +1 -1
- package/dist/{errors-C47hvAF8.js → errors-DKVS3_DO.js} +2 -5
- package/dist/{file-sync-store-DiiFsayX.js → file-sync-store-DjskBX2o.js} +24 -3
- package/dist/helper-api.js +2 -2
- package/dist/{idb-persistence-B6x7dMsF.js → idb-persistence-BM0P27Zg.js} +3 -2
- package/dist/{inbound-dedupe-CaBLblef.js → inbound-dedupe-RvSLqdsz.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{logger-D0GCSDQq.js → logger-B_71hN6W.js} +1 -1
- package/dist/{logging-DV-p52N0.js → logging-DRjvUOIh.js} +1 -1
- package/dist/{media-text-BTwzADS_.js → media-text-JudlYOSc.js} +1 -1
- package/dist/{messages-DxQJkhxs.js → messages-BW0s-6Y9.js} +7 -7
- package/dist/{monitor-VyWlSLwo.js → monitor-Ddfc-vjX.js} +394 -384
- package/dist/plugin-entry.handlers.runtime.js +3 -3
- package/dist/probe.runtime-Dr91B_X3.js +2 -0
- package/dist/profile-D-Wubo0A.js +108 -0
- package/dist/{profile-update-CffmyW_4.js → profile-update-BkgWYDIp.js} +3 -2
- package/dist/{reaction-events-B00WSi98.js → reaction-events-nfUbFLdV.js} +9 -6
- package/dist/{recovery-key-store-BNnHvXdk.js → recovery-key-store-CognuDys.js} +5 -4
- package/dist/{resolve-targets-nm2L48sh.js → resolve-targets-BJAPY4Vb.js} +1 -1
- package/dist/{resolver.runtime-DS6uPaEe.js → resolver.runtime-LWJELYq5.js} +1 -1
- package/dist/{room-info-CAFZ3Z9J.js → room-info-BXQA7y10.js} +12 -3
- package/dist/runtime-api.js +6 -3
- package/dist/{sdk-bUytQHx7.js → sdk-DjaQFCHc.js} +229 -120
- package/dist/{secret-contract-M3hRmGO-.js → secret-contract-CufozuyJ.js} +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/{send-BldGYG8g.js → send-ZDLU4JTk.js} +1462 -1196
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-Deleiibz.js → setup-bootstrap-BaXkhgJg.js} +4 -4
- package/dist/{setup-core-BVfBv2ai.js → setup-core-DQn6b5vi.js} +17 -266
- package/dist/setup-plugin-api.js +1 -44
- package/dist/{setup-surface-BBq3WeqX.js → setup-surface-DlhJdrNI.js} +9 -11
- package/dist/{startup-verification-wm3_i88s.js → startup-verification-Cs08ca8u.js} +3 -3
- package/dist/{storage-BvAkgzvT.js → storage-BsGuHngK.js} +3 -3
- package/dist/{thread-bindings-DGbl3vDW.js → thread-bindings-CcHZP3w2.js} +7 -4
- package/dist/{tool-actions.runtime-uu9blSqO.js → tool-actions.runtime-DmdRL0bN.js} +35 -18
- package/dist/{verification-DYMQ1QpI.js → verification-C7ig-bQE.js} +2 -2
- package/openclaw.plugin.json +54 -1
- package/package.json +4 -4
- package/dist/active-client-DXvz2gCo.js +0 -20
- package/dist/client-Dbso3-0V.js +0 -30
- package/dist/create-client-BmSU-q-D.js +0 -61
- package/dist/credentials-read-DVmFCm7X.js +0 -77
- package/dist/exec-approval-resolver-BCgqRtZS.js +0 -16
- package/dist/preflight-audio.runtime-BZxxQsxY.js +0 -11
- package/dist/probe.runtime-BuieqmS3.js +0 -3
- package/dist/record-shared-CWWx6fvI.js +0 -2
- package/dist/shared-CUMWxcMz.js +0 -673
- package/dist/sync-state-CWbp0QSY.js +0 -12
- package/dist/{runtime-api-D1xI_cvh.js → runtime-api-BGO16Fu8.js} +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { r as setMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
2
|
import { s as resetMatrixThreadBindingsForTests } from "./thread-bindings-shared-CKnY4LSd.js";
|
|
3
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
3
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-CcHZP3w2.js";
|
|
4
4
|
export { createMatrixThreadBindingManager, resetMatrixThreadBindingsForTests, setMatrixRuntime };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
|
|
2
|
-
import "./accounts-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import "./accounts-BCzyubQt.js";
|
|
3
|
+
import { n as bootstrapMatrixVerification } from "./verification-C7ig-bQE.js";
|
|
4
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
//#region extensions/matrix/src/setup-bootstrap.ts
|
|
6
6
|
async function maybeBootstrapNewEncryptedMatrixAccount(params) {
|
|
7
7
|
const accountConfig = resolveMatrixAccountConfig({
|
|
@@ -36,7 +36,7 @@ async function maybeBootstrapNewEncryptedMatrixAccount(params) {
|
|
|
36
36
|
success: false,
|
|
37
37
|
recoveryKeyCreatedAt: null,
|
|
38
38
|
backupVersion: null,
|
|
39
|
-
error:
|
|
39
|
+
error: formatErrorMessage(err)
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/routing";
|
|
1
|
+
import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
|
|
2
|
+
import { n as resolveMatrixEnvAuthReadiness } from "./env-auth-MVS-Vv41.js";
|
|
3
|
+
import { r as resolveDefaultMatrixAccountId } from "./accounts-BCzyubQt.js";
|
|
4
|
+
import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
|
|
5
|
+
import { r as updateMatrixAccountConfig } from "./config-update-Bor_Pjsv.js";
|
|
6
|
+
import { t as isSupportedMatrixAvatarSource } from "./profile-D-Wubo0A.js";
|
|
7
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
8
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
10
|
-
import { DEFAULT_ACCOUNT_ID
|
|
11
|
-
import {
|
|
12
|
-
import { coerceSecretRef } from "openclaw/plugin-sdk/secret-ref-runtime";
|
|
9
|
+
import { DEFAULT_ACCOUNT_ID, addWildcardAllowFrom, applyAccountNameToChannelSection, normalizeAccountId, normalizeAllowFromEntries, normalizeSecretInputString, prepareScopedSetupConfig } from "openclaw/plugin-sdk/setup";
|
|
10
|
+
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/routing";
|
|
13
11
|
import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
|
|
14
12
|
//#region extensions/matrix/src/setup-contract.ts
|
|
15
13
|
const matrixSingleAccountKeysToMove = [
|
|
@@ -73,253 +71,6 @@ function resolveSingleAccountPromotionTarget(params) {
|
|
|
73
71
|
return DEFAULT_ACCOUNT_ID$1;
|
|
74
72
|
}
|
|
75
73
|
//#endregion
|
|
76
|
-
//#region extensions/matrix/src/matrix/config-update.ts
|
|
77
|
-
var config_update_exports = /* @__PURE__ */ __exportAll({
|
|
78
|
-
resolveMatrixConfigFieldPath: () => resolveMatrixConfigFieldPath,
|
|
79
|
-
resolveMatrixConfigPath: () => resolveMatrixConfigPath,
|
|
80
|
-
shouldStoreMatrixAccountAtTopLevel: () => shouldStoreMatrixAccountAtTopLevel,
|
|
81
|
-
updateMatrixAccountConfig: () => updateMatrixAccountConfig
|
|
82
|
-
});
|
|
83
|
-
const resolveMatrixConfigPath = resolveMatrixConfigPath$1;
|
|
84
|
-
function applyNullableStringField(target, key, value) {
|
|
85
|
-
if (value === void 0) return;
|
|
86
|
-
if (value === null) {
|
|
87
|
-
delete target[key];
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const trimmed = value.trim();
|
|
91
|
-
if (!trimmed) {
|
|
92
|
-
delete target[key];
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
target[key] = trimmed;
|
|
96
|
-
}
|
|
97
|
-
function applyNullableSecretInputField(target, key, value, defaults) {
|
|
98
|
-
if (value === void 0) return;
|
|
99
|
-
if (value === null) {
|
|
100
|
-
delete target[key];
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (typeof value === "string") {
|
|
104
|
-
const normalized = normalizeSecretInputString(value);
|
|
105
|
-
if (normalized) target[key] = normalized;
|
|
106
|
-
else delete target[key];
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const ref = coerceSecretRef(value, defaults);
|
|
110
|
-
if (!ref) throw new Error(`Invalid Matrix ${key} SecretInput.`);
|
|
111
|
-
target[key] = ref;
|
|
112
|
-
}
|
|
113
|
-
function cloneMatrixDmConfig(dm) {
|
|
114
|
-
if (!dm) return dm;
|
|
115
|
-
return {
|
|
116
|
-
...dm,
|
|
117
|
-
...dm.allowFrom ? { allowFrom: [...dm.allowFrom] } : {}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function cloneMatrixRoomMap(rooms) {
|
|
121
|
-
if (!rooms) return rooms;
|
|
122
|
-
const clonedRoomEntries = [];
|
|
123
|
-
for (const [roomId, roomCfg] of Object.entries(rooms)) clonedRoomEntries.push([roomId, roomCfg ? { ...roomCfg } : roomCfg]);
|
|
124
|
-
return Object.fromEntries(clonedRoomEntries);
|
|
125
|
-
}
|
|
126
|
-
function applyNullableArrayField(target, key, value) {
|
|
127
|
-
if (value === void 0) return;
|
|
128
|
-
if (value === null) {
|
|
129
|
-
delete target[key];
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
target[key] = [...value];
|
|
133
|
-
}
|
|
134
|
-
function updateMatrixAccountConfig(cfg, accountId, patch) {
|
|
135
|
-
const matrix = cfg.channels?.matrix ?? {};
|
|
136
|
-
const normalizedAccountId = normalizeAccountId(accountId);
|
|
137
|
-
const nextAccount = { ...findMatrixAccountConfig(cfg, normalizedAccountId) ?? (normalizedAccountId === DEFAULT_ACCOUNT_ID ? matrix : {}) };
|
|
138
|
-
if (patch.name !== void 0) if (patch.name === null) delete nextAccount.name;
|
|
139
|
-
else {
|
|
140
|
-
const trimmed = patch.name.trim();
|
|
141
|
-
if (trimmed) nextAccount.name = trimmed;
|
|
142
|
-
else delete nextAccount.name;
|
|
143
|
-
}
|
|
144
|
-
if (typeof patch.enabled === "boolean") nextAccount.enabled = patch.enabled;
|
|
145
|
-
else if (typeof nextAccount.enabled !== "boolean") nextAccount.enabled = true;
|
|
146
|
-
applyNullableStringField(nextAccount, "homeserver", patch.homeserver);
|
|
147
|
-
applyNullableStringField(nextAccount, "proxy", patch.proxy);
|
|
148
|
-
applyNullableStringField(nextAccount, "userId", patch.userId);
|
|
149
|
-
applyNullableSecretInputField(nextAccount, "accessToken", patch.accessToken, cfg.secrets?.defaults);
|
|
150
|
-
applyNullableSecretInputField(nextAccount, "password", patch.password, cfg.secrets?.defaults);
|
|
151
|
-
applyNullableStringField(nextAccount, "deviceId", patch.deviceId);
|
|
152
|
-
applyNullableStringField(nextAccount, "deviceName", patch.deviceName);
|
|
153
|
-
applyNullableStringField(nextAccount, "avatarUrl", patch.avatarUrl);
|
|
154
|
-
if (patch.allowPrivateNetwork !== void 0) {
|
|
155
|
-
const nextNetwork = nextAccount.network && typeof nextAccount.network === "object" ? { ...nextAccount.network } : {};
|
|
156
|
-
if (patch.allowPrivateNetwork === null) delete nextNetwork.dangerouslyAllowPrivateNetwork;
|
|
157
|
-
else nextNetwork.dangerouslyAllowPrivateNetwork = patch.allowPrivateNetwork;
|
|
158
|
-
if (Object.keys(nextNetwork).length > 0) nextAccount.network = nextNetwork;
|
|
159
|
-
else delete nextAccount.network;
|
|
160
|
-
}
|
|
161
|
-
if (patch.initialSyncLimit !== void 0) if (patch.initialSyncLimit === null) delete nextAccount.initialSyncLimit;
|
|
162
|
-
else {
|
|
163
|
-
const initialSyncLimit = resolveOptionalIntegerOption(patch.initialSyncLimit, { min: 0 });
|
|
164
|
-
if (initialSyncLimit === void 0) delete nextAccount.initialSyncLimit;
|
|
165
|
-
else nextAccount.initialSyncLimit = initialSyncLimit;
|
|
166
|
-
}
|
|
167
|
-
if (patch.encryption !== void 0) if (patch.encryption === null) delete nextAccount.encryption;
|
|
168
|
-
else nextAccount.encryption = patch.encryption;
|
|
169
|
-
if (patch.allowBots !== void 0) if (patch.allowBots === null) delete nextAccount.allowBots;
|
|
170
|
-
else nextAccount.allowBots = patch.allowBots;
|
|
171
|
-
if (patch.autoJoin !== void 0) if (patch.autoJoin === null) delete nextAccount.autoJoin;
|
|
172
|
-
else nextAccount.autoJoin = patch.autoJoin;
|
|
173
|
-
applyNullableArrayField(nextAccount, "autoJoinAllowlist", patch.autoJoinAllowlist);
|
|
174
|
-
if (patch.dm !== void 0) if (patch.dm === null) delete nextAccount.dm;
|
|
175
|
-
else nextAccount.dm = cloneMatrixDmConfig({
|
|
176
|
-
...nextAccount.dm,
|
|
177
|
-
...patch.dm
|
|
178
|
-
});
|
|
179
|
-
if (patch.groupPolicy !== void 0) if (patch.groupPolicy === null) delete nextAccount.groupPolicy;
|
|
180
|
-
else nextAccount.groupPolicy = patch.groupPolicy;
|
|
181
|
-
applyNullableArrayField(nextAccount, "groupAllowFrom", patch.groupAllowFrom);
|
|
182
|
-
if (patch.groups !== void 0) if (patch.groups === null) delete nextAccount.groups;
|
|
183
|
-
else nextAccount.groups = cloneMatrixRoomMap(patch.groups);
|
|
184
|
-
if (patch.rooms !== void 0) if (patch.rooms === null) delete nextAccount.rooms;
|
|
185
|
-
else nextAccount.rooms = cloneMatrixRoomMap(patch.rooms);
|
|
186
|
-
const nextAccounts = Object.fromEntries(Object.entries(matrix.accounts ?? {}).filter(([rawAccountId]) => rawAccountId === normalizedAccountId || normalizeAccountId(rawAccountId) !== normalizedAccountId));
|
|
187
|
-
if (shouldStoreMatrixAccountAtTopLevel(cfg, normalizedAccountId)) {
|
|
188
|
-
const { accounts: _ignoredAccounts, defaultAccount } = matrix;
|
|
189
|
-
const { accounts: _ignoredNextAccounts, defaultAccount: _ignoredNextDefaultAccount, ...topLevelAccount } = nextAccount;
|
|
190
|
-
return {
|
|
191
|
-
...cfg,
|
|
192
|
-
channels: {
|
|
193
|
-
...cfg.channels,
|
|
194
|
-
matrix: {
|
|
195
|
-
...defaultAccount ? { defaultAccount } : {},
|
|
196
|
-
enabled: true,
|
|
197
|
-
...topLevelAccount
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
return {
|
|
203
|
-
...cfg,
|
|
204
|
-
channels: {
|
|
205
|
-
...cfg.channels,
|
|
206
|
-
matrix: {
|
|
207
|
-
...matrix,
|
|
208
|
-
enabled: true,
|
|
209
|
-
accounts: {
|
|
210
|
-
...nextAccounts,
|
|
211
|
-
[normalizedAccountId]: nextAccount
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
//#endregion
|
|
218
|
-
//#region extensions/matrix/src/matrix/profile.ts
|
|
219
|
-
var profile_exports = /* @__PURE__ */ __exportAll({
|
|
220
|
-
isSupportedMatrixAvatarSource: () => isSupportedMatrixAvatarSource,
|
|
221
|
-
syncMatrixOwnProfile: () => syncMatrixOwnProfile
|
|
222
|
-
});
|
|
223
|
-
const MATRIX_PROFILE_AVATAR_MAX_BYTES = 10 * 1024 * 1024;
|
|
224
|
-
function isMatrixMxcUri(value) {
|
|
225
|
-
return normalizeLowercaseStringOrEmpty(normalizeOptionalString(value)).startsWith("mxc://");
|
|
226
|
-
}
|
|
227
|
-
function isMatrixHttpAvatarUri(value) {
|
|
228
|
-
const normalized = normalizeLowercaseStringOrEmpty(normalizeOptionalString(value));
|
|
229
|
-
return normalized.startsWith("https://") || normalized.startsWith("http://");
|
|
230
|
-
}
|
|
231
|
-
function isSupportedMatrixAvatarSource(value) {
|
|
232
|
-
return isMatrixMxcUri(value) || isMatrixHttpAvatarUri(value);
|
|
233
|
-
}
|
|
234
|
-
async function uploadAvatarMedia(params) {
|
|
235
|
-
const media = await params.loadAvatar(params.avatarSource, params.avatarMaxBytes);
|
|
236
|
-
return await params.client.uploadContent(media.buffer, media.contentType, media.fileName || "avatar");
|
|
237
|
-
}
|
|
238
|
-
async function resolveAvatarUrl(params) {
|
|
239
|
-
const avatarPath = normalizeOptionalString(params.avatarPath) ?? null;
|
|
240
|
-
if (avatarPath) {
|
|
241
|
-
if (!params.loadAvatarFromPath) throw new Error("Matrix avatar path upload requires a media loader.");
|
|
242
|
-
return {
|
|
243
|
-
resolvedAvatarUrl: await uploadAvatarMedia({
|
|
244
|
-
client: params.client,
|
|
245
|
-
avatarSource: avatarPath,
|
|
246
|
-
avatarMaxBytes: params.avatarMaxBytes,
|
|
247
|
-
loadAvatar: params.loadAvatarFromPath
|
|
248
|
-
}),
|
|
249
|
-
uploadedAvatarSource: "path",
|
|
250
|
-
convertedAvatarFromHttp: false
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
const avatarUrl = normalizeOptionalString(params.avatarUrl) ?? null;
|
|
254
|
-
if (!avatarUrl) return {
|
|
255
|
-
resolvedAvatarUrl: null,
|
|
256
|
-
uploadedAvatarSource: null,
|
|
257
|
-
convertedAvatarFromHttp: false
|
|
258
|
-
};
|
|
259
|
-
if (isMatrixMxcUri(avatarUrl)) return {
|
|
260
|
-
resolvedAvatarUrl: avatarUrl,
|
|
261
|
-
uploadedAvatarSource: null,
|
|
262
|
-
convertedAvatarFromHttp: false
|
|
263
|
-
};
|
|
264
|
-
if (!isMatrixHttpAvatarUri(avatarUrl)) throw new Error("Matrix avatar URL must be an mxc:// URI or an http(s) URL.");
|
|
265
|
-
if (!params.loadAvatarFromUrl) throw new Error("Matrix avatar URL conversion requires a media loader.");
|
|
266
|
-
return {
|
|
267
|
-
resolvedAvatarUrl: await uploadAvatarMedia({
|
|
268
|
-
client: params.client,
|
|
269
|
-
avatarSource: avatarUrl,
|
|
270
|
-
avatarMaxBytes: params.avatarMaxBytes,
|
|
271
|
-
loadAvatar: params.loadAvatarFromUrl
|
|
272
|
-
}),
|
|
273
|
-
uploadedAvatarSource: "http",
|
|
274
|
-
convertedAvatarFromHttp: true
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
async function syncMatrixOwnProfile(params) {
|
|
278
|
-
const desiredDisplayName = normalizeOptionalString(params.displayName) ?? null;
|
|
279
|
-
const avatar = await resolveAvatarUrl({
|
|
280
|
-
client: params.client,
|
|
281
|
-
avatarUrl: params.avatarUrl ?? null,
|
|
282
|
-
avatarPath: params.avatarPath ?? null,
|
|
283
|
-
avatarMaxBytes: params.avatarMaxBytes ?? MATRIX_PROFILE_AVATAR_MAX_BYTES,
|
|
284
|
-
loadAvatarFromUrl: params.loadAvatarFromUrl,
|
|
285
|
-
loadAvatarFromPath: params.loadAvatarFromPath
|
|
286
|
-
});
|
|
287
|
-
const desiredAvatarUrl = avatar.resolvedAvatarUrl;
|
|
288
|
-
if (!desiredDisplayName && !desiredAvatarUrl) return {
|
|
289
|
-
skipped: true,
|
|
290
|
-
displayNameUpdated: false,
|
|
291
|
-
avatarUpdated: false,
|
|
292
|
-
resolvedAvatarUrl: null,
|
|
293
|
-
uploadedAvatarSource: avatar.uploadedAvatarSource,
|
|
294
|
-
convertedAvatarFromHttp: avatar.convertedAvatarFromHttp
|
|
295
|
-
};
|
|
296
|
-
let currentDisplayName;
|
|
297
|
-
let currentAvatarUrl;
|
|
298
|
-
try {
|
|
299
|
-
const currentProfile = await params.client.getUserProfile(params.userId);
|
|
300
|
-
currentDisplayName = normalizeOptionalString(currentProfile.displayname);
|
|
301
|
-
currentAvatarUrl = normalizeOptionalString(currentProfile.avatar_url);
|
|
302
|
-
} catch {}
|
|
303
|
-
let displayNameUpdated = false;
|
|
304
|
-
let avatarUpdated = false;
|
|
305
|
-
if (desiredDisplayName && currentDisplayName !== desiredDisplayName) {
|
|
306
|
-
await params.client.setDisplayName(desiredDisplayName);
|
|
307
|
-
displayNameUpdated = true;
|
|
308
|
-
}
|
|
309
|
-
if (desiredAvatarUrl && currentAvatarUrl !== desiredAvatarUrl) {
|
|
310
|
-
await params.client.setAvatarUrl(desiredAvatarUrl);
|
|
311
|
-
avatarUpdated = true;
|
|
312
|
-
}
|
|
313
|
-
return {
|
|
314
|
-
skipped: false,
|
|
315
|
-
displayNameUpdated,
|
|
316
|
-
avatarUpdated,
|
|
317
|
-
resolvedAvatarUrl: desiredAvatarUrl,
|
|
318
|
-
uploadedAvatarSource: avatar.uploadedAvatarSource,
|
|
319
|
-
convertedAvatarFromHttp: avatar.convertedAvatarFromHttp
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
//#endregion
|
|
323
74
|
//#region extensions/matrix/src/setup-config.ts
|
|
324
75
|
const channel$1 = "matrix";
|
|
325
76
|
const COMMON_SINGLE_ACCOUNT_KEYS_TO_MOVE = /* @__PURE__ */ new Set([
|
|
@@ -356,8 +107,8 @@ function resolveSetupAvatarUrl(input) {
|
|
|
356
107
|
return avatarUrl.trim() || void 0;
|
|
357
108
|
}
|
|
358
109
|
function resolveExistingMatrixAccountKey(accounts, targetAccountId) {
|
|
359
|
-
const normalizedTargetAccountId = normalizeAccountId
|
|
360
|
-
return Object.keys(accounts).find((accountId) => normalizeAccountId
|
|
110
|
+
const normalizedTargetAccountId = normalizeAccountId(targetAccountId);
|
|
111
|
+
return Object.keys(accounts).find((accountId) => normalizeAccountId(accountId) === normalizedTargetAccountId) ?? targetAccountId;
|
|
361
112
|
}
|
|
362
113
|
function moveSingleMatrixAccountConfigToNamedAccount(cfg) {
|
|
363
114
|
const baseConfig = cfg.channels?.[channel$1];
|
|
@@ -412,9 +163,9 @@ function validateMatrixSetupInput(params) {
|
|
|
412
163
|
}
|
|
413
164
|
function applyMatrixSetupAccountConfig(params) {
|
|
414
165
|
const input = params.input;
|
|
415
|
-
const normalizedAccountId = normalizeAccountId
|
|
166
|
+
const normalizedAccountId = normalizeAccountId(params.accountId);
|
|
416
167
|
const next = applyAccountNameToChannelSection({
|
|
417
|
-
cfg: normalizedAccountId !== DEFAULT_ACCOUNT_ID
|
|
168
|
+
cfg: normalizedAccountId !== DEFAULT_ACCOUNT_ID ? moveSingleMatrixAccountConfigToNamedAccount(params.cfg) : params.cfg,
|
|
418
169
|
channelKey: channel$1,
|
|
419
170
|
accountId: normalizedAccountId,
|
|
420
171
|
name: input.name
|
|
@@ -462,7 +213,7 @@ function createMatrixSetupDmPolicy(promptAllowFrom) {
|
|
|
462
213
|
allowFromPath: "dm.allowFrom",
|
|
463
214
|
resolveAccount: (cfg, accountId) => {
|
|
464
215
|
const resolvedCfg = cfg;
|
|
465
|
-
const resolvedAccountId = normalizeAccountId
|
|
216
|
+
const resolvedAccountId = normalizeAccountId(accountId?.trim() || resolveDefaultMatrixAccountId(resolvedCfg) || DEFAULT_ACCOUNT_ID);
|
|
466
217
|
const config = resolveMatrixAccountConfig({
|
|
467
218
|
cfg: resolvedCfg,
|
|
468
219
|
accountId: resolvedAccountId
|
|
@@ -494,7 +245,7 @@ function createMatrixSetupDmPolicy(promptAllowFrom) {
|
|
|
494
245
|
//#region extensions/matrix/src/setup-core.ts
|
|
495
246
|
const channel = "matrix";
|
|
496
247
|
function resolveMatrixSetupAccountId(params) {
|
|
497
|
-
return normalizeAccountId
|
|
248
|
+
return normalizeAccountId(params.accountId?.trim() || params.name?.trim() || DEFAULT_ACCOUNT_ID);
|
|
498
249
|
}
|
|
499
250
|
function createMatrixSetupWizardProxy(loadWizardModule) {
|
|
500
251
|
let wizardPromise = null;
|
|
@@ -559,7 +310,7 @@ const matrixSetupAdapter = {
|
|
|
559
310
|
input
|
|
560
311
|
}),
|
|
561
312
|
afterAccountConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
|
|
562
|
-
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-
|
|
313
|
+
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-BaXkhgJg.js");
|
|
563
314
|
await runMatrixSetupBootstrapAfterConfigWrite({
|
|
564
315
|
previousCfg,
|
|
565
316
|
cfg,
|
|
@@ -646,4 +397,4 @@ const matrixSetupContract = defineChannelSetupContract({
|
|
|
646
397
|
legacyAdapter: matrixSetupAdapter
|
|
647
398
|
});
|
|
648
399
|
//#endregion
|
|
649
|
-
export { moveSingleMatrixAccountConfigToNamedAccount as a,
|
|
400
|
+
export { moveSingleMatrixAccountConfigToNamedAccount as a, singleAccountKeysToMove as c, createMatrixSetupDmPolicy as i, matrixSetupAdapter as n, namedAccountPromotionKeys as o, matrixSetupContract as r, resolveSingleAccountPromotionTarget as s, createMatrixSetupWizardProxy as t };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,45 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-Djxw3C6b.js";
|
|
3
|
-
import { n as matrixSetupAdapter, r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-BVfBv2ai.js";
|
|
4
|
-
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
5
|
-
const matrixSetupPlugin = {
|
|
6
|
-
id: "matrix",
|
|
7
|
-
meta: {
|
|
8
|
-
id: "matrix",
|
|
9
|
-
label: "Matrix",
|
|
10
|
-
selectionLabel: "Matrix (plugin)",
|
|
11
|
-
docsPath: "/channels/matrix",
|
|
12
|
-
docsLabel: "matrix",
|
|
13
|
-
blurb: "open protocol; configure a homeserver + access token.",
|
|
14
|
-
order: 70,
|
|
15
|
-
quickstartAllowFrom: true
|
|
16
|
-
},
|
|
17
|
-
setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-BBq3WeqX.js").then((n) => n.t)).matrixSetupWizard })),
|
|
18
|
-
setup: matrixSetupAdapter,
|
|
19
|
-
setupContract: matrixSetupContract,
|
|
20
|
-
capabilities: {
|
|
21
|
-
chatTypes: [
|
|
22
|
-
"direct",
|
|
23
|
-
"group",
|
|
24
|
-
"thread"
|
|
25
|
-
],
|
|
26
|
-
polls: true,
|
|
27
|
-
reactions: true,
|
|
28
|
-
threads: true,
|
|
29
|
-
media: true
|
|
30
|
-
},
|
|
31
|
-
reload: { configPrefixes: ["channels.matrix"] },
|
|
32
|
-
configSchema: MatrixChannelConfigSchema,
|
|
33
|
-
config: {
|
|
34
|
-
...matrixConfigAdapter,
|
|
35
|
-
isConfigured: (account) => account.configured,
|
|
36
|
-
describeAccount: (account) => describeAccountSnapshot({
|
|
37
|
-
account,
|
|
38
|
-
configured: account.configured,
|
|
39
|
-
extra: { baseUrl: account.homeserver }
|
|
40
|
-
}),
|
|
41
|
-
hasConfiguredState: ({ cfg }) => resolveMatrixAccount({ cfg }).configured
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
1
|
+
import { n as matrixSetupPlugin } from "./channel.setup-PpxRP9Du.js";
|
|
45
2
|
export { matrixSetupPlugin };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-
|
|
2
|
+
import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-CWuhuFn1.js";
|
|
3
3
|
import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
|
|
4
|
-
import {
|
|
5
|
-
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-
|
|
6
|
-
import {
|
|
4
|
+
import { n as resolveMatrixEnvAuthReadiness } from "./env-auth-MVS-Vv41.js";
|
|
5
|
+
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-BCzyubQt.js";
|
|
6
|
+
import { r as updateMatrixAccountConfig } from "./config-update-Bor_Pjsv.js";
|
|
7
|
+
import { a as moveSingleMatrixAccountConfigToNamedAccount, i as createMatrixSetupDmPolicy } from "./setup-core-DQn6b5vi.js";
|
|
7
8
|
import { n as validateMatrixHomeserverUrl, r as isPrivateOrLoopbackHost, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
8
9
|
import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-CcVJfvRM.js";
|
|
9
10
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -89,7 +90,7 @@ async function promptMatrixAllowFrom(params) {
|
|
|
89
90
|
pending.push(part);
|
|
90
91
|
}
|
|
91
92
|
if (pending.length > 0) {
|
|
92
|
-
const { resolveMatrixTargets } = await import("./resolve-targets-
|
|
93
|
+
const { resolveMatrixTargets } = await import("./resolve-targets-BJAPY4Vb.js").then((n) => n.n);
|
|
93
94
|
const results = await resolveMatrixTargets({
|
|
94
95
|
cfg,
|
|
95
96
|
accountId,
|
|
@@ -207,7 +208,7 @@ async function configureMatrixAccessPrompts(params) {
|
|
|
207
208
|
resolvedIds.push(cleaned);
|
|
208
209
|
continue;
|
|
209
210
|
}
|
|
210
|
-
const { listMatrixDirectoryGroupsLive } = await import("./directory-live-
|
|
211
|
+
const { listMatrixDirectoryGroupsLive } = await import("./directory-live-Bvg2wAnR.js").then((n) => n.t);
|
|
211
212
|
const matches = await listMatrixDirectoryGroupsLive({
|
|
212
213
|
cfg: next,
|
|
213
214
|
accountId: params.accountId,
|
|
@@ -457,7 +458,7 @@ const matrixOnboardingAdapter = {
|
|
|
457
458
|
});
|
|
458
459
|
},
|
|
459
460
|
afterConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
|
|
460
|
-
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-
|
|
461
|
+
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-BaXkhgJg.js");
|
|
461
462
|
await runMatrixSetupBootstrapAfterConfigWrite({
|
|
462
463
|
previousCfg,
|
|
463
464
|
cfg,
|
|
@@ -479,9 +480,6 @@ const matrixOnboardingAdapter = {
|
|
|
479
480
|
};
|
|
480
481
|
//#endregion
|
|
481
482
|
//#region extensions/matrix/src/setup-surface.ts
|
|
482
|
-
var setup_surface_exports = /* @__PURE__ */ __exportAll({
|
|
483
|
-
matrixOnboardingAdapter: () => matrixOnboardingAdapter,
|
|
484
|
-
matrixSetupWizard: () => matrixOnboardingAdapter
|
|
485
|
-
});
|
|
483
|
+
var setup_surface_exports = /* @__PURE__ */ __exportAll({ matrixSetupWizard: () => matrixOnboardingAdapter });
|
|
486
484
|
//#endregion
|
|
487
485
|
export { matrixOnboardingAdapter as n, setup_surface_exports as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
|
-
import {
|
|
3
|
-
import { M as resolveMatrixSqliteStateEnv, l as resolveMatrixStoragePaths, o as recordCurrentStorageMetaDeviceId } from "./storage-BvAkgzvT.js";
|
|
2
|
+
import { M as resolveMatrixSqliteStateEnv, l as resolveMatrixStoragePaths, o as recordCurrentStorageMetaDeviceId } from "./storage-BsGuHngK.js";
|
|
4
3
|
import { createHash } from "node:crypto";
|
|
5
4
|
import path from "node:path";
|
|
5
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
6
6
|
import { timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
8
8
|
import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
|
|
@@ -207,7 +207,7 @@ async function ensureMatrixStartupVerification(params) {
|
|
|
207
207
|
transactionId: request.transactionId ?? void 0
|
|
208
208
|
};
|
|
209
209
|
} catch (err) {
|
|
210
|
-
const error =
|
|
210
|
+
const error = formatErrorMessage(err);
|
|
211
211
|
await writeStartupVerificationState({
|
|
212
212
|
auth: params.auth,
|
|
213
213
|
env: params.env,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as isRecord } from "./record-shared-CWWx6fvI.js";
|
|
2
1
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
2
|
import { n as resolveMatrixAccountStorageRoot } from "./storage-paths-gUmSydsW.js";
|
|
3
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
6
|
import path from "node:path";
|
|
@@ -526,7 +526,7 @@ function resolveMatrixStateFilePath(params) {
|
|
|
526
526
|
}
|
|
527
527
|
async function maybeMigrateLegacyStorage(params) {
|
|
528
528
|
const hasAccountScopedLegacyStorageFile = fs.existsSync(params.storagePaths.storagePath);
|
|
529
|
-
const syncCache = hasAccountScopedLegacyStorageFile ? await import("./file-sync-store-
|
|
529
|
+
const syncCache = hasAccountScopedLegacyStorageFile ? await import("./file-sync-store-DjskBX2o.js").then((n) => n.n) : null;
|
|
530
530
|
const hasAccountScopedLegacyStorage = hasAccountScopedLegacyStorageFile && await syncCache?.readLegacyMatrixSyncCacheState(params.storagePaths.rootDir) !== null;
|
|
531
531
|
const hasAccountScopedRecoveryKey = fs.existsSync(params.storagePaths.recoveryKeyPath);
|
|
532
532
|
const hasAccountScopedLegacyCryptoMigration = fs.existsSync(path.join(params.storagePaths.rootDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME));
|
|
@@ -573,7 +573,7 @@ async function maybeMigrateLegacyStorage(params) {
|
|
|
573
573
|
if (skippedExistingTargets.length > 0) logger.warn?.(`matrix: legacy client storage files were left in place because their migrated targets already existed.\n${skippedExistingTargets.join("\n")}`);
|
|
574
574
|
}
|
|
575
575
|
async function migrateLegacySyncCacheToSqlite(params) {
|
|
576
|
-
const syncCache = await import("./file-sync-store-
|
|
576
|
+
const syncCache = await import("./file-sync-store-DjskBX2o.js").then((n) => n.n);
|
|
577
577
|
const persisted = await syncCache.readLegacyMatrixSyncCacheState(params.sourceRootDir);
|
|
578
578
|
if (!persisted) return;
|
|
579
579
|
const store = getMatrixRuntime().state.openKeyedStore(syncCache.openMatrixSyncCacheStoreOptions(params.targetRootDir));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
2
|
import { a as listBindingsForAccount, c as resolveBindingKey, f as setMatrixThreadBindingManagerEntry, h as toSessionBindingRecord, l as resolveEffectiveBindingExpiry, m as toMatrixBindingTargetKind, o as removeBindingRecord, r as getMatrixThreadBindingManagerEntry, t as deleteMatrixThreadBindingManagerEntry, u as setBindingRecord } from "./thread-bindings-shared-CKnY4LSd.js";
|
|
3
|
-
import { M as resolveMatrixSqliteStateEnv, N as resolveMatrixSqliteStateKey, c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-
|
|
4
|
-
import { r as sendMessageMatrix } from "./send-
|
|
3
|
+
import { M as resolveMatrixSqliteStateEnv, N as resolveMatrixSqliteStateKey, c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-BsGuHngK.js";
|
|
4
|
+
import { r as sendMessageMatrix } from "./send-ZDLU4JTk.js";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { registerSessionBindingAdapter, resolveThreadBindingFarewellText, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
|
-
import {
|
|
10
|
+
import { resolveSessionAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
11
11
|
import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
|
|
12
12
|
import { resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
|
|
13
13
|
//#region extensions/matrix/src/matrix/thread-bindings.ts
|
|
@@ -354,7 +354,10 @@ async function createMatrixThreadBindingManager(params) {
|
|
|
354
354
|
...boundParentConversationId ? { parentConversationId: boundParentConversationId } : {},
|
|
355
355
|
targetKind: toMatrixBindingTargetKind(input.targetKind),
|
|
356
356
|
targetSessionKey,
|
|
357
|
-
agentId: normalizeOptionalString(input.metadata?.agentId)
|
|
357
|
+
agentId: normalizeOptionalString(input.metadata?.agentId) ?? resolveSessionAgentId({
|
|
358
|
+
config: params.cfg,
|
|
359
|
+
sessionKey: targetSessionKey
|
|
360
|
+
}),
|
|
358
361
|
label: normalizeOptionalString(input.metadata?.label) || void 0,
|
|
359
362
|
boundBy: normalizeOptionalString(input.metadata?.boundBy) || "system",
|
|
360
363
|
boundAt: now,
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig } from "./account-config-BZWN9tGS.js";
|
|
2
|
-
import { i as resolveMatrixAccount } from "./accounts-
|
|
3
|
-
import { r as resolveMatrixRoomConfig } from "./channel-
|
|
2
|
+
import { i as resolveMatrixAccount } from "./accounts-BCzyubQt.js";
|
|
3
|
+
import { r as resolveMatrixRoomConfig } from "./channel-VSrHgTON.js";
|
|
4
4
|
import { r as normalizeMatrixResolvableTarget } from "./target-ids-B-5aQxwn.js";
|
|
5
|
-
import {
|
|
5
|
+
import { g as parsePollStart, h as isPollStartType, n as reactMatrixMessage, u as buildPollResponseContent, x as resolveMatrixRoomId } from "./send-ZDLU4JTk.js";
|
|
6
|
+
import { i as isStrictDirectMembership, n as hasDirectMatrixMemberFlag, o as readJoinedMatrixMembers } from "./direct-room-RinHjtqX.js";
|
|
6
7
|
import { i as buildMatrixReactionRelationsPath, o as selectOwnMatrixReactionEventIds, s as summarizeMatrixReactionEvents } from "./reaction-common-DkrQdBSZ.js";
|
|
7
|
-
import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-
|
|
8
|
-
import { a as fetchEventSummary, c as resolveMatrixActionLimit, i as sendMatrixMessage, n as editMatrixMessage, o as readPinnedEvents, r as readMatrixMessages, s as EventType, t as deleteMatrixMessage } from "./messages-
|
|
9
|
-
import { c as readReactionParams, d as resolveAllowlistProviderRuntimeGroupPolicy, f as resolveDefaultGroupPolicy, i as createActionGate, l as readStringArrayParam, n as ToolAuthorizationError, o as jsonResult, s as readPositiveIntegerParam, u as readStringParam } from "./runtime-api-
|
|
10
|
-
import { t as applyMatrixProfileUpdate } from "./profile-update-
|
|
11
|
-
import { _ as scanMatrixVerificationQr, a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, h as restoreMatrixRoomKeyBackup, i as confirmMatrixVerificationReciprocateQr, l as getMatrixVerificationSas, n as bootstrapMatrixVerification, o as generateMatrixVerificationQr, p as requestMatrixVerification, r as cancelMatrixVerification, s as getMatrixEncryptionStatus, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-
|
|
12
|
-
import { t as createMatrixRoomInfoResolver } from "./room-info-
|
|
8
|
+
import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-sJesKQmp.js";
|
|
9
|
+
import { a as fetchEventSummary, c as resolveMatrixActionLimit, i as sendMatrixMessage, n as editMatrixMessage, o as readPinnedEvents, r as readMatrixMessages, s as EventType, t as deleteMatrixMessage } from "./messages-BW0s-6Y9.js";
|
|
10
|
+
import { c as readReactionParams, d as resolveAllowlistProviderRuntimeGroupPolicy, f as resolveDefaultGroupPolicy, i as createActionGate, l as readStringArrayParam, n as ToolAuthorizationError, o as jsonResult, s as readPositiveIntegerParam, u as readStringParam } from "./runtime-api-BGO16Fu8.js";
|
|
11
|
+
import { t as applyMatrixProfileUpdate } from "./profile-update-BkgWYDIp.js";
|
|
12
|
+
import { _ as scanMatrixVerificationQr, a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, h as restoreMatrixRoomKeyBackup, i as confirmMatrixVerificationReciprocateQr, l as getMatrixVerificationSas, n as bootstrapMatrixVerification, o as generateMatrixVerificationQr, p as requestMatrixVerification, r as cancelMatrixVerification, s as getMatrixEncryptionStatus, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-C7ig-bQE.js";
|
|
13
|
+
import { t as createMatrixRoomInfoResolver } from "./room-info-BXQA7y10.js";
|
|
13
14
|
import { normalizeOptionalLowercaseString, uniqueStrings, uniqueValues } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
15
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
15
16
|
//#region extensions/matrix/src/matrix/actions/polls.ts
|
|
@@ -64,12 +65,23 @@ async function voteMatrixPoll(roomId, pollId, opts = {}) {
|
|
|
64
65
|
}
|
|
65
66
|
//#endregion
|
|
66
67
|
//#region extensions/matrix/src/matrix/actions/reactions.ts
|
|
67
|
-
async function listMatrixReactionEvents(client, roomId, messageId, limit) {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
async function listMatrixReactionEvents(client, roomId, messageId, limit, opts = {}) {
|
|
69
|
+
const events = [];
|
|
70
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
71
|
+
let cursor;
|
|
72
|
+
while (true) {
|
|
73
|
+
const res = await client.doRequest("GET", buildMatrixReactionRelationsPath(roomId, messageId), {
|
|
74
|
+
dir: "b",
|
|
75
|
+
limit,
|
|
76
|
+
...cursor ? { from: cursor } : {}
|
|
77
|
+
});
|
|
78
|
+
if (Array.isArray(res.chunk)) events.push(...res.chunk);
|
|
79
|
+
const nextCursor = typeof res.next_batch === "string" ? res.next_batch.trim() : "";
|
|
80
|
+
if (!nextCursor || !opts.allPages && events.length >= limit) return events;
|
|
81
|
+
if (seenCursors.has(nextCursor)) throw new Error("Matrix reaction pagination returned a repeated cursor");
|
|
82
|
+
seenCursors.add(nextCursor);
|
|
83
|
+
cursor = nextCursor;
|
|
84
|
+
}
|
|
73
85
|
}
|
|
74
86
|
async function listMatrixReactions(roomId, messageId, opts = {}) {
|
|
75
87
|
return await withResolvedRoomAction(roomId, opts, async (client, resolvedRoom) => {
|
|
@@ -78,7 +90,7 @@ async function listMatrixReactions(roomId, messageId, opts = {}) {
|
|
|
78
90
|
}
|
|
79
91
|
async function removeMatrixReactions(roomId, messageId, opts = {}) {
|
|
80
92
|
return await withResolvedRoomAction(roomId, opts, async (client, resolvedRoom) => {
|
|
81
|
-
const chunk = await listMatrixReactionEvents(client, resolvedRoom, messageId, 200);
|
|
93
|
+
const chunk = await listMatrixReactionEvents(client, resolvedRoom, messageId, 200, { allPages: true });
|
|
82
94
|
const userId = await client.getUserId();
|
|
83
95
|
if (!userId) return { removed: 0 };
|
|
84
96
|
const toRemove = selectOwnMatrixReactionEventIds(chunk, userId, opts.emoji);
|
|
@@ -456,7 +468,8 @@ async function handleMatrixAction(params, cfg, opts = {}) {
|
|
|
456
468
|
const mediaUrl = readStringParam(params, "mediaUrl", { trim: false }) ?? readStringParam(params, "media", { trim: false }) ?? readStringParam(params, "filePath", { trim: false }) ?? readStringParam(params, "path", { trim: false });
|
|
457
469
|
const content = readStringParam(params, "content", {
|
|
458
470
|
required: !mediaUrl,
|
|
459
|
-
allowEmpty: true
|
|
471
|
+
allowEmpty: true,
|
|
472
|
+
trim: false
|
|
460
473
|
});
|
|
461
474
|
const replyToId = readStringParam(params, "replyToId") ?? readStringParam(params, "replyTo");
|
|
462
475
|
const threadId = readStringParam(params, "threadId");
|
|
@@ -465,6 +478,7 @@ async function handleMatrixAction(params, cfg, opts = {}) {
|
|
|
465
478
|
ok: true,
|
|
466
479
|
result: await sendMatrixMessage(to, content, {
|
|
467
480
|
mediaUrl: mediaUrl ?? void 0,
|
|
481
|
+
...opts.mediaAccess ? { mediaAccess: opts.mediaAccess } : {},
|
|
468
482
|
mediaLocalRoots: opts.mediaLocalRoots,
|
|
469
483
|
replyToId: replyToId ?? void 0,
|
|
470
484
|
threadId: threadId ?? void 0,
|
|
@@ -476,7 +490,10 @@ async function handleMatrixAction(params, cfg, opts = {}) {
|
|
|
476
490
|
case "editMessage": {
|
|
477
491
|
const roomId = readRoomId(params);
|
|
478
492
|
const messageId = readStringParam(params, "messageId", { required: true });
|
|
479
|
-
const content = readStringParam(params, "content", {
|
|
493
|
+
const content = readStringParam(params, "content", {
|
|
494
|
+
required: true,
|
|
495
|
+
trim: false
|
|
496
|
+
});
|
|
480
497
|
return jsonResult({
|
|
481
498
|
ok: true,
|
|
482
499
|
result: await withReadTarget(roomId, async (target) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-
|
|
3
|
-
import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-
|
|
2
|
+
import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-sJesKQmp.js";
|
|
3
|
+
import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-DmLY8NiO.js";
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
6
6
|
import { setTimeout } from "node:timers/promises";
|