@openclaw/matrix 2026.9.1-beta.1 → 2026.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
- package/dist/{account-selection-CWuhuFn1.js → account-selection-DA-jfx22.js} +74 -36
- package/dist/{accounts-BCzyubQt.js → accounts-DR1c4xF_.js} +4 -5
- package/dist/api.js +5 -5
- package/dist/{approval-handler.runtime-G9fLHUWe.js → approval-handler.runtime-BJCD4dLf.js} +34 -11
- package/dist/{approval-ids-C6FD3pVY.js → approval-ids-Bst7HM_o.js} +1 -1
- package/dist/{approval-reaction-auth-60xHiDtQ.js → approval-reaction-auth-DhH8QOSe.js} +2 -2
- package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
- package/dist/{channel-CBEvelTE.js → channel-Bs8VLb6q.js} +63 -58
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-CCJRhdH5.js +76 -0
- package/dist/{channel.setup-sWPOGyQG.js → channel.setup-DhmDXwPp.js} +32 -22
- package/dist/{cli-DrTD2a_q.js → cli-IvDUuiDH.js} +179 -135
- package/dist/{cli-metadata-DrYVwQ_r.js → cli-metadata-BGryAl2e.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-hs1ePy2O.js → client-Dj4mcf-s.js} +73 -22
- package/dist/{client-bootstrap-BxdxjCwA.js → client-bootstrap-n1Rqc8Go.js} +1 -1
- package/dist/{client-BUtHbzib.js → client-oNOlldJI.js} +2 -2
- package/dist/{config-update-Bor_Pjsv.js → config-update-BnX26jCO.js} +48 -31
- package/dist/contract-api.js +2 -2
- package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
- package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
- package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
- package/dist/{crypto-runtime-C4WDYxlP.js → crypto-runtime-m1eplj3b.js} +7 -7
- package/dist/crypto-snapshot-doctor.runtime-D0v841D_.js +91 -0
- package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
- package/dist/{directory-live-D0KfJlby.js → directory-live-DLUgWBhA.js} +8 -6
- package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
- package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
- package/dist/doctor-contract-api.js +89 -109
- package/dist/{draft-stream-B_m79Ynb.js → draft-stream-DglwxWzJ.js} +1 -1
- package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-BNcZNQZI.js} +3 -2
- package/dist/helper-api.js +1 -1
- package/dist/{http-client-D8o8b9u6.js → http-client-DOmFvKvB.js} +10 -7
- package/dist/{idb-persistence-DfgW720p.js → idb-persistence-CU7CNLlX.js} +2 -2
- package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
- package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-Dow9EOoJ.js → messages-Czn8lNEh.js} +154 -5
- package/dist/{monitor-DBB47wTy.js → monitor-DouG43FJ.js} +200 -156
- package/dist/outbound-Co_tJyE6.js +220 -0
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-B1YPxG9x.js +2 -0
- package/dist/{profile-update-C61NR24_.js → profile-update-CAl8nZNG.js} +5 -4
- package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
- package/dist/{reaction-events-BZUgLIZI.js → reaction-events-C_7G7bvI.js} +9 -7
- package/dist/{resolve-targets-DXzZwsIY.js → resolve-targets-B64O69Nd.js} +1 -1
- package/dist/{resolver.runtime-p5qJ3Kst.js → resolver.runtime-TRmePJDV.js} +1 -1
- package/dist/{room-info-BXQA7y10.js → room-info-6viLR3NH.js} +55 -1
- package/dist/runtime-api.js +2 -2
- package/dist/{sdk-CljOKEvc.js → sdk-C1yfda1L.js} +534 -26
- package/dist/{send-BKu9Ghi4.js → send-B5XChnvB.js} +31 -33
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-CpE6C3qV.js → setup-bootstrap-S_loyUyM.js} +3 -3
- package/dist/{setup-core-CyvaCOOr.js → setup-core-XkIfQ65J.js} +8 -7
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DtRvRcCT.js → setup-surface-B2yZ8KGc.js} +84 -79
- package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
- package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
- package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/sync-cache-state-d-A_OhbU.js +234 -0
- package/dist/{thread-bindings-BvyU66kE.js → thread-bindings-BkBnn4te.js} +4 -4
- package/dist/{tool-actions.runtime-DD6jUxFK.js → tool-actions.runtime-a5L5xGSP.js} +226 -215
- package/dist/{verification-BP-3-XYn.js → verification-XJtTc5DI.js} +2 -2
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +216 -183
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -1
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +7 -7
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -1
- package/node_modules/markdown-it/dist/markdown-it.cjs.js +98 -106
- package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -1
- package/node_modules/markdown-it/dist/markdown-it.d.mts +42 -71
- package/node_modules/markdown-it/dist/markdown-it.mjs +98 -106
- package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -1
- package/node_modules/markdown-it/package.json +1 -2
- package/node_modules/matrix-js-sdk/lib/client.d.ts +2 -1
- package/node_modules/matrix-js-sdk/lib/client.js +6 -2
- package/node_modules/matrix-js-sdk/lib/sync.js +8 -8
- package/node_modules/matrix-js-sdk/src/client.ts +7 -3
- package/node_modules/matrix-js-sdk/src/sync.ts +8 -8
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
- package/node_modules/typebox/build/system/memory/create.mjs +3 -4
- package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
- package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/node_modules/typebox/build/system/memory/update.mjs +3 -2
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +17 -3
- package/package.json +8 -7
- package/dist/channel.runtime-CiDl9deX.js +0 -276
- package/dist/env-auth-MVS-Vv41.js +0 -64
- package/dist/file-sync-store-DjskBX2o.js +0 -436
- package/dist/media-text-OR9uoC4W.js +0 -153
- package/dist/probe.runtime-CRM7RIrB.js +0 -2
- package/dist/recovery-key-store-CognuDys.js +0 -276
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { a as resolveMatrixAccountConfig } from "./account-config-
|
|
2
|
+
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
3
3
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
4
4
|
import { i as normalizeMatrixResolvableTarget, t as isMatrixQualifiedUserId } from "./target-ids-Nwx7cMVE.js";
|
|
5
5
|
import { n as MATRIX_REACTION_EVENT_TYPE, r as buildMatrixReactionContent, t as MATRIX_ANNOTATION_RELATION_TYPE } from "./reaction-common-DkrQdBSZ.js";
|
|
@@ -19,11 +19,12 @@ import { isAutoLinkedFileRef } from "openclaw/plugin-sdk/text-autolink-runtime";
|
|
|
19
19
|
import { isVoiceMessageCompatibleAudio } from "openclaw/plugin-sdk/media-runtime";
|
|
20
20
|
import { parseBuffer } from "music-metadata";
|
|
21
21
|
//#region extensions/matrix/src/matrix/send/client.ts
|
|
22
|
-
const loadMatrixSendClientRuntime = createLazyRuntimeModule(() => import("./client-bootstrap-
|
|
22
|
+
const loadMatrixSendClientRuntime = createLazyRuntimeModule(() => import("./client-bootstrap-n1Rqc8Go.js").then((n) => n.t));
|
|
23
23
|
function resolveMediaMaxBytes(accountId, cfg) {
|
|
24
24
|
if (!cfg) throw new Error("Matrix media limits requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
|
|
25
|
+
const resolvedCfg = requireRuntimeConfig(cfg, "Matrix media limits");
|
|
25
26
|
const mediaMaxMb = resolveMatrixAccountConfig({
|
|
26
|
-
cfg:
|
|
27
|
+
cfg: resolvedCfg,
|
|
27
28
|
accountId
|
|
28
29
|
}).mediaMaxMb;
|
|
29
30
|
return typeof mediaMaxMb === "number" && mediaMaxMb > 0 ? mediaMaxMb * 1024 * 1024 : void 0;
|
|
@@ -359,7 +360,7 @@ async function resolveMatrixRoomId(client, raw) {
|
|
|
359
360
|
//#region extensions/matrix/src/matrix/delivery-plan.ts
|
|
360
361
|
const DELIVERY_PLAN_VERSION = 1;
|
|
361
362
|
const DELIVERY_PLAN_NAMESPACE = "outbound-delivery-plans";
|
|
362
|
-
const DELIVERY_PLAN_TTL_MS =
|
|
363
|
+
const DELIVERY_PLAN_TTL_MS = 864e5;
|
|
363
364
|
var MatrixDeliveryPlanInvariantError = class extends Error {
|
|
364
365
|
constructor(message) {
|
|
365
366
|
super(message);
|
|
@@ -370,8 +371,8 @@ function createDeliveryPlanStore() {
|
|
|
370
371
|
return getMatrixRuntime().state.openBlobStore({
|
|
371
372
|
namespace: DELIVERY_PLAN_NAMESPACE,
|
|
372
373
|
maxEntries: 1e4,
|
|
373
|
-
maxBytesPerEntry:
|
|
374
|
-
maxBytesPerNamespace:
|
|
374
|
+
maxBytesPerEntry: 8388608,
|
|
375
|
+
maxBytesPerNamespace: 268435456,
|
|
375
376
|
overflowPolicy: "reject-new",
|
|
376
377
|
defaultTtlMs: DELIVERY_PLAN_TTL_MS
|
|
377
378
|
});
|
|
@@ -639,7 +640,8 @@ function isPollEventType(eventType) {
|
|
|
639
640
|
}
|
|
640
641
|
function getTextContent(text) {
|
|
641
642
|
if (!isRecord(text)) return "";
|
|
642
|
-
|
|
643
|
+
const value = text["m.text"] ?? text["org.matrix.msc1767.text"] ?? text.body;
|
|
644
|
+
return normalizeOptionalString(value) ?? "";
|
|
643
645
|
}
|
|
644
646
|
function parsePollStart(content) {
|
|
645
647
|
const poll = content["m.poll.start"] ?? content[ORG_POLL_START] ?? content["m.poll"];
|
|
@@ -852,8 +854,9 @@ function isMarkdownEscaped(markdown, index) {
|
|
|
852
854
|
return slashCount % 2 === 1;
|
|
853
855
|
}
|
|
854
856
|
function projectMatrixMarkdown(markdown) {
|
|
857
|
+
const normalized = (markdown ?? "").replace(/\r\n?/gu, "\n");
|
|
855
858
|
return renderMarkdownWithMarkers({
|
|
856
|
-
text:
|
|
859
|
+
text: normalized,
|
|
857
860
|
styles: [],
|
|
858
861
|
links: []
|
|
859
862
|
}, {
|
|
@@ -1040,11 +1043,12 @@ function findMatrixSpoilerDelimiterOffsets(markdown) {
|
|
|
1040
1043
|
function hasMatrixSpoilerMetadataCollision(markdown) {
|
|
1041
1044
|
const projected = projectMatrixMarkdown(markdown);
|
|
1042
1045
|
const ordinary = new Set(findMatrixSpoilerDelimiterOffsets(projected));
|
|
1043
|
-
const
|
|
1046
|
+
const underlineTags = [...tokenizeHtmlTags(projected)].filter((tag) => (tag.name === "u" || tag.name === "ins") && !isMarkdownEscaped(projected, tag.start));
|
|
1047
|
+
const literalRanges = [...findMatrixTableSourceRanges(projected), ...findCodeRegions(projected).filter((code) => !underlineTags.some((tag) => code.start > tag.start && code.start < tag.end))];
|
|
1044
1048
|
for (let index = 0; index < projected.length - 1; index += 1) {
|
|
1045
1049
|
if (projected[index] !== "|" || projected[index + 1] !== "|") continue;
|
|
1046
1050
|
if (ordinary.has(index) || isMarkdownEscaped(projected, index)) continue;
|
|
1047
|
-
if (
|
|
1051
|
+
if (literalRanges.some((range) => index >= range.start && index < range.end)) continue;
|
|
1048
1052
|
return true;
|
|
1049
1053
|
}
|
|
1050
1054
|
return false;
|
|
@@ -1358,18 +1362,15 @@ function compactLooseListTokens(tokens) {
|
|
|
1358
1362
|
if (token.type === "list_item_open") {
|
|
1359
1363
|
listItemStack.push({
|
|
1360
1364
|
level: token.level,
|
|
1361
|
-
|
|
1362
|
-
immediateParagraphCloseIndexes: []
|
|
1365
|
+
paragraphIndex: void 0
|
|
1363
1366
|
});
|
|
1364
1367
|
continue;
|
|
1365
1368
|
}
|
|
1366
1369
|
if (token.type === "list_item_close") {
|
|
1367
1370
|
const item = listItemStack.pop();
|
|
1368
|
-
if (
|
|
1369
|
-
const
|
|
1370
|
-
const
|
|
1371
|
-
const openToken = openIndex === void 0 ? void 0 : tokens[openIndex];
|
|
1372
|
-
const closeToken = closeIndex === void 0 ? void 0 : tokens[closeIndex];
|
|
1371
|
+
if (typeof item?.paragraphIndex === "number") {
|
|
1372
|
+
const openToken = tokens[item.paragraphIndex];
|
|
1373
|
+
const closeToken = tokens[item.paragraphIndex + 2];
|
|
1373
1374
|
if (openToken && closeToken) {
|
|
1374
1375
|
openToken.hidden = true;
|
|
1375
1376
|
closeToken.hidden = true;
|
|
@@ -1379,8 +1380,7 @@ function compactLooseListTokens(tokens) {
|
|
|
1379
1380
|
}
|
|
1380
1381
|
const currentItem = listItemStack.at(-1);
|
|
1381
1382
|
if (!currentItem || token.level !== currentItem.level + 1) continue;
|
|
1382
|
-
if (token.type === "paragraph_open") currentItem.
|
|
1383
|
-
else if (token.type === "paragraph_close") currentItem.immediateParagraphCloseIndexes.push(index);
|
|
1383
|
+
if (token.type === "paragraph_open") currentItem.paragraphIndex = currentItem.paragraphIndex === void 0 ? index : null;
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
1386
|
function markdownToMatrixHtml(markdown, options = {}) {
|
|
@@ -1427,11 +1427,12 @@ function markdownToMatrixBody(markdown) {
|
|
|
1427
1427
|
const close = offsets[index + 1];
|
|
1428
1428
|
if (open !== void 0 && close !== void 0) body = `${body.slice(0, open)}[Spoiler]${body.slice(close + 2)}`;
|
|
1429
1429
|
}
|
|
1430
|
-
|
|
1430
|
+
const ir = markdownToIR(body, {
|
|
1431
1431
|
enableHtmlUnderline: true,
|
|
1432
1432
|
headingStyle: "rich",
|
|
1433
1433
|
linkify: true
|
|
1434
|
-
})
|
|
1434
|
+
});
|
|
1435
|
+
return renderMarkdownWithMarkers(ir, {
|
|
1435
1436
|
styleMarkers: {},
|
|
1436
1437
|
escapeText: (text) => text
|
|
1437
1438
|
}, MATRIX_FORMAT_PROFILE);
|
|
@@ -1491,7 +1492,6 @@ async function renderMarkdownToMatrixHtmlWithMentions(params) {
|
|
|
1491
1492
|
}
|
|
1492
1493
|
//#endregion
|
|
1493
1494
|
//#region extensions/matrix/src/matrix/send/chunking.ts
|
|
1494
|
-
const getCore$2 = () => getMatrixRuntime();
|
|
1495
1495
|
function normalizeMatrixEventLimit(limit) {
|
|
1496
1496
|
if (!Number.isFinite(limit) || limit <= 0) return limit;
|
|
1497
1497
|
return Math.max(1, Math.floor(limit));
|
|
@@ -1596,14 +1596,14 @@ function prepareMatrixSingleText(text, opts) {
|
|
|
1596
1596
|
const normalizedText = text.replace(/\r\n?/gu, "\n");
|
|
1597
1597
|
const trimmedText = opts.preserveWhitespace ? normalizedText : normalizedText.trim();
|
|
1598
1598
|
const cfg = requireRuntimeConfig(opts.cfg, "Matrix text preparation");
|
|
1599
|
-
const tableMode = opts.tableMode ??
|
|
1599
|
+
const tableMode = opts.tableMode ?? getMatrixRuntime().channel.text.resolveMarkdownTableMode({
|
|
1600
1600
|
cfg,
|
|
1601
1601
|
channel: "matrix",
|
|
1602
1602
|
accountId: opts.accountId,
|
|
1603
1603
|
supportsBlockTables: MATRIX_FORMAT_PROFILE.constructs.table === "native"
|
|
1604
1604
|
});
|
|
1605
1605
|
const convertedText = renderMatrixMarkdownTables(trimmedText, tableMode);
|
|
1606
|
-
const singleEventLimit = normalizeMatrixEventLimit(Math.min(
|
|
1606
|
+
const singleEventLimit = normalizeMatrixEventLimit(Math.min(getMatrixRuntime().channel.text.resolveTextChunkLimit(cfg, "matrix", opts.accountId), MATRIX_FORMAT_PROFILE.chunk.limit));
|
|
1607
1607
|
const preparedBody = markdownToMatrixBody(convertedText);
|
|
1608
1608
|
const eventTextLength = Math.max(convertedText.length, preparedBody.length);
|
|
1609
1609
|
return {
|
|
@@ -1623,7 +1623,7 @@ function chunkMatrixText(text, opts) {
|
|
|
1623
1623
|
chunks: preparedText.convertedText ? [preparedText.convertedText] : []
|
|
1624
1624
|
};
|
|
1625
1625
|
const cfg = requireRuntimeConfig(opts.cfg, "Matrix text chunking");
|
|
1626
|
-
const chunkMode =
|
|
1626
|
+
const chunkMode = getMatrixRuntime().channel.text.resolveChunkMode(cfg, "matrix", opts.accountId);
|
|
1627
1627
|
const collisionRedacted = hasMatrixSpoilerMetadataCollision(preparedText.convertedText) ? markdownToMatrixBody(preparedText.convertedText) : void 0;
|
|
1628
1628
|
const chunkSegment = (segmentText) => {
|
|
1629
1629
|
const protectedUnderline = protectMatrixUnderlineTags(hasMatrixSpoilerMetadataCollision(segmentText) ? markdownToMatrixBody(segmentText) : segmentText);
|
|
@@ -1636,7 +1636,7 @@ function chunkMatrixText(text, opts) {
|
|
|
1636
1636
|
] : []);
|
|
1637
1637
|
let reserve = wrapperReserve;
|
|
1638
1638
|
while (reserve < preparedText.singleEventLimit) {
|
|
1639
|
-
const protectedChunks =
|
|
1639
|
+
const protectedChunks = getMatrixRuntime().channel.text.chunkMarkdownTextWithMode(protectedSpoilers.markdown, preparedText.singleEventLimit - reserve, chunkMode);
|
|
1640
1640
|
const restored = restoreMatrixStyleChunks(protectedChunks, protectedSpoilers.markers, protectedUnderline.markers).filter((_, index) => {
|
|
1641
1641
|
return privateMarkers.reduce((value, marker) => value.replaceAll(marker, ""), protectedChunks[index] ?? "").length > 0;
|
|
1642
1642
|
});
|
|
@@ -1657,7 +1657,6 @@ function chunkMatrixText(text, opts) {
|
|
|
1657
1657
|
}
|
|
1658
1658
|
//#endregion
|
|
1659
1659
|
//#region extensions/matrix/src/matrix/send/formatting.ts
|
|
1660
|
-
const getCore$1 = () => getMatrixRuntime();
|
|
1661
1660
|
async function renderMatrixFormattedContent(params) {
|
|
1662
1661
|
const markdown = params.markdown ?? "";
|
|
1663
1662
|
const body = params.preparedBody ?? markdownToMatrixBody(markdown);
|
|
@@ -1752,7 +1751,7 @@ function buildThreadRelation(threadId, replyToId) {
|
|
|
1752
1751
|
return relation;
|
|
1753
1752
|
}
|
|
1754
1753
|
function resolveMatrixMsgType(contentType, _fileName) {
|
|
1755
|
-
switch (
|
|
1754
|
+
switch (getMatrixRuntime().media.mediaKindFromMime(contentType ?? "")) {
|
|
1756
1755
|
case "image": return MsgType.Image;
|
|
1757
1756
|
case "audio": return MsgType.Audio;
|
|
1758
1757
|
case "video": return MsgType.Video;
|
|
@@ -1772,7 +1771,6 @@ function isMatrixVoiceCompatibleAudio(opts) {
|
|
|
1772
1771
|
}
|
|
1773
1772
|
//#endregion
|
|
1774
1773
|
//#region extensions/matrix/src/matrix/send/media.ts
|
|
1775
|
-
const getCore = () => getMatrixRuntime();
|
|
1776
1774
|
function buildMatrixMediaInfo(params) {
|
|
1777
1775
|
const base = {};
|
|
1778
1776
|
if (Number.isFinite(params.size)) base.size = params.size;
|
|
@@ -1851,20 +1849,20 @@ function resolveAifcIma4DurationSeconds(buffer, sampleRate) {
|
|
|
1851
1849
|
return packetCount * AIFC_IMA4_FRAMES_PER_PACKET / sampleRate;
|
|
1852
1850
|
}
|
|
1853
1851
|
async function prepareImageInfo(params) {
|
|
1854
|
-
const meta = await
|
|
1852
|
+
const meta = await getMatrixRuntime().media.getImageMetadata(params.buffer).catch(() => null);
|
|
1855
1853
|
if (!meta) return;
|
|
1856
1854
|
const imageInfo = {
|
|
1857
1855
|
w: meta.width,
|
|
1858
1856
|
h: meta.height
|
|
1859
1857
|
};
|
|
1860
1858
|
if (Math.max(meta.width, meta.height) > THUMBNAIL_MAX_SIDE) try {
|
|
1861
|
-
const thumbBuffer = await
|
|
1859
|
+
const thumbBuffer = await getMatrixRuntime().media.resizeToJpeg({
|
|
1862
1860
|
buffer: params.buffer,
|
|
1863
1861
|
maxSide: THUMBNAIL_MAX_SIDE,
|
|
1864
1862
|
quality: THUMBNAIL_QUALITY,
|
|
1865
1863
|
withoutEnlargement: true
|
|
1866
1864
|
});
|
|
1867
|
-
const thumbMeta = await
|
|
1865
|
+
const thumbMeta = await getMatrixRuntime().media.getImageMetadata(thumbBuffer).catch(() => null);
|
|
1868
1866
|
const result = await uploadMediaWithEncryption(params.client, params.roomId, thumbBuffer, {
|
|
1869
1867
|
contentType: "image/jpeg",
|
|
1870
1868
|
filename: "thumbnail.jpg"
|
|
@@ -2360,4 +2358,4 @@ async function reactMatrixMessage(roomId, messageId, emoji, opts) {
|
|
|
2360
2358
|
});
|
|
2361
2359
|
}
|
|
2362
2360
|
//#endregion
|
|
2363
|
-
export {
|
|
2361
|
+
export { repairMatrixDirectRooms as C, promoteMatrixDirectRoomCandidate as S, MsgType as T, resolvePollReferenceEventId as _, sendSingleTextMessageMatrix as a, resolveMatrixRoomId as b, prepareMatrixSingleText as c, formatPollAsText as d, formatPollResultsAsText as f, parsePollStartContent as g, parsePollStart as h, sendPollMatrix as i, buildPollResponseContent as l, isPollStartType as m, reactMatrixMessage as n, sendTypingMatrix as o, isPollEventType as p, sendMessageMatrix as r, send_exports as s, editMessageMatrix as t, buildPollResultsSummary as u, cleanupMatrixDeliveryPlans as v, MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY as w, direct_management_exports as x, reconcileMatrixUnknownSend as y };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { r as setMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
2
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-BkBnn4te.js";
|
|
3
3
|
export { createMatrixThreadBindingManager, setMatrixRuntime };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-
|
|
2
|
-
import "./accounts-
|
|
3
|
-
import { n as bootstrapMatrixVerification } from "./verification-
|
|
1
|
+
import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
|
+
import "./accounts-DR1c4xF_.js";
|
|
3
|
+
import { n as bootstrapMatrixVerification } from "./verification-XJtTc5DI.js";
|
|
4
4
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
//#region extensions/matrix/src/setup-bootstrap.ts
|
|
6
6
|
async function maybeBootstrapNewEncryptedMatrixAccount(params) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as resolveDefaultMatrixAccountId } from "./accounts-
|
|
1
|
+
import { s as resolveMatrixEnvAuthReadiness } from "./account-selection-DA-jfx22.js";
|
|
2
|
+
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
3
|
+
import { r as resolveDefaultMatrixAccountId } from "./accounts-DR1c4xF_.js";
|
|
4
4
|
import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
|
|
5
|
-
import { r as updateMatrixAccountConfig } from "./config-update-
|
|
6
|
-
import { t as isSupportedMatrixAvatarSource } from "./profile-
|
|
5
|
+
import { r as updateMatrixAccountConfig } from "./config-update-BnX26jCO.js";
|
|
6
|
+
import { t as isSupportedMatrixAvatarSource } from "./profile-vmjsmhh4.js";
|
|
7
7
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
9
9
|
import { DEFAULT_ACCOUNT_ID, addWildcardAllowFrom, applyAccountNameToChannelSection, normalizeAccountId, normalizeAllowFromEntries, normalizeSecretInputString, prepareScopedSetupConfig } from "openclaw/plugin-sdk/setup";
|
|
@@ -164,8 +164,9 @@ function validateMatrixSetupInput(params) {
|
|
|
164
164
|
function applyMatrixSetupAccountConfig(params) {
|
|
165
165
|
const input = params.input;
|
|
166
166
|
const normalizedAccountId = normalizeAccountId(params.accountId);
|
|
167
|
+
const migratedCfg = normalizedAccountId !== DEFAULT_ACCOUNT_ID ? moveSingleMatrixAccountConfigToNamedAccount(params.cfg) : params.cfg;
|
|
167
168
|
const next = applyAccountNameToChannelSection({
|
|
168
|
-
cfg:
|
|
169
|
+
cfg: migratedCfg,
|
|
169
170
|
channelKey: channel$1,
|
|
170
171
|
accountId: normalizedAccountId,
|
|
171
172
|
name: input.name
|
|
@@ -310,7 +311,7 @@ const matrixSetupAdapter = {
|
|
|
310
311
|
input
|
|
311
312
|
}),
|
|
312
313
|
afterAccountConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
|
|
313
|
-
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-
|
|
314
|
+
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-S_loyUyM.js");
|
|
314
315
|
await runMatrixSetupBootstrapAfterConfigWrite({
|
|
315
316
|
previousCfg,
|
|
316
317
|
cfg,
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as matrixSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { n as matrixSetupPlugin } from "./channel.setup-DhmDXwPp.js";
|
|
2
2
|
export { matrixSetupPlugin };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-
|
|
3
|
-
import { a as resolveMatrixAccountConfig } from "./account-config-
|
|
4
|
-
import {
|
|
5
|
-
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-BCzyubQt.js";
|
|
2
|
+
import { n as requiresExplicitMatrixDefaultAccount, s as resolveMatrixEnvAuthReadiness } from "./account-selection-DA-jfx22.js";
|
|
3
|
+
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
4
|
+
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-DR1c4xF_.js";
|
|
6
5
|
import { n as isMatrixRoomId } from "./target-ids-Nwx7cMVE.js";
|
|
7
|
-
import { r as updateMatrixAccountConfig } from "./config-update-
|
|
8
|
-
import { a as moveSingleMatrixAccountConfigToNamedAccount, i as createMatrixSetupDmPolicy } from "./setup-core-
|
|
6
|
+
import { r as updateMatrixAccountConfig } from "./config-update-BnX26jCO.js";
|
|
7
|
+
import { a as moveSingleMatrixAccountConfigToNamedAccount, i as createMatrixSetupDmPolicy } from "./setup-core-XkIfQ65J.js";
|
|
9
8
|
import { n as validateMatrixHomeserverUrl, r as isPrivateOrLoopbackHost, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
10
|
-
import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-
|
|
9
|
+
import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-mtxF2mHI.js";
|
|
11
10
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
11
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
13
12
|
import { formatDocsLink, hasConfiguredSecretInput, mergeAllowFromEntries, normalizeAccountId as normalizeAccountId$1, promptAccountId, promptChannelAccessConfig, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
@@ -69,12 +68,13 @@ async function promptMatrixAllowFrom(params) {
|
|
|
69
68
|
}).configured;
|
|
70
69
|
const isFullUserId = (value) => value.startsWith("@") && value.includes(":");
|
|
71
70
|
while (true) {
|
|
72
|
-
const
|
|
71
|
+
const entry = await prompter.text({
|
|
73
72
|
message: "Matrix allowFrom (full @user:server; display name only if unique)",
|
|
74
73
|
placeholder: "@user:server",
|
|
75
74
|
initialValue: existingAllowFrom[0] ? String(existingAllowFrom[0]) : void 0,
|
|
76
75
|
validate: (value) => normalizeOptionalString(value) ? void 0 : "Required"
|
|
77
|
-
})
|
|
76
|
+
});
|
|
77
|
+
const parts = splitSetupEntries(entry);
|
|
78
78
|
const resolvedIds = [];
|
|
79
79
|
const pending = [];
|
|
80
80
|
const unresolved = [];
|
|
@@ -91,7 +91,7 @@ async function promptMatrixAllowFrom(params) {
|
|
|
91
91
|
pending.push(part);
|
|
92
92
|
}
|
|
93
93
|
if (pending.length > 0) {
|
|
94
|
-
const { resolveMatrixTargets } = await import("./resolve-targets-
|
|
94
|
+
const { resolveMatrixTargets } = await import("./resolve-targets-B64O69Nd.js").then((n) => n.n);
|
|
95
95
|
const results = await resolveMatrixTargets({
|
|
96
96
|
cfg,
|
|
97
97
|
accountId,
|
|
@@ -159,14 +159,15 @@ async function configureMatrixInviteAutoJoin(params) {
|
|
|
159
159
|
}
|
|
160
160
|
if (policy === "always") return setMatrixAutoJoin(params.cfg, policy, [], accountId);
|
|
161
161
|
while (true) {
|
|
162
|
-
const
|
|
162
|
+
const rawAllowlist = await params.prompter.text({
|
|
163
163
|
message: "Matrix invite auto-join allowlist (comma-separated)",
|
|
164
164
|
placeholder: "!roomId:server, !roomId, #alias:server, *",
|
|
165
165
|
initialValue: currentAllowlist[0] ? currentAllowlist.join(", ") : void 0,
|
|
166
166
|
validate: (value) => {
|
|
167
167
|
return splitSetupEntries(value).length > 0 ? void 0 : "Required";
|
|
168
168
|
}
|
|
169
|
-
})
|
|
169
|
+
});
|
|
170
|
+
const allowlist = normalizeUniqueStringEntries(splitSetupEntries(rawAllowlist));
|
|
170
171
|
const invalidEntries = allowlist.filter((entry) => !isMatrixInviteAutoJoinTarget(entry));
|
|
171
172
|
if (allowlist.length === 0 || invalidEntries.length > 0) {
|
|
172
173
|
await params.prompter.note(["Use only stable Matrix invite targets for auto-join: !roomId:server (or the suffixless !roomId form on room version 12+), #alias:server, or *.", invalidEntries.length > 0 ? `Invalid: ${invalidEntries.join(", ")}` : void 0].filter(Boolean).join("\n"), "Matrix invite auto-join");
|
|
@@ -195,41 +196,43 @@ async function configureMatrixAccessPrompts(params) {
|
|
|
195
196
|
placeholder: "!roomId:server, !roomId, #alias:server, Project Room",
|
|
196
197
|
updatePrompt: Boolean(existingGroups)
|
|
197
198
|
});
|
|
198
|
-
if (accessConfig)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
199
|
+
if (accessConfig) {
|
|
200
|
+
if (accessConfig.policy !== "allowlist") next = updateMatrixAccountConfig(next, params.accountId, { groupPolicy: accessConfig.policy });
|
|
201
|
+
else {
|
|
202
|
+
let roomKeys = accessConfig.entries;
|
|
203
|
+
if (accessConfig.entries.length > 0) try {
|
|
204
|
+
const resolvedIds = [];
|
|
205
|
+
const unresolved = [];
|
|
206
|
+
for (const entry of accessConfig.entries) {
|
|
207
|
+
const trimmed = normalizeOptionalString(entry) ?? "";
|
|
208
|
+
if (!trimmed) continue;
|
|
209
|
+
const cleaned = trimmed.replace(/^(room|channel):/i, "").trim();
|
|
210
|
+
if (isMatrixRoomId(cleaned)) {
|
|
211
|
+
resolvedIds.push(cleaned);
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const { listMatrixDirectoryGroupsLive } = await import("./directory-live-DLUgWBhA.js").then((n) => n.t);
|
|
215
|
+
const matches = await listMatrixDirectoryGroupsLive({
|
|
216
|
+
cfg: next,
|
|
217
|
+
accountId: params.accountId,
|
|
218
|
+
query: trimmed,
|
|
219
|
+
limit: 10
|
|
220
|
+
});
|
|
221
|
+
const best = matches.find((match) => normalizeLowercaseStringOrEmpty(match.name) === normalizeLowercaseStringOrEmpty(trimmed)) ?? matches[0];
|
|
222
|
+
if (best?.id) resolvedIds.push(best.id);
|
|
223
|
+
else unresolved.push(entry);
|
|
211
224
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
query: trimmed,
|
|
217
|
-
limit: 10
|
|
218
|
-
});
|
|
219
|
-
const best = matches.find((match) => normalizeLowercaseStringOrEmpty(match.name) === normalizeLowercaseStringOrEmpty(trimmed)) ?? matches[0];
|
|
220
|
-
if (best?.id) resolvedIds.push(best.id);
|
|
221
|
-
else unresolved.push(entry);
|
|
225
|
+
roomKeys = [...resolvedIds, ...unresolved.map((entry) => normalizeOptionalString(entry)).filter((entry) => Boolean(entry))];
|
|
226
|
+
if (resolvedIds.length > 0 || unresolved.length > 0) await params.prompter.note([resolvedIds.length > 0 ? `Resolved: ${resolvedIds.join(", ")}` : void 0, unresolved.length > 0 ? `Unresolved (kept as typed): ${unresolved.join(", ")}` : void 0].filter(Boolean).join("\n"), "Matrix rooms");
|
|
227
|
+
} catch (err) {
|
|
228
|
+
await params.prompter.note(`Room lookup failed; keeping entries as typed. ${String(err)}`, "Matrix rooms");
|
|
222
229
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
230
|
+
next = updateMatrixAccountConfig(next, params.accountId, {
|
|
231
|
+
groupPolicy: "allowlist",
|
|
232
|
+
groups: Object.fromEntries(roomKeys.map((key) => [key, { enabled: true }])),
|
|
233
|
+
rooms: null
|
|
234
|
+
});
|
|
227
235
|
}
|
|
228
|
-
next = updateMatrixAccountConfig(next, params.accountId, {
|
|
229
|
-
groupPolicy: "allowlist",
|
|
230
|
-
groups: Object.fromEntries(roomKeys.map((key) => [key, { enabled: true }])),
|
|
231
|
-
rooms: null
|
|
232
|
-
});
|
|
233
236
|
}
|
|
234
237
|
return await configureMatrixInviteAutoJoin({
|
|
235
238
|
cfg: next,
|
|
@@ -336,40 +339,42 @@ async function runMatrixConfigure(params) {
|
|
|
336
339
|
userId = "";
|
|
337
340
|
}
|
|
338
341
|
}
|
|
339
|
-
if (!hasConfiguredSecretInput(accessToken) && !hasConfiguredSecretInput(password))
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
342
|
+
if (!hasConfiguredSecretInput(accessToken) && !hasConfiguredSecretInput(password)) {
|
|
343
|
+
if (await params.prompter.select({
|
|
344
|
+
message: "Matrix auth method",
|
|
345
|
+
options: [{
|
|
346
|
+
value: "token",
|
|
347
|
+
label: "Access token (user ID fetched automatically)"
|
|
348
|
+
}, {
|
|
349
|
+
value: "password",
|
|
350
|
+
label: "Password (requires user ID)"
|
|
351
|
+
}]
|
|
352
|
+
}) === "token") {
|
|
353
|
+
accessToken = normalizeStringifiedOptionalString(await params.prompter.text({
|
|
354
|
+
message: "Matrix access token",
|
|
355
|
+
sensitive: true,
|
|
356
|
+
validate: (value) => normalizeOptionalString(value) ? void 0 : "Required"
|
|
357
|
+
})) ?? "";
|
|
358
|
+
password = void 0;
|
|
359
|
+
userId = "";
|
|
360
|
+
} else {
|
|
361
|
+
userId = normalizeStringifiedOptionalString(await params.prompter.text({
|
|
362
|
+
message: "Matrix user ID",
|
|
363
|
+
initialValue: existing.userId ?? envUserId,
|
|
364
|
+
validate: (value) => {
|
|
365
|
+
const raw = normalizeOptionalString(value) ?? "";
|
|
366
|
+
if (!raw) return "Required";
|
|
367
|
+
if (!raw.startsWith("@")) return "Matrix user IDs should start with @";
|
|
368
|
+
if (!raw.includes(":")) return "Matrix user IDs should include a server (:server)";
|
|
369
|
+
}
|
|
370
|
+
})) ?? "";
|
|
371
|
+
password = normalizeStringifiedOptionalString(await params.prompter.text({
|
|
372
|
+
message: "Matrix password",
|
|
373
|
+
sensitive: true,
|
|
374
|
+
validate: (value) => normalizeOptionalString(value) ? void 0 : "Required"
|
|
375
|
+
})) ?? "";
|
|
376
|
+
accessToken = void 0;
|
|
377
|
+
}
|
|
373
378
|
}
|
|
374
379
|
const deviceName = normalizeStringifiedOptionalString(await params.prompter.text({
|
|
375
380
|
message: "Matrix device name (optional)",
|
|
@@ -459,7 +464,7 @@ const matrixOnboardingAdapter = {
|
|
|
459
464
|
});
|
|
460
465
|
},
|
|
461
466
|
afterConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
|
|
462
|
-
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-
|
|
467
|
+
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-S_loyUyM.js");
|
|
463
468
|
await runMatrixSetupBootstrapAfterConfigWrite({
|
|
464
469
|
previousCfg,
|
|
465
470
|
cfg,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
|
-
import { M as resolveMatrixSqliteStateEnv, l as resolveMatrixStoragePaths, o as recordCurrentStorageMetaDeviceId } from "./storage-
|
|
2
|
+
import { M as resolveMatrixSqliteStateEnv, l as resolveMatrixStoragePaths, o as recordCurrentStorageMetaDeviceId } from "./storage-BVf4uucD.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -13,7 +13,7 @@ const STARTUP_VERIFICATION_MIGRATIONS_NAMESPACE = "startup-verification-migratio
|
|
|
13
13
|
const STARTUP_VERIFICATION_MAX_ENTRIES = 1e3;
|
|
14
14
|
const DEFAULT_STARTUP_VERIFICATION_MODE = "if-unverified";
|
|
15
15
|
const DEFAULT_STARTUP_VERIFICATION_COOLDOWN_HOURS = 24;
|
|
16
|
-
const DEFAULT_STARTUP_VERIFICATION_FAILURE_COOLDOWN_MS =
|
|
16
|
+
const DEFAULT_STARTUP_VERIFICATION_FAILURE_COOLDOWN_MS = 36e5;
|
|
17
17
|
function normalizeCooldownHours(value) {
|
|
18
18
|
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_STARTUP_VERIFICATION_COOLDOWN_HOURS;
|
|
19
19
|
return Math.max(0, value);
|
|
@@ -33,7 +33,7 @@ const LEGACY_CRYPTO_MIGRATION_NAMESPACE = "legacy-crypto-migration";
|
|
|
33
33
|
const IDB_SNAPSHOT_NAMESPACE = "idb-snapshot";
|
|
34
34
|
const SMALL_STATE_MAX_ENTRIES = 10;
|
|
35
35
|
const IDB_SNAPSHOT_MAX_ENTRIES = 2e4;
|
|
36
|
-
const IDB_SNAPSHOT_MAX_CHUNKS = Math.floor(
|
|
36
|
+
const IDB_SNAPSHOT_MAX_CHUNKS = Math.floor(19999 / 2);
|
|
37
37
|
const IDB_SNAPSHOT_CHUNK_BYTES = 24e3;
|
|
38
38
|
const MATRIX_RECOVERY_KEY_FILENAME = "recovery-key.json";
|
|
39
39
|
const MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME = "legacy-crypto-migration.json";
|
|
@@ -487,8 +487,9 @@ function resolvePreferredMatrixStorageRoot(params) {
|
|
|
487
487
|
}
|
|
488
488
|
function resolveMatrixStoragePaths(params) {
|
|
489
489
|
const env = params.env ?? process.env;
|
|
490
|
+
const stateDir = params.stateDir ?? getMatrixRuntime().state.resolveStateDir(env, os.homedir);
|
|
490
491
|
const canonical = resolveMatrixAccountStorageRoot({
|
|
491
|
-
stateDir
|
|
492
|
+
stateDir,
|
|
492
493
|
homeserver: params.homeserver,
|
|
493
494
|
userId: params.userId,
|
|
494
495
|
accessToken: params.accessToken,
|
|
@@ -526,7 +527,7 @@ function resolveMatrixStateFilePath(params) {
|
|
|
526
527
|
}
|
|
527
528
|
async function maybeMigrateLegacyStorage(params) {
|
|
528
529
|
const hasAccountScopedLegacyStorageFile = fs.existsSync(params.storagePaths.storagePath);
|
|
529
|
-
const syncCache = hasAccountScopedLegacyStorageFile ? await import("./
|
|
530
|
+
const syncCache = hasAccountScopedLegacyStorageFile ? await import("./sync-cache-state-d-A_OhbU.js").then((n) => n.s) : null;
|
|
530
531
|
const hasAccountScopedLegacyStorage = hasAccountScopedLegacyStorageFile && await syncCache?.readLegacyMatrixSyncCacheState(params.storagePaths.rootDir) !== null;
|
|
531
532
|
const hasAccountScopedRecoveryKey = fs.existsSync(params.storagePaths.recoveryKeyPath);
|
|
532
533
|
const hasAccountScopedLegacyCryptoMigration = fs.existsSync(path.join(params.storagePaths.rootDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME));
|
|
@@ -573,7 +574,7 @@ async function maybeMigrateLegacyStorage(params) {
|
|
|
573
574
|
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")}`);
|
|
574
575
|
}
|
|
575
576
|
async function migrateLegacySyncCacheToSqlite(params) {
|
|
576
|
-
const syncCache = await import("./
|
|
577
|
+
const syncCache = await import("./sync-cache-state-d-A_OhbU.js").then((n) => n.s);
|
|
577
578
|
const persisted = await syncCache.readLegacyMatrixSyncCacheState(params.sourceRootDir);
|
|
578
579
|
if (!persisted) return;
|
|
579
580
|
const store = getMatrixRuntime().state.openKeyedStore(syncCache.openMatrixSyncCacheStoreOptions(params.targetRootDir));
|
|
@@ -13,7 +13,11 @@ async function handleMatrixSubagentEnded(event) {
|
|
|
13
13
|
const bindingId = resolveBindingKey(binding);
|
|
14
14
|
if ((await bindingService.unbind({
|
|
15
15
|
bindingId,
|
|
16
|
-
reason
|
|
16
|
+
reason,
|
|
17
|
+
scope: {
|
|
18
|
+
channel: "matrix",
|
|
19
|
+
accountId: binding.accountId
|
|
20
|
+
}
|
|
17
21
|
})).some((entry) => entry.bindingId === bindingId)) removedBindingKeys.add(bindingId);
|
|
18
22
|
}
|
|
19
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
2
2
|
//#region extensions/matrix/subagent-hooks-api.ts
|
|
3
|
-
const loadMatrixSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-
|
|
3
|
+
const loadMatrixSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-DeICLbU5.js"));
|
|
4
4
|
function registerMatrixSubagentHooks(api) {
|
|
5
5
|
api.on("subagent_ended", async (event) => {
|
|
6
6
|
const { handleMatrixSubagentEnded } = await loadMatrixSubagentHooksModule();
|