@openclaw/matrix 2026.10.10 → 2026.10.33
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/.setup/{account-config-CVM2a28p.mjs → account-config-CRsKoMqJ.mjs} +2 -1
- package/dist/.setup/{account-selection-Co94mKNj.mjs → account-selection-CWsL5zIU.mjs} +8 -5
- package/dist/.setup/{approval-handler.runtime-DtNvJpfB.mjs → approval-handler.runtime-Co2elSYS.mjs} +9 -8
- package/dist/.setup/{approval-reactions-DMDBJos0.mjs → approval-reactions-D2pEUrFS.mjs} +3 -2
- package/dist/.setup/{backup-health-BxH69np2.mjs → backup-health-Dm_YMVFT.mjs} +2 -1
- package/dist/.setup/{channel-CNjJyBS_.mjs → channel-BBvOdxTc.mjs} +44 -29
- package/dist/.setup/{channel.runtime-DaGbm27q.mjs → channel.runtime-DyX4mM8d.mjs} +10 -8
- package/dist/.setup/{channel.setup-IjRB0ymg.mjs → channel.setup-p6oll48W.mjs} +15 -7
- package/dist/.setup/{cli-CuEJNM3c.mjs → cli-C2XKMk1U.mjs} +39 -28
- package/dist/.setup/{cli-metadata-rWmD_rzx.mjs → cli-metadata-C60BW1oa.mjs} +5 -3
- package/dist/.setup/{client-7eyTX0cu.mjs → client-BEl7PU1_.mjs} +25 -19
- package/dist/.setup/{client-CV0MkCZG.mjs → client-Cxv-iMwp.mjs} +5 -4
- package/dist/.setup/{client-bootstrap-BjcmTmyR.mjs → client-bootstrap-D1vLveT2.mjs} +3 -2
- package/dist/.setup/{client-support-CFofPPPm.mjs → client-support-D-xHScuo.mjs} +5 -3
- package/dist/.setup/{config-paths-DBpHxDyc.mjs → config-paths-CnREYb1Y.mjs} +2 -1
- package/dist/.setup/{create-client-C4Lnqs2C.mjs → create-client-CrY1E3hg.mjs} +9 -8
- package/dist/.setup/{credentials-read-WCQSEvI8.mjs → credentials-read-Dj7Hj87M.mjs} +6 -5
- package/dist/.setup/{credentials-state-jxq29yQw.mjs → credentials-state-B3cuUFwZ.mjs} +2 -1
- package/dist/.setup/{credentials-B0vpXvcB.mjs → credentials-udso1z0C.mjs} +6 -5
- package/dist/.setup/{crypto-node.runtime-E_hqXGxm.mjs → crypto-node.runtime-6Aj_ltHQ.mjs} +2 -1
- package/dist/.setup/{crypto-runtime-Crp1is7m.mjs → crypto-runtime-DqX7VD1W.mjs} +19 -12
- package/dist/.setup/{crypto-state-store-CM57gchf.mjs → crypto-state-store-DclM-fO5.mjs} +5 -3
- package/dist/.setup/{crypto-store-ownership-Bratn-Np.mjs → crypto-store-ownership-Dr-T40Rp.mjs} +4 -3
- package/dist/.setup/{crypto-unsafe-state-doctor-Brv4bIyx.mjs → crypto-unsafe-state-doctor-BG9qMu0B.mjs} +8 -7
- package/dist/.setup/{deps-O7rEnklr.mjs → deps-L_1bUAGL.mjs} +2 -1
- package/dist/.setup/{device-health-DnKAXW1v.mjs → device-health-D6_ECUVe.mjs} +3 -2
- package/dist/.setup/{direct-management-DDaWVbQI.mjs → direct-management-ZcjZgYEl.mjs} +11 -7
- package/dist/.setup/{directory-live-B-csizuK.mjs → directory-live-_yaRaktv.mjs} +6 -5
- package/dist/.setup/doctor-contract-BANpMUbP.mjs +38 -0
- package/dist/.setup/{draft-stream-dmhBHufd.mjs → draft-stream-vO_qjwJb.mjs} +4 -3
- package/dist/.setup/{encryption-guidance-Cn6-Tlx0.mjs → encryption-guidance-BLUoN4aV.mjs} +4 -3
- package/dist/.setup/{env-vars-Bh1iOXJ1.mjs → env-vars-aEBngJPa.mjs} +2 -1
- package/dist/.setup/{errors-CL3YJV8U.mjs → errors-Bw4EHwKX.mjs} +2 -1
- package/dist/.setup/{event-helpers-DDUjVVf7.mjs → event-helpers-CxNgMQqH.mjs} +2 -1
- package/dist/.setup/{exec-approvals-D7vv3AZS.mjs → exec-approvals-BFT-ee9F.mjs} +9 -6
- package/dist/.setup/{file-sync-store-q5KCV2Lp.mjs → file-sync-store-BxUPmUoJ.mjs} +6 -5
- package/dist/.setup/{http-client-CxTmU1kT.mjs → http-client-ByR4STVQ.mjs} +7 -4
- package/dist/.setup/{idb-persistence-BF0MZglD.mjs → idb-persistence-C2TsCHY2.mjs} +7 -6
- package/dist/.setup/{idb-persistence-lock-CH2K6d_3.mjs → idb-persistence-lock-Bh3ZLIsE.mjs} +2 -1
- package/dist/.setup/{inbound-dedupe-CZnOq0ja.mjs → inbound-dedupe-sW_gaR44.mjs} +3 -2
- package/dist/.setup/{joined-room-encryption-Dl7Sb9FF.mjs → joined-room-encryption-DBbLkdvv.mjs} +3 -2
- package/dist/.setup/{logger-BX5kXvh1.mjs → logger-CuAzdD8Q.mjs} +5 -4
- package/dist/.setup/{logging-BLcaOSRD.mjs → logging-CoaEyRtA.mjs} +22 -15
- package/dist/.setup/{messages-BiHM0DM3.mjs → messages-TuEa_BPZ.mjs} +14 -9
- package/dist/.setup/{monitor-CPwDgRFY.mjs → monitor-B86Ll4B8.mjs} +166 -77
- package/dist/.setup/{onboarding-DiVtpjNu.mjs → onboarding-DOLEjkg2.mjs} +11 -10
- package/dist/.setup/{outbound-DwP97VpQ.mjs → outbound-BWsyqwt1.mjs} +4 -3
- package/dist/.setup/{profile-update-DnNA9mEa.mjs → profile-update-DiXSVBki.mjs} +8 -6
- package/dist/.setup/{reaction-events-ClY9h_FC.mjs → reaction-events-CuUeYcBC.mjs} +9 -8
- package/dist/.setup/{resolve-targets-B8PAwHVS.mjs → resolve-targets-Dd70hGcM.mjs} +5 -4
- package/dist/.setup/{retired-state-vIr2IB90.mjs → retired-state-C4UnLIg4.mjs} +5 -38
- package/dist/.setup/{room-info-T_PR_liR.mjs → room-info-C13IUffQ.mjs} +8 -6
- package/dist/.setup/{runtime-Ck8TjD7L.mjs → runtime-1kn1P6io.mjs} +2 -1
- package/dist/.setup/{doctor-contract-DybEjJcd.mjs → runtime-doctor-migrations-hxP-CXX7.mjs} +22 -52
- package/dist/.setup/runtime-setter-api-DtxDAM-x.mjs +3 -0
- package/dist/.setup/{sdk-Cj3ggJHG.mjs → sdk-DNW03GqJ.mjs} +47 -32
- package/dist/.setup/{secret-contract-AKnr45nw.mjs → secret-contract-DxyzKSzf.mjs} +3 -2
- package/dist/.setup/secret-contract-api-CiuSYjUy.mjs +3 -0
- package/dist/.setup/{send-C1qeMQAy.mjs → send-BGgwE5pV.mjs} +40 -24
- package/dist/.setup/{send-currentness-CAUVR-f3.mjs → send-currentness-C2rMVVIQ.mjs} +4 -2
- package/dist/.setup/{setup-bootstrap-DDhwWvDs.mjs → setup-bootstrap-BCbltIf_.mjs} +5 -4
- package/dist/.setup/{setup-core-D2r4BivQ.mjs → setup-core-Di6NtQ_J.mjs} +20 -13
- package/dist/.setup/setup-plugin-api-ORC_4yEA.mjs +3 -0
- package/dist/.setup/sqlite-state-LByPx4Yp.mjs +37 -0
- package/dist/.setup/{startup-verification-B3LEbW33.mjs → startup-verification-8xvGpdtK.mjs} +6 -4
- package/dist/.setup/{state-layout-walk-BqCZTHpp.mjs → state-layout-walk-BQMgMykU.mjs} +3 -2
- package/dist/.setup/{storage-CxN4jqKI.mjs → storage-CN4dxdtV.mjs} +20 -10
- package/dist/.setup/{storage-paths-e_Vq6cvw.mjs → storage-paths-B51JM-pC.mjs} +2 -1
- package/dist/.setup/{subagent-hooks-CT-rdJmh.mjs → subagent-hooks-CSY4iwa_.mjs} +3 -2
- package/dist/.setup/{sync-cache-state-qYrd2EEh.mjs → sync-cache-state-L1kwjhjj.mjs} +9 -5
- package/dist/.setup/{target-ids-DltG_ZHJ.mjs → target-ids-HhcaKX1n.mjs} +2 -1
- package/dist/.setup/{thread-binding-api-OtSciHmZ.mjs → thread-binding-api-BvuaKpd0.mjs} +3 -2
- package/dist/.setup/{thread-bindings-D2ZR6mEZ.mjs → thread-bindings-pNgPVdof.mjs} +10 -7
- package/dist/.setup/{thread-bindings-shared-FMu_szTm.mjs → thread-bindings-shared-CPjUA0Ib.mjs} +2 -1
- package/dist/.setup/{tool-actions-CdKa0DC4.mjs → tool-actions-CFC7ZpIt.mjs} +23 -18
- package/dist/.setup/{url-validation-C77p4qT9.mjs → url-validation-CF6pG6eE.mjs} +2 -1
- package/dist/.setup/{verification-jP3tm-xD.mjs → verification-CuT5ZBDO.mjs} +5 -4
- package/dist/api.js +8 -8
- package/dist/auth-presence.js +3 -2
- package/dist/channel-plugin-api.js +2 -1
- package/dist/cli-metadata.js +2 -1
- package/dist/contract-api.js +2 -2
- package/dist/doctor-contract-api.js +55 -20
- package/dist/helper-api.js +3 -3
- package/dist/index.js +4 -3
- package/dist/plugin-entry.handlers.runtime.js +4 -3
- package/dist/runtime-api.js +8 -7
- package/dist/runtime-setter-api.js +2 -1
- package/dist/secret-contract-api.js +2 -1
- package/dist/session-binding-contract-api.js +2 -2
- package/dist/setup-entry.js +5 -4
- package/dist/setup-plugin-api.js +2 -1
- package/dist/subagent-hooks-api.js +3 -2
- package/dist/thread-binding-api.js +2 -1
- package/dist/thread-bindings-runtime.js +2 -1
- package/node_modules/@openclaw/fs-safe/CHANGELOG.md +26 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/native-config.js +14 -3
- package/node_modules/@openclaw/fs-safe/dist/output.js +6 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +12 -5
- package/node_modules/@openclaw/fs-safe/dist/root-path-existing.d.ts +2 -2
- package/node_modules/@openclaw/fs-safe/dist/root-path-existing.js +27 -13
- package/node_modules/@openclaw/fs-safe/dist/root-path.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.js +18 -3
- package/node_modules/@openclaw/fs-safe/dist/watch-hints.js +8 -3
- package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.exe +0 -0
- package/node_modules/@openclaw/fs-safe/docs/config.md +7 -1
- package/node_modules/@openclaw/fs-safe/docs/copy.md +10 -0
- package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.5.md +6 -4
- package/node_modules/@openclaw/fs-safe/docs/native-helper.md +6 -4
- package/node_modules/@openclaw/fs-safe/docs/output.md +4 -2
- package/node_modules/@openclaw/fs-safe/docs/security-model.md +9 -0
- package/node_modules/@openclaw/fs-safe/docs/watch.md +7 -1
- package/node_modules/@openclaw/fs-safe/package.json +15 -14
- package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-freebsd-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-freebsd-arm64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-freebsd-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-freebsd-x64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-win32-arm64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-arm64-msvc/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
- package/package.json +5 -5
- package/dist/.setup/runtime-setter-api-CpwhcBQK.mjs +0 -2
- package/dist/.setup/secret-contract-api-DMSwMIxd.mjs +0 -2
- package/dist/.setup/setup-plugin-api-SO1hdrsT.mjs +0 -2
- package/dist/.source-module-urls/1cd4d4ff8d44e1c8b830932b44d7cf8a7f3350e09e169910e1d7a85e131b7bea.json +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as getMatrixRuntime } from "./runtime-
|
|
3
|
-
import { a as resolveMatrixAccountConfig } from "./account-config-
|
|
4
|
-
import { a as normalizeMatrixResolvableTarget, n as isMatrixQualifiedUserId } from "./target-ids-
|
|
5
|
-
import { n as withMatrixSendCurrentness, o as buildMatrixReactionContent, t as captureMatrixSendCurrentness } from "./send-currentness-
|
|
6
|
-
import { _ as MsgType, d as buildMatrixMessageRelation, f as resolveMatrixReplyToEventId, g as MSC4357_LIVE_KEY, l as isStrictDirectRoom, m as EventType, n as inspectMatrixDirectRooms, p as resolveMatrixThreadRootId, r as persistMatrixDirectRoomMapping, v as RelationType } from "./direct-management-
|
|
7
|
-
import { n as getMatrixEventProjection } from "./event-helpers-
|
|
1
|
+
import { n as __exportAll } from "./runtime-doctor-migrations-hxP-CXX7.mjs";
|
|
2
|
+
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
3
|
+
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
|
|
4
|
+
import { a as normalizeMatrixResolvableTarget, n as isMatrixQualifiedUserId } from "./target-ids-HhcaKX1n.mjs";
|
|
5
|
+
import { n as withMatrixSendCurrentness, o as buildMatrixReactionContent, t as captureMatrixSendCurrentness } from "./send-currentness-C2rMVVIQ.mjs";
|
|
6
|
+
import { _ as MsgType, d as buildMatrixMessageRelation, f as resolveMatrixReplyToEventId, g as MSC4357_LIVE_KEY, l as isStrictDirectRoom, m as EventType, n as inspectMatrixDirectRooms, p as resolveMatrixThreadRootId, r as persistMatrixDirectRoomMapping, v as RelationType } from "./direct-management-ZcjZgYEl.mjs";
|
|
7
|
+
import { n as getMatrixEventProjection } from "./event-helpers-CxNgMQqH.mjs";
|
|
8
8
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
9
9
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
10
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -22,8 +22,8 @@ import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
|
22
22
|
import MarkdownIt from "markdown-it";
|
|
23
23
|
import { isAutoLinkedFileRef } from "openclaw/plugin-sdk/text-autolink-runtime";
|
|
24
24
|
import { parseBuffer } from "music-metadata";
|
|
25
|
-
|
|
26
|
-
const loadMatrixSendClientRuntime = createLazyRuntimeModule(() => import("./client-bootstrap-
|
|
25
|
+
//#region extensions/matrix/src/matrix/send/client.ts
|
|
26
|
+
const loadMatrixSendClientRuntime = createLazyRuntimeModule(() => import("./client-bootstrap-D1vLveT2.mjs"));
|
|
27
27
|
function resolveMediaMaxBytes(accountId, cfg) {
|
|
28
28
|
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.");
|
|
29
29
|
const mediaMaxMb = resolveMatrixAccountConfig({
|
|
@@ -56,7 +56,8 @@ async function withResolvedMatrixClient(opts, run, shutdownBehavior) {
|
|
|
56
56
|
const { withResolvedRuntimeMatrixClient } = await loadMatrixSendClientRuntime();
|
|
57
57
|
return await withResolvedRuntimeMatrixClient(opts, run, shutdownBehavior);
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region extensions/matrix/src/matrix/send/receipt.ts
|
|
60
61
|
function createMatrixSendReceipt(params) {
|
|
61
62
|
const firstEvent = params.events[0];
|
|
62
63
|
const receipt = createMessageReceiptFromOutboundResults({
|
|
@@ -81,14 +82,16 @@ function createMatrixSendReceipt(params) {
|
|
|
81
82
|
});
|
|
82
83
|
return receipt;
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region extensions/matrix/src/matrix/monitor/bounded-cache.ts
|
|
85
87
|
function setBoundedMap(map, key, value, maxEntries) {
|
|
86
88
|
map.set(key, value);
|
|
87
89
|
if (map.size <= maxEntries) return;
|
|
88
90
|
const oldest = map.keys().next();
|
|
89
91
|
if (!oldest.done) map.delete(oldest.value);
|
|
90
92
|
}
|
|
91
|
-
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region extensions/matrix/src/matrix/send/targets.ts
|
|
92
95
|
function normalizeTarget(raw) {
|
|
93
96
|
const trimmed = raw.trim();
|
|
94
97
|
if (!trimmed) throw new Error("Matrix target is required (room:<id> or #alias)");
|
|
@@ -148,7 +151,8 @@ async function resolveMatrixRoomId(client, raw, opts = {}) {
|
|
|
148
151
|
}
|
|
149
152
|
return target;
|
|
150
153
|
}
|
|
151
|
-
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region extensions/matrix/src/matrix/delivery-plan.ts
|
|
152
156
|
const DELIVERY_PLAN_VERSION = 1;
|
|
153
157
|
const DELIVERY_PLAN_NAMESPACE = "outbound-delivery-plans";
|
|
154
158
|
const DELIVERY_PLAN_TTL_MS = 864e5;
|
|
@@ -379,7 +383,8 @@ async function cleanupMatrixDeliveryPlans(ctx) {
|
|
|
379
383
|
const keys = entries.filter((entry) => entry.key.startsWith(prefix)).map((entry) => entry.key);
|
|
380
384
|
for (const key of keys) await store.delete(key);
|
|
381
385
|
}
|
|
382
|
-
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region extensions/matrix/src/matrix/poll-types.ts
|
|
383
388
|
const M_POLL_START = "m.poll.start";
|
|
384
389
|
const M_POLL_RESPONSE = "m.poll.response";
|
|
385
390
|
const M_POLL_END = "m.poll.end";
|
|
@@ -556,7 +561,8 @@ function buildPollResponseContent(pollEventId, answerIds) {
|
|
|
556
561
|
}
|
|
557
562
|
};
|
|
558
563
|
}
|
|
559
|
-
|
|
564
|
+
//#endregion
|
|
565
|
+
//#region extensions/matrix/src/matrix/format-profile.ts
|
|
560
566
|
function createMatrixPrivateMarkers(markdown, exhaustedMessage) {
|
|
561
567
|
const used = new Set(Array.from(markdown, (character) => character.charCodeAt(0)));
|
|
562
568
|
for (const match of markdown.matchAll(/&#(?:x([0-9a-f]+)|(\d+));/giu)) {
|
|
@@ -599,7 +605,8 @@ function projectMatrixMarkdown(markdown) {
|
|
|
599
605
|
function renderMatrixMarkdownTables(markdown, mode) {
|
|
600
606
|
return MATRIX_FORMAT_PROFILE.constructs.table === "native" && (mode === "off" || mode === "block") ? markdown : convertMarkdownTables(markdown, mode);
|
|
601
607
|
}
|
|
602
|
-
|
|
608
|
+
//#endregion
|
|
609
|
+
//#region extensions/matrix/src/matrix/format-table-ranges.ts
|
|
603
610
|
const tableParser = new MarkdownIt({
|
|
604
611
|
html: false,
|
|
605
612
|
linkify: false,
|
|
@@ -620,7 +627,8 @@ function matrixTableSourceRangesFromTokens(tokens, lineStarts, sourceLength) {
|
|
|
620
627
|
}];
|
|
621
628
|
});
|
|
622
629
|
}
|
|
623
|
-
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region extensions/matrix/src/matrix/format-spoiler-ranges.ts
|
|
624
632
|
const spoilerParser = new MarkdownIt({
|
|
625
633
|
html: false,
|
|
626
634
|
linkify: true,
|
|
@@ -799,7 +807,8 @@ function analyzeMatrixSpoilers(markdown) {
|
|
|
799
807
|
metadataCollision: hasMatrixSpoilerMetadataCollision(source, delimiterOffsets)
|
|
800
808
|
};
|
|
801
809
|
}
|
|
802
|
-
|
|
810
|
+
//#endregion
|
|
811
|
+
//#region extensions/matrix/src/matrix/format.ts
|
|
803
812
|
const MATRIX_STYLE_MARKERS = {
|
|
804
813
|
underline: {
|
|
805
814
|
open: "<u>",
|
|
@@ -1198,7 +1207,8 @@ async function renderMarkdownToMatrixHtmlWithMentions(params) {
|
|
|
1198
1207
|
mentions: state.mentions
|
|
1199
1208
|
};
|
|
1200
1209
|
}
|
|
1201
|
-
|
|
1210
|
+
//#endregion
|
|
1211
|
+
//#region extensions/matrix/src/matrix/send/chunking.ts
|
|
1202
1212
|
function normalizeMatrixEventLimit(limit) {
|
|
1203
1213
|
if (!Number.isFinite(limit) || limit <= 0) return limit;
|
|
1204
1214
|
return Math.max(1, Math.floor(limit));
|
|
@@ -1361,7 +1371,8 @@ function chunkMatrixText(text, opts) {
|
|
|
1361
1371
|
chunks
|
|
1362
1372
|
};
|
|
1363
1373
|
}
|
|
1364
|
-
|
|
1374
|
+
//#endregion
|
|
1375
|
+
//#region extensions/matrix/src/matrix/media-text.ts
|
|
1365
1376
|
const MATRIX_MEDIA_KINDS = {
|
|
1366
1377
|
"m.audio": "audio",
|
|
1367
1378
|
"m.file": "file",
|
|
@@ -1429,7 +1440,8 @@ function formatMatrixMessageText(params) {
|
|
|
1429
1440
|
if (!body) return marker;
|
|
1430
1441
|
return `${body}\n\n${marker}`;
|
|
1431
1442
|
}
|
|
1432
|
-
|
|
1443
|
+
//#endregion
|
|
1444
|
+
//#region extensions/matrix/src/matrix/send/edit-content.ts
|
|
1433
1445
|
const MAX_EDIT_RELATION_PAGES = 100;
|
|
1434
1446
|
const EDIT_RELATION_PAGE_SIZE = 100;
|
|
1435
1447
|
const EDIT_DECRYPTION_ERROR = "Matrix edit history is not fully decrypted; restore encryption keys before editing.";
|
|
@@ -1467,7 +1479,8 @@ async function resolveMatrixEditContent(params) {
|
|
|
1467
1479
|
}
|
|
1468
1480
|
throw new Error("Matrix edit history could not be fully read; send a new message instead.");
|
|
1469
1481
|
}
|
|
1470
|
-
|
|
1482
|
+
//#endregion
|
|
1483
|
+
//#region extensions/matrix/src/matrix/send/formatting.ts
|
|
1471
1484
|
function buildTextContent(body, relation, opts = {}) {
|
|
1472
1485
|
return {
|
|
1473
1486
|
msgtype: opts.msgtype ?? MsgType.Text,
|
|
@@ -1530,7 +1543,8 @@ function resolveMatrixMsgType(contentType) {
|
|
|
1530
1543
|
default: return MsgType.File;
|
|
1531
1544
|
}
|
|
1532
1545
|
}
|
|
1533
|
-
|
|
1546
|
+
//#endregion
|
|
1547
|
+
//#region extensions/matrix/src/matrix/send/media.ts
|
|
1534
1548
|
function buildMediaContent(params) {
|
|
1535
1549
|
const base = {
|
|
1536
1550
|
msgtype: params.msgtype,
|
|
@@ -1646,7 +1660,8 @@ async function uploadMediaWithEncryption(client, roomId, buffer, params) {
|
|
|
1646
1660
|
}
|
|
1647
1661
|
return { url: await client.uploadContent(buffer, params.contentType, params.filename) };
|
|
1648
1662
|
}
|
|
1649
|
-
|
|
1663
|
+
//#endregion
|
|
1664
|
+
//#region extensions/matrix/src/matrix/send.ts
|
|
1650
1665
|
var send_exports = /* @__PURE__ */ __exportAll({
|
|
1651
1666
|
chunkMatrixText: () => chunkMatrixText,
|
|
1652
1667
|
editMessageMatrix: () => editMessageMatrix,
|
|
@@ -2005,4 +2020,5 @@ async function reactMatrixMessage(roomId, messageId, emoji, opts = {}) {
|
|
|
2005
2020
|
await resolved.sendEvent(resolvedRoom, EventType.Reaction, reaction);
|
|
2006
2021
|
});
|
|
2007
2022
|
}
|
|
2023
|
+
//#endregion
|
|
2008
2024
|
export { resolveMatrixRoomId as C, reconcileMatrixUnknownSend as S, isPollEventType as _, sendSingleTextMessageMatrix as a, resolvePollReferenceEventId as b, formatMatrixMessageText as c, resolveMatrixReplacementContent as d, prepareMatrixSingleText as f, formatPollResultsAsText as g, formatPollAsText as h, sendPollMatrix as i, isLikelyBareFilename as l, buildPollResultsSummary as m, reactMatrixMessage as n, sendTypingMatrix as o, buildPollResponseContent as p, sendMessageMatrix as r, send_exports as s, editMessageMatrix as t, resolveMatrixMessageAttachment as u, isPollStartType as v, setBoundedMap as w, cleanupMatrixDeliveryPlans as x, parsePollStart as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
-
|
|
3
|
+
//#region extensions/matrix/src/matrix/reaction-common.ts
|
|
4
4
|
const MATRIX_ANNOTATION_RELATION_TYPE = "m.annotation";
|
|
5
5
|
const MATRIX_REACTION_EVENT_TYPE = "m.reaction";
|
|
6
6
|
function normalizeMatrixReactionMessageId(messageId) {
|
|
@@ -65,7 +65,8 @@ function selectOwnMatrixReactionEventIds(events, userId, emoji) {
|
|
|
65
65
|
}
|
|
66
66
|
return ids;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region extensions/matrix/src/matrix/sdk/send-currentness.ts
|
|
69
70
|
const sendCurrentness = new AsyncLocalStorage();
|
|
70
71
|
function withMatrixSendCurrentness(client, assertCurrent, run) {
|
|
71
72
|
assertCurrent();
|
|
@@ -82,4 +83,5 @@ function captureMatrixSendCurrentness(client) {
|
|
|
82
83
|
function withoutMatrixSendCurrentness(run) {
|
|
83
84
|
return sendCurrentness.exit(run);
|
|
84
85
|
}
|
|
86
|
+
//#endregion
|
|
85
87
|
export { MATRIX_REACTION_EVENT_TYPE as a, extractMatrixReactionAnnotation as c, MATRIX_ANNOTATION_RELATION_TYPE as i, selectOwnMatrixReactionEventIds as l, withMatrixSendCurrentness as n, buildMatrixReactionContent as o, withoutMatrixSendCurrentness as r, buildMatrixReactionRelationsPath as s, captureMatrixSendCurrentness as t, summarizeMatrixReactionEvents as u };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-
|
|
2
|
-
import "./setup-core-
|
|
3
|
-
import { n as bootstrapMatrixVerification } from "./verification-
|
|
1
|
+
import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
|
|
2
|
+
import "./setup-core-Di6NtQ_J.mjs";
|
|
3
|
+
import { n as bootstrapMatrixVerification } from "./verification-CuT5ZBDO.mjs";
|
|
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) {
|
|
7
7
|
const accountConfig = resolveMatrixAccountConfig({
|
|
8
8
|
cfg: params.cfg,
|
|
@@ -54,4 +54,5 @@ async function runMatrixSetupBootstrapAfterConfigWrite(params) {
|
|
|
54
54
|
}
|
|
55
55
|
params.runtime.error(`Matrix verification bootstrap warning for "${params.accountId}": ${bootstrap.error ?? "unknown bootstrap failure"}`);
|
|
56
56
|
}
|
|
57
|
+
//#endregion
|
|
57
58
|
export { maybeBootstrapNewEncryptedMatrixAccount, runMatrixSetupBootstrapAfterConfigWrite };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as resolveConfiguredMatrixAccountIds, d as resolveScopedMatrixEnvConfig, f as resolveMatrixAccountStringValues, l as resolveGlobalMatrixEnvConfig, s as resolveMatrixDefaultOrOnlyAccountId, u as resolveMatrixEnvAuthReadiness } from "./account-selection-
|
|
3
|
-
import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig, t as findMatrixAccountConfig } from "./account-config-
|
|
4
|
-
import { a as loadMatrixCredentials, o as loadMatrixCredentialsAsync, r as credentialsMatchConfig, t as captureMatrixCredentialsEnv } from "./credentials-read-
|
|
5
|
-
import { n as resolveMatrixConfigPath, r as shouldStoreMatrixAccountAtTopLevel, t as resolveMatrixConfigFieldPath } from "./config-paths-
|
|
1
|
+
import { n as __exportAll } from "./runtime-doctor-migrations-hxP-CXX7.mjs";
|
|
2
|
+
import { a as resolveConfiguredMatrixAccountIds, d as resolveScopedMatrixEnvConfig, f as resolveMatrixAccountStringValues, l as resolveGlobalMatrixEnvConfig, s as resolveMatrixDefaultOrOnlyAccountId, u as resolveMatrixEnvAuthReadiness } from "./account-selection-CWsL5zIU.mjs";
|
|
3
|
+
import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig, t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
|
|
4
|
+
import { a as loadMatrixCredentials, o as loadMatrixCredentialsAsync, r as credentialsMatchConfig, t as captureMatrixCredentialsEnv } from "./credentials-read-Dj7Hj87M.mjs";
|
|
5
|
+
import { n as resolveMatrixConfigPath, r as shouldStoreMatrixAccountAtTopLevel, t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.mjs";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
7
7
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { coerceSecretRef, hasConfiguredSecretInput, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
@@ -11,7 +11,7 @@ import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, addWildcardAllowFrom, apply
|
|
|
11
11
|
import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
12
12
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$2, normalizeAccountId as normalizeAccountId$2 } from "openclaw/plugin-sdk/routing";
|
|
13
13
|
import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
|
|
14
|
-
|
|
14
|
+
//#region extensions/matrix/src/matrix/accounts.ts
|
|
15
15
|
function clean(value) {
|
|
16
16
|
return normalizeOptionalString(value) ?? "";
|
|
17
17
|
}
|
|
@@ -142,7 +142,8 @@ async function resolveMatrixAccountAsync(params) {
|
|
|
142
142
|
configured: isMatrixAccountConfigured(prepared, stored)
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region extensions/matrix/src/matrix/config-update.ts
|
|
146
147
|
var config_update_exports = /* @__PURE__ */ __exportAll({
|
|
147
148
|
resolveMatrixConfigFieldPath: () => resolveMatrixConfigFieldPath,
|
|
148
149
|
resolveMatrixConfigPath: () => resolveMatrixConfigPath,
|
|
@@ -236,7 +237,8 @@ function updateMatrixAccountConfig(cfg, accountId, patch) {
|
|
|
236
237
|
}
|
|
237
238
|
};
|
|
238
239
|
}
|
|
239
|
-
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region extensions/matrix/src/matrix/profile.ts
|
|
240
242
|
var profile_exports = /* @__PURE__ */ __exportAll({
|
|
241
243
|
isSupportedMatrixAvatarSource: () => isSupportedMatrixAvatarSource,
|
|
242
244
|
syncMatrixOwnProfile: () => syncMatrixOwnProfile
|
|
@@ -302,7 +304,8 @@ async function syncMatrixOwnProfile(params) {
|
|
|
302
304
|
...avatar
|
|
303
305
|
};
|
|
304
306
|
}
|
|
305
|
-
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region extensions/matrix/src/setup-contract.ts
|
|
306
309
|
const matrixSingleAccountKeysToMove = [
|
|
307
310
|
"homeserver",
|
|
308
311
|
"userId",
|
|
@@ -362,7 +365,8 @@ function resolveSingleAccountPromotionTarget(params) {
|
|
|
362
365
|
}
|
|
363
366
|
return DEFAULT_ACCOUNT_ID$2;
|
|
364
367
|
}
|
|
365
|
-
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region extensions/matrix/src/setup-config.ts
|
|
366
370
|
const channel$1 = "matrix";
|
|
367
371
|
const COMMON_SINGLE_ACCOUNT_KEYS_TO_MOVE = /* @__PURE__ */ new Set([
|
|
368
372
|
"name",
|
|
@@ -473,7 +477,8 @@ function applyMatrixSetupAccountConfig(params) {
|
|
|
473
477
|
initialSyncLimit: input.initialSyncLimit
|
|
474
478
|
});
|
|
475
479
|
}
|
|
476
|
-
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region extensions/matrix/src/setup-dm-policy.ts
|
|
477
482
|
function resolveMatrixSetupDmAllowFrom(policy, allowFrom) {
|
|
478
483
|
if (policy === "open") return addWildcardAllowFrom(allowFrom);
|
|
479
484
|
return normalizeAllowFromEntries(allowFrom ?? []).filter((entry) => entry !== "*");
|
|
@@ -514,7 +519,8 @@ function createMatrixSetupDmPolicy(promptAllowFrom) {
|
|
|
514
519
|
promptAllowFrom
|
|
515
520
|
});
|
|
516
521
|
}
|
|
517
|
-
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region extensions/matrix/src/setup-core.ts
|
|
518
524
|
const channel = "matrix";
|
|
519
525
|
function resolveMatrixSetupAccountId(params) {
|
|
520
526
|
return normalizeAccountId$1(params.accountId?.trim() || params.name?.trim() || DEFAULT_ACCOUNT_ID$1);
|
|
@@ -546,7 +552,7 @@ function createMatrixSetupWizardProxy(loadWizardModule) {
|
|
|
546
552
|
};
|
|
547
553
|
}
|
|
548
554
|
const finishMatrixSetupAfterConfigWrite = async ({ previousCfg, cfg, accountId, runtime }) => {
|
|
549
|
-
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-
|
|
555
|
+
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-BCbltIf_.mjs");
|
|
550
556
|
await runMatrixSetupBootstrapAfterConfigWrite({
|
|
551
557
|
previousCfg,
|
|
552
558
|
cfg,
|
|
@@ -660,4 +666,5 @@ const matrixSetupContract = defineChannelSetupContract({
|
|
|
660
666
|
},
|
|
661
667
|
legacyAdapter: matrixSetupAdapter
|
|
662
668
|
});
|
|
669
|
+
//#endregion
|
|
663
670
|
export { resolveMatrixAccount as _, createMatrixSetupDmPolicy as a, resolveSingleAccountPromotionTarget as c, syncMatrixOwnProfile as d, config_update_exports as f, resolveDefaultMatrixAccountId as g, resolveConfiguredMatrixBotUserIds as h, matrixSetupContract as i, singleAccountKeysToMove as l, listMatrixAccountIds as m, finishMatrixSetupAfterConfigWrite as n, moveSingleMatrixAccountConfigToNamedAccount as o, updateMatrixAccountConfig as p, matrixSetupAdapter as r, namedAccountPromotionKeys as s, createMatrixSetupWizardProxy as t, profile_exports as u, resolveMatrixAccountAsync as v };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
//#region extensions/matrix/src/matrix/sqlite-state.ts
|
|
4
|
+
function resolveStateDirOverride(options) {
|
|
5
|
+
if (!options) return;
|
|
6
|
+
return options.stateDir || options.stateRootDir || getMatrixRuntime().state.resolveStateDir(options.env ?? process.env, os.homedir);
|
|
7
|
+
}
|
|
8
|
+
function resolveMatrixSqliteStateKey(options) {
|
|
9
|
+
return resolveStateDirOverride(options) ?? "";
|
|
10
|
+
}
|
|
11
|
+
function resolveMatrixSqliteStateEnv(options) {
|
|
12
|
+
const stateDir = resolveStateDirOverride(options);
|
|
13
|
+
if (!stateDir) return options?.env;
|
|
14
|
+
return {
|
|
15
|
+
...options?.env ?? process.env,
|
|
16
|
+
OPENCLAW_STATE_DIR: stateDir
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async function updateMatrixKeyedState(store, key, update, onUndefined = "keep") {
|
|
20
|
+
let observation = await store.observe(key);
|
|
21
|
+
for (;;) {
|
|
22
|
+
const value = update(observation.value);
|
|
23
|
+
if (value === void 0 && onUndefined === "skip") return false;
|
|
24
|
+
const result = await store.compareAndApply(key, observation.comparison, value === void 0 ? {
|
|
25
|
+
operation: "update",
|
|
26
|
+
action: "keep"
|
|
27
|
+
} : {
|
|
28
|
+
operation: "update",
|
|
29
|
+
action: "set",
|
|
30
|
+
value
|
|
31
|
+
});
|
|
32
|
+
if (result.status !== "conflict") return true;
|
|
33
|
+
observation = result.current;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { resolveMatrixSqliteStateKey as n, updateMatrixKeyedState as r, resolveMatrixSqliteStateEnv as t };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { t as getMatrixRuntime } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
|
+
import { r as assertMatrixSupportedStateFile } from "./retired-state-C4UnLIg4.mjs";
|
|
3
|
+
import { t as resolveMatrixSqliteStateEnv } from "./sqlite-state-LByPx4Yp.mjs";
|
|
4
|
+
import { o as resolveMatrixStoragePaths, r as recordCurrentStorageMetaDeviceId } from "./storage-CN4dxdtV.mjs";
|
|
4
5
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
6
|
import path from "node:path";
|
|
6
|
-
|
|
7
|
+
//#region extensions/matrix/src/matrix/monitor/startup-verification.ts
|
|
7
8
|
const STARTUP_VERIFICATION_STATE_FILENAME = "startup-verification.json";
|
|
8
9
|
const STARTUP_VERIFICATION_NAMESPACE = "startup-verification";
|
|
9
10
|
const STARTUP_VERIFICATION_MAX_ENTRIES = 1e3;
|
|
@@ -110,4 +111,5 @@ async function ensureMatrixStartupVerification(params) {
|
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
113
|
}
|
|
114
|
+
//#endregion
|
|
113
115
|
export { ensureMatrixStartupVerification };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as resolveMatrixStateLayoutChildDepth } from "./storage-paths-
|
|
1
|
+
import { c as resolveMatrixStateLayoutChildDepth } from "./storage-paths-B51JM-pC.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { hasNodeErrorCode } from "@openclaw/fs-safe/path";
|
|
4
4
|
import { walkDirectory } from "@openclaw/fs-safe/walk";
|
|
5
|
-
|
|
5
|
+
//#region extensions/matrix/src/matrix/state-layout-walk.ts
|
|
6
6
|
/** Traverse only shipped Matrix layouts; archives and unrelated descendants stay unopened. */
|
|
7
7
|
async function walkMatrixStateFiles(stateDir, includeFile, stateRootDepths = []) {
|
|
8
8
|
const matrixRoot = path.resolve(stateDir, "matrix");
|
|
@@ -23,4 +23,5 @@ async function walkMatrixStateFiles(stateDir, includeFile, stateRootDepths = [])
|
|
|
23
23
|
failedDirs: result.failedDirs.filter((failure) => failure.path !== matrixRoot || !hasNodeErrorCode(failure.error, "ENOENT"))
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
//#endregion
|
|
26
27
|
export { walkMatrixStateFiles as t };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { t as getMatrixRuntime } from "./runtime-
|
|
2
|
-
import { n as isMatrixActiveTokenRootDirectory, r as resolveMatrixAccountStorageRoot } from "./storage-paths-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
|
+
import { n as isMatrixActiveTokenRootDirectory, r as resolveMatrixAccountStorageRoot } from "./storage-paths-B51JM-pC.mjs";
|
|
3
|
+
import { i as assertMatrixSupportedStateRoot, r as assertMatrixSupportedStateFile } from "./retired-state-C4UnLIg4.mjs";
|
|
4
|
+
import { r as updateMatrixKeyedState, t as resolveMatrixSqliteStateEnv } from "./sqlite-state-LByPx4Yp.mjs";
|
|
5
|
+
import { n as MATRIX_RECOVERY_KEY_FILENAME, o as scoreMatrixCryptoStateInStore, t as MATRIX_IDB_SNAPSHOT_FILENAME } from "./crypto-state-store-DclM-fO5.mjs";
|
|
5
6
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
6
7
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
8
|
import path from "node:path";
|
|
8
9
|
import fs from "node:fs";
|
|
9
10
|
import os from "node:os";
|
|
10
|
-
|
|
11
|
+
//#region extensions/matrix/src/matrix/client/storage-metadata.ts
|
|
11
12
|
const STORAGE_META_NAMESPACE = "storage-meta";
|
|
12
13
|
const STORAGE_META_STATE_KEY = "current";
|
|
13
14
|
const STORAGE_META_MAX_ENTRIES = 10;
|
|
@@ -35,7 +36,8 @@ function normalizeMatrixStorageMetadata(value) {
|
|
|
35
36
|
if (value.currentTokenStateClaimed === true) metadata.currentTokenStateClaimed = true;
|
|
36
37
|
return Object.keys(metadata).length > 0 ? metadata : null;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region extensions/matrix/src/matrix/client/storage.ts
|
|
39
41
|
const DEFAULT_ACCOUNT_KEY = "default";
|
|
40
42
|
const STORAGE_META_FILENAME = "storage-meta.json";
|
|
41
43
|
function openStorageMetaStore(rootDir) {
|
|
@@ -182,14 +184,21 @@ async function maybeMigrateLegacyStorage({ storagePaths }) {
|
|
|
182
184
|
const { rootDir, storagePath } = storagePaths;
|
|
183
185
|
await assertMatrixSupportedStateRoot(rootDir);
|
|
184
186
|
if (!fs.existsSync(storagePath)) return;
|
|
185
|
-
const syncCache = await import("./sync-cache-state-
|
|
186
|
-
|
|
187
|
+
const syncCache = await import("./sync-cache-state-L1kwjhjj.mjs").then((n) => n.o);
|
|
188
|
+
const { Utf8InputError } = await import("./runtime-doctor-migrations-hxP-CXX7.mjs").then((n) => n.t);
|
|
187
189
|
const logger = getMatrixRuntime().logging.getChildLogger({ module: "matrix-storage" });
|
|
190
|
+
let persisted;
|
|
191
|
+
try {
|
|
192
|
+
persisted = await syncCache.readLegacyMatrixSyncCacheState(rootDir);
|
|
193
|
+
} catch (error) {
|
|
194
|
+
if (!(error instanceof Utf8InputError)) throw error;
|
|
195
|
+
logger.warn?.(`${error.message} Legacy Matrix sync cache left in place: ${storagePath}`);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (!persisted) return;
|
|
188
199
|
fs.mkdirSync(rootDir, { recursive: true });
|
|
189
200
|
let migrated = false;
|
|
190
201
|
try {
|
|
191
|
-
const persisted = await syncCache.readLegacyMatrixSyncCacheState(rootDir);
|
|
192
|
-
if (!persisted) return;
|
|
193
202
|
const store = getMatrixRuntime().state.openKeyedStoreV2(syncCache.openMatrixSyncCacheStoreOptions(rootDir));
|
|
194
203
|
if (!await syncCache.hasMatrixSyncCacheStateInStore({
|
|
195
204
|
storageRootDir: rootDir,
|
|
@@ -275,4 +284,5 @@ async function repairCurrentTokenStorageMetaDeviceId(params) {
|
|
|
275
284
|
deviceId
|
|
276
285
|
});
|
|
277
286
|
}
|
|
287
|
+
//#endregion
|
|
278
288
|
export { resolveMatrixStateFilePath as a, repairCurrentTokenStorageMetaDeviceId as i, maybeMigrateLegacyStorage as n, resolveMatrixStoragePaths as o, recordCurrentStorageMetaDeviceId as r, writeStorageMeta as s, claimCurrentTokenStorageState as t };
|
|
@@ -2,7 +2,7 @@ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/acco
|
|
|
2
2
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import crypto from "node:crypto";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
|
|
5
|
+
//#region extensions/matrix/src/storage-paths.ts
|
|
6
6
|
const MATRIX_TOKEN_HASH_DIRECTORY_PATTERN = /^[a-f0-9]{16}$/u;
|
|
7
7
|
const MATRIX_SERVER_USER_DIRECTORY_PATTERN = /^.+__.+$/u;
|
|
8
8
|
function isMatrixActiveTokenRootDirectory(name) {
|
|
@@ -49,4 +49,5 @@ function resolveMatrixAccountStorageRoot(params) {
|
|
|
49
49
|
tokenHash
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
+
//#endregion
|
|
52
53
|
export { resolveMatrixCredentialsFilename as a, resolveMatrixStateLayoutChildDepth as c, resolveMatrixCredentialsDir as i, sanitizeMatrixPathSegment as l, isMatrixActiveTokenRootDirectory as n, resolveMatrixCredentialsPath as o, resolveMatrixAccountStorageRoot as r, resolveMatrixHomeserverKey as s, hashMatrixAccessToken as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as listBindingsForAccount, i as listAllBindings, n as getMatrixThreadBindingManager, s as resolveBindingKey } from "./thread-bindings-shared-
|
|
1
|
+
import { a as listBindingsForAccount, i as listAllBindings, n as getMatrixThreadBindingManager, s as resolveBindingKey } from "./thread-bindings-shared-CPjUA0Ib.mjs";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
4
|
-
|
|
4
|
+
//#region extensions/matrix/src/matrix/subagent-hooks.ts
|
|
5
5
|
async function handleMatrixSubagentEnded(event) {
|
|
6
6
|
const accountId = normalizeOptionalString(event.accountId) || void 0;
|
|
7
7
|
const matching = (accountId ? listBindingsForAccount(accountId) : listAllBindings()).filter((entry) => entry.targetSessionKey === event.targetSessionKey && entry.targetKind === "subagent");
|
|
@@ -49,4 +49,5 @@ function handleMatrixSubagentDeliveryTarget(event) {
|
|
|
49
49
|
...threadId ? { threadId } : {}
|
|
50
50
|
} };
|
|
51
51
|
}
|
|
52
|
+
//#endregion
|
|
52
53
|
export { handleMatrixSubagentDeliveryTarget, handleMatrixSubagentEnded };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as __exportAll } from "./runtime-doctor-migrations-hxP-CXX7.mjs";
|
|
2
|
+
import { c as writeMatrixStateChunks, o as chunkMatrixStateJson, s as readMatrixStateChunks } from "./retired-state-C4UnLIg4.mjs";
|
|
3
|
+
import { t as resolveMatrixSqliteStateEnv } from "./sqlite-state-LByPx4Yp.mjs";
|
|
3
4
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import { asSafeIntegerInRange } from "openclaw/plugin-sdk/number-runtime";
|
|
7
8
|
import fs from "node:fs/promises";
|
|
8
9
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
9
|
-
|
|
10
|
+
//#region extensions/matrix/src/matrix/client/sync-cache-state.ts
|
|
10
11
|
var sync_cache_state_exports = /* @__PURE__ */ __exportAll({
|
|
11
12
|
MATRIX_SYNC_CACHE_VERSION: () => 1,
|
|
12
13
|
deleteMatrixSyncCacheStateFromStore: () => deleteMatrixSyncCacheStateFromStore,
|
|
@@ -129,12 +130,14 @@ function buildSyncCacheRows(payload) {
|
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
132
|
async function readLegacyMatrixSyncCacheState(storageRootDir) {
|
|
133
|
+
const { decodeUtf8Input, Utf8InputError } = await import("./runtime-doctor-migrations-hxP-CXX7.mjs").then((n) => n.t);
|
|
132
134
|
try {
|
|
133
|
-
const raw = await fs.readFile(resolveLegacySyncCachePath(storageRootDir), "
|
|
135
|
+
const raw = decodeUtf8Input(await fs.readFile(resolveLegacySyncCachePath(storageRootDir)), "Legacy Matrix sync cache");
|
|
134
136
|
const persisted = normalizeLegacyPersistedStore(JSON.parse(raw));
|
|
135
137
|
if (!persisted?.savedSync && !persisted?.clientOptions) return null;
|
|
136
138
|
return persisted;
|
|
137
|
-
} catch {
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (error instanceof Utf8InputError) throw error;
|
|
138
141
|
return null;
|
|
139
142
|
}
|
|
140
143
|
}
|
|
@@ -161,4 +164,5 @@ async function deleteMatrixSyncCacheStateFromStore(params) {
|
|
|
161
164
|
await fs.rm(resolveLegacySyncCachePath(storageRootDir), { force: true }).catch(() => void 0);
|
|
162
165
|
});
|
|
163
166
|
}
|
|
167
|
+
//#endregion
|
|
164
168
|
export { readPersistedStoreFromStore as a, readLegacyMatrixSyncCacheState as i, hasMatrixSyncCacheStateInStore as n, sync_cache_state_exports as o, openMatrixSyncCacheStoreOptions as r, writeMatrixSyncCacheStateToStore as s, deleteMatrixSyncCacheStateFromStore as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
-
|
|
2
|
+
//#region extensions/matrix/src/matrix/target-ids.ts
|
|
3
3
|
const MATRIX_PREFIX = "matrix:";
|
|
4
4
|
const ROOM_PREFIX = "room:";
|
|
5
5
|
const CHANNEL_PREFIX = "channel:";
|
|
@@ -97,4 +97,5 @@ function resolveMatrixDirectUserId(params) {
|
|
|
97
97
|
const userId = stripKnownPrefixes(params.from ?? "", [MATRIX_PREFIX, USER_PREFIX]);
|
|
98
98
|
return isMatrixQualifiedUserId(userId) ? userId : void 0;
|
|
99
99
|
}
|
|
100
|
+
//#endregion
|
|
100
101
|
export { normalizeMatrixResolvableTarget as a, normalizeMatrixMessagingTarget as i, isMatrixQualifiedUserId as n, resolveMatrixDirectUserId as o, isMatrixRoomId as r, resolveMatrixTargetIdentity as s, isMatrixInviteAutoJoinTarget as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as resolveMatrixTargetIdentity } from "./target-ids-
|
|
1
|
+
import { s as resolveMatrixTargetIdentity } from "./target-ids-HhcaKX1n.mjs";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
|
|
3
|
+
//#region extensions/matrix/src/thread-binding-api.ts
|
|
4
4
|
const defaultTopLevelPlacement = "child";
|
|
5
5
|
function resolveMatrixInboundConversation(params) {
|
|
6
6
|
const rawTarget = params.to?.trim() || params.conversationId?.trim() || "";
|
|
@@ -13,4 +13,5 @@ function resolveMatrixInboundConversation(params) {
|
|
|
13
13
|
};
|
|
14
14
|
return parentConversationId ? { conversationId: parentConversationId } : null;
|
|
15
15
|
}
|
|
16
|
+
//#endregion
|
|
16
17
|
export { resolveMatrixInboundConversation as n, defaultTopLevelPlacement as t };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { t as getMatrixRuntime } from "./runtime-
|
|
2
|
-
import { a as listBindingsForAccount, c as setBindingRecord, d as setMatrixThreadBindingManagerEntry, m as toSessionBindingRecord, o as removeBindingRecord, r as getMatrixThreadBindingManagerEntry, s as resolveBindingKey, t as deleteMatrixThreadBindingManagerEntry } from "./thread-bindings-shared-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
|
+
import { a as listBindingsForAccount, c as setBindingRecord, d as setMatrixThreadBindingManagerEntry, m as toSessionBindingRecord, o as removeBindingRecord, r as getMatrixThreadBindingManagerEntry, s as resolveBindingKey, t as deleteMatrixThreadBindingManagerEntry } from "./thread-bindings-shared-CPjUA0Ib.mjs";
|
|
3
|
+
import { r as assertMatrixSupportedStateFile } from "./retired-state-C4UnLIg4.mjs";
|
|
4
|
+
import { n as resolveMatrixSqliteStateKey, t as resolveMatrixSqliteStateEnv } from "./sqlite-state-LByPx4Yp.mjs";
|
|
5
|
+
import { a as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-CN4dxdtV.mjs";
|
|
6
|
+
import { r as sendMessageMatrix } from "./send-BGgwE5pV.mjs";
|
|
6
7
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
8
|
import { createHash } from "node:crypto";
|
|
8
9
|
import path from "node:path";
|
|
@@ -11,7 +12,7 @@ import { registerSessionBindingAdapterV2, resolveThreadBindingFarewellText, reso
|
|
|
11
12
|
import { hasSqliteWorkerOutcomeUnknown } from "openclaw/plugin-sdk/sqlite-runtime";
|
|
12
13
|
import { resolveSessionAgentIdStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
13
14
|
import { resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
|
|
14
|
-
|
|
15
|
+
//#region extensions/matrix/src/matrix/thread-bindings-session-adapter.ts
|
|
15
16
|
function sameBindingIncarnation(a, b) {
|
|
16
17
|
return resolveBindingKey(a) === resolveBindingKey(b) && a.boundAt === b.boundAt && a.targetSessionKey === b.targetSessionKey && a.targetKind === b.targetKind;
|
|
17
18
|
}
|
|
@@ -193,7 +194,8 @@ function createMatrixSessionBindingAdapter(params, { manager, defaults, committe
|
|
|
193
194
|
unbindRecords
|
|
194
195
|
};
|
|
195
196
|
}
|
|
196
|
-
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region extensions/matrix/src/matrix/thread-bindings.ts
|
|
197
199
|
const THREAD_BINDINGS_NAMESPACE = "thread-bindings";
|
|
198
200
|
const THREAD_BINDINGS_MAX_ENTRIES = 1e4;
|
|
199
201
|
const THREAD_BINDINGS_SWEEP_INTERVAL_MS = 6e4;
|
|
@@ -615,4 +617,5 @@ async function createMatrixThreadBindingManager(params) {
|
|
|
615
617
|
});
|
|
616
618
|
return manager;
|
|
617
619
|
}
|
|
620
|
+
//#endregion
|
|
618
621
|
export { createMatrixThreadBindingManager as t };
|
package/dist/.setup/{thread-bindings-shared-FMu_szTm.mjs → thread-bindings-shared-CPjUA0Ib.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { projectThreadBindingRecord, resolveThreadBindingLifecycle, warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
|
|
2
|
-
|
|
2
|
+
//#region extensions/matrix/src/matrix/thread-bindings-shared.ts
|
|
3
3
|
const MANAGERS_BY_ACCOUNT_ID = /* @__PURE__ */ new Map();
|
|
4
4
|
const BINDINGS_BY_ACCOUNT_CONVERSATION = /* @__PURE__ */ new Map();
|
|
5
5
|
function resolveBindingKey(params) {
|
|
@@ -88,4 +88,5 @@ function createMatrixThreadBindingAsyncTimeoutSetter(update) {
|
|
|
88
88
|
}
|
|
89
89
|
const setMatrixThreadBindingIdleTimeoutBySessionKeyAsync = createMatrixThreadBindingAsyncTimeoutSetter((manager, params) => manager.setIdleTimeoutBySessionKeyAsync(params));
|
|
90
90
|
const setMatrixThreadBindingMaxAgeBySessionKeyAsync = createMatrixThreadBindingAsyncTimeoutSetter((manager, params) => manager.setMaxAgeBySessionKeyAsync(params));
|
|
91
|
+
//#endregion
|
|
91
92
|
export { listBindingsForAccount as a, setBindingRecord as c, setMatrixThreadBindingManagerEntry as d, setMatrixThreadBindingMaxAgeBySessionKey as f, listAllBindings as i, setMatrixThreadBindingIdleTimeoutBySessionKey as l, toSessionBindingRecord as m, getMatrixThreadBindingManager as n, removeBindingRecord as o, setMatrixThreadBindingMaxAgeBySessionKeyAsync as p, getMatrixThreadBindingManagerEntry as r, resolveBindingKey as s, deleteMatrixThreadBindingManagerEntry as t, setMatrixThreadBindingIdleTimeoutBySessionKeyAsync as u };
|