@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
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { r as setMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
2
|
import { s as resetMatrixThreadBindingsForTests } from "./thread-bindings-shared-CKnY4LSd.js";
|
|
3
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
3
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-D3RfVgAF.js";
|
|
4
4
|
export { createMatrixThreadBindingManager, resetMatrixThreadBindingsForTests, setMatrixRuntime };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
|
|
2
|
-
import "./setup-core-
|
|
2
|
+
import "./setup-core-a542Ernq.js";
|
|
3
3
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
4
|
-
import { n as bootstrapMatrixVerification } from "./verification-
|
|
4
|
+
import { n as bootstrapMatrixVerification } from "./verification-ZdAXdmuh.js";
|
|
5
5
|
//#region extensions/matrix/src/setup-bootstrap.ts
|
|
6
6
|
async function maybeBootstrapNewEncryptedMatrixAccount(params) {
|
|
7
7
|
const accountConfig = resolveMatrixAccountConfig({
|
|
@@ -8,6 +8,8 @@ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "opencl
|
|
|
8
8
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
9
9
|
import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input-runtime";
|
|
10
10
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/routing";
|
|
11
|
+
import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
|
|
12
|
+
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
11
13
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$2, addWildcardAllowFrom, applyAccountNameToChannelSection, normalizeAccountId as normalizeAccountId$2, normalizeAllowFromEntries, normalizeSecretInputString, prepareScopedSetupConfig } from "openclaw/plugin-sdk/setup";
|
|
12
14
|
import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
13
15
|
import { coerceSecretRef as coerceSecretRef$1 } from "openclaw/plugin-sdk/secret-ref-runtime";
|
|
@@ -135,7 +137,12 @@ function resolveMatrixAccount(params) {
|
|
|
135
137
|
//#endregion
|
|
136
138
|
//#region extensions/matrix/src/setup-contract.ts
|
|
137
139
|
const matrixSingleAccountKeysToMove = [
|
|
140
|
+
"homeserver",
|
|
141
|
+
"userId",
|
|
142
|
+
"accessToken",
|
|
143
|
+
"password",
|
|
138
144
|
"deviceId",
|
|
145
|
+
"deviceName",
|
|
139
146
|
"avatarUrl",
|
|
140
147
|
"initialSyncLimit",
|
|
141
148
|
"encryption",
|
|
@@ -509,16 +516,17 @@ function moveSingleMatrixAccountConfigToNamedAccount(cfg) {
|
|
|
509
516
|
};
|
|
510
517
|
}
|
|
511
518
|
function validateMatrixSetupInput(params) {
|
|
512
|
-
const
|
|
519
|
+
const input = params.input;
|
|
520
|
+
const avatarUrl = resolveSetupAvatarUrl(input);
|
|
513
521
|
if (avatarUrl && !isSupportedMatrixAvatarSource(avatarUrl)) return "Matrix avatar URL must be an mxc:// URI or an http(s) URL.";
|
|
514
|
-
if (
|
|
522
|
+
if (input.useEnv) {
|
|
515
523
|
const envReadiness = resolveMatrixEnvAuthReadiness(params.accountId, process.env);
|
|
516
524
|
return envReadiness.ready ? null : envReadiness.missingMessage;
|
|
517
525
|
}
|
|
518
|
-
if (!
|
|
519
|
-
const accessToken =
|
|
520
|
-
const password = normalizeSecretInputString(
|
|
521
|
-
const userId =
|
|
526
|
+
if (!input.homeserver?.trim()) return "Matrix requires --homeserver";
|
|
527
|
+
const accessToken = input.accessToken?.trim();
|
|
528
|
+
const password = normalizeSecretInputString(input.password);
|
|
529
|
+
const userId = input.userId?.trim();
|
|
522
530
|
if (!accessToken && !password) return "Matrix requires --access-token or --password";
|
|
523
531
|
if (!accessToken) {
|
|
524
532
|
if (!userId) return "Matrix requires --user-id when using --password";
|
|
@@ -527,15 +535,16 @@ function validateMatrixSetupInput(params) {
|
|
|
527
535
|
return null;
|
|
528
536
|
}
|
|
529
537
|
function applyMatrixSetupAccountConfig(params) {
|
|
538
|
+
const input = params.input;
|
|
530
539
|
const normalizedAccountId = normalizeAccountId$2(params.accountId);
|
|
531
540
|
const next = applyAccountNameToChannelSection({
|
|
532
541
|
cfg: normalizedAccountId !== DEFAULT_ACCOUNT_ID$2 ? moveSingleMatrixAccountConfigToNamedAccount(params.cfg) : params.cfg,
|
|
533
542
|
channelKey: channel$1,
|
|
534
543
|
accountId: normalizedAccountId,
|
|
535
|
-
name:
|
|
544
|
+
name: input.name
|
|
536
545
|
});
|
|
537
|
-
const avatarUrl = resolveSetupAvatarUrl(
|
|
538
|
-
if (
|
|
546
|
+
const avatarUrl = resolveSetupAvatarUrl(input);
|
|
547
|
+
if (input.useEnv) return updateMatrixAccountConfig(next, normalizedAccountId, {
|
|
539
548
|
enabled: true,
|
|
540
549
|
homeserver: null,
|
|
541
550
|
allowPrivateNetwork: null,
|
|
@@ -547,20 +556,20 @@ function applyMatrixSetupAccountConfig(params) {
|
|
|
547
556
|
deviceName: null,
|
|
548
557
|
avatarUrl
|
|
549
558
|
});
|
|
550
|
-
const accessToken =
|
|
551
|
-
const password = normalizeSecretInputString(
|
|
552
|
-
const userId =
|
|
559
|
+
const accessToken = input.accessToken?.trim();
|
|
560
|
+
const password = normalizeSecretInputString(input.password);
|
|
561
|
+
const userId = input.userId?.trim();
|
|
553
562
|
return updateMatrixAccountConfig(next, normalizedAccountId, {
|
|
554
563
|
enabled: true,
|
|
555
|
-
homeserver:
|
|
556
|
-
allowPrivateNetwork: typeof
|
|
557
|
-
proxy: normalizeOptionalString(
|
|
564
|
+
homeserver: input.homeserver?.trim(),
|
|
565
|
+
allowPrivateNetwork: typeof input.dangerouslyAllowPrivateNetwork === "boolean" ? input.dangerouslyAllowPrivateNetwork : typeof input.allowPrivateNetwork === "boolean" ? input.allowPrivateNetwork : void 0,
|
|
566
|
+
proxy: normalizeOptionalString(input.proxy),
|
|
558
567
|
userId: password && !userId ? null : userId,
|
|
559
568
|
accessToken: accessToken || (password ? null : void 0),
|
|
560
569
|
password: password || (accessToken ? null : void 0),
|
|
561
|
-
deviceName:
|
|
570
|
+
deviceName: input.deviceName?.trim(),
|
|
562
571
|
avatarUrl,
|
|
563
|
-
initialSyncLimit:
|
|
572
|
+
initialSyncLimit: input.initialSyncLimit
|
|
564
573
|
});
|
|
565
574
|
}
|
|
566
575
|
//#endregion
|
|
@@ -578,19 +587,6 @@ function resolveMatrixSetupAccountId(params) {
|
|
|
578
587
|
function resolveMatrixSetupWizardAccountId(cfg, accountId) {
|
|
579
588
|
return normalizeAccountId$2(accountId?.trim() || resolveDefaultMatrixAccountId(cfg) || DEFAULT_ACCOUNT_ID$2);
|
|
580
589
|
}
|
|
581
|
-
function setMatrixDmPolicy(cfg, policy, accountId) {
|
|
582
|
-
const resolvedAccountId = resolveMatrixSetupWizardAccountId(cfg, accountId);
|
|
583
|
-
const existing = resolveMatrixAccountConfig({
|
|
584
|
-
cfg,
|
|
585
|
-
accountId: resolvedAccountId
|
|
586
|
-
});
|
|
587
|
-
const allowFrom = resolveMatrixSetupDmAllowFrom(policy, existing.dm?.allowFrom);
|
|
588
|
-
return updateMatrixAccountConfig(cfg, resolvedAccountId, { dm: {
|
|
589
|
-
...existing.dm,
|
|
590
|
-
policy,
|
|
591
|
-
allowFrom
|
|
592
|
-
} });
|
|
593
|
-
}
|
|
594
590
|
function createMatrixSetupWizardProxy(loadWizardModule) {
|
|
595
591
|
let wizardPromise = null;
|
|
596
592
|
const loadWizard = () => {
|
|
@@ -610,28 +606,42 @@ function createMatrixSetupWizardProxy(loadWizardModule) {
|
|
|
610
606
|
return await (wizard.configureWhenConfigured ?? wizard.configureInteractive ?? wizard.configure)(ctx);
|
|
611
607
|
},
|
|
612
608
|
afterConfigWritten: async (ctx) => await (await loadWizard()).afterConfigWritten?.(ctx),
|
|
613
|
-
dmPolicy: {
|
|
609
|
+
dmPolicy: createChannelDmPolicy({
|
|
614
610
|
label: "Matrix",
|
|
615
611
|
channel,
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
const
|
|
612
|
+
policyPath: "dm.policy",
|
|
613
|
+
allowFromPath: "dm.allowFrom",
|
|
614
|
+
resolveAccount: (cfg, accountId) => {
|
|
615
|
+
const accountIdResolved = resolveMatrixSetupWizardAccountId(cfg, accountId);
|
|
616
|
+
const config = resolveMatrixAccountConfig({
|
|
617
|
+
cfg,
|
|
618
|
+
accountId: accountIdResolved
|
|
619
|
+
});
|
|
620
620
|
return {
|
|
621
|
-
|
|
622
|
-
|
|
621
|
+
accountId: accountIdResolved,
|
|
622
|
+
config: {
|
|
623
|
+
dmPolicy: config.dm?.policy,
|
|
624
|
+
allowFrom: config.dm?.allowFrom,
|
|
625
|
+
dm: config.dm
|
|
626
|
+
}
|
|
623
627
|
};
|
|
624
628
|
},
|
|
625
|
-
|
|
626
|
-
cfg,
|
|
627
|
-
|
|
628
|
-
})
|
|
629
|
-
|
|
629
|
+
resolveConfigKeys: ({ cfg, account }) => ({
|
|
630
|
+
policyKey: resolveMatrixConfigFieldPath(cfg, account.accountId, "dm.policy"),
|
|
631
|
+
allowFromKey: resolveMatrixConfigFieldPath(cfg, account.accountId, "dm.allowFrom")
|
|
632
|
+
}),
|
|
633
|
+
resolveAllowFrom: ({ policy, account }) => resolveMatrixSetupDmAllowFrom(policy, account.config.allowFrom),
|
|
634
|
+
buildPatch: ({ account, policy, allowFrom }) => ({ dm: {
|
|
635
|
+
...account.config.dm,
|
|
636
|
+
policy,
|
|
637
|
+
allowFrom
|
|
638
|
+
} }),
|
|
639
|
+
applyPatch: ({ cfg, account, patch }) => updateMatrixAccountConfig(cfg, account.accountId, patch),
|
|
630
640
|
promptAllowFrom: async (params) => {
|
|
631
641
|
const promptAllowFrom = (await loadWizard()).dmPolicy?.promptAllowFrom;
|
|
632
642
|
return promptAllowFrom ? await promptAllowFrom(params) : params.cfg;
|
|
633
643
|
}
|
|
634
|
-
},
|
|
644
|
+
}),
|
|
635
645
|
disable: (cfg) => ({
|
|
636
646
|
...cfg,
|
|
637
647
|
channels: {
|
|
@@ -645,6 +655,9 @@ function createMatrixSetupWizardProxy(loadWizardModule) {
|
|
|
645
655
|
};
|
|
646
656
|
}
|
|
647
657
|
const matrixSetupAdapter = {
|
|
658
|
+
singleAccountKeysToMove,
|
|
659
|
+
namedAccountPromotionKeys,
|
|
660
|
+
resolveSingleAccountPromotionTarget,
|
|
648
661
|
resolveAccountId: ({ accountId, input }) => resolveMatrixSetupAccountId({
|
|
649
662
|
accountId,
|
|
650
663
|
name: input?.name
|
|
@@ -669,7 +682,7 @@ const matrixSetupAdapter = {
|
|
|
669
682
|
input
|
|
670
683
|
}),
|
|
671
684
|
afterAccountConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
|
|
672
|
-
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-
|
|
685
|
+
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-BBGpPKgy.js");
|
|
673
686
|
await runMatrixSetupBootstrapAfterConfigWrite({
|
|
674
687
|
previousCfg,
|
|
675
688
|
cfg,
|
|
@@ -678,5 +691,82 @@ const matrixSetupAdapter = {
|
|
|
678
691
|
});
|
|
679
692
|
}
|
|
680
693
|
};
|
|
694
|
+
const matrixSetupContract = defineChannelSetupContract({
|
|
695
|
+
fields: {
|
|
696
|
+
homeserver: {
|
|
697
|
+
kind: "string",
|
|
698
|
+
cli: {
|
|
699
|
+
flags: "--homeserver <url>",
|
|
700
|
+
description: "Matrix homeserver URL"
|
|
701
|
+
}
|
|
702
|
+
},
|
|
703
|
+
userId: {
|
|
704
|
+
kind: "string",
|
|
705
|
+
cli: {
|
|
706
|
+
flags: "--user-id <id>",
|
|
707
|
+
description: "Matrix user id"
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
accessToken: {
|
|
711
|
+
kind: "string",
|
|
712
|
+
sensitive: true,
|
|
713
|
+
cli: {
|
|
714
|
+
flags: "--access-token <token>",
|
|
715
|
+
description: "Matrix access token"
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
password: {
|
|
719
|
+
kind: "string",
|
|
720
|
+
sensitive: true,
|
|
721
|
+
cli: {
|
|
722
|
+
flags: "--password <password>",
|
|
723
|
+
description: "Matrix password"
|
|
724
|
+
}
|
|
725
|
+
},
|
|
726
|
+
deviceName: {
|
|
727
|
+
kind: "string",
|
|
728
|
+
cli: {
|
|
729
|
+
flags: "--device-name <name>",
|
|
730
|
+
description: "Matrix device name"
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
avatarUrl: {
|
|
734
|
+
kind: "string",
|
|
735
|
+
cli: {
|
|
736
|
+
flags: "--avatar-url <url>",
|
|
737
|
+
description: "Matrix avatar URL"
|
|
738
|
+
}
|
|
739
|
+
},
|
|
740
|
+
initialSyncLimit: {
|
|
741
|
+
kind: "integer",
|
|
742
|
+
cli: {
|
|
743
|
+
flags: "--initial-sync-limit <n>",
|
|
744
|
+
description: "Matrix initial sync room limit"
|
|
745
|
+
}
|
|
746
|
+
},
|
|
747
|
+
proxy: {
|
|
748
|
+
kind: "string",
|
|
749
|
+
cli: {
|
|
750
|
+
flags: "--proxy <url>",
|
|
751
|
+
description: "Matrix proxy URL"
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
dangerouslyAllowPrivateNetwork: {
|
|
755
|
+
kind: "boolean",
|
|
756
|
+
cli: {
|
|
757
|
+
flags: "--dangerously-allow-private-network",
|
|
758
|
+
description: "Allow private-network Matrix homeservers"
|
|
759
|
+
}
|
|
760
|
+
},
|
|
761
|
+
useEnv: {
|
|
762
|
+
kind: "boolean",
|
|
763
|
+
cli: {
|
|
764
|
+
flags: "--use-env",
|
|
765
|
+
description: "Use Matrix environment credentials"
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
legacyAdapter: matrixSetupAdapter
|
|
770
|
+
});
|
|
681
771
|
//#endregion
|
|
682
|
-
export {
|
|
772
|
+
export { resolveMatrixAccount as _, moveSingleMatrixAccountConfigToNamedAccount as a, config_update_exports as c, namedAccountPromotionKeys as d, resolveSingleAccountPromotionTarget as f, resolveDefaultMatrixAccountId as g, resolveConfiguredMatrixBotUserIds as h, resolveMatrixSetupDmAllowFrom as i, resolveMatrixConfigPath as l, listMatrixAccountIds as m, matrixSetupAdapter as n, profile_exports as o, singleAccountKeysToMove as p, matrixSetupContract as r, syncMatrixOwnProfile as s, createMatrixSetupWizardProxy as t, updateMatrixAccountConfig as u };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-
|
|
1
|
+
import { _ as resolveMatrixAccount, n as matrixSetupAdapter, r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-a542Ernq.js";
|
|
2
|
+
import { r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-BShrVROw.js";
|
|
3
3
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
4
4
|
const matrixSetupPlugin = {
|
|
5
5
|
id: "matrix",
|
|
@@ -13,8 +13,9 @@ const matrixSetupPlugin = {
|
|
|
13
13
|
order: 70,
|
|
14
14
|
quickstartAllowFrom: true
|
|
15
15
|
},
|
|
16
|
-
setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-
|
|
16
|
+
setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-BJrCI6KT.js").then((n) => n.t)).matrixSetupWizard })),
|
|
17
17
|
setup: matrixSetupAdapter,
|
|
18
|
+
setupContract: matrixSetupContract,
|
|
18
19
|
capabilities: {
|
|
19
20
|
chatTypes: [
|
|
20
21
|
"direct",
|
|
@@ -2,12 +2,13 @@ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
|
2
2
|
import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-kqquRzCf.js";
|
|
3
3
|
import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
|
|
4
4
|
import { r as resolveMatrixEnvAuthReadiness } from "./env-auth-CQsYbz-p.js";
|
|
5
|
-
import {
|
|
5
|
+
import { _ as resolveMatrixAccount, a as moveSingleMatrixAccountConfigToNamedAccount, g as resolveDefaultMatrixAccountId, i as resolveMatrixSetupDmAllowFrom, m as listMatrixAccountIds, u as updateMatrixAccountConfig } from "./setup-core-a542Ernq.js";
|
|
6
6
|
import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
|
|
7
7
|
import { n as validateMatrixHomeserverUrl, r as isPrivateOrLoopbackHost, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
8
8
|
import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-CcVJfvRM.js";
|
|
9
9
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
10
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
11
|
+
import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
|
|
11
12
|
import { formatDocsLink, hasConfiguredSecretInput, mergeAllowFromEntries, normalizeAccountId as normalizeAccountId$1, promptAccountId, promptChannelAccessConfig, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
12
13
|
import { isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-policy";
|
|
13
14
|
//#region extensions/matrix/src/onboarding.ts
|
|
@@ -38,19 +39,6 @@ function normalizeMatrixInviteAutoJoinTargets(entries) {
|
|
|
38
39
|
function resolveMatrixOnboardingAccountId(cfg, accountId) {
|
|
39
40
|
return normalizeAccountId$1(normalizeOptionalString(accountId) || resolveDefaultMatrixAccountId(cfg) || DEFAULT_ACCOUNT_ID);
|
|
40
41
|
}
|
|
41
|
-
function setMatrixDmPolicy(cfg, policy, accountId) {
|
|
42
|
-
const resolvedAccountId = resolveMatrixOnboardingAccountId(cfg, accountId);
|
|
43
|
-
const existing = resolveMatrixAccountConfig({
|
|
44
|
-
cfg,
|
|
45
|
-
accountId: resolvedAccountId
|
|
46
|
-
});
|
|
47
|
-
const allowFrom = resolveMatrixSetupDmAllowFrom(policy, existing.dm?.allowFrom);
|
|
48
|
-
return updateMatrixAccountConfig(cfg, resolvedAccountId, { dm: {
|
|
49
|
-
...existing.dm,
|
|
50
|
-
policy,
|
|
51
|
-
allowFrom
|
|
52
|
-
} });
|
|
53
|
-
}
|
|
54
42
|
async function noteMatrixAuthHelp(prompter) {
|
|
55
43
|
await prompter.note([
|
|
56
44
|
"Matrix requires a homeserver URL.",
|
|
@@ -105,7 +93,7 @@ async function promptMatrixAllowFrom(params) {
|
|
|
105
93
|
pending.push(part);
|
|
106
94
|
}
|
|
107
95
|
if (pending.length > 0) {
|
|
108
|
-
const { resolveMatrixTargets } = await import("./resolve-targets-
|
|
96
|
+
const { resolveMatrixTargets } = await import("./resolve-targets-nNMcrV3W.js").then((n) => n.n);
|
|
109
97
|
const results = await resolveMatrixTargets({
|
|
110
98
|
cfg,
|
|
111
99
|
accountId,
|
|
@@ -233,7 +221,7 @@ async function configureMatrixAccessPrompts(params) {
|
|
|
233
221
|
resolvedIds.push(cleaned);
|
|
234
222
|
continue;
|
|
235
223
|
}
|
|
236
|
-
const { listMatrixDirectoryGroupsLive } = await import("./directory-live-
|
|
224
|
+
const { listMatrixDirectoryGroupsLive } = await import("./directory-live-YRgYDx2w.js").then((n) => n.t);
|
|
237
225
|
const matches = await listMatrixDirectoryGroupsLive({
|
|
238
226
|
cfg: next,
|
|
239
227
|
accountId: params.accountId,
|
|
@@ -258,25 +246,39 @@ async function configureMatrixAccessPrompts(params) {
|
|
|
258
246
|
accountId: params.accountId
|
|
259
247
|
});
|
|
260
248
|
}
|
|
261
|
-
const dmPolicy = {
|
|
249
|
+
const dmPolicy = createChannelDmPolicy({
|
|
262
250
|
label: "Matrix",
|
|
263
251
|
channel,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const
|
|
252
|
+
policyPath: "dm.policy",
|
|
253
|
+
allowFromPath: "dm.allowFrom",
|
|
254
|
+
resolveAccount: (cfg, accountId) => {
|
|
255
|
+
const accountIdResolved = resolveMatrixOnboardingAccountId(cfg, accountId);
|
|
256
|
+
const config = resolveMatrixAccountConfig({
|
|
257
|
+
cfg,
|
|
258
|
+
accountId: accountIdResolved
|
|
259
|
+
});
|
|
268
260
|
return {
|
|
269
|
-
|
|
270
|
-
|
|
261
|
+
accountId: accountIdResolved,
|
|
262
|
+
config: {
|
|
263
|
+
dmPolicy: config.dm?.policy,
|
|
264
|
+
allowFrom: config.dm?.allowFrom,
|
|
265
|
+
dm: config.dm
|
|
266
|
+
}
|
|
271
267
|
};
|
|
272
268
|
},
|
|
273
|
-
|
|
274
|
-
cfg,
|
|
275
|
-
|
|
276
|
-
})
|
|
277
|
-
|
|
269
|
+
resolveConfigKeys: ({ cfg, account }) => ({
|
|
270
|
+
policyKey: resolveMatrixConfigFieldPath(cfg, account.accountId, "dm.policy"),
|
|
271
|
+
allowFromKey: resolveMatrixConfigFieldPath(cfg, account.accountId, "dm.allowFrom")
|
|
272
|
+
}),
|
|
273
|
+
resolveAllowFrom: ({ policy, account }) => resolveMatrixSetupDmAllowFrom(policy, account.config.allowFrom),
|
|
274
|
+
buildPatch: ({ account, policy, allowFrom }) => ({ dm: {
|
|
275
|
+
...account.config.dm,
|
|
276
|
+
policy,
|
|
277
|
+
allowFrom
|
|
278
|
+
} }),
|
|
279
|
+
applyPatch: ({ cfg, account, patch }) => updateMatrixAccountConfig(cfg, account.accountId, patch),
|
|
278
280
|
promptAllowFrom: promptMatrixAllowFrom
|
|
279
|
-
};
|
|
281
|
+
});
|
|
280
282
|
async function runMatrixConfigure(params) {
|
|
281
283
|
let next = params.cfg;
|
|
282
284
|
await ensureMatrixSdkInstalled({
|
|
@@ -387,6 +389,7 @@ async function runMatrixConfigure(params) {
|
|
|
387
389
|
}) === "token") {
|
|
388
390
|
accessToken = normalizeStringifiedOptionalString(await params.prompter.text({
|
|
389
391
|
message: "Matrix access token",
|
|
392
|
+
sensitive: true,
|
|
390
393
|
validate: (value) => normalizeOptionalString(value) ? void 0 : "Required"
|
|
391
394
|
})) ?? "";
|
|
392
395
|
password = void 0;
|
|
@@ -404,6 +407,7 @@ async function runMatrixConfigure(params) {
|
|
|
404
407
|
})) ?? "";
|
|
405
408
|
password = normalizeStringifiedOptionalString(await params.prompter.text({
|
|
406
409
|
message: "Matrix password",
|
|
410
|
+
sensitive: true,
|
|
407
411
|
validate: (value) => normalizeOptionalString(value) ? void 0 : "Required"
|
|
408
412
|
})) ?? "";
|
|
409
413
|
accessToken = void 0;
|
|
@@ -508,7 +512,7 @@ const matrixOnboardingAdapter = {
|
|
|
508
512
|
});
|
|
509
513
|
},
|
|
510
514
|
afterConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
|
|
511
|
-
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-
|
|
515
|
+
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-BBGpPKgy.js");
|
|
512
516
|
await runMatrixSetupBootstrapAfterConfigWrite({
|
|
513
517
|
previousCfg,
|
|
514
518
|
cfg,
|
|
@@ -5,18 +5,18 @@ import { o as resolveMatrixBaseConfig, r as listNormalizedMatrixAccountIds, t as
|
|
|
5
5
|
import { i as resolveScopedMatrixEnvConfig, n as resolveGlobalMatrixEnvConfig } from "./env-auth-CQsYbz-p.js";
|
|
6
6
|
import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
|
|
7
7
|
import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
8
|
-
import { s as repairCurrentTokenStorageMetaDeviceId } from "./storage-
|
|
8
|
+
import { s as repairCurrentTokenStorageMetaDeviceId } from "./storage-BvAkgzvT.js";
|
|
9
9
|
import { n as LogService } from "./logger-D0GCSDQq.js";
|
|
10
10
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
11
11
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1, normalizeOptionalAccountId, normalizeOptionalAccountId as normalizeOptionalAccountId$1 } from "openclaw/plugin-sdk/account-id";
|
|
12
12
|
import { coerceSecretRef, normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input-runtime";
|
|
13
|
-
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
13
|
+
import { formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
14
14
|
import { isPrivateNetworkOptInEnabled, ssrfPolicyFromDangerouslyAllowPrivateNetwork as ssrfPolicyFromDangerouslyAllowPrivateNetwork$1 } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
15
15
|
import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
16
16
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
17
17
|
import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
18
18
|
//#region extensions/matrix/src/matrix/client/config.ts
|
|
19
|
-
const loadDefaultMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-
|
|
19
|
+
const loadDefaultMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-UzPd8tst.js"), import("./logging-DV-p52N0.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
|
|
20
20
|
MatrixClient: sdkModule.MatrixClient,
|
|
21
21
|
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
22
22
|
})));
|
|
@@ -470,17 +470,10 @@ async function awaitMatrixStartupWithAbort(promise, abortSignal) {
|
|
|
470
470
|
resolve(value);
|
|
471
471
|
}, (error) => {
|
|
472
472
|
abortSignal.removeEventListener("abort", onAbort);
|
|
473
|
-
reject(
|
|
473
|
+
reject(toErrorObject(error, "Non-Error rejection"));
|
|
474
474
|
});
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
|
-
function toLintErrorObject(value, fallbackMessage) {
|
|
478
|
-
if (value instanceof Error) return value;
|
|
479
|
-
if (typeof value === "string") return new Error(value);
|
|
480
|
-
const error = new Error(fallbackMessage, { cause: value });
|
|
481
|
-
if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
|
|
482
|
-
return error;
|
|
483
|
-
}
|
|
484
477
|
//#endregion
|
|
485
478
|
//#region extensions/matrix/src/matrix/client/shared.ts
|
|
486
479
|
var shared_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -492,7 +485,7 @@ var shared_exports = /* @__PURE__ */ __exportAll({
|
|
|
492
485
|
stopSharedClientForAccount: () => stopSharedClientForAccount,
|
|
493
486
|
stopSharedClientInstance: () => stopSharedClientInstance
|
|
494
487
|
});
|
|
495
|
-
const loadMatrixCreateClientDeps = createLazyRuntimeModule(() => import("./create-client-
|
|
488
|
+
const loadMatrixCreateClientDeps = createLazyRuntimeModule(() => import("./create-client-f-CkRllE.js").then((n) => n.n).then((runtime) => ({ createMatrixClient: runtime.createMatrixClient })));
|
|
496
489
|
const sharedClientStates = /* @__PURE__ */ new Map();
|
|
497
490
|
const sharedClientPromises = /* @__PURE__ */ new Map();
|
|
498
491
|
function serializeDispatcherPolicyKey(auth) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
2
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
3
|
-
import { M as resolveMatrixSqliteStateEnv, l as resolveMatrixStoragePaths, o as recordCurrentStorageMetaDeviceId } from "./storage-
|
|
3
|
+
import { M as resolveMatrixSqliteStateEnv, l as resolveMatrixStoragePaths, o as recordCurrentStorageMetaDeviceId } from "./storage-BvAkgzvT.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -123,8 +123,8 @@ function writeMatrixIdbSnapshotJson(params) {
|
|
|
123
123
|
store: openSyncStore(openMatrixIdbSnapshotStoreOptions(params.storageRootDir))
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
-
async function
|
|
127
|
-
return await readIdbSnapshotJsonFromAsyncStore(params.store)
|
|
126
|
+
async function readMatrixIdbSnapshotJsonFromStore(params) {
|
|
127
|
+
return await readIdbSnapshotJsonFromAsyncStore(params.store);
|
|
128
128
|
}
|
|
129
129
|
async function writeMatrixIdbSnapshotJsonToStore(params) {
|
|
130
130
|
const rows = buildIdbSnapshotRows(params.snapshotJson, params.databaseCount);
|
|
@@ -362,9 +362,8 @@ function openMatrixStorageMetaStoreOptions(storageRootDir) {
|
|
|
362
362
|
function openStorageMetaStore(rootDir) {
|
|
363
363
|
return getMatrixRuntime().state.openSyncKeyedStore(openMatrixStorageMetaStoreOptions(rootDir));
|
|
364
364
|
}
|
|
365
|
-
function scoreStorageRoot(rootDir) {
|
|
365
|
+
function scoreStorageRoot(rootDir, metadata = readStoredRootMetadata(rootDir)) {
|
|
366
366
|
let score = 0;
|
|
367
|
-
const metadata = readStoredRootMetadata(rootDir);
|
|
368
367
|
if (Object.keys(metadata).length > 0) score += 1;
|
|
369
368
|
if (metadata.currentTokenStateClaimed === true) score += 8;
|
|
370
369
|
if (fs.existsSync(path.join(rootDir, "crypto"))) score += 8;
|
|
@@ -417,8 +416,16 @@ function isCompatibleStorageRoot(params) {
|
|
|
417
416
|
return true;
|
|
418
417
|
}
|
|
419
418
|
function resolvePreferredMatrixStorageRoot(params) {
|
|
419
|
+
const canonical = {
|
|
420
|
+
rootDir: params.canonicalRootDir,
|
|
421
|
+
tokenHash: params.canonicalTokenHash
|
|
422
|
+
};
|
|
423
|
+
const deviceId = params.deviceId?.trim();
|
|
424
|
+
if (!deviceId) return canonical;
|
|
425
|
+
const canonicalMetadata = readStoredRootMetadata(params.canonicalRootDir);
|
|
426
|
+
if (canonicalMetadata.accessTokenHash === params.canonicalTokenHash && canonicalMetadata.deviceId?.trim() === deviceId && canonicalMetadata.currentTokenStateClaimed === true) return canonical;
|
|
420
427
|
const parentDir = path.dirname(params.canonicalRootDir);
|
|
421
|
-
const bestCurrentScore = scoreStorageRoot(params.canonicalRootDir);
|
|
428
|
+
const bestCurrentScore = scoreStorageRoot(params.canonicalRootDir, canonicalMetadata);
|
|
422
429
|
const bestCurrentMtimeMs = resolveStorageRootMtimeMs(params.canonicalRootDir);
|
|
423
430
|
let best = {
|
|
424
431
|
rootDir: params.canonicalRootDir,
|
|
@@ -426,10 +433,6 @@ function resolvePreferredMatrixStorageRoot(params) {
|
|
|
426
433
|
score: bestCurrentScore,
|
|
427
434
|
mtimeMs: bestCurrentMtimeMs
|
|
428
435
|
};
|
|
429
|
-
if (!params.deviceId?.trim()) return {
|
|
430
|
-
rootDir: best.rootDir,
|
|
431
|
-
tokenHash: best.tokenHash
|
|
432
|
-
};
|
|
433
436
|
let siblingEntries;
|
|
434
437
|
try {
|
|
435
438
|
siblingEntries = fs.readdirSync(parentDir, { withFileTypes: true });
|
|
@@ -450,8 +453,8 @@ function resolvePreferredMatrixStorageRoot(params) {
|
|
|
450
453
|
homeserver: params.homeserver,
|
|
451
454
|
userId: params.userId,
|
|
452
455
|
accountKey: params.accountKey,
|
|
453
|
-
deviceId
|
|
454
|
-
requireExplicitDeviceMatch:
|
|
456
|
+
deviceId,
|
|
457
|
+
requireExplicitDeviceMatch: true
|
|
455
458
|
})) continue;
|
|
456
459
|
const candidateScore = scoreStorageRoot(candidateRootDir);
|
|
457
460
|
if (candidateScore <= 0) continue;
|
|
@@ -463,15 +466,12 @@ function resolvePreferredMatrixStorageRoot(params) {
|
|
|
463
466
|
mtimeMs: resolveStorageRootMtimeMs(candidateRootDir)
|
|
464
467
|
});
|
|
465
468
|
}
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
mtimeMs: candidate.mtimeMs
|
|
473
|
-
};
|
|
474
|
-
}
|
|
469
|
+
for (const candidate of compatiblePopulatedSiblings) if (candidate.score > best.score || best.rootDir !== params.canonicalRootDir && candidate.score === best.score && candidate.mtimeMs > best.mtimeMs) best = {
|
|
470
|
+
rootDir: candidate.rootDir,
|
|
471
|
+
tokenHash: candidate.tokenHash,
|
|
472
|
+
score: candidate.score,
|
|
473
|
+
mtimeMs: candidate.mtimeMs
|
|
474
|
+
};
|
|
475
475
|
if (populatedTokenHashes.length > 1) getMatrixRuntime().logging.getChildLogger({ module: "matrix-storage" }).warn("matrix: multiple populated token-hash storage roots detected", {
|
|
476
476
|
parentDir,
|
|
477
477
|
canonicalTokenHash: params.canonicalTokenHash,
|
|
@@ -526,12 +526,11 @@ function resolveMatrixStateFilePath(params) {
|
|
|
526
526
|
}
|
|
527
527
|
async function maybeMigrateLegacyStorage(params) {
|
|
528
528
|
const hasAccountScopedLegacyStorageFile = fs.existsSync(params.storagePaths.storagePath);
|
|
529
|
-
const syncCache = hasAccountScopedLegacyStorageFile ? await import("./file-sync-store-
|
|
529
|
+
const syncCache = hasAccountScopedLegacyStorageFile ? await import("./file-sync-store-DiiFsayX.js").then((n) => n.n) : null;
|
|
530
530
|
const hasAccountScopedLegacyStorage = hasAccountScopedLegacyStorageFile && await syncCache?.readLegacyMatrixSyncCacheState(params.storagePaths.rootDir) !== null;
|
|
531
531
|
const hasAccountScopedRecoveryKey = fs.existsSync(params.storagePaths.recoveryKeyPath);
|
|
532
|
-
const hasAccountScopedIdbSnapshot = fs.existsSync(params.storagePaths.idbSnapshotPath);
|
|
533
532
|
const hasAccountScopedLegacyCryptoMigration = fs.existsSync(path.join(params.storagePaths.rootDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME));
|
|
534
|
-
if (!hasAccountScopedLegacyStorage && !hasAccountScopedRecoveryKey && !
|
|
533
|
+
if (!hasAccountScopedLegacyStorage && !hasAccountScopedRecoveryKey && !hasAccountScopedLegacyCryptoMigration) return;
|
|
535
534
|
const logger = getMatrixRuntime().logging.getChildLogger({ module: "matrix-storage" });
|
|
536
535
|
fs.mkdirSync(params.storagePaths.rootDir, { recursive: true });
|
|
537
536
|
const moved = [];
|
|
@@ -562,12 +561,6 @@ async function maybeMigrateLegacyStorage(params) {
|
|
|
562
561
|
label: "legacy crypto migration"
|
|
563
562
|
});
|
|
564
563
|
}
|
|
565
|
-
if (hasAccountScopedIdbSnapshot) await migrateLegacyIdbSnapshotToSqlite({
|
|
566
|
-
storageRootDir: params.storagePaths.rootDir,
|
|
567
|
-
snapshotPath: params.storagePaths.idbSnapshotPath,
|
|
568
|
-
moved,
|
|
569
|
-
pendingArchives
|
|
570
|
-
});
|
|
571
564
|
} catch (err) {
|
|
572
565
|
const rollbackError = rollbackLegacyMoves(moved);
|
|
573
566
|
throw new Error(rollbackError ? `Failed migrating legacy Matrix client storage: ${String(err)}. Rollback also failed: ${rollbackError}` : `Failed migrating legacy Matrix client storage: ${String(err)}`, { cause: err });
|
|
@@ -579,34 +572,8 @@ async function maybeMigrateLegacyStorage(params) {
|
|
|
579
572
|
if (moved.length > 0) logger.info(`matrix: migrated legacy client storage into ${params.storagePaths.rootDir}\n${moved.map((entry) => `- ${entry.label}: ${entry.sourcePath} -> ${entry.targetPath}`).join("\n")}`);
|
|
580
573
|
if (skippedExistingTargets.length > 0) logger.warn?.(`matrix: legacy client storage files were left in place because their migrated targets already existed.\n${skippedExistingTargets.join("\n")}`);
|
|
581
574
|
}
|
|
582
|
-
async function migrateLegacyIdbSnapshotToSqlite(params) {
|
|
583
|
-
if (readMatrixIdbSnapshotJson(params.storageRootDir)) {
|
|
584
|
-
params.pendingArchives.push({
|
|
585
|
-
sourcePath: params.snapshotPath,
|
|
586
|
-
label: "IndexedDB snapshot"
|
|
587
|
-
});
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
const { readLegacyMatrixIdbSnapshotState } = await import("./idb-persistence-Dyy6ipgU.js").then((n) => n.t);
|
|
591
|
-
const snapshot = await readLegacyMatrixIdbSnapshotState(params.storageRootDir);
|
|
592
|
-
if (!snapshot) return;
|
|
593
|
-
writeMatrixIdbSnapshotJson({
|
|
594
|
-
storageRootDir: params.storageRootDir,
|
|
595
|
-
snapshotJson: JSON.stringify(snapshot),
|
|
596
|
-
databaseCount: snapshot.length
|
|
597
|
-
});
|
|
598
|
-
params.moved.push({
|
|
599
|
-
sourcePath: params.snapshotPath,
|
|
600
|
-
targetPath: `${params.storageRootDir} SQLite IndexedDB snapshot state`,
|
|
601
|
-
label: "IndexedDB snapshot"
|
|
602
|
-
});
|
|
603
|
-
params.pendingArchives.push({
|
|
604
|
-
sourcePath: params.snapshotPath,
|
|
605
|
-
label: "IndexedDB snapshot"
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
575
|
async function migrateLegacySyncCacheToSqlite(params) {
|
|
609
|
-
const syncCache = await import("./file-sync-store-
|
|
576
|
+
const syncCache = await import("./file-sync-store-DiiFsayX.js").then((n) => n.n);
|
|
610
577
|
const persisted = await syncCache.readLegacyMatrixSyncCacheState(params.sourceRootDir);
|
|
611
578
|
if (!persisted) return;
|
|
612
579
|
const store = getMatrixRuntime().state.openKeyedStore(syncCache.openMatrixSyncCacheStoreOptions(params.targetRootDir));
|
|
@@ -715,4 +682,4 @@ function repairCurrentTokenStorageMetaDeviceId(params) {
|
|
|
715
682
|
});
|
|
716
683
|
}
|
|
717
684
|
//#endregion
|
|
718
|
-
export { writeMatrixRecoveryKeyStateForPath as A,
|
|
685
|
+
export { writeMatrixRecoveryKeyStateForPath as A, readLegacyMatrixRecoveryKeyState as C, writeMatrixIdbSnapshotJson as D, readMatrixRecoveryKeyStateForPath as E, resolveMatrixSqliteStateEnv as M, resolveMatrixSqliteStateKey as N, writeMatrixIdbSnapshotJsonToStore as O, readLegacyMatrixRecoveryKeyFile as S, readMatrixIdbSnapshotJsonFromStore as T, migrateLegacyMatrixRecoveryKeyFilePathToStore as _, openMatrixStorageMetaStoreOptions as a, openMatrixRecoveryKeyStoreOptions as b, resolveMatrixStateFilePath as c, writeStorageMeta as d, MATRIX_IDB_SNAPSHOT_FILENAME as f, hasMatrixRecoveryKeyStateInStore as g, hasMatrixLegacyCryptoMigrationStateInStore as h, normalizeMatrixStorageMetadata as i, writeMatrixRecoveryKeyStateToStore as j, writeMatrixLegacyCryptoMigrationStateToStore as k, resolveMatrixStoragePaths as l, MATRIX_RECOVERY_KEY_FILENAME as m, hasMatrixStorageMetaStateInStore as n, recordCurrentStorageMetaDeviceId as o, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME as p, maybeMigrateLegacyStorage as r, repairCurrentTokenStorageMetaDeviceId as s, claimCurrentTokenStorageState as t, writeMatrixStorageMetaStateToStore as u, openMatrixIdbSnapshotStoreOptions as v, readMatrixIdbSnapshotJson as w, readLegacyMatrixLegacyCryptoMigrationState as x, openMatrixLegacyCryptoMigrationStoreOptions as y };
|