@openclaw/matrix 2026.7.2-beta.7 → 2026.8.1-beta.3
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 +8 -11
- package/dist/{approval-handler.runtime-DSeaIsGa.js → approval-handler.runtime-CSvueU9P.js} +7 -6
- package/dist/{approval-ids-BdJGPAJT.js → approval-ids-CEcf-EiM.js} +1 -1
- package/dist/{approval-reaction-auth-BjOpELxu.js → approval-reaction-auth-CziKXatm.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-CzQw5OZN.js} +376 -148
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-CLoF2S9T.js → channel.runtime-I9pBRQb3.js} +79 -55
- package/dist/{config-schema-Djxw3C6b.js → channel.setup-aNaa3Uyn.js} +51 -10
- package/dist/{cli-DMqfDE-q.js → cli-iR6QJ5U0.js} +16 -16
- package/dist/{cli-metadata-C7D53SND.js → cli-metadata-BmUYWjuM.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-BBQdBG7t.js +799 -0
- package/dist/{client-6eRENr7k.js → client-D8XghqmX.js} +4 -4
- package/dist/{client-bootstrap-XsIkHNt0.js → client-bootstrap-Co3RlItb.js} +25 -61
- 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-DLQzel12.js} +2 -3
- 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 +209 -91
- package/dist/{draft-stream-CtvOXq0Z.js → draft-stream-DQ7QNC-l.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-Dh-DpTc3.js} +4 -1
- package/dist/{messages-DxQJkhxs.js → messages-DEqg7HVy.js} +31 -11
- package/dist/{monitor-VyWlSLwo.js → monitor-FNrfkuWL.js} +413 -405
- package/dist/plugin-entry.handlers.runtime.js +3 -3
- package/dist/probe.runtime-NIJZYqc2.js +2 -0
- package/dist/profile-D-Wubo0A.js +108 -0
- package/dist/{profile-update-CffmyW_4.js → profile-update-BQlE5s2J.js} +3 -2
- package/dist/{reaction-events-B00WSi98.js → reaction-events-BKOLlnCo.js} +10 -7
- package/dist/{recovery-key-store-BNnHvXdk.js → recovery-key-store-CognuDys.js} +5 -4
- package/dist/{resolve-targets-nm2L48sh.js → resolve-targets-e7AI0P75.js} +2 -2
- package/dist/{resolver.runtime-DS6uPaEe.js → resolver.runtime-V8u0pHEb.js} +1 -1
- package/dist/{room-info-CAFZ3Z9J.js → room-info-BXQA7y10.js} +12 -3
- package/dist/runtime-api.js +7 -4
- package/dist/{sdk-bUytQHx7.js → sdk-NxK3vzMa.js} +242 -119
- 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-ClHgDZLT.js} +1477 -1210
- package/dist/session-binding-contract-api.js +2 -3
- package/dist/{setup-bootstrap-Deleiibz.js → setup-bootstrap-BGPjbA5N.js} +4 -4
- package/dist/{setup-core-BVfBv2ai.js → setup-core-DigrLebY.js} +17 -266
- package/dist/setup-plugin-api.js +1 -44
- package/dist/{setup-surface-BBq3WeqX.js → setup-surface-Dtn8sAWs.js} +15 -16
- 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/subagent-hooks-CMoZaARG.js +48 -0
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{target-ids-B-5aQxwn.js → target-ids-Nwx7cMVE.js} +11 -1
- package/dist/{thread-binding-api-DRbBZlhS.js → thread-binding-api-CzkeLZCU.js} +1 -1
- package/dist/thread-binding-api.js +1 -1
- package/dist/{thread-bindings-DGbl3vDW.js → thread-bindings-BYEGfw3h.js} +17 -10
- package/dist/thread-bindings-runtime.js +1 -1
- package/dist/{thread-bindings-shared-CKnY4LSd.js → thread-bindings-shared-oNPiyMWY.js} +1 -6
- package/dist/{tool-actions.runtime-uu9blSqO.js → tool-actions.runtime-ck6IJyP0.js} +36 -19
- package/dist/{verification-DYMQ1QpI.js → verification-CabtBTtB.js} +2 -2
- package/openclaw.plugin.json +61 -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/route-DY6at4qJ.js +0 -161
- package/dist/shared-CUMWxcMz.js +0 -673
- package/dist/subagent-hooks-dkPAF6Et.js +0 -143
- package/dist/sync-state-CWbp0QSY.js +0 -12
- package/dist/{runtime-api-D1xI_cvh.js → runtime-api-BGO16Fu8.js} +3 -3
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { r as setMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export { createMatrixThreadBindingManager, resetMatrixThreadBindingsForTests, setMatrixRuntime };
|
|
2
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-BYEGfw3h.js";
|
|
3
|
+
export { createMatrixThreadBindingManager, 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-CabtBTtB.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-BGPjbA5N.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-aNaa3Uyn.js";
|
|
45
2
|
export { matrixSetupPlugin };
|
|
@@ -1,9 +1,11 @@
|
|
|
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 { n as isMatrixRoomId } from "./target-ids-Nwx7cMVE.js";
|
|
7
|
+
import { r as updateMatrixAccountConfig } from "./config-update-Bor_Pjsv.js";
|
|
8
|
+
import { a as moveSingleMatrixAccountConfigToNamedAccount, i as createMatrixSetupDmPolicy } from "./setup-core-DigrLebY.js";
|
|
7
9
|
import { n as validateMatrixHomeserverUrl, r as isPrivateOrLoopbackHost, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
8
10
|
import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-CcVJfvRM.js";
|
|
9
11
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -30,7 +32,7 @@ function isMatrixInviteAutoJoinPolicy(value) {
|
|
|
30
32
|
return value === "allowlist" || value === "always" || value === "off";
|
|
31
33
|
}
|
|
32
34
|
function isMatrixInviteAutoJoinTarget(entry) {
|
|
33
|
-
return entry === "*" ||
|
|
35
|
+
return entry === "*" || isMatrixRoomId(entry) || entry.startsWith("#") && entry.includes(":");
|
|
34
36
|
}
|
|
35
37
|
function resolveMatrixOnboardingAccountId(cfg, accountId) {
|
|
36
38
|
return normalizeAccountId$1(normalizeOptionalString(accountId) || resolveDefaultMatrixAccountId(cfg) || DEFAULT_ACCOUNT_ID);
|
|
@@ -89,7 +91,7 @@ async function promptMatrixAllowFrom(params) {
|
|
|
89
91
|
pending.push(part);
|
|
90
92
|
}
|
|
91
93
|
if (pending.length > 0) {
|
|
92
|
-
const { resolveMatrixTargets } = await import("./resolve-targets-
|
|
94
|
+
const { resolveMatrixTargets } = await import("./resolve-targets-e7AI0P75.js").then((n) => n.n);
|
|
93
95
|
const results = await resolveMatrixTargets({
|
|
94
96
|
cfg,
|
|
95
97
|
accountId,
|
|
@@ -159,7 +161,7 @@ async function configureMatrixInviteAutoJoin(params) {
|
|
|
159
161
|
while (true) {
|
|
160
162
|
const allowlist = normalizeUniqueStringEntries(splitSetupEntries(await params.prompter.text({
|
|
161
163
|
message: "Matrix invite auto-join allowlist (comma-separated)",
|
|
162
|
-
placeholder: "!roomId:server, #alias:server, *",
|
|
164
|
+
placeholder: "!roomId:server, !roomId, #alias:server, *",
|
|
163
165
|
initialValue: currentAllowlist[0] ? currentAllowlist.join(", ") : void 0,
|
|
164
166
|
validate: (value) => {
|
|
165
167
|
return splitSetupEntries(value).length > 0 ? void 0 : "Required";
|
|
@@ -167,7 +169,7 @@ async function configureMatrixInviteAutoJoin(params) {
|
|
|
167
169
|
})));
|
|
168
170
|
const invalidEntries = allowlist.filter((entry) => !isMatrixInviteAutoJoinTarget(entry));
|
|
169
171
|
if (allowlist.length === 0 || invalidEntries.length > 0) {
|
|
170
|
-
await params.prompter.note(["Use only stable Matrix invite targets for auto-join: !roomId:server, #alias:server, or *.", invalidEntries.length > 0 ? `Invalid: ${invalidEntries.join(", ")}` : void 0].filter(Boolean).join("\n"), "Matrix invite auto-join");
|
|
172
|
+
await params.prompter.note(["Use only stable Matrix invite targets for auto-join: !roomId:server (or the suffixless !roomId form on room version 12+), #alias:server, or *.", invalidEntries.length > 0 ? `Invalid: ${invalidEntries.join(", ")}` : void 0].filter(Boolean).join("\n"), "Matrix invite auto-join");
|
|
171
173
|
continue;
|
|
172
174
|
}
|
|
173
175
|
return setMatrixAutoJoin(params.cfg, "allowlist", allowlist, accountId);
|
|
@@ -190,7 +192,7 @@ async function configureMatrixAccessPrompts(params) {
|
|
|
190
192
|
label: "Matrix rooms",
|
|
191
193
|
currentPolicy: existingAccountConfig.groupPolicy ?? "allowlist",
|
|
192
194
|
currentEntries: Object.keys(existingGroups ?? {}),
|
|
193
|
-
placeholder: "!roomId:server, #alias:server, Project Room",
|
|
195
|
+
placeholder: "!roomId:server, !roomId, #alias:server, Project Room",
|
|
194
196
|
updatePrompt: Boolean(existingGroups)
|
|
195
197
|
});
|
|
196
198
|
if (accessConfig) if (accessConfig.policy !== "allowlist") next = updateMatrixAccountConfig(next, params.accountId, { groupPolicy: accessConfig.policy });
|
|
@@ -203,11 +205,11 @@ async function configureMatrixAccessPrompts(params) {
|
|
|
203
205
|
const trimmed = normalizeOptionalString(entry) ?? "";
|
|
204
206
|
if (!trimmed) continue;
|
|
205
207
|
const cleaned = trimmed.replace(/^(room|channel):/i, "").trim();
|
|
206
|
-
if (
|
|
208
|
+
if (isMatrixRoomId(cleaned)) {
|
|
207
209
|
resolvedIds.push(cleaned);
|
|
208
210
|
continue;
|
|
209
211
|
}
|
|
210
|
-
const { listMatrixDirectoryGroupsLive } = await import("./directory-live-
|
|
212
|
+
const { listMatrixDirectoryGroupsLive } = await import("./directory-live-DLQzel12.js").then((n) => n.t);
|
|
211
213
|
const matches = await listMatrixDirectoryGroupsLive({
|
|
212
214
|
cfg: next,
|
|
213
215
|
accountId: params.accountId,
|
|
@@ -457,7 +459,7 @@ const matrixOnboardingAdapter = {
|
|
|
457
459
|
});
|
|
458
460
|
},
|
|
459
461
|
afterConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
|
|
460
|
-
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-
|
|
462
|
+
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-BGPjbA5N.js");
|
|
461
463
|
await runMatrixSetupBootstrapAfterConfigWrite({
|
|
462
464
|
previousCfg,
|
|
463
465
|
cfg,
|
|
@@ -479,9 +481,6 @@ const matrixOnboardingAdapter = {
|
|
|
479
481
|
};
|
|
480
482
|
//#endregion
|
|
481
483
|
//#region extensions/matrix/src/setup-surface.ts
|
|
482
|
-
var setup_surface_exports = /* @__PURE__ */ __exportAll({
|
|
483
|
-
matrixOnboardingAdapter: () => matrixOnboardingAdapter,
|
|
484
|
-
matrixSetupWizard: () => matrixOnboardingAdapter
|
|
485
|
-
});
|
|
484
|
+
var setup_surface_exports = /* @__PURE__ */ __exportAll({ matrixSetupWizard: () => matrixOnboardingAdapter });
|
|
486
485
|
//#endregion
|
|
487
486
|
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));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { a as listBindingsForAccount, i as listAllBindings, n as getMatrixThreadBindingManager, o as removeBindingRecord, s as resolveBindingKey } from "./thread-bindings-shared-oNPiyMWY.js";
|
|
2
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
4
|
+
//#region extensions/matrix/src/matrix/subagent-hooks.ts
|
|
5
|
+
async function handleMatrixSubagentEnded(event) {
|
|
6
|
+
const accountId = normalizeOptionalString(event.accountId) || void 0;
|
|
7
|
+
const matching = (accountId ? listBindingsForAccount(accountId) : listAllBindings()).filter((entry) => entry.targetSessionKey === event.targetSessionKey && entry.targetKind === "subagent");
|
|
8
|
+
const removedBindingKeys = /* @__PURE__ */ new Set();
|
|
9
|
+
if (event.sendFarewell) {
|
|
10
|
+
const bindingService = getSessionBindingService();
|
|
11
|
+
const reason = normalizeOptionalString(event.reason) || "subagent-ended";
|
|
12
|
+
for (const binding of matching) {
|
|
13
|
+
const bindingId = resolveBindingKey(binding);
|
|
14
|
+
if ((await bindingService.unbind({
|
|
15
|
+
bindingId,
|
|
16
|
+
reason
|
|
17
|
+
})).some((entry) => entry.bindingId === bindingId)) removedBindingKeys.add(bindingId);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const affectedAccountIds = /* @__PURE__ */ new Set();
|
|
21
|
+
for (const binding of matching) {
|
|
22
|
+
if (removedBindingKeys.has(resolveBindingKey(binding))) continue;
|
|
23
|
+
if (removeBindingRecord(binding)) affectedAccountIds.add(binding.accountId);
|
|
24
|
+
}
|
|
25
|
+
for (const acctId of affectedAccountIds) await getMatrixThreadBindingManager(acctId)?.persist();
|
|
26
|
+
}
|
|
27
|
+
function handleMatrixSubagentDeliveryTarget(event) {
|
|
28
|
+
if (!event.expectsCompletionMessage) return;
|
|
29
|
+
if (event.requesterOrigin?.channel?.trim().toLowerCase() !== "matrix") return;
|
|
30
|
+
const requesterAccountId = normalizeOptionalString(event.requesterOrigin?.accountId);
|
|
31
|
+
const requesterThreadId = event.requesterOrigin?.threadId != null && event.requesterOrigin.threadId !== "" ? String(event.requesterOrigin.threadId).trim() : "";
|
|
32
|
+
const bindings = (requesterAccountId ? listBindingsForAccount(requesterAccountId) : listAllBindings()).filter((entry) => entry.targetSessionKey === event.childSessionKey && entry.targetKind === "subagent");
|
|
33
|
+
if (bindings.length === 0) return;
|
|
34
|
+
let binding;
|
|
35
|
+
if (requesterThreadId) binding = bindings.find((entry) => entry.conversationId === requesterThreadId && (!requesterAccountId || entry.accountId === requesterAccountId));
|
|
36
|
+
if (!binding && bindings.length === 1) binding = bindings[0];
|
|
37
|
+
if (!binding) return;
|
|
38
|
+
const roomId = binding.parentConversationId ?? binding.conversationId;
|
|
39
|
+
const threadId = binding.parentConversationId && binding.parentConversationId !== binding.conversationId ? binding.conversationId : void 0;
|
|
40
|
+
return { origin: {
|
|
41
|
+
channel: "matrix",
|
|
42
|
+
accountId: binding.accountId,
|
|
43
|
+
to: `room:${roomId}`,
|
|
44
|
+
...threadId ? { threadId } : {}
|
|
45
|
+
} };
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { handleMatrixSubagentDeliveryTarget, handleMatrixSubagentEnded };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
2
2
|
//#region extensions/matrix/subagent-hooks-api.ts
|
|
3
|
-
const loadMatrixSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-
|
|
3
|
+
const loadMatrixSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-CMoZaARG.js"));
|
|
4
4
|
function registerMatrixSubagentHooks(api) {
|
|
5
5
|
api.on("subagent_ended", async (event) => {
|
|
6
6
|
const { handleMatrixSubagentEnded } = await loadMatrixSubagentHooksModule();
|
|
@@ -52,6 +52,16 @@ function isMatrixQualifiedUserId(raw) {
|
|
|
52
52
|
const trimmed = raw.trim();
|
|
53
53
|
return trimmed.startsWith("@") && trimmed.includes(":");
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Whether `raw` is already a literal room ID rather than a name/query to resolve.
|
|
57
|
+
* Room version 12 (MSC4291) dropped the trailing ":server" from room IDs — they're
|
|
58
|
+
* now a hash of the create event — so this must not require a colon the way user
|
|
59
|
+
* IDs and aliases still do.
|
|
60
|
+
*/
|
|
61
|
+
function isMatrixRoomId(raw) {
|
|
62
|
+
const trimmed = raw.trim();
|
|
63
|
+
return trimmed.startsWith("!") && trimmed.length > 1;
|
|
64
|
+
}
|
|
55
65
|
function normalizeMatrixResolvableTarget(raw) {
|
|
56
66
|
return stripKnownPrefixes(raw, [
|
|
57
67
|
MATRIX_PREFIX,
|
|
@@ -74,4 +84,4 @@ function resolveMatrixDirectUserId(params) {
|
|
|
74
84
|
return isMatrixQualifiedUserId(userId) ? userId : void 0;
|
|
75
85
|
}
|
|
76
86
|
//#endregion
|
|
77
|
-
export {
|
|
87
|
+
export { resolveMatrixDirectUserId as a, normalizeMatrixResolvableTarget as i, isMatrixRoomId as n, resolveMatrixTargetIdentity as o, normalizeMatrixMessagingTarget as r, isMatrixQualifiedUserId as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as resolveMatrixTargetIdentity } from "./target-ids-Nwx7cMVE.js";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/matrix/src/thread-binding-api.ts
|
|
4
4
|
const defaultTopLevelPlacement = "child";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolveMatrixInboundConversation, t as defaultTopLevelPlacement } from "./thread-binding-api-
|
|
1
|
+
import { n as resolveMatrixInboundConversation, t as defaultTopLevelPlacement } from "./thread-binding-api-CzkeLZCU.js";
|
|
2
2
|
export { defaultTopLevelPlacement, resolveMatrixInboundConversation as resolveInboundConversation };
|