@openclaw/matrix 2026.9.1-beta.1 → 2026.9.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-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
- package/dist/{account-selection-CWuhuFn1.js → account-selection-DA-jfx22.js} +74 -36
- package/dist/{accounts-BCzyubQt.js → accounts-DR1c4xF_.js} +4 -5
- package/dist/api.js +5 -5
- package/dist/{approval-handler.runtime-G9fLHUWe.js → approval-handler.runtime-B_6ytY5I.js} +34 -11
- package/dist/{approval-ids-C6FD3pVY.js → approval-ids-CfHtZ9d1.js} +1 -1
- package/dist/{approval-reaction-auth-60xHiDtQ.js → approval-reaction-auth-BpDvJqfy.js} +2 -2
- package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
- package/dist/{channel-CBEvelTE.js → channel-b-jES-oi.js} +63 -58
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-BkqjwEDU.js +76 -0
- package/dist/{channel.setup-sWPOGyQG.js → channel.setup-BY42QaL7.js} +28 -21
- package/dist/{cli-DrTD2a_q.js → cli-CtYeU7ol.js} +42 -32
- package/dist/{cli-metadata-DrYVwQ_r.js → cli-metadata-B7MQjR5S.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-BUtHbzib.js → client-D2utPQ1E.js} +2 -2
- package/dist/{client-hs1ePy2O.js → client-Dj4mcf-s.js} +73 -22
- package/dist/{client-bootstrap-BxdxjCwA.js → client-bootstrap-n1Rqc8Go.js} +1 -1
- package/dist/{config-update-Bor_Pjsv.js → config-update-BnX26jCO.js} +48 -31
- package/dist/contract-api.js +2 -2
- package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
- package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
- package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
- package/dist/{crypto-runtime-C4WDYxlP.js → crypto-runtime-m1eplj3b.js} +7 -7
- package/dist/crypto-snapshot-doctor.runtime-D0v841D_.js +91 -0
- package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
- package/dist/{directory-live-D0KfJlby.js → directory-live-DLUgWBhA.js} +8 -6
- package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
- package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
- package/dist/doctor-contract-api.js +89 -109
- package/dist/{draft-stream-B_m79Ynb.js → draft-stream-DPYdv4fE.js} +1 -1
- package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-BNcZNQZI.js} +3 -2
- package/dist/helper-api.js +1 -1
- package/dist/{http-client-D8o8b9u6.js → http-client-DOmFvKvB.js} +10 -7
- package/dist/{idb-persistence-DfgW720p.js → idb-persistence-CU7CNLlX.js} +2 -2
- package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
- package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-Dow9EOoJ.js → messages-C1U3b1oN.js} +154 -5
- package/dist/{monitor-DBB47wTy.js → monitor-SNnu-0bp.js} +177 -130
- package/dist/outbound-CeCEtF_q.js +220 -0
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-B1YPxG9x.js +2 -0
- package/dist/{profile-update-C61NR24_.js → profile-update-Cd1p8ABr.js} +5 -4
- package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
- package/dist/{reaction-events-BZUgLIZI.js → reaction-events-DveJRUaX.js} +9 -7
- package/dist/{resolve-targets-DXzZwsIY.js → resolve-targets-B64O69Nd.js} +1 -1
- package/dist/{resolver.runtime-p5qJ3Kst.js → resolver.runtime-TRmePJDV.js} +1 -1
- package/dist/{room-info-BXQA7y10.js → room-info-DVkKDscD.js} +55 -1
- package/dist/runtime-api.js +2 -2
- package/dist/{sdk-CljOKEvc.js → sdk-C1yfda1L.js} +534 -26
- package/dist/{send-BKu9Ghi4.js → send-DG7Bnj7_.js} +26 -24
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-CpE6C3qV.js → setup-bootstrap-Co985F63.js} +3 -3
- package/dist/{setup-core-CyvaCOOr.js → setup-core-CEF6exLW.js} +8 -7
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DtRvRcCT.js → setup-surface-BSlj1vnL.js} +84 -79
- package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
- package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
- package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/sync-cache-state-d-A_OhbU.js +234 -0
- package/dist/{thread-bindings-BvyU66kE.js → thread-bindings-DgxQEB99.js} +4 -4
- package/dist/{tool-actions.runtime-DD6jUxFK.js → tool-actions.runtime-vbkQgU7D.js} +226 -215
- package/dist/{verification-BP-3-XYn.js → verification-D-iOebn4.js} +2 -2
- package/node_modules/matrix-js-sdk/lib/client.d.ts +2 -1
- package/node_modules/matrix-js-sdk/lib/client.js +6 -2
- package/node_modules/matrix-js-sdk/lib/sync.js +8 -8
- package/node_modules/matrix-js-sdk/src/client.ts +7 -3
- package/node_modules/matrix-js-sdk/src/sync.ts +8 -8
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +16 -1
- package/package.json +7 -6
- package/dist/channel.runtime-CiDl9deX.js +0 -276
- package/dist/env-auth-MVS-Vv41.js +0 -64
- package/dist/file-sync-store-DjskBX2o.js +0 -436
- package/dist/media-text-OR9uoC4W.js +0 -153
- package/dist/probe.runtime-CRM7RIrB.js +0 -2
- package/dist/recovery-key-store-CognuDys.js +0 -276
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { t as findMatrixAccountConfig } from "./account-config-
|
|
2
|
+
import { t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
3
3
|
import { n as resolveMatrixConfigPath$1, r as shouldStoreMatrixAccountAtTopLevel, t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
|
-
import { normalizeSecretInputString } from "openclaw/plugin-sdk/
|
|
5
|
+
import { coerceSecretRef, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
6
6
|
import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
7
|
-
import { coerceSecretRef } from "openclaw/plugin-sdk/secret-ref-runtime";
|
|
8
7
|
//#region extensions/matrix/src/matrix/config-update.ts
|
|
9
8
|
var config_update_exports = /* @__PURE__ */ __exportAll({
|
|
10
9
|
resolveMatrixConfigFieldPath: () => resolveMatrixConfigFieldPath,
|
|
@@ -67,11 +66,13 @@ function updateMatrixAccountConfig(cfg, accountId, patch) {
|
|
|
67
66
|
const matrix = cfg.channels?.matrix ?? {};
|
|
68
67
|
const normalizedAccountId = normalizeAccountId(accountId);
|
|
69
68
|
const nextAccount = { ...findMatrixAccountConfig(cfg, normalizedAccountId) ?? (normalizedAccountId === DEFAULT_ACCOUNT_ID ? matrix : {}) };
|
|
70
|
-
if (patch.name !== void 0)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
if (patch.name !== void 0) {
|
|
70
|
+
if (patch.name === null) delete nextAccount.name;
|
|
71
|
+
else {
|
|
72
|
+
const trimmed = patch.name.trim();
|
|
73
|
+
if (trimmed) nextAccount.name = trimmed;
|
|
74
|
+
else delete nextAccount.name;
|
|
75
|
+
}
|
|
75
76
|
}
|
|
76
77
|
if (typeof patch.enabled === "boolean") nextAccount.enabled = patch.enabled;
|
|
77
78
|
else if (typeof nextAccount.enabled !== "boolean") nextAccount.enabled = true;
|
|
@@ -90,31 +91,47 @@ function updateMatrixAccountConfig(cfg, accountId, patch) {
|
|
|
90
91
|
if (Object.keys(nextNetwork).length > 0) nextAccount.network = nextNetwork;
|
|
91
92
|
else delete nextAccount.network;
|
|
92
93
|
}
|
|
93
|
-
if (patch.initialSyncLimit !== void 0)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (patch.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
94
|
+
if (patch.initialSyncLimit !== void 0) {
|
|
95
|
+
if (patch.initialSyncLimit === null) delete nextAccount.initialSyncLimit;
|
|
96
|
+
else {
|
|
97
|
+
const initialSyncLimit = resolveOptionalIntegerOption(patch.initialSyncLimit, { min: 0 });
|
|
98
|
+
if (initialSyncLimit === void 0) delete nextAccount.initialSyncLimit;
|
|
99
|
+
else nextAccount.initialSyncLimit = initialSyncLimit;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (patch.encryption !== void 0) {
|
|
103
|
+
if (patch.encryption === null) delete nextAccount.encryption;
|
|
104
|
+
else nextAccount.encryption = patch.encryption;
|
|
105
|
+
}
|
|
106
|
+
if (patch.allowBots !== void 0) {
|
|
107
|
+
if (patch.allowBots === null) delete nextAccount.allowBots;
|
|
108
|
+
else nextAccount.allowBots = patch.allowBots;
|
|
109
|
+
}
|
|
110
|
+
if (patch.autoJoin !== void 0) {
|
|
111
|
+
if (patch.autoJoin === null) delete nextAccount.autoJoin;
|
|
112
|
+
else nextAccount.autoJoin = patch.autoJoin;
|
|
113
|
+
}
|
|
105
114
|
applyNullableArrayField(nextAccount, "autoJoinAllowlist", patch.autoJoinAllowlist);
|
|
106
|
-
if (patch.dm !== void 0)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
if (patch.dm !== void 0) {
|
|
116
|
+
if (patch.dm === null) delete nextAccount.dm;
|
|
117
|
+
else nextAccount.dm = cloneMatrixDmConfig({
|
|
118
|
+
...nextAccount.dm,
|
|
119
|
+
...patch.dm
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (patch.groupPolicy !== void 0) {
|
|
123
|
+
if (patch.groupPolicy === null) delete nextAccount.groupPolicy;
|
|
124
|
+
else nextAccount.groupPolicy = patch.groupPolicy;
|
|
125
|
+
}
|
|
113
126
|
applyNullableArrayField(nextAccount, "groupAllowFrom", patch.groupAllowFrom);
|
|
114
|
-
if (patch.groups !== void 0)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
127
|
+
if (patch.groups !== void 0) {
|
|
128
|
+
if (patch.groups === null) delete nextAccount.groups;
|
|
129
|
+
else nextAccount.groups = cloneMatrixRoomMap(patch.groups);
|
|
130
|
+
}
|
|
131
|
+
if (patch.rooms !== void 0) {
|
|
132
|
+
if (patch.rooms === null) delete nextAccount.rooms;
|
|
133
|
+
else nextAccount.rooms = cloneMatrixRoomMap(patch.rooms);
|
|
134
|
+
}
|
|
118
135
|
const nextAccounts = Object.fromEntries(Object.entries(matrix.accounts ?? {}).filter(([rawAccountId]) => rawAccountId === normalizedAccountId || normalizeAccountId(rawAccountId) !== normalizedAccountId));
|
|
119
136
|
if (shouldStoreMatrixAccountAtTopLevel(cfg, normalizedAccountId)) {
|
|
120
137
|
const { accounts: _ignoredAccounts, defaultAccount } = matrix;
|
package/dist/contract-api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as singleAccountKeysToMove, n as matrixSetupAdapter, o as namedAccountPromotionKeys, s as resolveSingleAccountPromotionTarget } from "./setup-core-
|
|
2
|
-
import { n as matrixOnboardingAdapter } from "./setup-surface-
|
|
1
|
+
import { c as singleAccountKeysToMove, n as matrixSetupAdapter, o as namedAccountPromotionKeys, s as resolveSingleAccountPromotionTarget } from "./setup-core-CEF6exLW.js";
|
|
2
|
+
import { n as matrixOnboardingAdapter } from "./setup-surface-BSlj1vnL.js";
|
|
3
3
|
export { matrixSetupAdapter, matrixOnboardingAdapter as matrixSetupWizard, namedAccountPromotionKeys, resolveSingleAccountPromotionTarget, singleAccountKeysToMove };
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { i as normalizeMatrixStoredCredentials, n as isMatrixCredentialRevocation, r as matrixCredentialsStoreKey } from "./credentials-state-B3cuUFwZ.js";
|
|
2
2
|
import { a as resolveMatrixCredentialsPath, r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.js";
|
|
3
|
-
import { a as openMatrixCredentialsStore, i as loadMatrixCredentials, n as credentialsMatchConfig, t as clearMatrixCredentials } from "./credentials-read-
|
|
3
|
+
import { a as openMatrixCredentialsStore, i as loadMatrixCredentials, n as credentialsMatchConfig, t as clearMatrixCredentials } from "./credentials-read-mexhw-Ur.js";
|
|
4
4
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
5
|
//#region extensions/matrix/src/matrix/credentials.ts
|
|
6
|
-
function requireCredentialStoreUpdate(store) {
|
|
7
|
-
if (!store.update) throw new Error("Matrix credentials require atomic plugin-state updates");
|
|
8
|
-
return store.update;
|
|
9
|
-
}
|
|
10
6
|
async function saveMatrixCredentials(credentials, env = process.env, accountId) {
|
|
11
7
|
const normalizedAccountId = normalizeAccountId(accountId);
|
|
12
8
|
const store = openMatrixCredentialsStore(env);
|
|
13
9
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
14
|
-
|
|
10
|
+
store.update(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
|
|
15
11
|
const existing = normalizeMatrixStoredCredentials(current, normalizedAccountId);
|
|
16
12
|
return {
|
|
17
13
|
accountId: normalizedAccountId,
|
|
@@ -29,7 +25,7 @@ async function saveBackfilledMatrixDeviceId(credentials, env = process.env, acco
|
|
|
29
25
|
const store = openMatrixCredentialsStore(env);
|
|
30
26
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
31
27
|
let result = "saved";
|
|
32
|
-
|
|
28
|
+
store.update(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
|
|
33
29
|
if (isMatrixCredentialRevocation(current, normalizedAccountId)) {
|
|
34
30
|
result = "skipped";
|
|
35
31
|
return current;
|
|
@@ -53,7 +49,7 @@ async function saveBackfilledMatrixDeviceId(credentials, env = process.env, acco
|
|
|
53
49
|
}
|
|
54
50
|
async function touchMatrixCredentials(env = process.env, accountId) {
|
|
55
51
|
const normalizedAccountId = normalizeAccountId(accountId);
|
|
56
|
-
|
|
52
|
+
openMatrixCredentialsStore(env).update(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
|
|
57
53
|
if (isMatrixCredentialRevocation(current, normalizedAccountId)) return current;
|
|
58
54
|
const existing = normalizeMatrixStoredCredentials(current, normalizedAccountId);
|
|
59
55
|
return existing ? {
|
|
@@ -15,19 +15,21 @@ var credentials_read_exports = /* @__PURE__ */ __exportAll({
|
|
|
15
15
|
});
|
|
16
16
|
function openMatrixCredentialsStore(env = process.env) {
|
|
17
17
|
const runtime = getOptionalMatrixRuntime();
|
|
18
|
+
const resolvedEnv = env.OPENCLAW_STATE_DIR?.trim() || !runtime ? env : {
|
|
19
|
+
...env,
|
|
20
|
+
OPENCLAW_STATE_DIR: runtime.state.resolveStateDir(env)
|
|
21
|
+
};
|
|
18
22
|
return createPluginStateSyncKeyedStore("matrix", {
|
|
19
23
|
namespace: MATRIX_CREDENTIALS_NAMESPACE,
|
|
20
24
|
maxEntries: 256,
|
|
21
25
|
overflowPolicy: "reject-new",
|
|
22
|
-
env:
|
|
23
|
-
...env,
|
|
24
|
-
OPENCLAW_STATE_DIR: runtime.state.resolveStateDir(env)
|
|
25
|
-
}
|
|
26
|
+
env: resolvedEnv
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
function loadMatrixCredentials(env = process.env, accountId) {
|
|
29
30
|
const normalizedAccountId = normalizeAccountId(accountId);
|
|
30
|
-
const
|
|
31
|
+
const stored = openMatrixCredentialsStore(env).lookup(matrixCredentialsStoreKey(accountId));
|
|
32
|
+
const parsed = normalizeMatrixStoredCredentials(stored, normalizedAccountId);
|
|
31
33
|
if (!parsed || parsed.accountId !== normalizedAccountId) return null;
|
|
32
34
|
const { accountId: _accountId, ...credentials } = parsed;
|
|
33
35
|
return credentials;
|
package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
2
2
|
//#region extensions/matrix/src/matrix/credentials-write.runtime.ts
|
|
3
|
-
const loadMatrixCredentialsRuntime = createLazyRuntimeModule(() => import("./credentials-
|
|
3
|
+
const loadMatrixCredentialsRuntime = createLazyRuntimeModule(() => import("./credentials-DJj2xs3q.js"));
|
|
4
4
|
async function saveMatrixCredentials(...args) {
|
|
5
5
|
return (await loadMatrixCredentialsRuntime()).saveMatrixCredentials(...args);
|
|
6
6
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { t as ensureMatrixCryptoRuntime } from "./deps-
|
|
1
|
+
import { t as ensureMatrixCryptoRuntime } from "./deps-mtxF2mHI.js";
|
|
2
2
|
import { n as LogService, r as noop } from "./logger-B_71hN6W.js";
|
|
3
|
-
import { i as restoreIdbFromDisk, n as persistIdbToDisk } from "./idb-persistence-
|
|
4
|
-
import { n as isRepairableSecretStorageAccessError } from "./
|
|
3
|
+
import { i as restoreIdbFromDisk, n as persistIdbToDisk } from "./idb-persistence-CU7CNLlX.js";
|
|
4
|
+
import { n as isRepairableSecretStorageAccessError } from "./sdk-C1yfda1L.js";
|
|
5
5
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
6
|
import { formatErrorMessage, toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
7
7
|
import { resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
8
|
-
import { MatrixEventEvent } from "matrix-js-sdk/lib/matrix.js";
|
|
9
|
-
import { IDBDatabase } from "fake-indexeddb";
|
|
10
8
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
9
|
+
import { IDBDatabase } from "fake-indexeddb";
|
|
10
|
+
import { MatrixEventEvent } from "matrix-js-sdk/lib/matrix.js";
|
|
11
11
|
import { VerificationMethod } from "matrix-js-sdk/lib/types.js";
|
|
12
12
|
import "fake-indexeddb/auto";
|
|
13
13
|
import { CryptoEvent } from "matrix-js-sdk/lib/crypto-api/CryptoEvent.js";
|
|
@@ -450,7 +450,7 @@ const MATRIX_DECRYPT_RETRY_BASE_DELAY_MS = 1500;
|
|
|
450
450
|
const MATRIX_DECRYPT_RETRY_MAX_DELAY_MS = 3e4;
|
|
451
451
|
const MATRIX_DECRYPT_RETRY_MAX_ATTEMPTS = 8;
|
|
452
452
|
const MATRIX_DECRYPT_DRAIN_TIMEOUT_MS = 5e3;
|
|
453
|
-
const MATRIX_DECRYPT_EXHAUSTED_RETRY_TTL_MS =
|
|
453
|
+
const MATRIX_DECRYPT_EXHAUSTED_RETRY_TTL_MS = 36e5;
|
|
454
454
|
const MATRIX_DECRYPT_EXHAUSTED_RETRY_MAX_ENTRIES = 512;
|
|
455
455
|
function resolveDecryptRetryKey(roomId, eventId) {
|
|
456
456
|
if (!roomId || !eventId) return null;
|
|
@@ -770,7 +770,7 @@ function isMatrixVerificationPhase(value) {
|
|
|
770
770
|
return typeof value === "number" && MATRIX_VERIFICATION_PHASES.has(value);
|
|
771
771
|
}
|
|
772
772
|
const MAX_TRACKED_VERIFICATION_SESSIONS = 256;
|
|
773
|
-
const TERMINAL_SESSION_RETENTION_MS =
|
|
773
|
+
const TERMINAL_SESSION_RETENTION_MS = 864e5;
|
|
774
774
|
const SAS_AUTO_CONFIRM_DELAY_MS = 3e4;
|
|
775
775
|
var MatrixVerificationManager = class {
|
|
776
776
|
constructor(opts = {}) {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { O as writeMatrixIdbSnapshotJsonToStore, T as readMatrixIdbSnapshotJsonFromStore, f as MATRIX_IDB_SNAPSHOT_FILENAME, v as openMatrixIdbSnapshotStoreOptions } from "./storage-BVf4uucD.js";
|
|
2
|
+
import { n as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS } from "./idb-persistence-lock-B3fZXyF_.js";
|
|
3
|
+
import { r as readLegacyMatrixIdbSnapshotStateUnlocked, t as isValidMatrixIdbSnapshotJson } from "./idb-persistence-CU7CNLlX.js";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import fs from "node:fs";
|
|
7
|
+
import fs$1 from "node:fs/promises";
|
|
8
|
+
import { isDeepStrictEqual } from "node:util";
|
|
9
|
+
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
10
|
+
//#region extensions/matrix/src/matrix/crypto-snapshot-doctor.runtime.ts
|
|
11
|
+
async function migrateLegacyMatrixIdbSnapshot(params) {
|
|
12
|
+
const snapshotPath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
13
|
+
try {
|
|
14
|
+
await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, () => migrateLegacyMatrixIdbSnapshotLocked(params));
|
|
15
|
+
} catch (err) {
|
|
16
|
+
params.warnings.push(`Failed locking Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function migrateLegacyMatrixIdbSnapshotLocked(params) {
|
|
20
|
+
const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
21
|
+
let snapshot;
|
|
22
|
+
try {
|
|
23
|
+
snapshot = readLegacyMatrixIdbSnapshotStateUnlocked(params.storageRootDir);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
params.warnings.push(`Failed reading Matrix IndexedDB snapshot legacy source for ${params.storageRootDir}: ${String(err)}; left source in place`);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!snapshot) {
|
|
29
|
+
if (!fs.existsSync(sourcePath)) return;
|
|
30
|
+
const archived = await archiveLegacyMatrixIdbSnapshot(params);
|
|
31
|
+
params.warnings.push(archived ? `Matrix IndexedDB snapshot legacy source is invalid for ${params.storageRootDir}; archived without import` : `Matrix IndexedDB snapshot legacy source is invalid for ${params.storageRootDir}; left active because archival failed`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const snapshotJson = JSON.stringify(snapshot);
|
|
35
|
+
const store = params.context.openPluginStateKeyedStore(openMatrixIdbSnapshotStoreOptions(params.storageRootDir));
|
|
36
|
+
let persisted;
|
|
37
|
+
let hadPartialState;
|
|
38
|
+
try {
|
|
39
|
+
persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
|
|
40
|
+
const persistedIsValid = persisted ? isValidMatrixIdbSnapshotJson(persisted) : false;
|
|
41
|
+
hadPartialState = !persistedIsValid && (await store.entries()).length > 0;
|
|
42
|
+
if (!persistedIsValid) persisted = null;
|
|
43
|
+
} catch (err) {
|
|
44
|
+
params.warnings.push(`Failed inspecting Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (persisted && !snapshotContentMatches(persisted, snapshot)) {
|
|
48
|
+
if (await archiveLegacyMatrixIdbSnapshot(params)) params.notices.push(`Kept the canonical Matrix IndexedDB snapshot in SQLite and archived a differing legacy source for ${params.storageRootDir}`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (!persisted) {
|
|
52
|
+
try {
|
|
53
|
+
await writeMatrixIdbSnapshotJsonToStore({
|
|
54
|
+
snapshotJson,
|
|
55
|
+
databaseCount: snapshot.length,
|
|
56
|
+
store
|
|
57
|
+
});
|
|
58
|
+
persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
|
|
59
|
+
} catch (err) {
|
|
60
|
+
params.warnings.push(`Failed importing Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (!persisted || !snapshotContentMatches(persisted, snapshot)) {
|
|
64
|
+
params.warnings.push(`Failed verifying Matrix IndexedDB snapshot for ${params.storageRootDir}; left legacy source in place`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
params.changes.push(hadPartialState ? `Repaired partial or invalid Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}` : `Migrated Matrix IndexedDB snapshot JSON to SQLite for ${params.storageRootDir}`);
|
|
68
|
+
}
|
|
69
|
+
await archiveLegacyMatrixIdbSnapshot(params);
|
|
70
|
+
}
|
|
71
|
+
function snapshotContentMatches(persistedJson, snapshot) {
|
|
72
|
+
try {
|
|
73
|
+
return isDeepStrictEqual(JSON.parse(persistedJson), snapshot);
|
|
74
|
+
} catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async function archiveLegacyMatrixIdbSnapshot(params) {
|
|
79
|
+
const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
80
|
+
const archivePath = `${sourcePath}.migrated-${(/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-")}-${randomUUID()}`;
|
|
81
|
+
try {
|
|
82
|
+
await fs$1.rename(sourcePath, archivePath);
|
|
83
|
+
params.changes.push(`Archived Matrix IndexedDB snapshot legacy source -> ${archivePath}`);
|
|
84
|
+
return true;
|
|
85
|
+
} catch (err) {
|
|
86
|
+
params.warnings.push(`Failed archiving Matrix IndexedDB snapshot legacy source: ${String(err)}`);
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { migrateLegacyMatrixIdbSnapshot };
|
|
@@ -10,7 +10,7 @@ const REQUIRED_MATRIX_PACKAGES = [
|
|
|
10
10
|
"@matrix-org/matrix-sdk-crypto-wasm"
|
|
11
11
|
];
|
|
12
12
|
const MIN_MATRIX_CRYPTO_NATIVE_BINDING_BYTES = 1e6;
|
|
13
|
-
const MATRIX_COMMAND_OUTPUT_TAIL_BYTES =
|
|
13
|
+
const MATRIX_COMMAND_OUTPUT_TAIL_BYTES = 65536;
|
|
14
14
|
function resolveMissingMatrixPackages(resolveFn) {
|
|
15
15
|
const resolve = resolveFn ?? defaultResolveFn;
|
|
16
16
|
return REQUIRED_MATRIX_PACKAGES.filter((pkg) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { r as normalizeMatrixMessagingTarget, t as isMatrixQualifiedUserId } from "./target-ids-Nwx7cMVE.js";
|
|
3
|
-
import {
|
|
4
|
-
import { t as MatrixAuthedHttpClient } from "./http-client-
|
|
3
|
+
import { l as resolveMatrixAuth } from "./client-Dj4mcf-s.js";
|
|
4
|
+
import { t as MatrixAuthedHttpClient } from "./http-client-DOmFvKvB.js";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
//#region extensions/matrix/src/directory-live.ts
|
|
7
7
|
var directory_live_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -85,20 +85,22 @@ async function listMatrixDirectoryPeersLive(params) {
|
|
|
85
85
|
}
|
|
86
86
|
async function resolveMatrixRoomAlias(client, alias) {
|
|
87
87
|
try {
|
|
88
|
-
|
|
88
|
+
const res = await requestMatrixJson(client, {
|
|
89
89
|
method: "GET",
|
|
90
90
|
endpoint: `/_matrix/client/v3/directory/room/${encodeURIComponent(alias)}`
|
|
91
|
-
})
|
|
91
|
+
});
|
|
92
|
+
return normalizeOptionalString(res.room_id) ?? null;
|
|
92
93
|
} catch {
|
|
93
94
|
return null;
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
async function fetchMatrixRoomName(client, roomId) {
|
|
97
98
|
try {
|
|
98
|
-
|
|
99
|
+
const res = await requestMatrixJson(client, {
|
|
99
100
|
method: "GET",
|
|
100
101
|
endpoint: `/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/state/m.room.name`
|
|
101
|
-
})
|
|
102
|
+
});
|
|
103
|
+
return normalizeOptionalString(res.name) ?? null;
|
|
102
104
|
} catch {
|
|
103
105
|
return null;
|
|
104
106
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-
|
|
1
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-HyWFZQVG.js";
|
|
2
2
|
import { detectPluginInstallPathIssue, formatPluginInstallPathIssue, removePluginFromConfig } from "openclaw/plugin-sdk/doctor-repair-runtime";
|
|
3
3
|
//#region extensions/matrix/src/doctor.ts
|
|
4
4
|
async function collectMatrixInstallPathWarnings(cfg) {
|
|
@@ -152,11 +152,12 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
152
152
|
scope: "root-and-accounts",
|
|
153
153
|
onRemove: ({ key, pathPrefix }) => changes.push(`Removed ${pathPrefix}.${key} (never read by the Matrix runtime).`)
|
|
154
154
|
}).config;
|
|
155
|
+
const aliases = streamingAliasMigration.normalizeChannelConfig({
|
|
156
|
+
cfg: withoutJunkStreamMode,
|
|
157
|
+
changes
|
|
158
|
+
});
|
|
155
159
|
return normalizeChannelConfigEntries({
|
|
156
|
-
cfg:
|
|
157
|
-
cfg: withoutJunkStreamMode,
|
|
158
|
-
changes
|
|
159
|
-
}).config,
|
|
160
|
+
cfg: aliases.config,
|
|
160
161
|
channelId: "matrix",
|
|
161
162
|
changes,
|
|
162
163
|
normalizeEntry: normalizeMatrixEntry
|