@openclaw/matrix 2026.8.2 → 2026.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +4 -4
- package/dist/{approval-handler.runtime-xcVrZw9o.js → approval-handler.runtime-B_6ytY5I.js} +32 -9
- package/dist/{approval-ids-hmvhDNBj.js → approval-ids-CfHtZ9d1.js} +1 -1
- package/dist/{approval-reaction-auth-DziFGHSk.js → approval-reaction-auth-BpDvJqfy.js} +1 -1
- package/dist/{channel-D6-ajB_u.js → channel-b-jES-oi.js} +18 -11
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-BkqjwEDU.js +76 -0
- package/dist/{channel.setup-OIEzCzSs.js → channel.setup-BY42QaL7.js} +2 -2
- package/dist/{cli-B6HF7Hmn.js → cli-CtYeU7ol.js} +8 -8
- package/dist/{cli-metadata-Mtzu5-AY.js → cli-metadata-B7MQjR5S.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-B0yMDho1.js → client-D2utPQ1E.js} +2 -2
- package/dist/{client-DFsRJEgB.js → client-Dj4mcf-s.js} +2 -2
- package/dist/{client-bootstrap-DjXCKEtg.js → client-bootstrap-n1Rqc8Go.js} +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/{crypto-runtime-QvlgyCkj.js → crypto-runtime-m1eplj3b.js} +3 -3
- package/dist/crypto-snapshot-doctor.runtime-D0v841D_.js +91 -0
- package/dist/{directory-live-Drh343TW.js → directory-live-DLUgWBhA.js} +1 -1
- package/dist/doctor-contract-api.js +85 -105
- package/dist/{draft-stream-DhGHVdO4.js → draft-stream-DPYdv4fE.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-DlMQaC02.js → messages-C1U3b1oN.js} +2 -2
- package/dist/{monitor-U2LcVtHt.js → monitor-SNnu-0bp.js} +29 -17
- package/dist/outbound-CeCEtF_q.js +220 -0
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-B1YPxG9x.js +2 -0
- package/dist/{profile-update-CsyKA9jI.js → profile-update-Cd1p8ABr.js} +1 -1
- package/dist/{reaction-events-lwNc5I1X.js → reaction-events-DveJRUaX.js} +3 -3
- package/dist/{resolve-targets-D3Eakgzs.js → resolve-targets-B64O69Nd.js} +1 -1
- package/dist/{resolver.runtime-DJQxR35r.js → resolver.runtime-TRmePJDV.js} +1 -1
- package/dist/{room-info-DIU67XLP.js → room-info-DVkKDscD.js} +3 -3
- package/dist/{sdk-Jl2CgAbJ.js → sdk-C1yfda1L.js} +4 -4
- package/dist/{send-DfS5ciUL.js → send-DG7Bnj7_.js} +12 -14
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-CWoIWudw.js → setup-bootstrap-Co985F63.js} +1 -1
- package/dist/{setup-core-CZM496H-.js → setup-core-CEF6exLW.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DSZtOsWK.js → setup-surface-BSlj1vnL.js} +4 -4
- package/dist/{thread-bindings-2HN2AyLu.js → thread-bindings-DgxQEB99.js} +1 -1
- package/dist/{tool-actions.runtime-CFZZPG5g.js → tool-actions.runtime-vbkQgU7D.js} +7 -7
- package/dist/{verification-CD7k5vE9.js → verification-D-iOebn4.js} +1 -1
- package/package.json +6 -5
- package/dist/channel.runtime-BMA0dG2k.js +0 -280
- package/dist/probe.runtime-CNo-5_iz.js +0 -2
- package/dist/{idb-persistence-D4NGNQxt.js → idb-persistence-CU7CNLlX.js} +1 -1
package/dist/api.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-DA-jfx22.js";
|
|
2
2
|
import { n as listMatrixEnvAccountIds, r as resolveMatrixEnvAccountToken, t as getMatrixScopedEnvVarNames } from "./env-vars-dGqak9dN.js";
|
|
3
3
|
import { a as resolveMatrixCredentialsPath, i as resolveMatrixCredentialsFilename, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as sanitizeMatrixPathSegment, t as hashMatrixAccessToken } from "./storage-paths-gUmSydsW.js";
|
|
4
|
-
import { t as matrixPlugin } from "./channel-
|
|
5
|
-
import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-
|
|
4
|
+
import { t as matrixPlugin } from "./channel-b-jES-oi.js";
|
|
5
|
+
import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-CEF6exLW.js";
|
|
6
6
|
import { f as setMatrixThreadBindingMaxAgeBySessionKey, n as getMatrixThreadBindingManager, u as setMatrixThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings-shared-oNPiyMWY.js";
|
|
7
|
-
import { n as matrixOnboardingAdapter } from "./setup-surface-
|
|
8
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
7
|
+
import { n as matrixOnboardingAdapter } from "./setup-surface-BSlj1vnL.js";
|
|
8
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-DgxQEB99.js";
|
|
9
9
|
export { createMatrixSetupWizardProxy, createMatrixThreadBindingManager, findMatrixAccountEntry, getMatrixScopedEnvVarNames, getMatrixThreadBindingManager, hashMatrixAccessToken, listMatrixEnvAccountIds, matrixOnboardingAdapter, matrixOnboardingAdapter as matrixSetupWizard, matrixPlugin, matrixSetupAdapter, requiresExplicitMatrixDefaultAccount, resolveConfiguredMatrixAccountIds, resolveMatrixAccountStorageRoot, resolveMatrixChannelConfig, resolveMatrixCredentialsDir, resolveMatrixCredentialsFilename, resolveMatrixCredentialsPath, resolveMatrixDefaultOrOnlyAccountId, resolveMatrixEnvAccountToken, resolveMatrixHomeserverKey, sanitizeMatrixPathSegment, setMatrixThreadBindingIdleTimeoutBySessionKey, setMatrixThreadBindingMaxAgeBySessionKey };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
|
|
2
|
-
import { C as shouldHandleMatrixApprovalRequest, S as isMatrixAnyApprovalClientEnabled } from "./channel-
|
|
2
|
+
import { C as shouldHandleMatrixApprovalRequest, S as isMatrixAnyApprovalClientEnabled } from "./channel-b-jES-oi.js";
|
|
3
3
|
import { o as resolveMatrixTargetIdentity } from "./target-ids-Nwx7cMVE.js";
|
|
4
|
-
import { C as repairMatrixDirectRooms, a as sendSingleTextMessageMatrix, n as reactMatrixMessage, r as sendMessageMatrix } from "./send-
|
|
4
|
+
import { C as repairMatrixDirectRooms, a as sendSingleTextMessageMatrix, n as reactMatrixMessage, r as sendMessageMatrix } from "./send-DG7Bnj7_.js";
|
|
5
5
|
import { a as unregisterMatrixApprovalReactionTarget, n as listMatrixApprovalReactionBindings, r as registerMatrixApprovalReactionTarget, t as buildMatrixApprovalReactionHint } from "./approval-reactions-1fwEhoK9.js";
|
|
6
|
-
import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-
|
|
6
|
+
import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-C1U3b1oN.js";
|
|
7
7
|
import { listMessageReceiptPlatformIds, resolveMessageReceiptPrimaryId } from "openclaw/plugin-sdk/channel-outbound";
|
|
8
8
|
import { normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
10
10
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
11
11
|
import { createChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-runtime";
|
|
12
12
|
import { buildExecApprovalPendingReplyPayload, buildPluginApprovalPendingReplyPayload } from "openclaw/plugin-sdk/approval-reply-runtime";
|
|
13
|
-
import { buildPluginApprovalResolvedReplyPayload } from "openclaw/plugin-sdk/approval-runtime";
|
|
13
|
+
import { buildApprovalPendingReplyPayload, buildPluginApprovalResolvedReplyPayload } from "openclaw/plugin-sdk/approval-runtime";
|
|
14
14
|
import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
15
15
|
//#region extensions/matrix/src/approval-handler.runtime.ts
|
|
16
16
|
const MATRIX_APPROVAL_METADATA_KEY = "com.openclaw.approval";
|
|
@@ -110,6 +110,13 @@ function buildMatrixApprovalMetadata(params) {
|
|
|
110
110
|
...params.view.pluginId != null ? { pluginId: params.view.pluginId } : {},
|
|
111
111
|
...params.view.toolName != null ? { toolName: params.view.toolName } : {}
|
|
112
112
|
};
|
|
113
|
+
if (params.view.approvalKind === "system-agent") return {
|
|
114
|
+
...base,
|
|
115
|
+
kind: "system-agent",
|
|
116
|
+
commandText: params.view.commandText,
|
|
117
|
+
operationSummary: params.view.operationSummary,
|
|
118
|
+
...params.view.agentId != null ? { agentId: params.view.agentId } : {}
|
|
119
|
+
};
|
|
113
120
|
return {
|
|
114
121
|
...base,
|
|
115
122
|
kind: "exec",
|
|
@@ -126,7 +133,8 @@ function buildMatrixApprovalMetadata(params) {
|
|
|
126
133
|
}
|
|
127
134
|
function buildPendingApprovalContent(params) {
|
|
128
135
|
const allowedDecisions = params.view.actions.map((action) => action.decision);
|
|
129
|
-
|
|
136
|
+
let payload;
|
|
137
|
+
if (params.view.approvalKind === "plugin") payload = buildPluginApprovalPendingReplyPayload({
|
|
130
138
|
request: {
|
|
131
139
|
approvalKind: "plugin",
|
|
132
140
|
id: params.view.approvalId,
|
|
@@ -144,7 +152,17 @@ function buildPendingApprovalContent(params) {
|
|
|
144
152
|
},
|
|
145
153
|
nowMs: params.nowMs,
|
|
146
154
|
allowedDecisions
|
|
147
|
-
})
|
|
155
|
+
});
|
|
156
|
+
else if (params.view.approvalKind === "system-agent") payload = buildApprovalPendingReplyPayload({
|
|
157
|
+
approvalKind: "system-agent",
|
|
158
|
+
approvalId: params.view.approvalId,
|
|
159
|
+
approvalSlug: params.view.approvalId.slice(0, 8),
|
|
160
|
+
text: `OpenClaw change requires approval:\n${params.view.operationSummary}`,
|
|
161
|
+
agentId: params.view.agentId,
|
|
162
|
+
allowedDecisions,
|
|
163
|
+
sessionKey: params.view.sessionKey
|
|
164
|
+
});
|
|
165
|
+
else payload = buildExecApprovalPendingReplyPayload({
|
|
148
166
|
approvalId: params.view.approvalId,
|
|
149
167
|
approvalSlug: params.view.approvalId.slice(0, 8),
|
|
150
168
|
approvalCommandId: params.view.approvalId,
|
|
@@ -179,10 +197,11 @@ function buildResolvedApprovalText(view) {
|
|
|
179
197
|
resolvedBy: view.resolvedBy ?? void 0,
|
|
180
198
|
ts: 0
|
|
181
199
|
} }).text ?? "";
|
|
200
|
+
const decisionLabel = view.approvalKind === "system-agent" && view.terminalStatus === "cancelled" ? "Cancelled" : view.approvalKind === "system-agent" && view.applicationStatus === "applied" ? "Applied" : view.approvalKind === "system-agent" && view.applicationStatus === "not-applied" ? "Not applied" : view.decision === "allow-once" ? "Allowed once" : view.decision === "allow-always" ? "Allowed always" : "Denied";
|
|
182
201
|
return [
|
|
183
|
-
|
|
202
|
+
`${view.approvalKind === "system-agent" ? "OpenClaw change" : "Exec approval"}: ${decisionLabel}`,
|
|
184
203
|
"",
|
|
185
|
-
"Command",
|
|
204
|
+
view.approvalKind === "system-agent" ? "Change" : "Command",
|
|
186
205
|
buildMarkdownCodeBlock(view.commandText)
|
|
187
206
|
].join("\n");
|
|
188
207
|
}
|
|
@@ -196,7 +215,11 @@ function buildMarkdownCodeBlock(text) {
|
|
|
196
215
|
].join("\n");
|
|
197
216
|
}
|
|
198
217
|
const matrixApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
|
|
199
|
-
eventKinds: [
|
|
218
|
+
eventKinds: [
|
|
219
|
+
"exec",
|
|
220
|
+
"plugin",
|
|
221
|
+
"system-agent"
|
|
222
|
+
],
|
|
200
223
|
availability: {
|
|
201
224
|
isConfigured: ({ cfg, accountId, context }) => {
|
|
202
225
|
const resolved = resolveHandlerContext({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as normalizeMatrixUserId } from "./channel.setup-
|
|
1
|
+
import { a as normalizeMatrixUserId } from "./channel.setup-BY42QaL7.js";
|
|
2
2
|
//#region extensions/matrix/src/approval-ids.ts
|
|
3
3
|
function normalizeMatrixApproverId(value) {
|
|
4
4
|
return normalizeMatrixUserId(String(value)) || void 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
|
|
2
|
-
import { t as normalizeMatrixApproverId } from "./approval-ids-
|
|
2
|
+
import { t as normalizeMatrixApproverId } from "./approval-ids-CfHtZ9d1.js";
|
|
3
3
|
import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
4
4
|
//#region extensions/matrix/src/approval-reaction-auth.ts
|
|
5
5
|
function normalizeMatrixExecApproverId(value) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-DA-jfx22.js";
|
|
2
2
|
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
3
3
|
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-DR1c4xF_.js";
|
|
4
|
-
import { a as normalizeMatrixUserId, r as DEFAULT_ACCOUNT_ID$2, t as matrixPluginBase } from "./channel.setup-
|
|
5
|
-
import { t as normalizeMatrixApproverId } from "./approval-ids-
|
|
4
|
+
import { a as normalizeMatrixUserId, r as DEFAULT_ACCOUNT_ID$2, t as matrixPluginBase } from "./channel.setup-BY42QaL7.js";
|
|
5
|
+
import { t as normalizeMatrixApproverId } from "./approval-ids-CfHtZ9d1.js";
|
|
6
6
|
import { a as resolveMatrixDirectUserId, i as normalizeMatrixResolvableTarget, n as isMatrixRoomId, o as resolveMatrixTargetIdentity, r as normalizeMatrixMessagingTarget, t as isMatrixQualifiedUserId } from "./target-ids-Nwx7cMVE.js";
|
|
7
7
|
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-HyWFZQVG.js";
|
|
8
8
|
import { n as MATRIX_REACTION_EVENT_TYPE } from "./reaction-common-DkrQdBSZ.js";
|
|
@@ -149,7 +149,7 @@ const matrixMessageActions = {
|
|
|
149
149
|
return account && createActionGate(account.config.actions)("messages") ? payload : null;
|
|
150
150
|
},
|
|
151
151
|
handleAction: async (ctx) => {
|
|
152
|
-
const { handleMatrixAction } = await import("./tool-actions.runtime-
|
|
152
|
+
const { handleMatrixAction } = await import("./tool-actions.runtime-vbkQgU7D.js");
|
|
153
153
|
const { action, params, cfg, accountId, mediaLocalRoots } = ctx;
|
|
154
154
|
const dispatch = async (actionParams) => await handleMatrixAction({
|
|
155
155
|
...actionParams,
|
|
@@ -412,7 +412,7 @@ const isMatrixExecApprovalClientEnabled = matrixExecApprovalProfile.isClientEnab
|
|
|
412
412
|
const isMatrixExecApprovalAuthorizedSender = matrixExecApprovalProfile.isAuthorizedSender;
|
|
413
413
|
const resolveMatrixExecApprovalTarget = matrixExecApprovalProfile.resolveTarget;
|
|
414
414
|
function isMatrixApprovalClientEnabled(params) {
|
|
415
|
-
if (params.approvalKind === "exec") return isMatrixExecApprovalClientEnabled(params);
|
|
415
|
+
if (params.approvalKind === "exec" || params.approvalKind === "system-agent") return isMatrixExecApprovalClientEnabled(params);
|
|
416
416
|
const config = resolveMatrixExecApprovalConfig(params);
|
|
417
417
|
return isChannelExecApprovalClientEnabledFromConfig({
|
|
418
418
|
enabled: config?.enabled,
|
|
@@ -426,10 +426,13 @@ function isMatrixAnyApprovalClientEnabled(params) {
|
|
|
426
426
|
}) || isMatrixApprovalClientEnabled({
|
|
427
427
|
...params,
|
|
428
428
|
approvalKind: "plugin"
|
|
429
|
+
}) || isMatrixApprovalClientEnabled({
|
|
430
|
+
...params,
|
|
431
|
+
approvalKind: "system-agent"
|
|
429
432
|
});
|
|
430
433
|
}
|
|
431
434
|
function shouldHandleMatrixApprovalRequest(params) {
|
|
432
|
-
if (params.approvalKind !== "exec" && params.approvalKind !== "plugin") return false;
|
|
435
|
+
if (params.approvalKind !== "exec" && params.approvalKind !== "plugin" && params.approvalKind !== "system-agent") return false;
|
|
433
436
|
if (!matchesMatrixRequestAccount({
|
|
434
437
|
...params,
|
|
435
438
|
approvalKind: params.approvalKind
|
|
@@ -548,7 +551,7 @@ function resolveSuppressionAccountId(params) {
|
|
|
548
551
|
const resolveMatrixOriginTarget = createChannelNativeOriginTargetResolver({
|
|
549
552
|
channel: "matrix",
|
|
550
553
|
shouldHandleRequest: ({ cfg, accountId, approvalKind, request }) => {
|
|
551
|
-
if (approvalKind !== "exec" && approvalKind !== "plugin") return false;
|
|
554
|
+
if (approvalKind !== "exec" && approvalKind !== "plugin" && approvalKind !== "system-agent") return false;
|
|
552
555
|
return shouldHandleMatrixApprovalRequest({
|
|
553
556
|
cfg,
|
|
554
557
|
accountId,
|
|
@@ -616,7 +619,11 @@ const matrixNativeApprovalCapability = createApproverRestrictedNativeApprovalCap
|
|
|
616
619
|
resolveApproverDmTargets: resolveMatrixApproverDmTargets,
|
|
617
620
|
notifyOriginWhenDmOnly: true,
|
|
618
621
|
nativeRuntime: createLazyChannelApprovalNativeRuntimeAdapter({
|
|
619
|
-
eventKinds: [
|
|
622
|
+
eventKinds: [
|
|
623
|
+
"exec",
|
|
624
|
+
"plugin",
|
|
625
|
+
"system-agent"
|
|
626
|
+
],
|
|
620
627
|
isConfigured: ({ cfg, accountId }) => isMatrixAnyApprovalClientEnabled({
|
|
621
628
|
cfg,
|
|
622
629
|
accountId
|
|
@@ -627,7 +634,7 @@ const matrixNativeApprovalCapability = createApproverRestrictedNativeApprovalCap
|
|
|
627
634
|
approvalKind,
|
|
628
635
|
request
|
|
629
636
|
}),
|
|
630
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
637
|
+
load: async () => (await import("./approval-handler.runtime-B_6ytY5I.js")).matrixApprovalNativeRuntime
|
|
631
638
|
})
|
|
632
639
|
});
|
|
633
640
|
const splitMatrixApprovalCapability = splitChannelApprovalCapability(matrixNativeApprovalCapability);
|
|
@@ -1035,7 +1042,7 @@ function resolveMatrixConversationRouteOwner(params) {
|
|
|
1035
1042
|
}
|
|
1036
1043
|
//#endregion
|
|
1037
1044
|
//#region extensions/matrix/src/resolver.ts
|
|
1038
|
-
const loadMatrixChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./resolver.runtime-
|
|
1045
|
+
const loadMatrixChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./resolver.runtime-TRmePJDV.js"), "matrixResolverRuntime");
|
|
1039
1046
|
const matrixResolverAdapter = { resolveTargets: async ({ cfg, accountId, inputs, kind, runtime }) => (await loadMatrixChannelRuntime$1()).resolveMatrixTargets({
|
|
1040
1047
|
cfg,
|
|
1041
1048
|
accountId,
|
|
@@ -1164,7 +1171,7 @@ function resolveMatrixOutboundSessionRoute(params) {
|
|
|
1164
1171
|
//#endregion
|
|
1165
1172
|
//#region extensions/matrix/src/channel.ts
|
|
1166
1173
|
let matrixStartupLock = Promise.resolve();
|
|
1167
|
-
const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
1174
|
+
const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-BkqjwEDU.js"), "matrixChannelRuntime");
|
|
1168
1175
|
const loadMatrixDoctorModule = createLazyRuntimeModule(() => import("./doctor-CJE8wO6y.js"));
|
|
1169
1176
|
function buildMatrixTrafficStatusSummary(snapshot) {
|
|
1170
1177
|
return {
|
|
@@ -1515,7 +1522,7 @@ const matrixPlugin = createChatChannelPlugin({
|
|
|
1515
1522
|
await previousLock;
|
|
1516
1523
|
let monitorMatrixProvider;
|
|
1517
1524
|
try {
|
|
1518
|
-
monitorMatrixProvider = (await import("./monitor-
|
|
1525
|
+
monitorMatrixProvider = (await import("./monitor-SNnu-0bp.js")).monitorMatrixProvider;
|
|
1519
1526
|
} finally {
|
|
1520
1527
|
releaseLock();
|
|
1521
1528
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as matrixPlugin } from "./channel-
|
|
1
|
+
import { t as matrixPlugin } from "./channel-b-jES-oi.js";
|
|
2
2
|
export { matrixPlugin };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { o as sendTypingMatrix, r as sendMessageMatrix, v as cleanupMatrixDeliveryPlans, y as reconcileMatrixUnknownSend } from "./send-DG7Bnj7_.js";
|
|
2
|
+
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
3
|
+
import { l as resolveMatrixAuth } from "./client-Dj4mcf-s.js";
|
|
4
|
+
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DLUgWBhA.js";
|
|
5
|
+
import { t as matrixOutbound } from "./outbound-CeCEtF_q.js";
|
|
6
|
+
import { t as resolveMatrixTargets } from "./resolve-targets-B64O69Nd.js";
|
|
7
|
+
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
8
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
10
|
+
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
11
|
+
//#region extensions/matrix/src/matrix/probe.ts
|
|
12
|
+
const loadMatrixProbeRuntimeDeps = createLazyRuntimeModule(() => import("./probe.runtime-B1YPxG9x.js").then((runtimeModule) => ({ createMatrixClient: runtimeModule.createMatrixClient })));
|
|
13
|
+
async function probeMatrix(params) {
|
|
14
|
+
return await runChannelProbe(void 0, async () => {
|
|
15
|
+
const result = {
|
|
16
|
+
ok: false,
|
|
17
|
+
status: null,
|
|
18
|
+
error: null
|
|
19
|
+
};
|
|
20
|
+
if (isBunRuntime()) return {
|
|
21
|
+
...result,
|
|
22
|
+
error: "Matrix probe requires Node (bun runtime not supported)"
|
|
23
|
+
};
|
|
24
|
+
if (!params.homeserver?.trim()) return {
|
|
25
|
+
...result,
|
|
26
|
+
error: "missing homeserver"
|
|
27
|
+
};
|
|
28
|
+
if (!params.accessToken?.trim()) return {
|
|
29
|
+
...result,
|
|
30
|
+
error: "missing access token"
|
|
31
|
+
};
|
|
32
|
+
const { createMatrixClient } = await loadMatrixProbeRuntimeDeps();
|
|
33
|
+
const inputUserId = normalizeOptionalString(params.userId);
|
|
34
|
+
const userId = await (await createMatrixClient({
|
|
35
|
+
homeserver: params.homeserver,
|
|
36
|
+
userId: void 0,
|
|
37
|
+
accessToken: params.accessToken,
|
|
38
|
+
deviceId: params.deviceId,
|
|
39
|
+
persistStorage: false,
|
|
40
|
+
localTimeoutMs: params.timeoutMs,
|
|
41
|
+
accountId: params.accountId,
|
|
42
|
+
allowPrivateNetwork: params.allowPrivateNetwork,
|
|
43
|
+
ssrfPolicy: params.ssrfPolicy,
|
|
44
|
+
dispatcherPolicy: params.dispatcherPolicy
|
|
45
|
+
})).getUserId();
|
|
46
|
+
if (inputUserId && inputUserId !== userId) return {
|
|
47
|
+
...result,
|
|
48
|
+
error: "Matrix access token user does not match configured userId"
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
...result,
|
|
52
|
+
ok: true,
|
|
53
|
+
userId
|
|
54
|
+
};
|
|
55
|
+
}, (error) => ({
|
|
56
|
+
ok: false,
|
|
57
|
+
status: typeof error === "object" && error && "statusCode" in error ? Number(error.statusCode) : null,
|
|
58
|
+
error: formatErrorMessage(error)
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region extensions/matrix/src/channel.runtime.ts
|
|
63
|
+
const matrixChannelRuntime = {
|
|
64
|
+
cleanupMatrixDeliveryPlans,
|
|
65
|
+
listMatrixDirectoryGroupsLive,
|
|
66
|
+
listMatrixDirectoryPeersLive,
|
|
67
|
+
matrixOutbound,
|
|
68
|
+
probeMatrix,
|
|
69
|
+
resolveMatrixAuth,
|
|
70
|
+
resolveMatrixTargets,
|
|
71
|
+
reconcileMatrixUnknownSend,
|
|
72
|
+
sendMessageMatrix,
|
|
73
|
+
sendTypingMatrix
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { matrixChannelRuntime };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
2
|
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-DR1c4xF_.js";
|
|
3
|
-
import { r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-
|
|
3
|
+
import { r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-CEF6exLW.js";
|
|
4
4
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
5
5
|
import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -314,7 +314,7 @@ const matrixPluginBase = {
|
|
|
314
314
|
order: 70,
|
|
315
315
|
quickstartAllowFrom: true
|
|
316
316
|
},
|
|
317
|
-
setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-
|
|
317
|
+
setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-BSlj1vnL.js").then((n) => n.t)).matrixSetupWizard })),
|
|
318
318
|
setupContract: matrixSetupContract,
|
|
319
319
|
capabilities: {
|
|
320
320
|
chatTypes: [
|
|
@@ -2,14 +2,14 @@ import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
|
2
2
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
3
|
import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
|
|
4
4
|
import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-BnX26jCO.js";
|
|
5
|
-
import { n as matrixSetupAdapter } from "./setup-core-
|
|
6
|
-
import { n as withResolvedActionClient } from "./client-
|
|
7
|
-
import { u as resolveMatrixAuthContext } from "./client-
|
|
5
|
+
import { n as matrixSetupAdapter } from "./setup-core-CEF6exLW.js";
|
|
6
|
+
import { n as withResolvedActionClient } from "./client-D2utPQ1E.js";
|
|
7
|
+
import { u as resolveMatrixAuthContext } from "./client-Dj4mcf-s.js";
|
|
8
8
|
import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.js";
|
|
9
9
|
import { i as setMatrixSdkLogMode, r as setMatrixSdkConsoleLogging } from "./logging-DRjvUOIh.js";
|
|
10
10
|
import { n as isOpenClawManagedMatrixDevice, r as summarizeMatrixDeviceHealth } from "./device-health-B4-YXtJR.js";
|
|
11
|
-
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-
|
|
12
|
-
import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-
|
|
11
|
+
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-Cd1p8ABr.js";
|
|
12
|
+
import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-D-iOebn4.js";
|
|
13
13
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
14
14
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
15
15
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -417,7 +417,7 @@ async function addMatrixAccount(params) {
|
|
|
417
417
|
backupVersion: null
|
|
418
418
|
};
|
|
419
419
|
if (accountConfig.encryption === true) {
|
|
420
|
-
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-
|
|
420
|
+
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-Co985F63.js");
|
|
421
421
|
verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
|
|
422
422
|
previousCfg: cfg,
|
|
423
423
|
cfg: updated,
|
|
@@ -605,8 +605,8 @@ function registerMatrixDeviceCommands(root) {
|
|
|
605
605
|
}
|
|
606
606
|
//#endregion
|
|
607
607
|
//#region extensions/matrix/src/cli-direct.ts
|
|
608
|
-
const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-
|
|
609
|
-
const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-
|
|
608
|
+
const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-D2utPQ1E.js").then((n) => n.t));
|
|
609
|
+
const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-DG7Bnj7_.js").then((n) => n.x));
|
|
610
610
|
function printDirectRoomCandidate(room) {
|
|
611
611
|
const members = room.joinedMembers === null ? "unavailable" : room.joinedMembers.map((member) => formatMatrixCliText(member)).join(", ") || "none";
|
|
612
612
|
console.log(`- ${formatMatrixCliText(room.roomId)} [${room.source}] strict=${room.strict ? "yes" : "no"} joined=${members}`);
|
|
@@ -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-CtYeU7ol.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-B7MQjR5S.js";
|
|
2
2
|
export { cli_metadata_default as default, registerMatrixCliMetadata };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { b as resolveMatrixRoomId } from "./send-
|
|
3
|
-
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-
|
|
2
|
+
import { b as resolveMatrixRoomId } from "./send-DG7Bnj7_.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,
|
|
@@ -20,7 +20,7 @@ import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
|
20
20
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
21
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
|
})));
|
|
@@ -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
|
})));
|
|
@@ -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
|
})));
|
package/dist/contract-api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as singleAccountKeysToMove, n as matrixSetupAdapter, o as namedAccountPromotionKeys, s as resolveSingleAccountPromotionTarget } from "./setup-core-
|
|
2
|
-
import { n as matrixOnboardingAdapter } from "./setup-surface-
|
|
1
|
+
import { c as singleAccountKeysToMove, n as matrixSetupAdapter, o as namedAccountPromotionKeys, s as resolveSingleAccountPromotionTarget } from "./setup-core-CEF6exLW.js";
|
|
2
|
+
import { n as matrixOnboardingAdapter } from "./setup-surface-BSlj1vnL.js";
|
|
3
3
|
export { matrixSetupAdapter, matrixOnboardingAdapter as matrixSetupWizard, namedAccountPromotionKeys, resolveSingleAccountPromotionTarget, singleAccountKeysToMove };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
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 "./sdk-
|
|
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 { IDBDatabase } from "fake-indexeddb";
|
|
9
8
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
9
|
+
import { IDBDatabase } from "fake-indexeddb";
|
|
10
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";
|
|
@@ -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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
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 { l as resolveMatrixAuth } from "./client-
|
|
3
|
+
import { l as resolveMatrixAuth } from "./client-Dj4mcf-s.js";
|
|
4
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
|