@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
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { i as sendPollMatrix, r as sendMessageMatrix } from "./send-B5XChnvB.js";
|
|
2
|
+
import { createMessageReceiptFromOutboundResults, createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
|
+
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
|
|
5
|
+
import { attachChannelToResult } from "openclaw/plugin-sdk/channel-send-result";
|
|
6
|
+
import { renderMessagePresentationFallbackText, renderPresentationForDelivery } from "openclaw/plugin-sdk/interactive-runtime";
|
|
7
|
+
import { resolveSendableOutboundReplyParts, sendPayloadMediaSequence } from "openclaw/plugin-sdk/reply-payload";
|
|
8
|
+
//#region extensions/matrix/src/outbound.ts
|
|
9
|
+
const MATRIX_OPENCLAW_PRESENTATION_KEY = "com.openclaw.presentation";
|
|
10
|
+
const MATRIX_OPENCLAW_PRESENTATION_TYPE = "message.presentation";
|
|
11
|
+
const MATRIX_EMPTY_PRESENTATION_FALLBACK_TEXT = "---";
|
|
12
|
+
const MATRIX_PRESENTATION_CAPABILITIES = {
|
|
13
|
+
supported: true,
|
|
14
|
+
buttons: true,
|
|
15
|
+
selects: true,
|
|
16
|
+
context: true,
|
|
17
|
+
divider: true,
|
|
18
|
+
limits: { text: {
|
|
19
|
+
markdownDialect: "markdown",
|
|
20
|
+
supportsEdit: true
|
|
21
|
+
} }
|
|
22
|
+
};
|
|
23
|
+
function toMatrixOutboundResult(result) {
|
|
24
|
+
const { roomId, ...delivery } = result;
|
|
25
|
+
return {
|
|
26
|
+
...delivery,
|
|
27
|
+
target: {
|
|
28
|
+
kind: "room",
|
|
29
|
+
id: roomId
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function resolveMatrixChannelData(payload) {
|
|
34
|
+
const raw = asOptionalRecord(payload.channelData)?.matrix;
|
|
35
|
+
return asOptionalRecord(raw) ?? {};
|
|
36
|
+
}
|
|
37
|
+
function buildMatrixPresentationContent(presentation) {
|
|
38
|
+
return {
|
|
39
|
+
...presentation,
|
|
40
|
+
version: 1,
|
|
41
|
+
type: MATRIX_OPENCLAW_PRESENTATION_TYPE
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function resolveMatrixPresentationContent(payload) {
|
|
45
|
+
const extraContent = asOptionalRecord(resolveMatrixChannelData(payload).extraContent);
|
|
46
|
+
const presentation = asOptionalRecord(extraContent?.[MATRIX_OPENCLAW_PRESENTATION_KEY]);
|
|
47
|
+
if (!presentation || presentation.version !== 1 || presentation.type !== MATRIX_OPENCLAW_PRESENTATION_TYPE) return;
|
|
48
|
+
return presentation;
|
|
49
|
+
}
|
|
50
|
+
function renderMatrixPresentationPayload(params) {
|
|
51
|
+
const matrixData = resolveMatrixChannelData(params.payload);
|
|
52
|
+
const fallbackText = renderMessagePresentationFallbackText({
|
|
53
|
+
text: params.payload.text,
|
|
54
|
+
presentation: params.presentation,
|
|
55
|
+
emptyFallback: MATRIX_EMPTY_PRESENTATION_FALLBACK_TEXT
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
...params.payload,
|
|
59
|
+
text: fallbackText,
|
|
60
|
+
channelData: {
|
|
61
|
+
...params.payload.channelData,
|
|
62
|
+
matrix: {
|
|
63
|
+
...matrixData,
|
|
64
|
+
extraContent: { [MATRIX_OPENCLAW_PRESENTATION_KEY]: buildMatrixPresentationContent(params.presentation) }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function prepareMatrixReplyPayload(payload) {
|
|
70
|
+
return renderPresentationForDelivery({
|
|
71
|
+
presentationCapabilities: MATRIX_PRESENTATION_CAPABILITIES,
|
|
72
|
+
renderPresentation: (prepared) => renderMatrixPresentationPayload({
|
|
73
|
+
payload: prepared,
|
|
74
|
+
presentation: prepared.presentation
|
|
75
|
+
})
|
|
76
|
+
}, payload);
|
|
77
|
+
}
|
|
78
|
+
function resolveMatrixPayloadText(payload) {
|
|
79
|
+
const text = payload.text ?? "";
|
|
80
|
+
if (text.trim() || !resolveMatrixPresentationContent(payload)) return text;
|
|
81
|
+
return MATRIX_EMPTY_PRESENTATION_FALLBACK_TEXT;
|
|
82
|
+
}
|
|
83
|
+
/** Matrix event fields a reply carries beyond its body, currently its presentation. */
|
|
84
|
+
function resolveMatrixExtraContent(payload) {
|
|
85
|
+
const presentation = resolveMatrixPresentationContent(payload);
|
|
86
|
+
return presentation ? { [MATRIX_OPENCLAW_PRESENTATION_KEY]: presentation } : void 0;
|
|
87
|
+
}
|
|
88
|
+
function resolveMatrixDeliveryProgress(onDeliveryResult) {
|
|
89
|
+
return onDeliveryResult ? async (result) => {
|
|
90
|
+
await onDeliveryResult(attachChannelToResult("matrix", toMatrixOutboundResult(result)));
|
|
91
|
+
} : void 0;
|
|
92
|
+
}
|
|
93
|
+
const matrixOutbound = {
|
|
94
|
+
deliveryMode: "direct",
|
|
95
|
+
chunker: chunkTextForOutbound,
|
|
96
|
+
chunkerMode: "markdown",
|
|
97
|
+
textChunkLimit: 4e3,
|
|
98
|
+
presentationCapabilities: MATRIX_PRESENTATION_CAPABILITIES,
|
|
99
|
+
renderPresentation: ({ payload, presentation }) => renderMatrixPresentationPayload({
|
|
100
|
+
payload,
|
|
101
|
+
presentation
|
|
102
|
+
}),
|
|
103
|
+
sendPayload: async ({ cfg, to, payload, mediaLocalRoots, mediaReadFile, mediaAccess, deps, replyToId, replyToIdSource, replyToMode, threadId, accountId, audioAsVoice, deliveryQueueId, onPlatformSendDispatch, onDeliveryResult }) => {
|
|
104
|
+
const send = resolveOutboundSendDep(deps, "matrix") ?? sendMessageMatrix;
|
|
105
|
+
const resolvedThreadId = threadId !== void 0 && threadId !== null ? String(threadId) : void 0;
|
|
106
|
+
const resolveReplyToId = createReplyToFanout({
|
|
107
|
+
...replyToId != null ? { replyToId } : {},
|
|
108
|
+
...replyToIdSource !== void 0 ? { replyToIdSource } : {},
|
|
109
|
+
...replyToMode !== void 0 ? { replyToMode } : {}
|
|
110
|
+
});
|
|
111
|
+
const urls = resolveSendableOutboundReplyParts(payload).mediaUrls;
|
|
112
|
+
const payloadText = resolveMatrixPayloadText(payload);
|
|
113
|
+
if (urls.length > 0) {
|
|
114
|
+
const sentResults = [];
|
|
115
|
+
const lastResult = await sendPayloadMediaSequence({
|
|
116
|
+
text: payloadText,
|
|
117
|
+
mediaUrls: urls,
|
|
118
|
+
send: async ({ text, mediaUrl, index, isFirst }) => await send(to, text, {
|
|
119
|
+
cfg,
|
|
120
|
+
mediaUrl,
|
|
121
|
+
mediaAccess,
|
|
122
|
+
mediaLocalRoots,
|
|
123
|
+
mediaReadFile,
|
|
124
|
+
replyToId: resolveReplyToId(),
|
|
125
|
+
threadId: resolvedThreadId,
|
|
126
|
+
accountId: accountId ?? void 0,
|
|
127
|
+
audioAsVoice: payload.audioAsVoice ?? audioAsVoice,
|
|
128
|
+
deliveryQueueId,
|
|
129
|
+
deliveryPartIndex: index,
|
|
130
|
+
deliveryPartCount: urls.length,
|
|
131
|
+
onPlatformSendDispatch,
|
|
132
|
+
extraContent: isFirst ? resolveMatrixExtraContent(payload) : void 0,
|
|
133
|
+
onDeliveryResult: resolveMatrixDeliveryProgress(onDeliveryResult)
|
|
134
|
+
}),
|
|
135
|
+
onResult: (result) => {
|
|
136
|
+
sentResults.push(result);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
if (lastResult !== void 0) {
|
|
140
|
+
const receipt = createMessageReceiptFromOutboundResults({ results: sentResults });
|
|
141
|
+
receipt.parts = receipt.parts.map((part, index) => ({
|
|
142
|
+
...part,
|
|
143
|
+
index
|
|
144
|
+
}));
|
|
145
|
+
return attachChannelToResult("matrix", toMatrixOutboundResult({
|
|
146
|
+
...lastResult,
|
|
147
|
+
primaryMessageId: receipt.primaryPlatformMessageId,
|
|
148
|
+
receipt,
|
|
149
|
+
content: sentResults.map((result) => result.content).join("\n")
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const result = await send(to, payloadText, {
|
|
154
|
+
cfg,
|
|
155
|
+
mediaAccess,
|
|
156
|
+
mediaLocalRoots,
|
|
157
|
+
mediaReadFile,
|
|
158
|
+
replyToId: resolveReplyToId(),
|
|
159
|
+
threadId: resolvedThreadId,
|
|
160
|
+
accountId: accountId ?? void 0,
|
|
161
|
+
audioAsVoice: payload.audioAsVoice ?? audioAsVoice,
|
|
162
|
+
deliveryQueueId,
|
|
163
|
+
deliveryPartIndex: 0,
|
|
164
|
+
deliveryPartCount: 1,
|
|
165
|
+
onPlatformSendDispatch,
|
|
166
|
+
extraContent: resolveMatrixExtraContent(payload),
|
|
167
|
+
onDeliveryResult: resolveMatrixDeliveryProgress(onDeliveryResult)
|
|
168
|
+
});
|
|
169
|
+
return attachChannelToResult("matrix", toMatrixOutboundResult(result));
|
|
170
|
+
},
|
|
171
|
+
sendText: async ({ cfg, to, text, deps, replyToId, threadId, accountId, audioAsVoice, deliveryQueueId, deliveryPartIndex, deliveryPartCount, onPlatformSendDispatch, onDeliveryResult }) => {
|
|
172
|
+
const result = await (resolveOutboundSendDep(deps, "matrix") ?? sendMessageMatrix)(to, text, {
|
|
173
|
+
cfg,
|
|
174
|
+
replyToId: replyToId ?? void 0,
|
|
175
|
+
threadId: threadId !== void 0 && threadId !== null ? String(threadId) : void 0,
|
|
176
|
+
accountId: accountId ?? void 0,
|
|
177
|
+
audioAsVoice,
|
|
178
|
+
deliveryQueueId,
|
|
179
|
+
deliveryPartIndex,
|
|
180
|
+
...deliveryQueueId !== void 0 ? { deliveryPartCount } : {},
|
|
181
|
+
onPlatformSendDispatch,
|
|
182
|
+
onDeliveryResult: resolveMatrixDeliveryProgress(onDeliveryResult)
|
|
183
|
+
});
|
|
184
|
+
return attachChannelToResult("matrix", toMatrixOutboundResult(result));
|
|
185
|
+
},
|
|
186
|
+
sendMedia: async ({ cfg, to, text, mediaUrl, mediaLocalRoots, mediaReadFile, mediaAccess, deps, replyToId, threadId, accountId, audioAsVoice, deliveryQueueId, deliveryPartIndex, deliveryPartCount, onPlatformSendDispatch, onDeliveryResult }) => {
|
|
187
|
+
const result = await (resolveOutboundSendDep(deps, "matrix") ?? sendMessageMatrix)(to, text, {
|
|
188
|
+
cfg,
|
|
189
|
+
mediaUrl,
|
|
190
|
+
mediaLocalRoots,
|
|
191
|
+
mediaReadFile,
|
|
192
|
+
mediaAccess,
|
|
193
|
+
replyToId: replyToId ?? void 0,
|
|
194
|
+
threadId: threadId !== void 0 && threadId !== null ? String(threadId) : void 0,
|
|
195
|
+
accountId: accountId ?? void 0,
|
|
196
|
+
audioAsVoice,
|
|
197
|
+
deliveryQueueId,
|
|
198
|
+
deliveryPartIndex,
|
|
199
|
+
...deliveryQueueId !== void 0 ? { deliveryPartCount } : {},
|
|
200
|
+
onPlatformSendDispatch,
|
|
201
|
+
onDeliveryResult: resolveMatrixDeliveryProgress(onDeliveryResult)
|
|
202
|
+
});
|
|
203
|
+
return attachChannelToResult("matrix", toMatrixOutboundResult(result));
|
|
204
|
+
},
|
|
205
|
+
sendPoll: async ({ cfg, to, poll, threadId, accountId }) => {
|
|
206
|
+
const result = await sendPollMatrix(to, poll, {
|
|
207
|
+
cfg,
|
|
208
|
+
threadId: threadId !== void 0 && threadId !== null ? threadId : void 0,
|
|
209
|
+
accountId: accountId ?? void 0
|
|
210
|
+
});
|
|
211
|
+
return {
|
|
212
|
+
channel: "matrix",
|
|
213
|
+
messageId: result.eventId,
|
|
214
|
+
roomId: result.roomId,
|
|
215
|
+
pollId: result.eventId
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
//#endregion
|
|
220
|
+
export { prepareMatrixReplyPayload as n, resolveMatrixExtraContent as r, matrixOutbound as t };
|
|
@@ -2,7 +2,7 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
4
4
|
//#region extensions/matrix/src/plugin-entry.runtime.ts
|
|
5
|
-
const loadMatrixVerificationRuntime = createLazyRuntimeModule(() => import("./verification-
|
|
5
|
+
const loadMatrixVerificationRuntime = createLazyRuntimeModule(() => import("./verification-XJtTc5DI.js").then((n) => n.y));
|
|
6
6
|
function sendError(respond, err) {
|
|
7
7
|
respond(false, { error: formatErrorMessage(err) });
|
|
8
8
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
|
-
import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-
|
|
3
|
-
import { r as syncMatrixOwnProfile } from "./profile-
|
|
4
|
-
import { n as withResolvedActionClient } from "./client-
|
|
2
|
+
import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-BnX26jCO.js";
|
|
3
|
+
import { r as syncMatrixOwnProfile } from "./profile-vmjsmhh4.js";
|
|
4
|
+
import { n as withResolvedActionClient } from "./client-oNOlldJI.js";
|
|
5
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
6
6
|
//#region extensions/matrix/src/matrix/actions/profile.ts
|
|
7
7
|
async function updateMatrixOwnProfile(opts = {}) {
|
|
@@ -10,9 +10,10 @@ async function updateMatrixOwnProfile(opts = {}) {
|
|
|
10
10
|
const avatarPath = opts.avatarPath?.trim();
|
|
11
11
|
const runtime = getMatrixRuntime();
|
|
12
12
|
return await withResolvedActionClient(opts, async (client) => {
|
|
13
|
+
const userId = await client.getUserId();
|
|
13
14
|
return await syncMatrixOwnProfile({
|
|
14
15
|
client,
|
|
15
|
-
userId
|
|
16
|
+
userId,
|
|
16
17
|
displayName: displayName || void 0,
|
|
17
18
|
avatarUrl: avatarUrl || void 0,
|
|
18
19
|
avatarPath: avatarPath || void 0,
|
|
@@ -5,7 +5,7 @@ var profile_exports = /* @__PURE__ */ __exportAll({
|
|
|
5
5
|
isSupportedMatrixAvatarSource: () => isSupportedMatrixAvatarSource,
|
|
6
6
|
syncMatrixOwnProfile: () => syncMatrixOwnProfile
|
|
7
7
|
});
|
|
8
|
-
const MATRIX_PROFILE_AVATAR_MAX_BYTES =
|
|
8
|
+
const MATRIX_PROFILE_AVATAR_MAX_BYTES = 10485760;
|
|
9
9
|
function isMatrixMxcUri(value) {
|
|
10
10
|
return normalizeLowercaseStringOrEmpty(normalizeOptionalString(value)).startsWith("mxc://");
|
|
11
11
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as resolveMatrixAccountConfig } from "./account-config-
|
|
2
|
-
import { a as resolveMatrixThreadRootId, o as resolveMatrixThreadRouting, r as resolveMatrixInboundRoute } from "./channel-
|
|
1
|
+
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
|
+
import { a as resolveMatrixThreadRootId, o as resolveMatrixThreadRouting, r as resolveMatrixInboundRoute } from "./channel-Bs8VLb6q.js";
|
|
3
3
|
import { a as extractMatrixReactionAnnotation } from "./reaction-common-DkrQdBSZ.js";
|
|
4
|
-
import { i as resolveMatrixApprovalReactionTargetWithPersistence, o as unregisterMatrixApprovalReactionTargetsForApproval } from "./approval-reactions-
|
|
4
|
+
import { i as resolveMatrixApprovalReactionTargetWithPersistence, o as unregisterMatrixApprovalReactionTargetsForApproval } from "./approval-reactions-1fwEhoK9.js";
|
|
5
5
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
6
|
import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
|
|
7
7
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
8
8
|
import { getSessionBindingService } from "openclaw/plugin-sdk/session-binding-runtime";
|
|
9
9
|
//#region extensions/matrix/src/matrix/monitor/reaction-events.ts
|
|
10
|
-
const loadApprovalReactionAuth = createLazyRuntimeModule(() => import("./approval-reaction-auth-
|
|
10
|
+
const loadApprovalReactionAuth = createLazyRuntimeModule(() => import("./approval-reaction-auth-DhH8QOSe.js"));
|
|
11
11
|
const loadExecApprovalResolver = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/approval-gateway-runtime"));
|
|
12
|
-
const loadMatrixSend = createLazyRuntimeModule(() => import("./send-
|
|
12
|
+
const loadMatrixSend = createLazyRuntimeModule(() => import("./send-B5XChnvB.js").then((n) => n.s));
|
|
13
13
|
function buildMatrixApprovalTerminalText(result) {
|
|
14
14
|
const approval = result.approval;
|
|
15
15
|
const terminalLabel = approval.status === "allowed" ? approval.decision === "allow-always" ? "Allowed always" : "Allowed once" : approval.status === "denied" ? "Denied" : approval.status === "expired" ? "Expired" : "Cancelled";
|
|
@@ -152,10 +152,12 @@ async function handleInboundMatrixReaction(params) {
|
|
|
152
152
|
isDirectMessage: params.isDirectMessage,
|
|
153
153
|
dmSessionScope: accountConfig.dm?.sessionScope ?? "per-user",
|
|
154
154
|
threadId: thread.threadId,
|
|
155
|
-
eventTs: params.event.origin_server_ts,
|
|
156
155
|
resolveAgentRoute: params.core.channel.routing.resolveAgentRoute
|
|
157
156
|
});
|
|
158
|
-
if (runtimeBindingId) getSessionBindingService().touch(runtimeBindingId, params.event.origin_server_ts
|
|
157
|
+
if (runtimeBindingId) getSessionBindingService().touch(runtimeBindingId, params.event.origin_server_ts, {
|
|
158
|
+
channel: "matrix",
|
|
159
|
+
accountId: params.accountId
|
|
160
|
+
});
|
|
159
161
|
const text = `Matrix reaction added: ${reaction.key} by ${params.senderLabel} on msg ${reaction.eventId}`;
|
|
160
162
|
params.core.system.enqueueSystemEvent(text, {
|
|
161
163
|
sessionKey: route.sessionKey,
|
|
@@ -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 { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-
|
|
3
|
+
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DLUgWBhA.js";
|
|
4
4
|
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/matrix/src/resolve-targets.ts
|
|
6
6
|
var resolve_targets_exports = /* @__PURE__ */ __exportAll({ resolveMatrixTargets: () => resolveMatrixTargets });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as resolveMatrixTargets } from "./resolve-targets-
|
|
1
|
+
import { t as resolveMatrixTargets } from "./resolve-targets-B64O69Nd.js";
|
|
2
2
|
//#region extensions/matrix/src/resolver.runtime.ts
|
|
3
3
|
const matrixResolverRuntime = { resolveMatrixTargets };
|
|
4
4
|
//#endregion
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { b as resolveMatrixRoomId } from "./send-B5XChnvB.js";
|
|
2
|
+
import { s as EventType } from "./messages-Czn8lNEh.js";
|
|
3
|
+
import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-oNOlldJI.js";
|
|
1
4
|
import { n as isMatrixNotFoundError } from "./errors-DKVS3_DO.js";
|
|
2
5
|
//#region extensions/matrix/src/matrix/monitor/bounded-cache.ts
|
|
3
6
|
function setBoundedMap(map, key, value, maxEntries) {
|
|
@@ -7,6 +10,57 @@ function setBoundedMap(map, key, value, maxEntries) {
|
|
|
7
10
|
if (!oldest.done) map.delete(oldest.value);
|
|
8
11
|
}
|
|
9
12
|
//#endregion
|
|
13
|
+
//#region extensions/matrix/src/matrix/actions/room.ts
|
|
14
|
+
async function getMatrixMemberInfo(userId, opts) {
|
|
15
|
+
return await withResolvedActionClient(opts, async (client) => {
|
|
16
|
+
const roomId = await resolveMatrixRoomId(client, opts.roomId);
|
|
17
|
+
if (!(await client.getJoinedRoomMembers(roomId)).includes(userId)) throw new Error(`User ${userId} is not a member of room ${roomId}`);
|
|
18
|
+
const profile = await client.getUserProfile(userId);
|
|
19
|
+
return {
|
|
20
|
+
userId,
|
|
21
|
+
profile: {
|
|
22
|
+
displayName: profile?.displayname ?? null,
|
|
23
|
+
avatarUrl: profile?.avatar_url ?? null
|
|
24
|
+
},
|
|
25
|
+
membership: null,
|
|
26
|
+
powerLevel: null,
|
|
27
|
+
displayName: profile?.displayname ?? null,
|
|
28
|
+
roomId
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async function getMatrixRoomInfo(roomId, opts = {}) {
|
|
33
|
+
return await withResolvedRoomAction(roomId, opts, async (client, resolvedRoom) => {
|
|
34
|
+
let name = null;
|
|
35
|
+
let topic = null;
|
|
36
|
+
let canonicalAlias = null;
|
|
37
|
+
let memberCount = null;
|
|
38
|
+
try {
|
|
39
|
+
const nameState = await client.getRoomStateEvent(resolvedRoom, "m.room.name", "");
|
|
40
|
+
name = typeof nameState?.name === "string" ? nameState.name : null;
|
|
41
|
+
} catch {}
|
|
42
|
+
try {
|
|
43
|
+
const topicState = await client.getRoomStateEvent(resolvedRoom, EventType.RoomTopic, "");
|
|
44
|
+
topic = typeof topicState?.topic === "string" ? topicState.topic : null;
|
|
45
|
+
} catch {}
|
|
46
|
+
try {
|
|
47
|
+
const aliasState = await client.getRoomStateEvent(resolvedRoom, "m.room.canonical_alias", "");
|
|
48
|
+
canonicalAlias = typeof aliasState?.alias === "string" ? aliasState.alias : null;
|
|
49
|
+
} catch {}
|
|
50
|
+
try {
|
|
51
|
+
memberCount = (await client.getJoinedRoomMembers(resolvedRoom)).length;
|
|
52
|
+
} catch {}
|
|
53
|
+
return {
|
|
54
|
+
roomId: resolvedRoom,
|
|
55
|
+
name,
|
|
56
|
+
topic,
|
|
57
|
+
canonicalAlias,
|
|
58
|
+
altAliases: [],
|
|
59
|
+
memberCount
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
10
64
|
//#region extensions/matrix/src/matrix/monitor/room-info.ts
|
|
11
65
|
const MAX_ROOM_INFO = 1024;
|
|
12
66
|
const MAX_MEMBER_DISPLAY_NAMES = 4096;
|
|
@@ -93,4 +147,4 @@ function createMatrixRoomInfoResolver(client) {
|
|
|
93
147
|
};
|
|
94
148
|
}
|
|
95
149
|
//#endregion
|
|
96
|
-
export { setBoundedMap as n, createMatrixRoomInfoResolver as t };
|
|
150
|
+
export { setBoundedMap as i, getMatrixMemberInfo as n, getMatrixRoomInfo as r, createMatrixRoomInfoResolver as t };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig,
|
|
1
|
+
import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, l as resolveMatrixAccountStringValues, 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 { r as setMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
4
4
|
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";
|
|
5
5
|
import { f as setMatrixThreadBindingMaxAgeBySessionKey, u as setMatrixThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings-shared-oNPiyMWY.js";
|
|
6
|
-
import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-
|
|
6
|
+
import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-mtxF2mHI.js";
|
|
7
7
|
import { chunkTextForOutbound as chunkTextForOutbound$1 } from "openclaw/plugin-sdk/text-chunking";
|
|
8
8
|
import { assertHttpUrlTargetsPrivateNetwork, closeDispatcher, createPinnedDispatcher, resolvePinnedHostnameWithPolicy, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
9
9
|
import { writeJsonFileAtomically } from "openclaw/plugin-sdk/json-store";
|