@openclaw/matrix 2026.9.1-beta.1 → 2026.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
- package/dist/{account-selection-CWuhuFn1.js → account-selection-DA-jfx22.js} +74 -36
- package/dist/{accounts-BCzyubQt.js → accounts-DR1c4xF_.js} +4 -5
- package/dist/api.js +5 -5
- package/dist/{approval-handler.runtime-G9fLHUWe.js → approval-handler.runtime-BJCD4dLf.js} +34 -11
- package/dist/{approval-ids-C6FD3pVY.js → approval-ids-Bst7HM_o.js} +1 -1
- package/dist/{approval-reaction-auth-60xHiDtQ.js → approval-reaction-auth-DhH8QOSe.js} +2 -2
- package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
- package/dist/{channel-CBEvelTE.js → channel-Bs8VLb6q.js} +63 -58
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-CCJRhdH5.js +76 -0
- package/dist/{channel.setup-sWPOGyQG.js → channel.setup-DhmDXwPp.js} +32 -22
- package/dist/{cli-DrTD2a_q.js → cli-IvDUuiDH.js} +179 -135
- package/dist/{cli-metadata-DrYVwQ_r.js → cli-metadata-BGryAl2e.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-hs1ePy2O.js → client-Dj4mcf-s.js} +73 -22
- package/dist/{client-bootstrap-BxdxjCwA.js → client-bootstrap-n1Rqc8Go.js} +1 -1
- package/dist/{client-BUtHbzib.js → client-oNOlldJI.js} +2 -2
- package/dist/{config-update-Bor_Pjsv.js → config-update-BnX26jCO.js} +48 -31
- package/dist/contract-api.js +2 -2
- package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
- package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
- package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
- package/dist/{crypto-runtime-C4WDYxlP.js → crypto-runtime-m1eplj3b.js} +7 -7
- package/dist/crypto-snapshot-doctor.runtime-D0v841D_.js +91 -0
- package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
- package/dist/{directory-live-D0KfJlby.js → directory-live-DLUgWBhA.js} +8 -6
- package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
- package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
- package/dist/doctor-contract-api.js +89 -109
- package/dist/{draft-stream-B_m79Ynb.js → draft-stream-DglwxWzJ.js} +1 -1
- package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-BNcZNQZI.js} +3 -2
- package/dist/helper-api.js +1 -1
- package/dist/{http-client-D8o8b9u6.js → http-client-DOmFvKvB.js} +10 -7
- package/dist/{idb-persistence-DfgW720p.js → idb-persistence-CU7CNLlX.js} +2 -2
- package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
- package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-Dow9EOoJ.js → messages-Czn8lNEh.js} +154 -5
- package/dist/{monitor-DBB47wTy.js → monitor-DouG43FJ.js} +200 -156
- package/dist/outbound-Co_tJyE6.js +220 -0
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-B1YPxG9x.js +2 -0
- package/dist/{profile-update-C61NR24_.js → profile-update-CAl8nZNG.js} +5 -4
- package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
- package/dist/{reaction-events-BZUgLIZI.js → reaction-events-C_7G7bvI.js} +9 -7
- package/dist/{resolve-targets-DXzZwsIY.js → resolve-targets-B64O69Nd.js} +1 -1
- package/dist/{resolver.runtime-p5qJ3Kst.js → resolver.runtime-TRmePJDV.js} +1 -1
- package/dist/{room-info-BXQA7y10.js → room-info-6viLR3NH.js} +55 -1
- package/dist/runtime-api.js +2 -2
- package/dist/{sdk-CljOKEvc.js → sdk-C1yfda1L.js} +534 -26
- package/dist/{send-BKu9Ghi4.js → send-B5XChnvB.js} +31 -33
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-CpE6C3qV.js → setup-bootstrap-S_loyUyM.js} +3 -3
- package/dist/{setup-core-CyvaCOOr.js → setup-core-XkIfQ65J.js} +8 -7
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DtRvRcCT.js → setup-surface-B2yZ8KGc.js} +84 -79
- package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
- package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
- package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/sync-cache-state-d-A_OhbU.js +234 -0
- package/dist/{thread-bindings-BvyU66kE.js → thread-bindings-BkBnn4te.js} +4 -4
- package/dist/{tool-actions.runtime-DD6jUxFK.js → tool-actions.runtime-a5L5xGSP.js} +226 -215
- package/dist/{verification-BP-3-XYn.js → verification-XJtTc5DI.js} +2 -2
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +216 -183
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -1
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +7 -7
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -1
- package/node_modules/markdown-it/dist/markdown-it.cjs.js +98 -106
- package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -1
- package/node_modules/markdown-it/dist/markdown-it.d.mts +42 -71
- package/node_modules/markdown-it/dist/markdown-it.mjs +98 -106
- package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -1
- package/node_modules/markdown-it/package.json +1 -2
- package/node_modules/matrix-js-sdk/lib/client.d.ts +2 -1
- package/node_modules/matrix-js-sdk/lib/client.js +6 -2
- package/node_modules/matrix-js-sdk/lib/sync.js +8 -8
- package/node_modules/matrix-js-sdk/src/client.ts +7 -3
- package/node_modules/matrix-js-sdk/src/sync.ts +8 -8
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
- package/node_modules/typebox/build/system/memory/create.mjs +3 -4
- package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
- package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/node_modules/typebox/build/system/memory/update.mjs +3 -2
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +17 -3
- package/package.json +8 -7
- package/dist/channel.runtime-CiDl9deX.js +0 -276
- package/dist/env-auth-MVS-Vv41.js +0 -64
- package/dist/file-sync-store-DjskBX2o.js +0 -436
- package/dist/media-text-OR9uoC4W.js +0 -153
- package/dist/probe.runtime-CRM7RIrB.js +0 -2
- package/dist/recovery-key-store-CognuDys.js +0 -276
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { a as resolveMatrixDefaultOrOnlyAccountId, n as requiresExplicitMatrixDefaultAccount, o as
|
|
2
|
+
import { a as resolveMatrixDefaultOrOnlyAccountId, c as resolveScopedMatrixEnvConfig, l as resolveMatrixAccountStringValues, n as requiresExplicitMatrixDefaultAccount, o as resolveGlobalMatrixEnvConfig } from "./account-selection-DA-jfx22.js";
|
|
3
3
|
import { t as getMatrixScopedEnvVarNames } from "./env-vars-dGqak9dN.js";
|
|
4
|
-
import { o as resolveMatrixBaseConfig, r as listNormalizedMatrixAccountIds, t as findMatrixAccountConfig } from "./account-config-
|
|
5
|
-
import { r as resolveScopedMatrixEnvConfig, t as resolveGlobalMatrixEnvConfig } from "./env-auth-MVS-Vv41.js";
|
|
4
|
+
import { o as resolveMatrixBaseConfig, r as listNormalizedMatrixAccountIds, t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
6
5
|
import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
|
|
7
6
|
import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
8
|
-
import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage, s as repairCurrentTokenStorageMetaDeviceId } from "./storage-
|
|
7
|
+
import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage, s as repairCurrentTokenStorageMetaDeviceId } from "./storage-BVf4uucD.js";
|
|
9
8
|
import { n as LogService } from "./logger-B_71hN6W.js";
|
|
10
9
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
11
10
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
11
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
13
|
-
import { coerceSecretRef, normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input
|
|
12
|
+
import { coerceSecretRef, isBuiltInDefaultSecretProviderRef, normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
14
13
|
import { formatErrorMessage, toErrorObject, toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
15
14
|
import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
16
15
|
import { isPrivateNetworkOptInEnabled, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
@@ -19,14 +18,15 @@ import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime"
|
|
|
19
18
|
import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
20
19
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
21
20
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
21
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
22
22
|
//#region extensions/matrix/src/matrix/client/config.ts
|
|
23
|
-
const loadMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-
|
|
23
|
+
const loadMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-C1yfda1L.js").then((n) => n.t), import("./logging-DRjvUOIh.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
|
|
24
24
|
MatrixClient: sdkModule.MatrixClient,
|
|
25
25
|
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
26
26
|
})));
|
|
27
27
|
const MATRIX_AUTH_REQUEST_RETRY_RE = /\b(fetch failed|econnreset|econnrefused|enotfound|etimedout|ehostunreach|enetunreach|eai_again|und_err_|socket hang up|network|headers timeout|body timeout|connect timeout)\b/i;
|
|
28
|
-
const loadMatrixCredentialsReadDeps = createLazyRuntimeModule(() => import("./credentials-read-
|
|
29
|
-
const loadMatrixCredentialsWriteRuntime = createLazyRuntimeModule(() => import("./credentials-write.runtime-
|
|
28
|
+
const loadMatrixCredentialsReadDeps = createLazyRuntimeModule(() => import("./credentials-read-mexhw-Ur.js").then((n) => n.r));
|
|
29
|
+
const loadMatrixCredentialsWriteRuntime = createLazyRuntimeModule(() => import("./credentials-write.runtime-DQt-kgJq.js"));
|
|
30
30
|
const loadMatrixSecretInputDeps = createLazyRuntimeModule(() => import("./config-secret-input.runtime-CwsP3--c.js"));
|
|
31
31
|
function shouldRetryMatrixAuthRequest(err) {
|
|
32
32
|
return MATRIX_AUTH_REQUEST_RETRY_RE.test(formatErrorMessage(err));
|
|
@@ -70,21 +70,21 @@ const MATRIX_CONFIG_STRING_FIELDS = [
|
|
|
70
70
|
const MATRIX_AUTH_SECRET_FIELDS = ["accessToken", "password"];
|
|
71
71
|
function readMatrixEnvSecretRef(params) {
|
|
72
72
|
const provider = params.cfg.secrets?.providers?.[params.ref.provider];
|
|
73
|
-
if (provider) {
|
|
74
|
-
if (provider.source !== "env") throw new Error(`Secret provider "${params.ref.provider}" has source "${provider.source}" but ref requests "env".`);
|
|
73
|
+
if (provider?.source === "env") {
|
|
75
74
|
if (provider.allowlist && !provider.allowlist.includes(params.ref.id)) throw new Error(`Environment variable "${params.ref.id}" is not allowlisted in secrets.providers.${params.ref.provider}.allowlist.`);
|
|
76
|
-
} else if (params.ref
|
|
75
|
+
} else if (!isBuiltInDefaultSecretProviderRef(params.cfg, params.ref)) throw new Error(provider ? `Secret provider "${params.ref.provider}" has source "${provider.source}" but ref requests "env".` : `Secret provider "${params.ref.provider}" is not configured (ref: env:${params.ref.provider}:${params.ref.id}).`);
|
|
77
76
|
return params.env[params.ref.id]?.trim() || void 0;
|
|
78
77
|
}
|
|
79
78
|
function readMatrixConfigString(params) {
|
|
80
79
|
const ref = coerceSecretRef(params.value, params.cfg.secrets?.defaults);
|
|
81
80
|
if (params.suppressSecretRef && ref) return "";
|
|
81
|
+
const value = params.allowEnvSecretRef ? ref?.source === "env" ? readMatrixEnvSecretRef({
|
|
82
|
+
ref,
|
|
83
|
+
cfg: params.cfg,
|
|
84
|
+
env: params.env
|
|
85
|
+
}) ?? params.value : ref ? "" : params.value : params.value;
|
|
82
86
|
return normalizeResolvedSecretInputString({
|
|
83
|
-
value
|
|
84
|
-
ref,
|
|
85
|
-
cfg: params.cfg,
|
|
86
|
-
env: params.env
|
|
87
|
-
}) ?? params.value : ref ? "" : params.value : params.value,
|
|
87
|
+
value,
|
|
88
88
|
path: params.path,
|
|
89
89
|
defaults: params.cfg.secrets?.defaults
|
|
90
90
|
}) ?? "";
|
|
@@ -416,7 +416,7 @@ async function backfillMatrixAuthDeviceIdAfterStartup(params) {
|
|
|
416
416
|
//#endregion
|
|
417
417
|
//#region extensions/matrix/src/matrix/client/create-client.ts
|
|
418
418
|
var create_client_exports = /* @__PURE__ */ __exportAll({ createMatrixClient: () => createMatrixClient });
|
|
419
|
-
const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-
|
|
419
|
+
const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-C1yfda1L.js").then((n) => n.t), import("./logging-DRjvUOIh.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
|
|
420
420
|
MatrixClient: sdkModule.MatrixClient,
|
|
421
421
|
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
422
422
|
})));
|
|
@@ -466,6 +466,44 @@ async function createMatrixClient(params) {
|
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
468
|
//#endregion
|
|
469
|
+
//#region extensions/matrix/src/matrix/monitor/task-runner.ts
|
|
470
|
+
const monitorTaskSignal = new AsyncLocalStorage();
|
|
471
|
+
function getMatrixMonitorTaskSignal() {
|
|
472
|
+
return monitorTaskSignal.getStore();
|
|
473
|
+
}
|
|
474
|
+
function createMatrixMonitorTaskRunner(params) {
|
|
475
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
476
|
+
let closed = false;
|
|
477
|
+
const runDetachedTask = (label, task) => {
|
|
478
|
+
if (closed) return Promise.resolve();
|
|
479
|
+
const controller = new AbortController();
|
|
480
|
+
const trackedTask = monitorTaskSignal.run(controller.signal, () => Promise.resolve().then(task)).catch((error) => {
|
|
481
|
+
const message = String(error);
|
|
482
|
+
params.logVerboseMessage(`matrix: ${label} failed (${message})`);
|
|
483
|
+
params.logger.warn("matrix background task failed", {
|
|
484
|
+
task: label,
|
|
485
|
+
error: message
|
|
486
|
+
});
|
|
487
|
+
}).finally(() => {
|
|
488
|
+
controller.abort();
|
|
489
|
+
inFlight.delete(trackedTask);
|
|
490
|
+
});
|
|
491
|
+
inFlight.set(trackedTask, controller);
|
|
492
|
+
return trackedTask;
|
|
493
|
+
};
|
|
494
|
+
const waitForIdle = async () => {
|
|
495
|
+
while (inFlight.size > 0) await Promise.allSettled(Array.from(inFlight.keys()));
|
|
496
|
+
};
|
|
497
|
+
return {
|
|
498
|
+
close: () => {
|
|
499
|
+
closed = true;
|
|
500
|
+
for (const controller of inFlight.values()) controller.abort();
|
|
501
|
+
},
|
|
502
|
+
runDetachedTask,
|
|
503
|
+
waitForIdle
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
//#endregion
|
|
469
507
|
//#region extensions/matrix/src/matrix/startup-abort.ts
|
|
470
508
|
function createMatrixStartupAbortError() {
|
|
471
509
|
const error = /* @__PURE__ */ new Error("Matrix startup aborted");
|
|
@@ -592,6 +630,7 @@ async function resolveSharedMatrixAuth(params) {
|
|
|
592
630
|
}
|
|
593
631
|
async function resolveOpenSharedMatrixClientState(params) {
|
|
594
632
|
const auth = await resolveSharedMatrixAuth(params);
|
|
633
|
+
throwIfMatrixStartupAborted(params.abortSignal);
|
|
595
634
|
const key = buildSharedClientKey(auth);
|
|
596
635
|
while (true) {
|
|
597
636
|
const existing = sharedClientStates.get(key);
|
|
@@ -775,8 +814,8 @@ function createSharedMatrixClientLease(state, role) {
|
|
|
775
814
|
leaseState.releasePromise = retireMonitorLease(state, leaseState);
|
|
776
815
|
return leaseState.releasePromise;
|
|
777
816
|
}
|
|
778
|
-
if (!(finalMonitor || state.leases.size === 0)) {
|
|
779
|
-
leaseState.releasePromise = Promise.resolve();
|
|
817
|
+
if (!(state.phase === "open" && (finalMonitor || state.leases.size === 0))) {
|
|
818
|
+
leaseState.releasePromise = state.poisonError ? Promise.reject(state.poisonError) : Promise.resolve();
|
|
780
819
|
return leaseState.releasePromise;
|
|
781
820
|
}
|
|
782
821
|
leaseState.releasePromise = beginGenerationRetirement({
|
|
@@ -788,11 +827,23 @@ function createSharedMatrixClientLease(state, role) {
|
|
|
788
827
|
};
|
|
789
828
|
}
|
|
790
829
|
async function acquireSharedMatrixClient(params = {}) {
|
|
830
|
+
const taskSignal = getMatrixMonitorTaskSignal();
|
|
831
|
+
const abortSignal = taskSignal && params.abortSignal ? AbortSignal.any([taskSignal, params.abortSignal]) : taskSignal ?? params.abortSignal;
|
|
832
|
+
const acquisition = {
|
|
833
|
+
...params,
|
|
834
|
+
abortSignal
|
|
835
|
+
};
|
|
791
836
|
while (true) {
|
|
792
|
-
|
|
837
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
838
|
+
const state = await resolveOpenSharedMatrixClientState(acquisition);
|
|
839
|
+
if (abortSignal?.aborted) {
|
|
840
|
+
if (state.phase === "open" && state.leases.size === 0) await beginGenerationRetirement({ state });
|
|
841
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
842
|
+
}
|
|
843
|
+
const lease = createSharedMatrixClientLease(state, params.role ?? "transient");
|
|
793
844
|
if (!lease) continue;
|
|
794
845
|
if (params.startClient !== false) try {
|
|
795
|
-
await lease.start(
|
|
846
|
+
await lease.start(abortSignal);
|
|
796
847
|
} catch (error) {
|
|
797
848
|
await lease.release({ mode: "stop" }).catch(() => void 0);
|
|
798
849
|
throw error;
|
|
@@ -807,4 +858,4 @@ var client_exports = /* @__PURE__ */ __exportAll({
|
|
|
807
858
|
resolveMatrixAuthContext: () => resolveMatrixAuthContext
|
|
808
859
|
});
|
|
809
860
|
//#endregion
|
|
810
|
-
export { throwIfMatrixStartupAborted as a,
|
|
861
|
+
export { throwIfMatrixStartupAborted as a, backfillMatrixAuthDeviceIdAfterStartup as c, isMatrixStartupAbortError as i, resolveMatrixAuth as l, acquireSharedMatrixClient as n, createMatrixMonitorTaskRunner as o, createMatrixStartupAbortError as r, createMatrixClient as s, client_exports as t, resolveMatrixAuthContext as u };
|
|
@@ -7,7 +7,7 @@ var client_bootstrap_exports = /* @__PURE__ */ __exportAll({
|
|
|
7
7
|
resolveRuntimeMatrixClientWithReadiness: () => resolveRuntimeMatrixClientWithReadiness,
|
|
8
8
|
withResolvedRuntimeMatrixClient: () => withResolvedRuntimeMatrixClient
|
|
9
9
|
});
|
|
10
|
-
const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => import("./client-
|
|
10
|
+
const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => import("./client-Dj4mcf-s.js").then((n) => n.t).then((clientModule) => ({
|
|
11
11
|
acquireSharedMatrixClient: clientModule.acquireSharedMatrixClient,
|
|
12
12
|
resolveMatrixAuthContext: clientModule.resolveMatrixAuthContext
|
|
13
13
|
})));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-
|
|
2
|
+
import { b as resolveMatrixRoomId } from "./send-B5XChnvB.js";
|
|
3
|
+
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-n1Rqc8Go.js";
|
|
4
4
|
//#region extensions/matrix/src/matrix/actions/client.ts
|
|
5
5
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
withResolvedActionClient: () => withResolvedActionClient,
|
|
@@ -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-XkIfQ65J.js";
|
|
2
|
+
import { n as matrixOnboardingAdapter } from "./setup-surface-B2yZ8KGc.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
|