@openclaw/matrix 2026.7.1-beta.6 → 2026.7.2-beta.1
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-5e4mHR1m.js → account-selection-Bz00QTmQ.js} +4 -3
- package/dist/api.js +8 -8
- package/dist/{approval-handler.runtime-DI5x9r8I.js → approval-handler.runtime--Ei44Vo2.js} +27 -17
- package/dist/{approval-ids-ZgqbspmS.js → approval-ids-C_2kSMdJ.js} +1 -1
- package/dist/{approval-reaction-auth-D9LijQhr.js → approval-reaction-auth-TdVPcgxP.js} +2 -2
- package/dist/approval-reactions-BgU51JGd.js +202 -0
- package/dist/auth-presence.js +1 -1
- package/dist/{channel-jUTBsjHU.js → channel-CxqDh7mS.js} +102 -143
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-DO1Nv9ed.js → channel.runtime-wNfJc57I.js} +7 -7
- package/dist/{cli-metadata-CfiEO-CE.js → cli-metadata-Gf3HSJ2c.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{cli-CEfWwCKx.js → cli-o00oTJhx.js} +12 -12
- package/dist/{client-FRuyCNju.js → client-ClHisZbf.js} +2 -2
- package/dist/{client-tgnlQJk4.js → client-DP0nmFxK.js} +4 -4
- package/dist/{client-bootstrap-DjFJ7e0N.js → client-bootstrap-PqYOS-mO.js} +1 -1
- package/dist/{config-schema-DtnhNYd-.js → config-schema-CG9goLWp.js} +21 -55
- package/dist/contract-api.js +2 -2
- package/dist/{create-client-CNakT7zF.js → create-client-D9z9RjCM.js} +3 -3
- package/dist/{credentials-Ds9V1mn2.js → credentials-DnhsLAuR.js} +1 -1
- package/dist/{credentials-read-BlkvsNFg.js → credentials-read-BtS-HRT5.js} +3 -3
- package/dist/{credentials-write.runtime-CTqqxcut.js → credentials-write.runtime-J_EUt5WP.js} +1 -1
- package/dist/{crypto-runtime-B74cTS6A.js → crypto-runtime-BHcxauC4.js} +75 -45
- package/dist/{deps-CdjHvnmh.js → deps-DDbghaZH.js} +23 -90
- package/dist/{directory-live-Ufd4qSpX.js → directory-live-DPy2aaPF.js} +3 -3
- package/dist/doctor-BGTs609f.js +64 -0
- package/dist/{doctor-contract-BAja_fmb.js → doctor-contract-D2qTLe-C.js} +72 -6
- package/dist/doctor-contract-api.js +323 -45
- package/dist/{draft-stream-D4EH25gv.js → draft-stream-De7uikGn.js} +1 -1
- package/dist/{encryption-guidance-D8walY04.js → encryption-guidance-BFfgq7c7.js} +1 -1
- package/dist/{env-auth-DIzOApj0.js → env-auth-CQsYbz-p.js} +1 -1
- package/dist/{env-vars-KzaYveuy.js → env-vars-B0NxQnPk.js} +3 -1
- package/dist/{exec-approval-resolver-f9j6staN.js → exec-approval-resolver-BCgqRtZS.js} +2 -1
- package/dist/{file-sync-store-DVm0ACml.js → file-sync-store-Cxb0ckyX.js} +4 -5
- package/dist/helper-api.js +4 -4
- package/dist/{http-client-nSmFiVgk.js → http-client-W4TJQM6r.js} +17 -33
- package/dist/{idb-persistence-BHm97th-.js → idb-persistence-iUZoHZkp.js} +2 -2
- package/dist/inbound-dedupe-DcMs0YXL.js +67 -0
- package/dist/index.js +1 -1
- package/dist/{logger-D0GCSDQq.js → logger-BMClpI5b.js} +1 -1
- package/dist/{logging-QH-48Gr6.js → logging-CFJrbDAN.js} +1 -1
- package/dist/{media-text-p-LP21qs.js → media-text-DWaotsZB.js} +1 -1
- package/dist/{messages-DRKkiEY-.js → messages-Dm3K4ZvM.js} +3 -3
- package/dist/{monitor-CsGOGdwu.js → monitor-C_kgPPeV.js} +44 -382
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-Dry8PTWC.js +3 -0
- package/dist/{profile-update-Ucc8RrJL.js → profile-update-iUHCoks3.js} +3 -3
- package/dist/{reaction-events-DentrVii.js → reaction-events-0tubdHRM.js} +60 -10
- package/dist/record-shared-CvzjvHRn.js +2 -0
- package/dist/{recovery-key-store-DSeLFvNx.js → recovery-key-store-Bx0zTJcB.js} +2 -2
- package/dist/{resolve-targets-DcV_KfgX.js → resolve-targets-DlLrfWDy.js} +1 -1
- package/dist/{resolver.runtime-Hr6bO5zl.js → resolver.runtime-MeaT1zXx.js} +1 -1
- package/dist/room-info-B6vKD5DF.js +86 -0
- package/dist/{runtime-6S3DNFNv.js → runtime-CveSqMOP.js} +1 -1
- package/dist/{runtime-api-CsBoesCU.js → runtime-api-D1xI_cvh.js} +3 -3
- package/dist/runtime-api.js +6 -6
- package/dist/runtime-setter-api.js +1 -1
- package/dist/{sdk-AZYVl34z.js → sdk-CI8E2TKg.js} +12 -17
- package/dist/{secret-contract-DTgQyQxc.js → secret-contract-OZoQf0kI.js} +7 -48
- package/dist/secret-contract-api.js +1 -1
- package/dist/{send-D92v6Yy0.js → send-C7xuGWpv.js} +10 -4
- package/dist/session-binding-contract-api.js +2 -2
- package/dist/{setup-bootstrap-Da564w5f.js → setup-bootstrap-CCsexWTZ.js} +2 -2
- package/dist/{setup-core-BGgbrdaJ.js → setup-core-DlmTyIP0.js} +9 -7
- package/dist/setup-plugin-api.js +3 -3
- package/dist/{setup-surface-iJ6pd-t5.js → setup-surface-2SS94JV0.js} +7 -7
- package/dist/{shared-DkFfq7mH.js → shared-DgvN5rBx.js} +14 -9
- package/dist/{startup-verification-BKMAXvcV.js → startup-verification-CbIyF7z1.js} +3 -4
- package/dist/storage-BtSOar8T.js +718 -0
- package/dist/{storage-paths-BWo_ZEMC.js → storage-paths-B4_I9iqO.js} +1 -12
- package/dist/{thread-bindings-BX5nmWpw.js → thread-bindings-BI8MHWp9.js} +4 -5
- package/dist/{tool-actions.runtime-C1d5fxE_.js → tool-actions.runtime-CnyhVPoY.js} +242 -53
- package/dist/{verification-BGCMiO1p.js → verification-DLSe3sP7.js} +2 -2
- package/npm-shrinkwrap.json +3 -3
- package/openclaw.plugin.json +66 -55
- package/package.json +4 -4
- package/dist/approval-reactions-BdUaUXVw.js +0 -113
- package/dist/crypto-state-store-Jy3qwhdy.js +0 -352
- package/dist/doctor-DfaOqFtr.js +0 -167
- package/dist/legacy-crypto-inspector-vzXSkm18.js +0 -42
- package/dist/legacy-crypto-restore-CIBfOmLn.js +0 -93
- package/dist/matrix-migration.runtime-BMCyrANT.js +0 -524
- package/dist/migration-snapshot-backup-YcCrSjbE.js +0 -69
- package/dist/migration-snapshot.runtime-VGD4QfeS.js +0 -2
- package/dist/probe.runtime-2MZLc6ng.js +0 -3
- package/dist/runtime-heavy-api.js +0 -3
- package/dist/storage-CQdyKcGg.js +0 -430
|
@@ -1,6 +1,66 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as isRecord } from "./record-shared-CvzjvHRn.js";
|
|
2
|
+
import { defineChannelAliasMigration } from "openclaw/plugin-sdk/runtime-doctor";
|
|
2
3
|
import { hasLegacyFlatAllowPrivateNetworkAlias, migrateLegacyFlatAllowPrivateNetworkAlias } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
3
4
|
//#region extensions/matrix/src/doctor-contract.ts
|
|
5
|
+
function parseMatrixStreamingMode(value) {
|
|
6
|
+
if (typeof value !== "string") return null;
|
|
7
|
+
const normalized = value.trim().toLowerCase();
|
|
8
|
+
return normalized === "partial" || normalized === "quiet" || normalized === "progress" || normalized === "off" ? normalized : null;
|
|
9
|
+
}
|
|
10
|
+
const streamingAliasMigration = defineChannelAliasMigration({
|
|
11
|
+
channelId: "matrix",
|
|
12
|
+
streaming: {
|
|
13
|
+
defaultMode: "off",
|
|
14
|
+
resolveMode: (entry) => {
|
|
15
|
+
const streaming = isRecord(entry.streaming) ? entry.streaming : null;
|
|
16
|
+
const parsed = parseMatrixStreamingMode(streaming ? streaming.mode : entry.streaming);
|
|
17
|
+
if (parsed) return parsed;
|
|
18
|
+
return entry.streaming === true ? "partial" : "off";
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
accountStreamingReplacesRoot: true
|
|
22
|
+
});
|
|
23
|
+
function stripMatrixJunkStreamMode(cfg, changes) {
|
|
24
|
+
const channels = isRecord(cfg.channels) ? cfg.channels : null;
|
|
25
|
+
const matrix = isRecord(channels?.matrix) ? channels.matrix : null;
|
|
26
|
+
if (!matrix) return cfg;
|
|
27
|
+
let updated = matrix;
|
|
28
|
+
let changed = false;
|
|
29
|
+
if (updated.streamMode !== void 0) {
|
|
30
|
+
const { streamMode: _streamMode, ...rest } = updated;
|
|
31
|
+
updated = rest;
|
|
32
|
+
changes.push("Removed channels.matrix.streamMode (never read by the Matrix runtime).");
|
|
33
|
+
changed = true;
|
|
34
|
+
}
|
|
35
|
+
const accounts = isRecord(updated.accounts) ? updated.accounts : null;
|
|
36
|
+
if (accounts) {
|
|
37
|
+
let accountsChanged = false;
|
|
38
|
+
const nextAccounts = { ...accounts };
|
|
39
|
+
for (const [accountId, accountValue] of Object.entries(accounts)) {
|
|
40
|
+
const account = isRecord(accountValue) ? accountValue : null;
|
|
41
|
+
if (!account || account.streamMode === void 0) continue;
|
|
42
|
+
const { streamMode: _streamMode, ...rest } = account;
|
|
43
|
+
nextAccounts[accountId] = rest;
|
|
44
|
+
changes.push(`Removed channels.matrix.accounts.${accountId}.streamMode (never read by the Matrix runtime).`);
|
|
45
|
+
accountsChanged = true;
|
|
46
|
+
}
|
|
47
|
+
if (accountsChanged) {
|
|
48
|
+
updated = {
|
|
49
|
+
...updated,
|
|
50
|
+
accounts: nextAccounts
|
|
51
|
+
};
|
|
52
|
+
changed = true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!changed) return cfg;
|
|
56
|
+
return {
|
|
57
|
+
...cfg,
|
|
58
|
+
channels: {
|
|
59
|
+
...channels,
|
|
60
|
+
matrix: updated
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
4
64
|
function hasLegacyMatrixRoomAllowAlias(value) {
|
|
5
65
|
const room = isRecord(value) ? value : null;
|
|
6
66
|
return Boolean(room && typeof room.allow === "boolean");
|
|
@@ -73,6 +133,7 @@ function normalizeMatrixRoomAllowAliases(params) {
|
|
|
73
133
|
};
|
|
74
134
|
}
|
|
75
135
|
const legacyConfigRules = [
|
|
136
|
+
...streamingAliasMigration.legacyConfigRules,
|
|
76
137
|
{
|
|
77
138
|
path: ["channels", "matrix"],
|
|
78
139
|
message: "channels.matrix.allowPrivateNetwork is legacy; use channels.matrix.network.dangerouslyAllowPrivateNetwork instead. Run \"openclaw doctor --fix\".",
|
|
@@ -130,15 +191,20 @@ const legacyConfigRules = [
|
|
|
130
191
|
}
|
|
131
192
|
];
|
|
132
193
|
function normalizeCompatibilityConfig({ cfg }) {
|
|
133
|
-
const
|
|
194
|
+
const changes = [];
|
|
195
|
+
const withoutJunkStreamMode = stripMatrixJunkStreamMode(cfg, changes);
|
|
196
|
+
const aliases = streamingAliasMigration.normalizeChannelConfig({
|
|
197
|
+
cfg: withoutJunkStreamMode,
|
|
198
|
+
changes
|
|
199
|
+
});
|
|
200
|
+
const channels = isRecord(aliases.config.channels) ? aliases.config.channels : null;
|
|
134
201
|
const matrix = isRecord(channels?.matrix) ? channels.matrix : null;
|
|
135
202
|
if (!matrix) return {
|
|
136
203
|
config: cfg,
|
|
137
204
|
changes: []
|
|
138
205
|
};
|
|
139
|
-
const changes = [];
|
|
140
206
|
let updatedMatrix = matrix;
|
|
141
|
-
let changed =
|
|
207
|
+
let changed = aliases.config !== cfg;
|
|
142
208
|
const topLevelPrivateNetwork = migrateLegacyFlatAllowPrivateNetworkAlias({
|
|
143
209
|
entry: updatedMatrix,
|
|
144
210
|
pathPrefix: "channels.matrix",
|
|
@@ -233,9 +299,9 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
233
299
|
};
|
|
234
300
|
return {
|
|
235
301
|
config: {
|
|
236
|
-
...
|
|
302
|
+
...aliases.config,
|
|
237
303
|
channels: {
|
|
238
|
-
...
|
|
304
|
+
...aliases.config.channels,
|
|
239
305
|
matrix: updatedMatrix
|
|
240
306
|
}
|
|
241
307
|
},
|
|
@@ -1,11 +1,201 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as openMatrixStorageMetaStoreOptions, i as normalizeMatrixStorageMetadata, n as hasMatrixStorageMetaStateInStore, u as writeMatrixStorageMetaStateToStore } from "./storage-
|
|
4
|
-
import { a as readLegacyMatrixSyncCacheState, i as openMatrixSyncCacheStoreOptions, o as writeMatrixSyncCacheStateToStore, r as hasMatrixSyncCacheStateInStore } from "./file-sync-store-
|
|
5
|
-
import { r as
|
|
1
|
+
import { t as isRecord } from "./record-shared-CvzjvHRn.js";
|
|
2
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-D2qTLe-C.js";
|
|
3
|
+
import { O as writeMatrixIdbSnapshotJsonToStore, S as readLegacyMatrixLegacyCryptoMigrationState, _ as hasMatrixRecoveryKeyStateInStore, a as openMatrixStorageMetaStoreOptions, b as openMatrixLegacyCryptoMigrationStoreOptions, f as MATRIX_IDB_SNAPSHOT_FILENAME, g as hasMatrixLegacyCryptoMigrationStateInStore, h as hasMatrixIdbSnapshotStateInStore, i as normalizeMatrixStorageMetadata, j as writeMatrixRecoveryKeyStateToStore, k as writeMatrixLegacyCryptoMigrationStateToStore, m as MATRIX_RECOVERY_KEY_FILENAME, n as hasMatrixStorageMetaStateInStore, p as MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, u as writeMatrixStorageMetaStateToStore, w as readLegacyMatrixRecoveryKeyState, x as openMatrixRecoveryKeyStoreOptions, y as openMatrixIdbSnapshotStoreOptions } from "./storage-BtSOar8T.js";
|
|
4
|
+
import { a as readLegacyMatrixSyncCacheState, i as openMatrixSyncCacheStoreOptions, o as writeMatrixSyncCacheStateToStore, r as hasMatrixSyncCacheStateInStore } from "./file-sync-store-Cxb0ckyX.js";
|
|
5
|
+
import { a as resolveMatrixInboundDedupeStateNamespace, n as MATRIX_INBOUND_DEDUPE_TTL_MS, r as buildMatrixInboundDedupeEventKey } from "./inbound-dedupe-DcMs0YXL.js";
|
|
6
|
+
import { r as readLegacyMatrixIdbSnapshotState } from "./idb-persistence-iUZoHZkp.js";
|
|
6
7
|
import path from "node:path";
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
import { archiveLegacyStateSource } from "openclaw/plugin-sdk/runtime-doctor";
|
|
7
10
|
import fs from "node:fs/promises";
|
|
8
|
-
import {
|
|
11
|
+
import { createPersistentDedupeImportEntry } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
12
|
+
//#region extensions/matrix/src/matrix/monitor/inbound-dedupe-migration.ts
|
|
13
|
+
const LEGACY_SQLITE_NAMESPACE = "inbound-dedupe";
|
|
14
|
+
const LEGACY_SQLITE_MAX_ENTRIES = 2e4;
|
|
15
|
+
const LEGACY_MARKERS_NAMESPACE = "inbound-dedupe-migrations";
|
|
16
|
+
const LEGACY_MARKERS_MAX_ENTRIES = 1e3;
|
|
17
|
+
const LEGACY_JSON_VERSION = 1;
|
|
18
|
+
const STORAGE_META_FILENAME = "storage-meta.json";
|
|
19
|
+
const MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME = "inbound-dedupe.json";
|
|
20
|
+
async function collectMatrixInboundDedupeSources(stateDir) {
|
|
21
|
+
const matrixRoot = path.join(stateDir, "matrix");
|
|
22
|
+
const sqliteRoots = /* @__PURE__ */ new Set();
|
|
23
|
+
const jsonRoots = /* @__PURE__ */ new Set();
|
|
24
|
+
async function visit(dir) {
|
|
25
|
+
let entries;
|
|
26
|
+
try {
|
|
27
|
+
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
28
|
+
} catch {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
for (const entry of entries) {
|
|
32
|
+
const entryPath = path.join(dir, entry.name);
|
|
33
|
+
if (entry.isFile()) {
|
|
34
|
+
if (entry.name === "openclaw.sqlite" && path.basename(dir) === "state") sqliteRoots.add(path.dirname(dir));
|
|
35
|
+
else if (entry.name === "inbound-dedupe.json") jsonRoots.add(dir);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (entry.isDirectory()) await visit(entryPath);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
await visit(matrixRoot);
|
|
42
|
+
const matrixRootResolved = path.resolve(matrixRoot);
|
|
43
|
+
const isAccountRoot = (root) => path.resolve(root) !== matrixRootResolved;
|
|
44
|
+
return {
|
|
45
|
+
sqliteRoots: [...sqliteRoots].filter(isAccountRoot).toSorted(),
|
|
46
|
+
jsonRoots: [...jsonRoots].filter(isAccountRoot).toSorted()
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function openLegacySqliteStore(io, storageRootDir) {
|
|
50
|
+
return io.context.openPluginStateKeyedStore({
|
|
51
|
+
namespace: LEGACY_SQLITE_NAMESPACE,
|
|
52
|
+
maxEntries: LEGACY_SQLITE_MAX_ENTRIES,
|
|
53
|
+
env: {
|
|
54
|
+
...io.env,
|
|
55
|
+
OPENCLAW_STATE_DIR: storageRootDir
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function openLegacyMarkersStore(io, storageRootDir) {
|
|
60
|
+
return io.context.openPluginStateKeyedStore({
|
|
61
|
+
namespace: LEGACY_MARKERS_NAMESPACE,
|
|
62
|
+
maxEntries: LEGACY_MARKERS_MAX_ENTRIES,
|
|
63
|
+
env: {
|
|
64
|
+
...io.env,
|
|
65
|
+
OPENCLAW_STATE_DIR: storageRootDir
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function normalizeLegacyTimestamp(raw) {
|
|
70
|
+
if (typeof raw !== "number" || !Number.isFinite(raw)) return null;
|
|
71
|
+
return Math.max(0, Math.floor(raw));
|
|
72
|
+
}
|
|
73
|
+
function parseLegacySqliteRow(row) {
|
|
74
|
+
const value = isRecord(row.value) ? row.value : {};
|
|
75
|
+
const roomId = typeof value.roomId === "string" ? value.roomId.trim() : "";
|
|
76
|
+
const eventId = typeof value.eventId === "string" ? value.eventId.trim() : "";
|
|
77
|
+
const ts = normalizeLegacyTimestamp(value.ts);
|
|
78
|
+
const separator = row.key.lastIndexOf(":");
|
|
79
|
+
if (!roomId || !eventId || ts === null || separator <= 0) return null;
|
|
80
|
+
const accountId = row.key.slice(0, separator);
|
|
81
|
+
const digest = createHash("sha256").update(accountId).update("\0").update(roomId).update("\0").update(eventId).digest("hex");
|
|
82
|
+
if (row.key.slice(separator + 1) !== digest) return null;
|
|
83
|
+
return {
|
|
84
|
+
accountId,
|
|
85
|
+
roomId,
|
|
86
|
+
eventId,
|
|
87
|
+
ts
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** Reads one storage root's legacy SQLite dedupe rows; throws on store errors. */
|
|
91
|
+
async function readLegacyInboundDedupeSqliteSource(io, storageRootDir) {
|
|
92
|
+
const rows = await openLegacySqliteStore(io, storageRootDir).entries();
|
|
93
|
+
const markerRows = await openLegacyMarkersStore(io, storageRootDir).entries();
|
|
94
|
+
const markers = [];
|
|
95
|
+
for (const row of rows) {
|
|
96
|
+
const marker = parseLegacySqliteRow(row);
|
|
97
|
+
if (marker) markers.push(marker);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
markers,
|
|
101
|
+
legacyRowCount: rows.length + markerRows.length
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** Clears one storage root's retired legacy dedupe namespaces after import. */
|
|
105
|
+
async function retireLegacyInboundDedupeSqliteRows(io, storageRootDir) {
|
|
106
|
+
await openLegacySqliteStore(io, storageRootDir).clear();
|
|
107
|
+
await openLegacyMarkersStore(io, storageRootDir).clear();
|
|
108
|
+
}
|
|
109
|
+
async function resolveJsonRootAccountId(storageRootDir) {
|
|
110
|
+
for (const filename of [STORAGE_META_FILENAME, `${STORAGE_META_FILENAME}.migrated`]) try {
|
|
111
|
+
const metadata = normalizeMatrixStorageMetadata(JSON.parse(await fs.readFile(path.join(storageRootDir, filename), "utf8")));
|
|
112
|
+
if (metadata?.accountId) return metadata.accountId;
|
|
113
|
+
} catch {}
|
|
114
|
+
return "default";
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Reads one storage root's legacy inbound-dedupe.json markers. Throws on file
|
|
118
|
+
* read errors so a transiently unreadable file is never retired unread, and
|
|
119
|
+
* returns null for malformed content so the caller can archive it explicitly.
|
|
120
|
+
*/
|
|
121
|
+
async function readLegacyInboundDedupeJsonSource(storageRootDir) {
|
|
122
|
+
const jsonPath = path.join(storageRootDir, MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME);
|
|
123
|
+
const raw = await fs.readFile(jsonPath, "utf8");
|
|
124
|
+
let parsed;
|
|
125
|
+
try {
|
|
126
|
+
parsed = JSON.parse(raw);
|
|
127
|
+
} catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
if (!isRecord(parsed) || parsed.version !== LEGACY_JSON_VERSION || !Array.isArray(parsed.entries)) return null;
|
|
131
|
+
const accountId = await resolveJsonRootAccountId(storageRootDir);
|
|
132
|
+
const markers = [];
|
|
133
|
+
for (const entry of parsed.entries) {
|
|
134
|
+
if (!isRecord(entry) || typeof entry.key !== "string") continue;
|
|
135
|
+
const separator = entry.key.indexOf("|");
|
|
136
|
+
if (separator <= 0) continue;
|
|
137
|
+
const roomId = entry.key.slice(0, separator).trim();
|
|
138
|
+
const eventId = entry.key.slice(separator + 1).trim();
|
|
139
|
+
const ts = normalizeLegacyTimestamp(entry.ts);
|
|
140
|
+
if (!roomId || !eventId || ts === null) continue;
|
|
141
|
+
markers.push({
|
|
142
|
+
accountId,
|
|
143
|
+
roomId,
|
|
144
|
+
eventId,
|
|
145
|
+
ts
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return markers;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Imports the globally newest legacy markers into the claimable-dedupe store.
|
|
152
|
+
* Never exceeds capacity: eviction is by row creation time, so letting fresh
|
|
153
|
+
* imports overflow the namespace would evict the newer rows the runtime
|
|
154
|
+
* committed since the upgrade. Throws on store errors so the caller keeps the
|
|
155
|
+
* legacy sources for the next doctor attempt.
|
|
156
|
+
*/
|
|
157
|
+
async function importNewestInboundDedupeMarkers(params) {
|
|
158
|
+
const now = params.now ?? Date.now();
|
|
159
|
+
const stateMaxEntries = params.stateMaxEntries ?? 2e4;
|
|
160
|
+
const newestByKey = /* @__PURE__ */ new Map();
|
|
161
|
+
for (const marker of params.markers) {
|
|
162
|
+
const key = buildMatrixInboundDedupeEventKey(marker);
|
|
163
|
+
if (!key) continue;
|
|
164
|
+
const existing = newestByKey.get(key);
|
|
165
|
+
if (!existing || marker.ts > existing.ts) newestByKey.set(key, {
|
|
166
|
+
...marker,
|
|
167
|
+
key
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
const markers = [...newestByKey.values()].toSorted((left, right) => right.ts - left.ts);
|
|
171
|
+
const store = params.io.context.openPluginStateKeyedStore({
|
|
172
|
+
namespace: resolveMatrixInboundDedupeStateNamespace(),
|
|
173
|
+
maxEntries: stateMaxEntries,
|
|
174
|
+
defaultTtlMs: MATRIX_INBOUND_DEDUPE_TTL_MS,
|
|
175
|
+
env: params.io.env
|
|
176
|
+
});
|
|
177
|
+
let capacity = Math.max(0, stateMaxEntries - (await store.entries()).length);
|
|
178
|
+
let imported = 0;
|
|
179
|
+
for (const marker of markers) {
|
|
180
|
+
if (capacity <= 0) break;
|
|
181
|
+
const remainingTtlMs = MATRIX_INBOUND_DEDUPE_TTL_MS - (now - marker.ts);
|
|
182
|
+
if (remainingTtlMs <= 0) continue;
|
|
183
|
+
const entry = createPersistentDedupeImportEntry({
|
|
184
|
+
key: marker.key,
|
|
185
|
+
seenAt: marker.ts,
|
|
186
|
+
ttlMs: Math.max(1, Math.floor(remainingTtlMs))
|
|
187
|
+
});
|
|
188
|
+
if (await store.registerIfAbsent(entry.key, entry.value, { ttlMs: entry.ttlMs ?? 2592e6 })) {
|
|
189
|
+
imported += 1;
|
|
190
|
+
capacity -= 1;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
imported,
|
|
195
|
+
total: markers.length
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
9
199
|
//#region extensions/matrix/doctor-contract-api.ts
|
|
10
200
|
const MATRIX_SYNC_CACHE_FILENAME = "bot-storage.json";
|
|
11
201
|
const MATRIX_STORAGE_META_FILENAME = "storage-meta.json";
|
|
@@ -42,34 +232,107 @@ async function readLegacyMatrixStorageMetadata(storageRootDir) {
|
|
|
42
232
|
}
|
|
43
233
|
}
|
|
44
234
|
async function archiveLegacySyncCache(params) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
await fs.rename(sourcePath, archivedPath);
|
|
53
|
-
params.changes.push(`Archived Matrix sync cache legacy source -> ${archivedPath}`);
|
|
54
|
-
} catch (err) {
|
|
55
|
-
params.warnings.push(`Failed archiving Matrix sync cache legacy source: ${String(err)}`);
|
|
56
|
-
}
|
|
235
|
+
await archiveLegacyMatrixStateFile({
|
|
236
|
+
...params,
|
|
237
|
+
filename: MATRIX_SYNC_CACHE_FILENAME,
|
|
238
|
+
label: "Matrix sync cache"
|
|
239
|
+
});
|
|
57
240
|
}
|
|
58
241
|
async function archiveLegacyMatrixStateFile(params) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
params.changes.push(`Archived ${params.label} legacy source -> ${archivedPath}`);
|
|
68
|
-
} catch (err) {
|
|
69
|
-
params.warnings.push(`Failed archiving ${params.label} legacy source: ${String(err)}`);
|
|
70
|
-
}
|
|
242
|
+
const warningCount = params.warnings.length;
|
|
243
|
+
await archiveLegacyStateSource({
|
|
244
|
+
filePath: path.join(params.storageRootDir, params.filename),
|
|
245
|
+
label: params.label,
|
|
246
|
+
changes: params.changes,
|
|
247
|
+
warnings: params.warnings
|
|
248
|
+
});
|
|
249
|
+
if (params.notice && params.warnings.length === warningCount) params.notices?.push(params.notice);
|
|
71
250
|
}
|
|
72
251
|
const stateMigrations = [
|
|
252
|
+
{
|
|
253
|
+
id: "matrix-inbound-dedupe-to-claimable-dedupe",
|
|
254
|
+
label: "Matrix inbound dedupe markers",
|
|
255
|
+
async detectLegacyState(params) {
|
|
256
|
+
const io = {
|
|
257
|
+
context: params.context,
|
|
258
|
+
env: params.env
|
|
259
|
+
};
|
|
260
|
+
const preview = [];
|
|
261
|
+
const sources = await collectMatrixInboundDedupeSources(params.stateDir);
|
|
262
|
+
for (const storageRootDir of sources.sqliteRoots) {
|
|
263
|
+
try {
|
|
264
|
+
if ((await readLegacyInboundDedupeSqliteSource(io, storageRootDir)).legacyRowCount === 0) continue;
|
|
265
|
+
} catch {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
preview.push(`Matrix inbound dedupe rows can migrate to the claimable dedupe store: ${storageRootDir}`);
|
|
269
|
+
}
|
|
270
|
+
for (const storageRootDir of sources.jsonRoots) preview.push(`Matrix inbound dedupe JSON can migrate to the claimable dedupe store: ${path.join(storageRootDir, MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME)}`);
|
|
271
|
+
return preview.length > 0 ? { preview } : null;
|
|
272
|
+
},
|
|
273
|
+
async migrateLegacyState(params) {
|
|
274
|
+
const io = {
|
|
275
|
+
context: params.context,
|
|
276
|
+
env: params.env
|
|
277
|
+
};
|
|
278
|
+
const changes = [];
|
|
279
|
+
const warnings = [];
|
|
280
|
+
const sources = await collectMatrixInboundDedupeSources(params.stateDir);
|
|
281
|
+
const gathered = [];
|
|
282
|
+
const sqliteRootsToRetire = [];
|
|
283
|
+
for (const storageRootDir of sources.sqliteRoots) try {
|
|
284
|
+
const source = await readLegacyInboundDedupeSqliteSource(io, storageRootDir);
|
|
285
|
+
if (source.legacyRowCount === 0) continue;
|
|
286
|
+
gathered.push(...source.markers);
|
|
287
|
+
sqliteRootsToRetire.push(storageRootDir);
|
|
288
|
+
} catch (err) {
|
|
289
|
+
warnings.push(`Failed reading Matrix inbound dedupe rows for ${storageRootDir}: ${String(err)}; left legacy rows in place`);
|
|
290
|
+
}
|
|
291
|
+
const jsonRootsToRetire = [];
|
|
292
|
+
for (const storageRootDir of sources.jsonRoots) try {
|
|
293
|
+
const markers = await readLegacyInboundDedupeJsonSource(storageRootDir);
|
|
294
|
+
if (markers === null) warnings.push(`Matrix inbound dedupe JSON for ${storageRootDir} is malformed; archived without import`);
|
|
295
|
+
else gathered.push(...markers);
|
|
296
|
+
jsonRootsToRetire.push(storageRootDir);
|
|
297
|
+
} catch (err) {
|
|
298
|
+
warnings.push(`Failed reading Matrix inbound dedupe JSON for ${storageRootDir}: ${String(err)}; left legacy file in place`);
|
|
299
|
+
}
|
|
300
|
+
if (sqliteRootsToRetire.length + jsonRootsToRetire.length === 0) return {
|
|
301
|
+
changes,
|
|
302
|
+
warnings
|
|
303
|
+
};
|
|
304
|
+
try {
|
|
305
|
+
const result = await importNewestInboundDedupeMarkers({
|
|
306
|
+
io,
|
|
307
|
+
markers: gathered
|
|
308
|
+
});
|
|
309
|
+
changes.push(`Migrated Matrix inbound dedupe markers to the claimable dedupe store (${result.imported} of ${result.total} entries)`);
|
|
310
|
+
} catch (err) {
|
|
311
|
+
warnings.push(`Failed importing Matrix inbound dedupe markers: ${String(err)}; left legacy sources in place`);
|
|
312
|
+
return {
|
|
313
|
+
changes,
|
|
314
|
+
warnings
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
for (const storageRootDir of sqliteRootsToRetire) try {
|
|
318
|
+
await retireLegacyInboundDedupeSqliteRows(io, storageRootDir);
|
|
319
|
+
changes.push(`Retired Matrix inbound dedupe rows for ${storageRootDir}`);
|
|
320
|
+
} catch (err) {
|
|
321
|
+
warnings.push(`Failed retiring Matrix inbound dedupe rows for ${storageRootDir}: ${String(err)}`);
|
|
322
|
+
}
|
|
323
|
+
for (const storageRootDir of jsonRootsToRetire) await archiveLegacyMatrixStateFile({
|
|
324
|
+
storageRootDir,
|
|
325
|
+
filename: MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME,
|
|
326
|
+
label: "Matrix inbound dedupe",
|
|
327
|
+
changes,
|
|
328
|
+
warnings
|
|
329
|
+
});
|
|
330
|
+
return {
|
|
331
|
+
changes,
|
|
332
|
+
warnings
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
},
|
|
73
336
|
{
|
|
74
337
|
id: "matrix-storage-meta-json-to-plugin-state",
|
|
75
338
|
label: "Matrix storage metadata",
|
|
@@ -84,18 +347,20 @@ const stateMigrations = [
|
|
|
84
347
|
async migrateLegacyState(params) {
|
|
85
348
|
const changes = [];
|
|
86
349
|
const warnings = [];
|
|
350
|
+
const notices = [];
|
|
87
351
|
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_STORAGE_META_FILENAME)) {
|
|
88
352
|
const payload = await readLegacyMatrixStorageMetadata(storageRootDir);
|
|
89
353
|
if (!payload) continue;
|
|
90
354
|
const store = params.context.openPluginStateKeyedStore(openMatrixStorageMetaStoreOptions(storageRootDir));
|
|
91
355
|
if (await hasMatrixStorageMetaStateInStore({ store })) {
|
|
92
|
-
warnings.push(`Skipped Matrix storage metadata import for ${storageRootDir} because SQLite already has metadata`);
|
|
93
356
|
await archiveLegacyMatrixStateFile({
|
|
94
357
|
storageRootDir,
|
|
95
358
|
filename: MATRIX_STORAGE_META_FILENAME,
|
|
96
359
|
label: "Matrix storage metadata",
|
|
97
360
|
changes,
|
|
98
|
-
warnings
|
|
361
|
+
warnings,
|
|
362
|
+
notices,
|
|
363
|
+
notice: `Kept existing Matrix storage metadata in SQLite and archived the legacy source for ${storageRootDir}`
|
|
99
364
|
});
|
|
100
365
|
continue;
|
|
101
366
|
}
|
|
@@ -114,7 +379,8 @@ const stateMigrations = [
|
|
|
114
379
|
}
|
|
115
380
|
return {
|
|
116
381
|
changes,
|
|
117
|
-
warnings
|
|
382
|
+
warnings,
|
|
383
|
+
...notices.length > 0 ? { notices } : {}
|
|
118
384
|
};
|
|
119
385
|
}
|
|
120
386
|
},
|
|
@@ -132,6 +398,7 @@ const stateMigrations = [
|
|
|
132
398
|
async migrateLegacyState(params) {
|
|
133
399
|
const changes = [];
|
|
134
400
|
const warnings = [];
|
|
401
|
+
const notices = [];
|
|
135
402
|
for (const storageRootDir of await collectLegacySyncCacheRoots(params.stateDir)) {
|
|
136
403
|
const persisted = await readLegacyMatrixSyncCacheState(storageRootDir);
|
|
137
404
|
if (!persisted) continue;
|
|
@@ -140,11 +407,12 @@ const stateMigrations = [
|
|
|
140
407
|
storageRootDir,
|
|
141
408
|
store
|
|
142
409
|
})) {
|
|
143
|
-
warnings.push(`Skipped Matrix sync cache import for ${storageRootDir} because SQLite already has sync cache state`);
|
|
144
410
|
await archiveLegacySyncCache({
|
|
145
411
|
storageRootDir,
|
|
146
412
|
changes,
|
|
147
|
-
warnings
|
|
413
|
+
warnings,
|
|
414
|
+
notices,
|
|
415
|
+
notice: `Kept existing Matrix sync cache in SQLite and archived the legacy source for ${storageRootDir}`
|
|
148
416
|
});
|
|
149
417
|
continue;
|
|
150
418
|
}
|
|
@@ -162,7 +430,8 @@ const stateMigrations = [
|
|
|
162
430
|
}
|
|
163
431
|
return {
|
|
164
432
|
changes,
|
|
165
|
-
warnings
|
|
433
|
+
warnings,
|
|
434
|
+
...notices.length > 0 ? { notices } : {}
|
|
166
435
|
};
|
|
167
436
|
}
|
|
168
437
|
},
|
|
@@ -180,18 +449,20 @@ const stateMigrations = [
|
|
|
180
449
|
async migrateLegacyState(params) {
|
|
181
450
|
const changes = [];
|
|
182
451
|
const warnings = [];
|
|
452
|
+
const notices = [];
|
|
183
453
|
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_RECOVERY_KEY_FILENAME)) {
|
|
184
454
|
const payload = readLegacyMatrixRecoveryKeyState(storageRootDir);
|
|
185
455
|
if (!payload) continue;
|
|
186
456
|
const store = params.context.openPluginStateKeyedStore(openMatrixRecoveryKeyStoreOptions(storageRootDir));
|
|
187
457
|
if (await hasMatrixRecoveryKeyStateInStore({ store })) {
|
|
188
|
-
warnings.push(`Skipped Matrix recovery-key import for ${storageRootDir} because SQLite already has recovery-key state`);
|
|
189
458
|
await archiveLegacyMatrixStateFile({
|
|
190
459
|
storageRootDir,
|
|
191
460
|
filename: MATRIX_RECOVERY_KEY_FILENAME,
|
|
192
461
|
label: "Matrix recovery key",
|
|
193
462
|
changes,
|
|
194
|
-
warnings
|
|
463
|
+
warnings,
|
|
464
|
+
notices,
|
|
465
|
+
notice: `Kept existing Matrix recovery key in SQLite and archived the legacy source for ${storageRootDir}`
|
|
195
466
|
});
|
|
196
467
|
continue;
|
|
197
468
|
}
|
|
@@ -210,7 +481,8 @@ const stateMigrations = [
|
|
|
210
481
|
}
|
|
211
482
|
return {
|
|
212
483
|
changes,
|
|
213
|
-
warnings
|
|
484
|
+
warnings,
|
|
485
|
+
...notices.length > 0 ? { notices } : {}
|
|
214
486
|
};
|
|
215
487
|
}
|
|
216
488
|
},
|
|
@@ -228,18 +500,20 @@ const stateMigrations = [
|
|
|
228
500
|
async migrateLegacyState(params) {
|
|
229
501
|
const changes = [];
|
|
230
502
|
const warnings = [];
|
|
503
|
+
const notices = [];
|
|
231
504
|
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME)) {
|
|
232
505
|
const snapshot = await readLegacyMatrixIdbSnapshotState(storageRootDir);
|
|
233
506
|
if (!snapshot) continue;
|
|
234
507
|
const store = params.context.openPluginStateKeyedStore(openMatrixIdbSnapshotStoreOptions(storageRootDir));
|
|
235
508
|
if (await hasMatrixIdbSnapshotStateInStore({ store })) {
|
|
236
|
-
warnings.push(`Skipped Matrix IndexedDB snapshot import for ${storageRootDir} because SQLite already has snapshot state`);
|
|
237
509
|
await archiveLegacyMatrixStateFile({
|
|
238
510
|
storageRootDir,
|
|
239
511
|
filename: MATRIX_IDB_SNAPSHOT_FILENAME,
|
|
240
512
|
label: "Matrix IndexedDB snapshot",
|
|
241
513
|
changes,
|
|
242
|
-
warnings
|
|
514
|
+
warnings,
|
|
515
|
+
notices,
|
|
516
|
+
notice: `Kept existing Matrix IndexedDB snapshot in SQLite and archived the legacy source for ${storageRootDir}`
|
|
243
517
|
});
|
|
244
518
|
continue;
|
|
245
519
|
}
|
|
@@ -259,7 +533,8 @@ const stateMigrations = [
|
|
|
259
533
|
}
|
|
260
534
|
return {
|
|
261
535
|
changes,
|
|
262
|
-
warnings
|
|
536
|
+
warnings,
|
|
537
|
+
...notices.length > 0 ? { notices } : {}
|
|
263
538
|
};
|
|
264
539
|
}
|
|
265
540
|
},
|
|
@@ -277,18 +552,20 @@ const stateMigrations = [
|
|
|
277
552
|
async migrateLegacyState(params) {
|
|
278
553
|
const changes = [];
|
|
279
554
|
const warnings = [];
|
|
555
|
+
const notices = [];
|
|
280
556
|
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME)) {
|
|
281
557
|
const state = readLegacyMatrixLegacyCryptoMigrationState(storageRootDir);
|
|
282
558
|
if (!state) continue;
|
|
283
559
|
const store = params.context.openPluginStateKeyedStore(openMatrixLegacyCryptoMigrationStoreOptions(storageRootDir));
|
|
284
560
|
if (await hasMatrixLegacyCryptoMigrationStateInStore({ store })) {
|
|
285
|
-
warnings.push(`Skipped Matrix legacy crypto migration import for ${storageRootDir} because SQLite already has migration state`);
|
|
286
561
|
await archiveLegacyMatrixStateFile({
|
|
287
562
|
storageRootDir,
|
|
288
563
|
filename: MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME,
|
|
289
564
|
label: "Matrix legacy crypto migration",
|
|
290
565
|
changes,
|
|
291
|
-
warnings
|
|
566
|
+
warnings,
|
|
567
|
+
notices,
|
|
568
|
+
notice: `Kept existing Matrix legacy crypto migration in SQLite and archived the legacy source for ${storageRootDir}`
|
|
292
569
|
});
|
|
293
570
|
continue;
|
|
294
571
|
}
|
|
@@ -307,7 +584,8 @@ const stateMigrations = [
|
|
|
307
584
|
}
|
|
308
585
|
return {
|
|
309
586
|
changes,
|
|
310
|
-
warnings
|
|
587
|
+
warnings,
|
|
588
|
+
...notices.length > 0 ? { notices } : {}
|
|
311
589
|
};
|
|
312
590
|
}
|
|
313
591
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as editMessageMatrix, r as prepareMatrixSingleText, s as sendSingleTextMessageMatrix, y as MsgType } from "./send-
|
|
1
|
+
import { n as editMessageMatrix, r as prepareMatrixSingleText, s as sendSingleTextMessageMatrix, y as MsgType } from "./send-C7xuGWpv.js";
|
|
2
2
|
import { createDraftStreamLoop } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
3
|
//#region extensions/matrix/src/matrix/draft-stream.ts
|
|
4
4
|
const DEFAULT_THROTTLE_MS = 1e3;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveMatrixDefaultOrOnlyAccountId } from "./account-selection-
|
|
1
|
+
import { a as resolveMatrixDefaultOrOnlyAccountId } from "./account-selection-Bz00QTmQ.js";
|
|
2
2
|
import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
|
|
3
3
|
import { normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
4
4
|
//#region extensions/matrix/src/matrix/encryption-guidance.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as getMatrixScopedEnvVarNames } from "./env-vars-
|
|
1
|
+
import { t as getMatrixScopedEnvVarNames } from "./env-vars-B0NxQnPk.js";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
3
3
|
//#region extensions/matrix/src/matrix/client/env-auth.ts
|
|
4
4
|
function cleanEnv(value) {
|
|
@@ -54,7 +54,9 @@ function listMatrixEnvAccountIds(env = process.env) {
|
|
|
54
54
|
for (const key of Object.keys(env)) {
|
|
55
55
|
const match = MATRIX_SCOPED_ENV_RE.exec(key);
|
|
56
56
|
if (!match) continue;
|
|
57
|
-
const
|
|
57
|
+
const encodedAccountId = match[1];
|
|
58
|
+
if (!encodedAccountId) continue;
|
|
59
|
+
const accountId = decodeMatrixEnvAccountToken(encodedAccountId);
|
|
58
60
|
if (accountId) ids.add(accountId);
|
|
59
61
|
}
|
|
60
62
|
return Array.from(ids).toSorted((a, b) => a.localeCompare(b));
|
|
@@ -2,9 +2,10 @@ import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
|
|
|
2
2
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
3
3
|
//#region extensions/matrix/src/exec-approval-resolver.ts
|
|
4
4
|
async function resolveMatrixApproval(params) {
|
|
5
|
-
await resolveApprovalOverGateway({
|
|
5
|
+
return await resolveApprovalOverGateway({
|
|
6
6
|
cfg: params.cfg,
|
|
7
7
|
approvalId: params.approvalId,
|
|
8
|
+
approvalKind: params.approvalKind,
|
|
8
9
|
decision: params.decision,
|
|
9
10
|
senderId: params.senderId,
|
|
10
11
|
gatewayUrl: params.gatewayUrl,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as getMatrixRuntime } from "./runtime-
|
|
4
|
-
import {
|
|
5
|
-
import { t as claimCurrentTokenStorageState } from "./storage-CQdyKcGg.js";
|
|
2
|
+
import { t as isRecord } from "./record-shared-CvzjvHRn.js";
|
|
3
|
+
import { t as getMatrixRuntime } from "./runtime-CveSqMOP.js";
|
|
4
|
+
import { M as resolveMatrixSqliteStateEnv, t as claimCurrentTokenStorageState } from "./storage-BtSOar8T.js";
|
|
6
5
|
import { t as createAsyncLock } from "./async-lock-BcLS4KOc.js";
|
|
7
|
-
import { n as LogService } from "./logger-
|
|
6
|
+
import { n as LogService } from "./logger-BMClpI5b.js";
|
|
8
7
|
import path from "node:path";
|
|
9
8
|
import { createHash, randomUUID } from "node:crypto";
|
|
10
9
|
import fs from "node:fs/promises";
|