@openclaw/matrix 2026.7.2-beta.3 → 2026.7.2-beta.5
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/README.md +1 -1
- package/dist/api.js +4 -4
- package/dist/{approval-handler.runtime-BEa98wwG.js → approval-handler.runtime-D1ibJgSk.js} +4 -4
- package/dist/{approval-ids-Dfn7oQAm.js → approval-ids-2OQj32-K.js} +1 -1
- package/dist/{approval-reaction-auth-kXkCJBGi.js → approval-reaction-auth-CCAWWkbu.js} +2 -2
- package/dist/{channel-j331Xd7b.js → channel-Cmi248PA.js} +34 -32
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-BIwlVfQw.js → channel.runtime-BaPXFRgT.js} +34 -40
- package/dist/{cli-0EcKfqFw.js → cli-0CNHkps5.js} +868 -852
- package/dist/{cli-metadata-Xq1Xb15R.js → cli-metadata-DnXxNCoj.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-CA0PULls.js → client-BFRg0kd4.js} +2 -2
- package/dist/{client-BtG4quUl.js → client-CitERujx.js} +2 -2
- package/dist/{client-bootstrap-Dk5EAn3n.js → client-bootstrap-CkAnkzB6.js} +1 -1
- package/dist/{config-schema-B5GRV8wL.js → config-schema-BShrVROw.js} +19 -6
- package/dist/contract-api.js +2 -2
- package/dist/{create-client-WQExaby_.js → create-client-f-CkRllE.js} +3 -3
- package/dist/{crypto-runtime-CAff-n15.js → crypto-runtime-D9_6J5tZ.js} +2 -2
- package/dist/{device-health-D4LBxuPq.js → device-health-B4-YXtJR.js} +6 -1
- package/dist/{directory-live-DiC-0XBC.js → directory-live-YRgYDx2w.js} +3 -3
- package/dist/{doctor-DwUVm5Lw.js → doctor-CM8ijNpW.js} +1 -1
- package/dist/doctor-contract-BMSJkkAE.js +167 -0
- package/dist/doctor-contract-api.js +112 -71
- package/dist/{draft-stream-CTLKtJJ0.js → draft-stream-CIjafRr0.js} +1 -1
- package/dist/{file-sync-store-CPkgnSXp.js → file-sync-store-DiiFsayX.js} +1 -1
- package/dist/{http-client-BmrgOZTL.js → http-client-CycYxU9-.js} +2 -2
- package/dist/{idb-persistence-Dyy6ipgU.js → idb-persistence-B6x7dMsF.js} +75 -72
- package/dist/index.js +1 -1
- package/dist/{logging-QH-48Gr6.js → logging-DV-p52N0.js} +8 -1
- package/dist/{media-text-BMXEXb1j.js → media-text-DlQC_k_K.js} +1 -1
- package/dist/{messages-3UBHfZrN.js → messages-Bf_s--M9.js} +3 -3
- package/dist/{monitor-BtUIds8T.js → monitor-s--XqoxF.js} +2041 -1804
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-BJOvCHnZ.js +3 -0
- package/dist/{profile-update-Bh2XtJwN.js → profile-update-z3aM46KS.js} +2 -2
- package/dist/{reaction-events-BwAKtUyQ.js → reaction-events-DrK9Zua7.js} +2 -2
- package/dist/{recovery-key-store-CW6eePfp.js → recovery-key-store-BNnHvXdk.js} +1 -1
- package/dist/{resolve-targets-DVoj-YxB.js → resolve-targets-nNMcrV3W.js} +1 -1
- package/dist/{resolver.runtime-CC0VVsAt.js → resolver.runtime-BvaFlVLg.js} +1 -1
- package/dist/{room-info-B6vKD5DF.js → room-info-CAFZ3Z9J.js} +13 -12
- package/dist/{sdk-CIDZXWpZ.js → sdk-UzPd8tst.js} +227 -181
- package/dist/{send-BJbrdmNm.js → send-C9Ssx-iV.js} +624 -109
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-DGPOOdz-.js → setup-bootstrap-BBGpPKgy.js} +2 -2
- package/dist/{setup-core-XCdAx1nY.js → setup-core-a542Ernq.js} +135 -45
- package/dist/setup-plugin-api.js +4 -3
- package/dist/{setup-surface-CzUiTe_k.js → setup-surface-BJrCI6KT.js} +34 -30
- package/dist/{shared-DquM1oz6.js → shared-CUH5otj8.js} +5 -12
- package/dist/{startup-verification-CA00kebL.js → startup-verification-wm3_i88s.js} +1 -1
- package/dist/{storage-CzHxeF5E.js → storage-BvAkgzvT.js} +24 -57
- package/dist/{thread-bindings-Cw194yEn.js → thread-bindings-D3RfVgAF.js} +4 -3
- package/dist/{tool-actions.runtime-C0jgWYhX.js → tool-actions.runtime-Dh5ow2EK.js} +8 -8
- package/dist/{verification-DjxyWTNP.js → verification-ZdAXdmuh.js} +1 -1
- package/node_modules/music-metadata/lib/common/Util.d.ts +1 -1
- package/node_modules/music-metadata/lib/common/Util.js +7 -1
- package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +23 -3
- package/node_modules/music-metadata/lib/id3v2/FrameParser.js +2 -2
- package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +1 -1
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +38 -13
- package/node_modules/music-metadata/lib/mpeg/MpegParser.js +1 -1
- package/node_modules/music-metadata/package.json +6 -6
- package/node_modules/typebox/build/compile/validator.d.mts +1 -4
- package/node_modules/typebox/build/guard/guard.d.mts +1 -1
- package/node_modules/typebox/build/guard/guard.mjs +5 -2
- package/node_modules/typebox/build/guard/string.mjs +16 -4
- package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
- package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
- package/node_modules/typebox/build/typebox.d.mts +1 -1
- package/node_modules/typebox/build/typebox.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +29 -32
- package/openclaw.plugin.json +7 -20
- package/package.json +111 -29
- package/dist/doctor-contract-BA2Y6Crx.js +0 -312
- package/dist/probe.runtime-sBV-Govx.js +0 -3
- package/npm-shrinkwrap.json +0 -557
|
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
|
2
2
|
//#region extensions/matrix/src/cli-metadata.ts
|
|
3
3
|
function registerMatrixCliMetadata(api) {
|
|
4
4
|
api.registerCli(async ({ program }) => {
|
|
5
|
-
const { registerMatrixCli } = await import("./cli-
|
|
5
|
+
const { registerMatrixCli } = await import("./cli-0CNHkps5.js");
|
|
6
6
|
registerMatrixCli({ program });
|
|
7
7
|
}, { descriptors: [{
|
|
8
8
|
name: "matrix",
|
package/dist/cli-metadata.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as registerMatrixCliMetadata, t as cli_metadata_default } from "./cli-metadata-
|
|
1
|
+
import { n as registerMatrixCliMetadata, t as cli_metadata_default } from "./cli-metadata-DnXxNCoj.js";
|
|
2
2
|
export { cli_metadata_default as default, registerMatrixCliMetadata };
|
|
@@ -3,8 +3,8 @@ import { t as getMatrixScopedEnvVarNames } from "./env-vars-B0NxQnPk.js";
|
|
|
3
3
|
import { i as resolveScopedMatrixEnvConfig, r as resolveMatrixEnvAuthReadiness, t as hasReadyMatrixEnvAuth } from "./env-auth-CQsYbz-p.js";
|
|
4
4
|
import { n as validateMatrixHomeserverUrl, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
5
5
|
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
6
|
-
import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, m as resolveMatrixConfigForAccount, n as releaseSharedClientInstance, o as stopSharedClientForAccount, p as resolveMatrixAuthContext, r as removeSharedClientInstance, s as stopSharedClientInstance, t as acquireSharedMatrixClient } from "./shared-
|
|
7
|
-
import { t as createMatrixClient } from "./create-client-
|
|
6
|
+
import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, m as resolveMatrixConfigForAccount, n as releaseSharedClientInstance, o as stopSharedClientForAccount, p as resolveMatrixAuthContext, r as removeSharedClientInstance, s as stopSharedClientInstance, t as acquireSharedMatrixClient } from "./shared-CUH5otj8.js";
|
|
7
|
+
import { t as createMatrixClient } from "./create-client-f-CkRllE.js";
|
|
8
8
|
//#region extensions/matrix/src/matrix/client.ts
|
|
9
9
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
acquireSharedMatrixClient: () => acquireSharedMatrixClient,
|
|
@@ -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 { c as resolveMatrixRoomId } from "./send-C9Ssx-iV.js";
|
|
3
|
+
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-CkAnkzB6.js";
|
|
4
4
|
//#region extensions/matrix/src/matrix/actions/client.ts
|
|
5
5
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
withResolvedActionClient: () => withResolvedActionClient,
|
|
@@ -8,7 +8,7 @@ var client_bootstrap_exports = /* @__PURE__ */ __exportAll({
|
|
|
8
8
|
resolveRuntimeMatrixClientWithReadiness: () => resolveRuntimeMatrixClientWithReadiness,
|
|
9
9
|
withResolvedRuntimeMatrixClient: () => withResolvedRuntimeMatrixClient
|
|
10
10
|
});
|
|
11
|
-
const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./client-
|
|
11
|
+
const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./client-BFRg0kd4.js").then((n) => n.t), import("./shared-CUH5otj8.js").then((n) => n.a)]).then(([clientModule, sharedModule]) => ({
|
|
12
12
|
acquireSharedMatrixClient: clientModule.acquireSharedMatrixClient,
|
|
13
13
|
resolveMatrixAuthContext: clientModule.resolveMatrixAuthContext,
|
|
14
14
|
releaseSharedClientInstance: sharedModule.releaseSharedClientInstance
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
|
|
2
|
-
import {
|
|
2
|
+
import { _ as resolveMatrixAccount, g as resolveDefaultMatrixAccountId, m as listMatrixAccountIds } from "./setup-core-a542Ernq.js";
|
|
3
3
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
4
4
|
import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -159,9 +159,7 @@ const matrixThreadBindingsSchema = z.object({
|
|
|
159
159
|
idleHours: z.number().nonnegative().optional(),
|
|
160
160
|
maxAgeHours: z.number().nonnegative().optional(),
|
|
161
161
|
spawnSessions: z.boolean().optional(),
|
|
162
|
-
defaultSpawnContext: z.enum(["isolated", "fork"]).optional()
|
|
163
|
-
spawnSubagentSessions: z.boolean().optional(),
|
|
164
|
-
spawnAcpSessions: z.boolean().optional()
|
|
162
|
+
defaultSpawnContext: z.enum(["isolated", "fork"]).optional()
|
|
165
163
|
}).optional();
|
|
166
164
|
const matrixExecApprovalsSchema = z.object({
|
|
167
165
|
enabled: z.boolean().optional(),
|
|
@@ -208,15 +206,30 @@ const matrixStreamingSchema = z.object({
|
|
|
208
206
|
labels: z.array(z.string()).optional(),
|
|
209
207
|
maxLines: z.number().int().positive().optional(),
|
|
210
208
|
maxLineChars: z.number().int().positive().optional(),
|
|
211
|
-
toolProgress: z.boolean().optional()
|
|
209
|
+
toolProgress: z.boolean().optional(),
|
|
210
|
+
commandText: z.enum(["raw", "status"]).optional()
|
|
212
211
|
}).strict().optional(),
|
|
213
212
|
preview: z.object({ toolProgress: z.boolean().optional() }).strict().optional()
|
|
214
213
|
}).strict();
|
|
214
|
+
const retiredMatrixAccountStreamingKeys = [
|
|
215
|
+
"streamMode",
|
|
216
|
+
"chunkMode",
|
|
217
|
+
"blockStreaming",
|
|
218
|
+
"blockStreamingCoalesce",
|
|
219
|
+
"draftChunk"
|
|
220
|
+
];
|
|
221
|
+
function hasCanonicalMatrixAccountStreaming(account) {
|
|
222
|
+
if (typeof account !== "object" || account === null || Array.isArray(account)) return true;
|
|
223
|
+
if (retiredMatrixAccountStreamingKeys.some((key) => Object.hasOwn(account, key))) return false;
|
|
224
|
+
if (!Object.hasOwn(account, "streaming")) return true;
|
|
225
|
+
const streaming = account.streaming;
|
|
226
|
+
return typeof streaming === "object" && streaming !== null && !Array.isArray(streaming);
|
|
227
|
+
}
|
|
215
228
|
const MatrixChannelConfigSchema = buildChannelConfigSchema(z.object({
|
|
216
229
|
name: z.string().optional(),
|
|
217
230
|
enabled: z.boolean().optional(),
|
|
218
231
|
defaultAccount: z.string().optional(),
|
|
219
|
-
accounts: z.record(z.string(), z.unknown()).optional(),
|
|
232
|
+
accounts: z.record(z.string(), z.unknown().refine(hasCanonicalMatrixAccountStreaming, { message: "flat or scalar streaming values are no longer supported; use streaming.* and run \"openclaw doctor --fix\"" })).optional(),
|
|
220
233
|
markdown: MarkdownConfigSchema,
|
|
221
234
|
homeserver: z.string().optional(),
|
|
222
235
|
network: matrixNetworkSchema,
|
package/dist/contract-api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import { n as matrixOnboardingAdapter } from "./setup-surface-
|
|
1
|
+
import { d as namedAccountPromotionKeys, f as resolveSingleAccountPromotionTarget, n as matrixSetupAdapter, p as singleAccountKeysToMove } from "./setup-core-a542Ernq.js";
|
|
2
|
+
import { n as matrixOnboardingAdapter } from "./setup-surface-BJrCI6KT.js";
|
|
3
3
|
export { matrixSetupAdapter, matrixOnboardingAdapter as matrixSetupWizard, namedAccountPromotionKeys, resolveSingleAccountPromotionTarget, singleAccountKeysToMove };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
3
|
-
import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage } from "./storage-
|
|
4
|
-
import "./shared-
|
|
3
|
+
import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage } from "./storage-BvAkgzvT.js";
|
|
4
|
+
import "./shared-CUH5otj8.js";
|
|
5
5
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
8
8
|
import fs from "node:fs";
|
|
9
9
|
//#region extensions/matrix/src/matrix/client/create-client.ts
|
|
10
10
|
var create_client_exports = /* @__PURE__ */ __exportAll({ createMatrixClient: () => createMatrixClient });
|
|
11
|
-
const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-
|
|
11
|
+
const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-UzPd8tst.js"), import("./logging-DV-p52N0.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
|
|
12
12
|
MatrixClient: sdkModule.MatrixClient,
|
|
13
13
|
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
14
14
|
})));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
2
2
|
import { t as ensureMatrixCryptoRuntime } from "./deps-CcVJfvRM.js";
|
|
3
3
|
import { n as LogService, r as noop } from "./logger-D0GCSDQq.js";
|
|
4
|
-
import { i as restoreIdbFromDisk, n as persistIdbToDisk } from "./idb-persistence-
|
|
5
|
-
import { n as isRepairableSecretStorageAccessError } from "./recovery-key-store-
|
|
4
|
+
import { i as restoreIdbFromDisk, n as persistIdbToDisk } from "./idb-persistence-B6x7dMsF.js";
|
|
5
|
+
import { n as isRepairableSecretStorageAccessError } from "./recovery-key-store-BNnHvXdk.js";
|
|
6
6
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
7
7
|
import { resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
8
8
|
import { MatrixEventEvent } from "matrix-js-sdk/lib/matrix.js";
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
1
2
|
//#region extensions/matrix/src/matrix/device-health.ts
|
|
3
|
+
var device_health_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
isOpenClawManagedMatrixDevice: () => isOpenClawManagedMatrixDevice,
|
|
5
|
+
summarizeMatrixDeviceHealth: () => summarizeMatrixDeviceHealth
|
|
6
|
+
});
|
|
2
7
|
const OPENCLAW_DEVICE_NAME_PREFIX = "OpenClaw ";
|
|
3
8
|
function isOpenClawManagedMatrixDevice(displayName) {
|
|
4
9
|
return displayName?.startsWith(OPENCLAW_DEVICE_NAME_PREFIX) === true;
|
|
@@ -13,4 +18,4 @@ function summarizeMatrixDeviceHealth(devices) {
|
|
|
13
18
|
};
|
|
14
19
|
}
|
|
15
20
|
//#endregion
|
|
16
|
-
export { isOpenClawManagedMatrixDevice, summarizeMatrixDeviceHealth };
|
|
21
|
+
export { isOpenClawManagedMatrixDevice as n, summarizeMatrixDeviceHealth as r, device_health_exports as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { n as normalizeMatrixMessagingTarget, t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
|
|
3
|
-
import { f as resolveMatrixAuth } from "./shared-
|
|
4
|
-
import "./client-
|
|
5
|
-
import { t as MatrixAuthedHttpClient } from "./http-client-
|
|
3
|
+
import { f as resolveMatrixAuth } from "./shared-CUH5otj8.js";
|
|
4
|
+
import "./client-BFRg0kd4.js";
|
|
5
|
+
import { t as MatrixAuthedHttpClient } from "./http-client-CycYxU9-.js";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
//#region extensions/matrix/src/directory-live.ts
|
|
8
8
|
var directory_live_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -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-BMSJkkAE.js";
|
|
2
2
|
import { detectPluginInstallPathIssue, formatPluginInstallPathIssue, removePluginFromConfig } from "openclaw/plugin-sdk/runtime-doctor";
|
|
3
3
|
//#region extensions/matrix/src/doctor.ts
|
|
4
4
|
async function collectMatrixInstallPathWarnings(cfg) {
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { t as isRecord } from "./record-shared-CWWx6fvI.js";
|
|
2
|
+
import { defineChannelAliasMigration, defineKeyMoveMigration, hasLegacyAccountStreamingAliases, normalizeChannelConfigEntries, stripRetiredChannelKeys } from "openclaw/plugin-sdk/runtime-doctor";
|
|
3
|
+
import { hasLegacyFlatAllowPrivateNetworkAlias, migrateLegacyFlatAllowPrivateNetworkAlias } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
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
|
+
const roomAllowMigration = defineKeyMoveMigration({
|
|
24
|
+
scope: ["*"],
|
|
25
|
+
from: ["allow"],
|
|
26
|
+
to: ["enabled"],
|
|
27
|
+
sourceOwn: false,
|
|
28
|
+
match: (value) => typeof value === "boolean",
|
|
29
|
+
targetIsSet: (value) => typeof value === "boolean",
|
|
30
|
+
movedMessage: ({ sourcePath, targetPath, mappedValue }) => `Moved ${sourcePath} → ${targetPath} (${String(mappedValue)}).`,
|
|
31
|
+
existingMessage: ({ sourcePath, targetPath, targetValue }) => `Moved ${sourcePath} → ${targetPath} (${String(targetValue)}).`
|
|
32
|
+
});
|
|
33
|
+
function hasLegacyTrustedDmPolicy(value) {
|
|
34
|
+
const root = isRecord(value) ? value : null;
|
|
35
|
+
if (!root) return false;
|
|
36
|
+
return (isRecord(root.dm) ? root.dm : null)?.policy === "trusted";
|
|
37
|
+
}
|
|
38
|
+
function migrateLegacyTrustedDmPolicy(params) {
|
|
39
|
+
const dm = isRecord(params.entry.dm) ? params.entry.dm : null;
|
|
40
|
+
if (!dm || dm.policy !== "trusted") return {
|
|
41
|
+
entry: params.entry,
|
|
42
|
+
changed: false
|
|
43
|
+
};
|
|
44
|
+
const allowFromRaw = dm.allowFrom;
|
|
45
|
+
const allowFromEntries = Array.isArray(allowFromRaw) ? allowFromRaw.filter((entry) => typeof entry === "string" && entry.trim().length > 0).length : 0;
|
|
46
|
+
const nextPolicy = allowFromEntries > 0 ? "allowlist" : "pairing";
|
|
47
|
+
const nextDm = {
|
|
48
|
+
...dm,
|
|
49
|
+
policy: nextPolicy
|
|
50
|
+
};
|
|
51
|
+
params.changes.push(`Migrated ${params.pathPrefix}.dm.policy "trusted" → "${nextPolicy}" (legacy alias removed; ${allowFromEntries > 0 ? `preserved ${allowFromEntries} ${params.pathPrefix}.dm.allowFrom ${allowFromEntries === 1 ? "entry" : "entries"}` : "no allowFrom entries present, defaulting to pairing for safety"}).`);
|
|
52
|
+
return {
|
|
53
|
+
entry: {
|
|
54
|
+
...params.entry,
|
|
55
|
+
dm: nextDm
|
|
56
|
+
},
|
|
57
|
+
changed: true
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const legacyConfigRules = [
|
|
61
|
+
...streamingAliasMigration.legacyConfigRules,
|
|
62
|
+
{
|
|
63
|
+
path: ["channels", "matrix"],
|
|
64
|
+
message: "channels.matrix.allowPrivateNetwork is legacy; use channels.matrix.network.dangerouslyAllowPrivateNetwork instead. Run \"openclaw doctor --fix\".",
|
|
65
|
+
match: (value) => hasLegacyFlatAllowPrivateNetworkAlias(isRecord(value) ? value : {})
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
path: [
|
|
69
|
+
"channels",
|
|
70
|
+
"matrix",
|
|
71
|
+
"accounts"
|
|
72
|
+
],
|
|
73
|
+
message: "channels.matrix.accounts.<id>.allowPrivateNetwork is legacy; use channels.matrix.accounts.<id>.network.dangerouslyAllowPrivateNetwork instead. Run \"openclaw doctor --fix\".",
|
|
74
|
+
match: (value) => hasLegacyAccountStreamingAliases(value, (account) => hasLegacyFlatAllowPrivateNetworkAlias(isRecord(account) ? account : {}))
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
path: [
|
|
78
|
+
"channels",
|
|
79
|
+
"matrix",
|
|
80
|
+
"groups"
|
|
81
|
+
],
|
|
82
|
+
message: "channels.matrix.groups.<room>.allow is legacy; use channels.matrix.groups.<room>.enabled instead. Run \"openclaw doctor --fix\".",
|
|
83
|
+
match: roomAllowMigration.hasLegacy
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
path: [
|
|
87
|
+
"channels",
|
|
88
|
+
"matrix",
|
|
89
|
+
"rooms"
|
|
90
|
+
],
|
|
91
|
+
message: "channels.matrix.rooms.<room>.allow is legacy; use channels.matrix.rooms.<room>.enabled instead. Run \"openclaw doctor --fix\".",
|
|
92
|
+
match: roomAllowMigration.hasLegacy
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
path: [
|
|
96
|
+
"channels",
|
|
97
|
+
"matrix",
|
|
98
|
+
"accounts"
|
|
99
|
+
],
|
|
100
|
+
message: "channels.matrix.accounts.<id>.{groups,rooms}.<room>.allow is legacy; use channels.matrix.accounts.<id>.{groups,rooms}.<room>.enabled instead. Run \"openclaw doctor --fix\".",
|
|
101
|
+
match: (value) => hasLegacyAccountStreamingAliases(value, (account) => {
|
|
102
|
+
if (!isRecord(account)) return false;
|
|
103
|
+
return roomAllowMigration.hasLegacy(account.groups) || roomAllowMigration.hasLegacy(account.rooms);
|
|
104
|
+
})
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
path: ["channels", "matrix"],
|
|
108
|
+
message: "channels.matrix.dm.policy \"trusted\" is legacy; use \"allowlist\" (with allowFrom entries) or \"pairing\" instead. Run \"openclaw doctor --fix\".",
|
|
109
|
+
match: hasLegacyTrustedDmPolicy
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
path: [
|
|
113
|
+
"channels",
|
|
114
|
+
"matrix",
|
|
115
|
+
"accounts"
|
|
116
|
+
],
|
|
117
|
+
message: "channels.matrix.accounts.<id>.dm.policy \"trusted\" is legacy; use \"allowlist\" (with allowFrom entries) or \"pairing\" instead. Run \"openclaw doctor --fix\".",
|
|
118
|
+
match: (value) => hasLegacyAccountStreamingAliases(value, hasLegacyTrustedDmPolicy)
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
function normalizeMatrixEntry(params) {
|
|
122
|
+
const network = migrateLegacyFlatAllowPrivateNetworkAlias(params);
|
|
123
|
+
const dmPolicy = migrateLegacyTrustedDmPolicy({
|
|
124
|
+
...params,
|
|
125
|
+
entry: network.entry
|
|
126
|
+
});
|
|
127
|
+
let entry = dmPolicy.entry;
|
|
128
|
+
let changed = network.changed || dmPolicy.changed;
|
|
129
|
+
for (const section of ["groups", "rooms"]) {
|
|
130
|
+
const roomMap = isRecord(entry[section]) ? entry[section] : null;
|
|
131
|
+
if (!roomMap) continue;
|
|
132
|
+
const normalized = roomAllowMigration.normalize({
|
|
133
|
+
entry: roomMap,
|
|
134
|
+
pathPrefix: `${params.pathPrefix}.${section}`,
|
|
135
|
+
changes: params.changes
|
|
136
|
+
});
|
|
137
|
+
if (normalized.changed) {
|
|
138
|
+
entry = Object.assign({}, entry, { [section]: normalized.entry });
|
|
139
|
+
changed = true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
entry,
|
|
144
|
+
changed
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function normalizeCompatibilityConfig({ cfg }) {
|
|
148
|
+
const changes = [];
|
|
149
|
+
const withoutJunkStreamMode = stripRetiredChannelKeys({
|
|
150
|
+
cfg,
|
|
151
|
+
channelId: "matrix",
|
|
152
|
+
keys: /* @__PURE__ */ new Set(["streamMode"]),
|
|
153
|
+
scope: "root-and-accounts",
|
|
154
|
+
onRemove: ({ key, pathPrefix }) => changes.push(`Removed ${pathPrefix}.${key} (never read by the Matrix runtime).`)
|
|
155
|
+
}).config;
|
|
156
|
+
return normalizeChannelConfigEntries({
|
|
157
|
+
cfg: streamingAliasMigration.normalizeChannelConfig({
|
|
158
|
+
cfg: withoutJunkStreamMode,
|
|
159
|
+
changes
|
|
160
|
+
}).config,
|
|
161
|
+
channelId: "matrix",
|
|
162
|
+
changes,
|
|
163
|
+
normalizeEntry: normalizeMatrixEntry
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
//#endregion
|
|
167
|
+
export { normalizeCompatibilityConfig as n, legacyConfigRules as t };
|
|
@@ -2,18 +2,103 @@ import { a as resolveMatrixDefaultOrOnlyAccountId, n as requiresExplicitMatrixDe
|
|
|
2
2
|
import { t as isRecord$1 } from "./record-shared-CWWx6fvI.js";
|
|
3
3
|
import { r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.js";
|
|
4
4
|
import { a as isMatrixCredentialRevocation, c as normalizeMatrixStoredCredentials, s as matrixCredentialsStoreKey, t as MATRIX_CREDENTIALS_NAMESPACE } from "./credentials-read-DVmFCm7X.js";
|
|
5
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-
|
|
6
|
-
import {
|
|
7
|
-
import { a as readLegacyMatrixSyncCacheState, i as openMatrixSyncCacheStoreOptions, o as writeMatrixSyncCacheStateToStore, r as hasMatrixSyncCacheStateInStore } from "./file-sync-store-
|
|
5
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BMSJkkAE.js";
|
|
6
|
+
import { C as readLegacyMatrixRecoveryKeyState, O as writeMatrixIdbSnapshotJsonToStore, T as readMatrixIdbSnapshotJsonFromStore, a as openMatrixStorageMetaStoreOptions, b as openMatrixRecoveryKeyStoreOptions, f as MATRIX_IDB_SNAPSHOT_FILENAME, g as hasMatrixRecoveryKeyStateInStore, h as hasMatrixLegacyCryptoMigrationStateInStore, 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, v as openMatrixIdbSnapshotStoreOptions, x as readLegacyMatrixLegacyCryptoMigrationState, y as openMatrixLegacyCryptoMigrationStoreOptions } from "./storage-BvAkgzvT.js";
|
|
7
|
+
import { a as readLegacyMatrixSyncCacheState, i as openMatrixSyncCacheStoreOptions, o as writeMatrixSyncCacheStateToStore, r as hasMatrixSyncCacheStateInStore } from "./file-sync-store-DiiFsayX.js";
|
|
8
|
+
import { n as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS } from "./idb-persistence-lock-DAJ49nZX.js";
|
|
9
|
+
import { r as readLegacyMatrixIdbSnapshotStateUnlocked, t as isValidMatrixIdbSnapshotJson } from "./idb-persistence-B6x7dMsF.js";
|
|
8
10
|
import { a as resolveMatrixInboundDedupeStateNamespace, n as MATRIX_INBOUND_DEDUPE_TTL_MS, r as buildMatrixInboundDedupeEventKey } from "./inbound-dedupe-CaBLblef.js";
|
|
9
|
-
import { r as readLegacyMatrixIdbSnapshotState } from "./idb-persistence-Dyy6ipgU.js";
|
|
10
11
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
12
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
12
13
|
import { archiveLegacyStateSource } from "openclaw/plugin-sdk/runtime-doctor";
|
|
13
|
-
import { createHash } from "node:crypto";
|
|
14
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
14
15
|
import path from "node:path";
|
|
15
|
-
import fs from "node:fs
|
|
16
|
+
import fs from "node:fs";
|
|
17
|
+
import fs$1 from "node:fs/promises";
|
|
18
|
+
import { isDeepStrictEqual } from "node:util";
|
|
19
|
+
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
16
20
|
import { createPersistentDedupeImportEntry } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
21
|
+
//#region extensions/matrix/src/matrix/crypto-snapshot-doctor.ts
|
|
22
|
+
async function migrateLegacyMatrixIdbSnapshot(params) {
|
|
23
|
+
const snapshotPath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
24
|
+
try {
|
|
25
|
+
await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, () => migrateLegacyMatrixIdbSnapshotLocked(params));
|
|
26
|
+
} catch (err) {
|
|
27
|
+
params.warnings.push(`Failed locking Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function migrateLegacyMatrixIdbSnapshotLocked(params) {
|
|
31
|
+
const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
32
|
+
let snapshot;
|
|
33
|
+
try {
|
|
34
|
+
snapshot = readLegacyMatrixIdbSnapshotStateUnlocked(params.storageRootDir);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
params.warnings.push(`Failed reading Matrix IndexedDB snapshot legacy source for ${params.storageRootDir}: ${String(err)}; left source in place`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!snapshot) {
|
|
40
|
+
if (!fs.existsSync(sourcePath)) return;
|
|
41
|
+
const archived = await archiveLegacyMatrixIdbSnapshot(params);
|
|
42
|
+
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`);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const snapshotJson = JSON.stringify(snapshot);
|
|
46
|
+
const store = params.context.openPluginStateKeyedStore(openMatrixIdbSnapshotStoreOptions(params.storageRootDir));
|
|
47
|
+
let persisted;
|
|
48
|
+
let hadPartialState;
|
|
49
|
+
try {
|
|
50
|
+
persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
|
|
51
|
+
const persistedIsValid = persisted ? isValidMatrixIdbSnapshotJson(persisted) : false;
|
|
52
|
+
hadPartialState = !persistedIsValid && (await store.entries()).length > 0;
|
|
53
|
+
if (!persistedIsValid) persisted = null;
|
|
54
|
+
} catch (err) {
|
|
55
|
+
params.warnings.push(`Failed inspecting Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (persisted && !snapshotContentMatches(persisted, snapshot)) {
|
|
59
|
+
if (await archiveLegacyMatrixIdbSnapshot(params)) params.notices.push(`Kept the canonical Matrix IndexedDB snapshot in SQLite and archived a differing legacy source for ${params.storageRootDir}`);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!persisted) {
|
|
63
|
+
try {
|
|
64
|
+
await writeMatrixIdbSnapshotJsonToStore({
|
|
65
|
+
snapshotJson,
|
|
66
|
+
databaseCount: snapshot.length,
|
|
67
|
+
store
|
|
68
|
+
});
|
|
69
|
+
persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
|
|
70
|
+
} catch (err) {
|
|
71
|
+
params.warnings.push(`Failed importing Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!persisted || !snapshotContentMatches(persisted, snapshot)) {
|
|
75
|
+
params.warnings.push(`Failed verifying Matrix IndexedDB snapshot for ${params.storageRootDir}; left legacy source in place`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
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}`);
|
|
79
|
+
}
|
|
80
|
+
await archiveLegacyMatrixIdbSnapshot(params);
|
|
81
|
+
}
|
|
82
|
+
function snapshotContentMatches(persistedJson, snapshot) {
|
|
83
|
+
try {
|
|
84
|
+
return isDeepStrictEqual(JSON.parse(persistedJson), snapshot);
|
|
85
|
+
} catch {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function archiveLegacyMatrixIdbSnapshot(params) {
|
|
90
|
+
const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
91
|
+
const archivePath = `${sourcePath}.migrated-${(/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-")}-${randomUUID()}`;
|
|
92
|
+
try {
|
|
93
|
+
await fs$1.rename(sourcePath, archivePath);
|
|
94
|
+
params.changes.push(`Archived Matrix IndexedDB snapshot legacy source -> ${archivePath}`);
|
|
95
|
+
return true;
|
|
96
|
+
} catch (err) {
|
|
97
|
+
params.warnings.push(`Failed archiving Matrix IndexedDB snapshot legacy source: ${String(err)}`);
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
17
102
|
//#region extensions/matrix/src/matrix/monitor/inbound-dedupe-migration.ts
|
|
18
103
|
const LEGACY_SQLITE_NAMESPACE = "inbound-dedupe";
|
|
19
104
|
const LEGACY_SQLITE_MAX_ENTRIES = 2e4;
|
|
@@ -29,7 +114,7 @@ async function collectMatrixInboundDedupeSources(stateDir) {
|
|
|
29
114
|
async function visit(dir) {
|
|
30
115
|
let entries;
|
|
31
116
|
try {
|
|
32
|
-
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
117
|
+
entries = await fs$1.readdir(dir, { withFileTypes: true });
|
|
33
118
|
} catch {
|
|
34
119
|
return;
|
|
35
120
|
}
|
|
@@ -113,7 +198,7 @@ async function retireLegacyInboundDedupeSqliteRows(io, storageRootDir) {
|
|
|
113
198
|
}
|
|
114
199
|
async function resolveJsonRootAccountId(storageRootDir) {
|
|
115
200
|
for (const filename of [STORAGE_META_FILENAME, `${STORAGE_META_FILENAME}.migrated`]) try {
|
|
116
|
-
const metadata = normalizeMatrixStorageMetadata(JSON.parse(await fs.readFile(path.join(storageRootDir, filename), "utf8")));
|
|
201
|
+
const metadata = normalizeMatrixStorageMetadata(JSON.parse(await fs$1.readFile(path.join(storageRootDir, filename), "utf8")));
|
|
117
202
|
if (metadata?.accountId) return metadata.accountId;
|
|
118
203
|
} catch {}
|
|
119
204
|
return "default";
|
|
@@ -125,7 +210,7 @@ async function resolveJsonRootAccountId(storageRootDir) {
|
|
|
125
210
|
*/
|
|
126
211
|
async function readLegacyInboundDedupeJsonSource(storageRootDir) {
|
|
127
212
|
const jsonPath = path.join(storageRootDir, MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME);
|
|
128
|
-
const raw = await fs.readFile(jsonPath, "utf8");
|
|
213
|
+
const raw = await fs$1.readFile(jsonPath, "utf8");
|
|
129
214
|
let parsed;
|
|
130
215
|
try {
|
|
131
216
|
parsed = JSON.parse(raw);
|
|
@@ -208,7 +293,7 @@ async function collectLegacyMatrixCredentialSources(params) {
|
|
|
208
293
|
const credentialsDir = resolveMatrixCredentialsDir(params.stateDir);
|
|
209
294
|
let entries;
|
|
210
295
|
try {
|
|
211
|
-
entries = await fs.readdir(credentialsDir, { withFileTypes: true });
|
|
296
|
+
entries = await fs$1.readdir(credentialsDir, { withFileTypes: true });
|
|
212
297
|
} catch {
|
|
213
298
|
return [];
|
|
214
299
|
}
|
|
@@ -227,8 +312,8 @@ async function collectLegacyMatrixCredentialSources(params) {
|
|
|
227
312
|
async function readLegacyMatrixCredentials(source) {
|
|
228
313
|
if (!source.accountId) return null;
|
|
229
314
|
try {
|
|
230
|
-
const raw = JSON.parse(await fs.readFile(source.filePath, "utf8"));
|
|
231
|
-
const createdAt = isRecord(raw) && typeof raw.createdAt === "string" && raw.createdAt ? raw.createdAt : (await fs.stat(source.filePath)).mtime.toISOString();
|
|
315
|
+
const raw = JSON.parse(await fs$1.readFile(source.filePath, "utf8"));
|
|
316
|
+
const createdAt = isRecord(raw) && typeof raw.createdAt === "string" && raw.createdAt ? raw.createdAt : (await fs$1.stat(source.filePath)).mtime.toISOString();
|
|
232
317
|
return normalizeMatrixStoredCredentials(isRecord(raw) ? {
|
|
233
318
|
...raw,
|
|
234
319
|
createdAt
|
|
@@ -237,13 +322,13 @@ async function readLegacyMatrixCredentials(source) {
|
|
|
237
322
|
return null;
|
|
238
323
|
}
|
|
239
324
|
}
|
|
240
|
-
async function collectLegacyMatrixStateRoots(stateDir, filename) {
|
|
325
|
+
async function collectLegacyMatrixStateRoots(stateDir, filename, options) {
|
|
241
326
|
const matrixRoot = path.join(stateDir, "matrix");
|
|
242
327
|
const roots = [];
|
|
243
328
|
async function visit(dir) {
|
|
244
329
|
let entries;
|
|
245
330
|
try {
|
|
246
|
-
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
331
|
+
entries = await fs$1.readdir(dir, { withFileTypes: true });
|
|
247
332
|
} catch {
|
|
248
333
|
return;
|
|
249
334
|
}
|
|
@@ -257,14 +342,14 @@ async function collectLegacyMatrixStateRoots(stateDir, filename) {
|
|
|
257
342
|
}
|
|
258
343
|
}
|
|
259
344
|
await visit(matrixRoot);
|
|
260
|
-
return roots.filter((root) => path.resolve(root) !== path.resolve(matrixRoot)).toSorted();
|
|
345
|
+
return roots.filter((root) => options?.includeMatrixRoot || path.resolve(root) !== path.resolve(matrixRoot)).toSorted();
|
|
261
346
|
}
|
|
262
347
|
async function collectLegacySyncCacheRoots(stateDir) {
|
|
263
348
|
return collectLegacyMatrixStateRoots(stateDir, MATRIX_SYNC_CACHE_FILENAME);
|
|
264
349
|
}
|
|
265
350
|
async function readLegacyMatrixStorageMetadata(storageRootDir) {
|
|
266
351
|
try {
|
|
267
|
-
return normalizeMatrixStorageMetadata(JSON.parse(await fs.readFile(path.join(storageRootDir, MATRIX_STORAGE_META_FILENAME), "utf8")));
|
|
352
|
+
return normalizeMatrixStorageMetadata(JSON.parse(await fs$1.readFile(path.join(storageRootDir, MATRIX_STORAGE_META_FILENAME), "utf8")));
|
|
268
353
|
} catch {
|
|
269
354
|
return null;
|
|
270
355
|
}
|
|
@@ -592,74 +677,23 @@ const stateMigrations = [
|
|
|
592
677
|
};
|
|
593
678
|
}
|
|
594
679
|
},
|
|
595
|
-
{
|
|
596
|
-
id: "matrix-idb-snapshot-json-to-plugin-state",
|
|
597
|
-
label: "Matrix IndexedDB snapshot",
|
|
598
|
-
async detectLegacyState(params) {
|
|
599
|
-
const previews = [];
|
|
600
|
-
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME)) {
|
|
601
|
-
if (!await readLegacyMatrixIdbSnapshotState(storageRootDir)) continue;
|
|
602
|
-
previews.push(`Matrix IndexedDB snapshot JSON can migrate to SQLite: ${storageRootDir}`);
|
|
603
|
-
}
|
|
604
|
-
return previews.length > 0 ? { preview: previews } : null;
|
|
605
|
-
},
|
|
606
|
-
async migrateLegacyState(params) {
|
|
607
|
-
const changes = [];
|
|
608
|
-
const warnings = [];
|
|
609
|
-
const notices = [];
|
|
610
|
-
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME)) {
|
|
611
|
-
const snapshot = await readLegacyMatrixIdbSnapshotState(storageRootDir);
|
|
612
|
-
if (!snapshot) continue;
|
|
613
|
-
const store = params.context.openPluginStateKeyedStore(openMatrixIdbSnapshotStoreOptions(storageRootDir));
|
|
614
|
-
if (await hasMatrixIdbSnapshotStateInStore({ store })) {
|
|
615
|
-
await archiveLegacyMatrixStateFile({
|
|
616
|
-
storageRootDir,
|
|
617
|
-
filename: MATRIX_IDB_SNAPSHOT_FILENAME,
|
|
618
|
-
label: "Matrix IndexedDB snapshot",
|
|
619
|
-
changes,
|
|
620
|
-
warnings,
|
|
621
|
-
notices,
|
|
622
|
-
notice: `Kept existing Matrix IndexedDB snapshot in SQLite and archived the legacy source for ${storageRootDir}`
|
|
623
|
-
});
|
|
624
|
-
continue;
|
|
625
|
-
}
|
|
626
|
-
await writeMatrixIdbSnapshotJsonToStore({
|
|
627
|
-
snapshotJson: JSON.stringify(snapshot),
|
|
628
|
-
databaseCount: snapshot.length,
|
|
629
|
-
store
|
|
630
|
-
});
|
|
631
|
-
changes.push(`Migrated Matrix IndexedDB snapshot JSON to SQLite for ${storageRootDir}`);
|
|
632
|
-
await archiveLegacyMatrixStateFile({
|
|
633
|
-
storageRootDir,
|
|
634
|
-
filename: MATRIX_IDB_SNAPSHOT_FILENAME,
|
|
635
|
-
label: "Matrix IndexedDB snapshot",
|
|
636
|
-
changes,
|
|
637
|
-
warnings
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
return {
|
|
641
|
-
changes,
|
|
642
|
-
warnings,
|
|
643
|
-
...notices.length > 0 ? { notices } : {}
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
},
|
|
647
680
|
{
|
|
648
681
|
id: "matrix-legacy-crypto-migration-json-to-plugin-state",
|
|
649
|
-
label: "Matrix legacy crypto
|
|
682
|
+
label: "Matrix legacy crypto state",
|
|
650
683
|
async detectLegacyState(params) {
|
|
651
684
|
const previews = [];
|
|
652
|
-
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME)) {
|
|
685
|
+
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, { includeMatrixRoot: true })) {
|
|
653
686
|
if (!readLegacyMatrixLegacyCryptoMigrationState(storageRootDir)) continue;
|
|
654
687
|
previews.push(`Matrix legacy crypto migration JSON can migrate to SQLite: ${storageRootDir}`);
|
|
655
688
|
}
|
|
689
|
+
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME, { includeMatrixRoot: true })) previews.push(`Matrix IndexedDB snapshot JSON can migrate to SQLite: ${storageRootDir}`);
|
|
656
690
|
return previews.length > 0 ? { preview: previews } : null;
|
|
657
691
|
},
|
|
658
692
|
async migrateLegacyState(params) {
|
|
659
693
|
const changes = [];
|
|
660
694
|
const warnings = [];
|
|
661
695
|
const notices = [];
|
|
662
|
-
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME)) {
|
|
696
|
+
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, { includeMatrixRoot: true })) {
|
|
663
697
|
const state = readLegacyMatrixLegacyCryptoMigrationState(storageRootDir);
|
|
664
698
|
if (!state) continue;
|
|
665
699
|
const store = params.context.openPluginStateKeyedStore(openMatrixLegacyCryptoMigrationStoreOptions(storageRootDir));
|
|
@@ -688,6 +722,13 @@ const stateMigrations = [
|
|
|
688
722
|
warnings
|
|
689
723
|
});
|
|
690
724
|
}
|
|
725
|
+
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME, { includeMatrixRoot: true })) await migrateLegacyMatrixIdbSnapshot({
|
|
726
|
+
storageRootDir,
|
|
727
|
+
context: params.context,
|
|
728
|
+
changes,
|
|
729
|
+
notices,
|
|
730
|
+
warnings
|
|
731
|
+
});
|
|
691
732
|
return {
|
|
692
733
|
changes,
|
|
693
734
|
warnings,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as MsgType, a as sendSingleTextMessageMatrix, t as editMessageMatrix, y as prepareMatrixSingleText } from "./send-C9Ssx-iV.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,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { t as isRecord } from "./record-shared-CWWx6fvI.js";
|
|
3
3
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
4
|
-
import { M as resolveMatrixSqliteStateEnv, t as claimCurrentTokenStorageState } from "./storage-
|
|
4
|
+
import { M as resolveMatrixSqliteStateEnv, t as claimCurrentTokenStorageState } from "./storage-BvAkgzvT.js";
|
|
5
5
|
import { n as LogService } from "./logger-D0GCSDQq.js";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
import path from "node:path";
|