@openclaw/matrix 2026.7.2-beta.7 → 2026.8.1-beta.3
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-selection-kqquRzCf.js → account-selection-CWuhuFn1.js} +7 -8
- package/dist/{accounts-DfngqebB.js → accounts-BCzyubQt.js} +3 -3
- package/dist/api.js +8 -11
- package/dist/{approval-handler.runtime-DSeaIsGa.js → approval-handler.runtime-CSvueU9P.js} +7 -6
- package/dist/{approval-ids-BdJGPAJT.js → approval-ids-CEcf-EiM.js} +1 -1
- package/dist/{approval-reaction-auth-BjOpELxu.js → approval-reaction-auth-CziKXatm.js} +2 -2
- package/dist/{approval-reactions-D-BxBK_L.js → approval-reactions-tXh9KYrW.js} +2 -8
- package/dist/auth-presence.js +2 -2
- package/dist/{channel-vj788dNZ.js → channel-CzQw5OZN.js} +376 -148
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-CLoF2S9T.js → channel.runtime-I9pBRQb3.js} +79 -55
- package/dist/{config-schema-Djxw3C6b.js → channel.setup-aNaa3Uyn.js} +51 -10
- package/dist/{cli-DMqfDE-q.js → cli-iR6QJ5U0.js} +16 -16
- package/dist/{cli-metadata-C7D53SND.js → cli-metadata-BmUYWjuM.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-BBQdBG7t.js +799 -0
- package/dist/{client-6eRENr7k.js → client-D8XghqmX.js} +4 -4
- package/dist/{client-bootstrap-XsIkHNt0.js → client-bootstrap-Co3RlItb.js} +25 -61
- package/dist/client-support-DLj4vDeu.js +93 -0
- package/dist/config-update-Bor_Pjsv.js +150 -0
- package/dist/contract-api.js +2 -2
- package/dist/{credentials-W2EmwRhu.js → credentials-BdAaWuiR.js} +2 -1
- package/dist/credentials-read-B37cQknZ.js +51 -0
- package/dist/credentials-state-B3cuUFwZ.js +27 -0
- package/dist/{credentials-write.runtime-Be9zNSUw.js → credentials-write.runtime-nAV2-5uR.js} +1 -1
- package/dist/{crypto-runtime-D9_6J5tZ.js → crypto-runtime-Bnz3zEcS.js} +55 -32
- package/dist/direct-room-RinHjtqX.js +71 -0
- package/dist/{directory-live-C8dVBiCc.js → directory-live-DLQzel12.js} +2 -3
- package/dist/{doctor-CM8ijNpW.js → doctor-EWf9CDso.js} +2 -2
- package/dist/{doctor-contract-BMSJkkAE.js → doctor-contract-DEt4O4Zt.js} +2 -3
- package/dist/doctor-contract-api.js +209 -91
- package/dist/{draft-stream-CtvOXq0Z.js → draft-stream-DQ7QNC-l.js} +20 -23
- package/dist/{encryption-guidance-CbEFe38F.js → encryption-guidance-DmLY8NiO.js} +1 -1
- package/dist/{env-auth-CQsYbz-p.js → env-auth-MVS-Vv41.js} +4 -3
- package/dist/{env-vars-B0NxQnPk.js → env-vars-dGqak9dN.js} +1 -1
- package/dist/{errors-C47hvAF8.js → errors-DKVS3_DO.js} +2 -5
- package/dist/{file-sync-store-DiiFsayX.js → file-sync-store-DjskBX2o.js} +24 -3
- package/dist/helper-api.js +2 -2
- package/dist/{idb-persistence-B6x7dMsF.js → idb-persistence-BM0P27Zg.js} +3 -2
- package/dist/{inbound-dedupe-CaBLblef.js → inbound-dedupe-RvSLqdsz.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{logger-D0GCSDQq.js → logger-B_71hN6W.js} +1 -1
- package/dist/{logging-DV-p52N0.js → logging-DRjvUOIh.js} +1 -1
- package/dist/{media-text-BTwzADS_.js → media-text-Dh-DpTc3.js} +4 -1
- package/dist/{messages-DxQJkhxs.js → messages-DEqg7HVy.js} +31 -11
- package/dist/{monitor-VyWlSLwo.js → monitor-FNrfkuWL.js} +413 -405
- package/dist/plugin-entry.handlers.runtime.js +3 -3
- package/dist/probe.runtime-NIJZYqc2.js +2 -0
- package/dist/profile-D-Wubo0A.js +108 -0
- package/dist/{profile-update-CffmyW_4.js → profile-update-BQlE5s2J.js} +3 -2
- package/dist/{reaction-events-B00WSi98.js → reaction-events-BKOLlnCo.js} +10 -7
- package/dist/{recovery-key-store-BNnHvXdk.js → recovery-key-store-CognuDys.js} +5 -4
- package/dist/{resolve-targets-nm2L48sh.js → resolve-targets-e7AI0P75.js} +2 -2
- package/dist/{resolver.runtime-DS6uPaEe.js → resolver.runtime-V8u0pHEb.js} +1 -1
- package/dist/{room-info-CAFZ3Z9J.js → room-info-BXQA7y10.js} +12 -3
- package/dist/runtime-api.js +7 -4
- package/dist/{sdk-bUytQHx7.js → sdk-NxK3vzMa.js} +242 -119
- package/dist/{secret-contract-M3hRmGO-.js → secret-contract-CufozuyJ.js} +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/{send-BldGYG8g.js → send-ClHgDZLT.js} +1477 -1210
- package/dist/session-binding-contract-api.js +2 -3
- package/dist/{setup-bootstrap-Deleiibz.js → setup-bootstrap-BGPjbA5N.js} +4 -4
- package/dist/{setup-core-BVfBv2ai.js → setup-core-DigrLebY.js} +17 -266
- package/dist/setup-plugin-api.js +1 -44
- package/dist/{setup-surface-BBq3WeqX.js → setup-surface-Dtn8sAWs.js} +15 -16
- package/dist/{startup-verification-wm3_i88s.js → startup-verification-Cs08ca8u.js} +3 -3
- package/dist/{storage-BvAkgzvT.js → storage-BsGuHngK.js} +3 -3
- package/dist/subagent-hooks-CMoZaARG.js +48 -0
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{target-ids-B-5aQxwn.js → target-ids-Nwx7cMVE.js} +11 -1
- package/dist/{thread-binding-api-DRbBZlhS.js → thread-binding-api-CzkeLZCU.js} +1 -1
- package/dist/thread-binding-api.js +1 -1
- package/dist/{thread-bindings-DGbl3vDW.js → thread-bindings-BYEGfw3h.js} +17 -10
- package/dist/thread-bindings-runtime.js +1 -1
- package/dist/{thread-bindings-shared-CKnY4LSd.js → thread-bindings-shared-oNPiyMWY.js} +1 -6
- package/dist/{tool-actions.runtime-uu9blSqO.js → tool-actions.runtime-ck6IJyP0.js} +36 -19
- package/dist/{verification-DYMQ1QpI.js → verification-CabtBTtB.js} +2 -2
- package/openclaw.plugin.json +61 -1
- package/package.json +4 -4
- package/dist/active-client-DXvz2gCo.js +0 -20
- package/dist/client-Dbso3-0V.js +0 -30
- package/dist/create-client-BmSU-q-D.js +0 -61
- package/dist/credentials-read-DVmFCm7X.js +0 -77
- package/dist/exec-approval-resolver-BCgqRtZS.js +0 -16
- package/dist/preflight-audio.runtime-BZxxQsxY.js +0 -11
- package/dist/probe.runtime-BuieqmS3.js +0 -3
- package/dist/record-shared-CWWx6fvI.js +0 -2
- package/dist/route-DY6at4qJ.js +0 -161
- package/dist/shared-CUMWxcMz.js +0 -673
- package/dist/subagent-hooks-dkPAF6Et.js +0 -143
- package/dist/sync-state-CWbp0QSY.js +0 -12
- package/dist/{runtime-api-D1xI_cvh.js → runtime-api-BGO16Fu8.js} +3 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
|
-
import { a as listBindingsForAccount, c as
|
|
3
|
-
import { M as resolveMatrixSqliteStateEnv, N as resolveMatrixSqliteStateKey, c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-
|
|
4
|
-
import { r as sendMessageMatrix } from "./send-
|
|
2
|
+
import { a as listBindingsForAccount, c as resolveEffectiveBindingExpiry, d as setMatrixThreadBindingManagerEntry, l as setBindingRecord, m as toSessionBindingRecord, o as removeBindingRecord, p as toMatrixBindingTargetKind, r as getMatrixThreadBindingManagerEntry, s as resolveBindingKey, t as deleteMatrixThreadBindingManagerEntry } from "./thread-bindings-shared-oNPiyMWY.js";
|
|
3
|
+
import { M as resolveMatrixSqliteStateEnv, N as resolveMatrixSqliteStateKey, c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-BsGuHngK.js";
|
|
4
|
+
import { r as sendMessageMatrix } from "./send-ClHgDZLT.js";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { registerSessionBindingAdapter, resolveThreadBindingFarewellText, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
|
-
import {
|
|
10
|
+
import { resolveSessionAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
11
11
|
import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
|
|
12
12
|
import { resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
|
|
13
13
|
//#region extensions/matrix/src/matrix/thread-bindings.ts
|
|
@@ -153,7 +153,7 @@ async function createMatrixThreadBindingManager(params) {
|
|
|
153
153
|
const existingEntry = getMatrixThreadBindingManagerEntry(params.accountId);
|
|
154
154
|
if (existingEntry) {
|
|
155
155
|
if (existingEntry.storageKey === storageKey) return existingEntry.manager;
|
|
156
|
-
existingEntry.manager.stop();
|
|
156
|
+
await existingEntry.manager.stop();
|
|
157
157
|
}
|
|
158
158
|
const pluginLoaded = await loadBindingsFromPluginState({
|
|
159
159
|
accountId: params.accountId,
|
|
@@ -274,20 +274,24 @@ async function createMatrixThreadBindingManager(params) {
|
|
|
274
274
|
})
|
|
275
275
|
});
|
|
276
276
|
},
|
|
277
|
-
stop: () => {
|
|
277
|
+
stop: async () => {
|
|
278
278
|
if (sweepTimer) clearInterval(sweepTimer);
|
|
279
|
+
let finalPersist = persistQueue;
|
|
279
280
|
if (persistTimer) {
|
|
280
281
|
clearTimeout(persistTimer);
|
|
281
282
|
persistTimer = null;
|
|
282
|
-
|
|
283
|
+
finalPersist = enqueuePersist();
|
|
283
284
|
}
|
|
284
285
|
unregisterSessionBindingAdapter({
|
|
285
286
|
channel: "matrix",
|
|
286
287
|
accountId: params.accountId,
|
|
287
288
|
adapter: sessionBindingAdapter
|
|
288
289
|
});
|
|
289
|
-
if (getMatrixThreadBindingManagerEntry(params.accountId)?.manager === manager)
|
|
290
|
-
|
|
290
|
+
if (getMatrixThreadBindingManagerEntry(params.accountId)?.manager === manager) {
|
|
291
|
+
deleteMatrixThreadBindingManagerEntry(params.accountId);
|
|
292
|
+
for (const record of listBindingsForAccount(params.accountId)) removeBindingRecord(record);
|
|
293
|
+
}
|
|
294
|
+
await finalPersist;
|
|
291
295
|
}
|
|
292
296
|
};
|
|
293
297
|
let sweepTimer = null;
|
|
@@ -354,7 +358,10 @@ async function createMatrixThreadBindingManager(params) {
|
|
|
354
358
|
...boundParentConversationId ? { parentConversationId: boundParentConversationId } : {},
|
|
355
359
|
targetKind: toMatrixBindingTargetKind(input.targetKind),
|
|
356
360
|
targetSessionKey,
|
|
357
|
-
agentId: normalizeOptionalString(input.metadata?.agentId)
|
|
361
|
+
agentId: normalizeOptionalString(input.metadata?.agentId) ?? resolveSessionAgentId({
|
|
362
|
+
config: params.cfg,
|
|
363
|
+
sessionKey: targetSessionKey
|
|
364
|
+
}),
|
|
358
365
|
label: normalizeOptionalString(input.metadata?.label) || void 0,
|
|
359
366
|
boundBy: normalizeOptionalString(input.metadata?.boundBy) || "system",
|
|
360
367
|
boundAt: now,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as setMatrixThreadBindingMaxAgeBySessionKey, u as setMatrixThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings-shared-oNPiyMWY.js";
|
|
2
2
|
export { setMatrixThreadBindingIdleTimeoutBySessionKey, setMatrixThreadBindingMaxAgeBySessionKey };
|
|
@@ -88,10 +88,5 @@ function setMatrixThreadBindingMaxAgeBySessionKey(params) {
|
|
|
88
88
|
maxAgeMs: manager.getMaxAgeMs()
|
|
89
89
|
}));
|
|
90
90
|
}
|
|
91
|
-
function resetMatrixThreadBindingsForTests() {
|
|
92
|
-
for (const { manager } of MANAGERS_BY_ACCOUNT_ID.values()) manager.stop();
|
|
93
|
-
MANAGERS_BY_ACCOUNT_ID.clear();
|
|
94
|
-
BINDINGS_BY_ACCOUNT_CONVERSATION.clear();
|
|
95
|
-
}
|
|
96
91
|
//#endregion
|
|
97
|
-
export { listBindingsForAccount as a,
|
|
92
|
+
export { listBindingsForAccount as a, resolveEffectiveBindingExpiry as c, setMatrixThreadBindingManagerEntry as d, setMatrixThreadBindingMaxAgeBySessionKey as f, listAllBindings as i, setBindingRecord as l, toSessionBindingRecord as m, getMatrixThreadBindingManager as n, removeBindingRecord as o, toMatrixBindingTargetKind as p, getMatrixThreadBindingManagerEntry as r, resolveBindingKey as s, deleteMatrixThreadBindingManagerEntry as t, setMatrixThreadBindingIdleTimeoutBySessionKey as u };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig } from "./account-config-BZWN9tGS.js";
|
|
2
|
-
import { i as resolveMatrixAccount } from "./accounts-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { E as parsePollStart, T as isPollStartType, b as buildPollResponseContent, c as resolveMatrixRoomId, h as readJoinedMatrixMembers, m as isStrictDirectMembership, n as reactMatrixMessage, p as hasDirectMatrixMemberFlag } from "./send-BldGYG8g.js";
|
|
2
|
+
import { i as resolveMatrixAccount } from "./accounts-BCzyubQt.js";
|
|
3
|
+
import { l as resolveMatrixRoomConfig } from "./channel-CzQw5OZN.js";
|
|
4
|
+
import { i as normalizeMatrixResolvableTarget } from "./target-ids-Nwx7cMVE.js";
|
|
6
5
|
import { i as buildMatrixReactionRelationsPath, o as selectOwnMatrixReactionEventIds, s as summarizeMatrixReactionEvents } from "./reaction-common-DkrQdBSZ.js";
|
|
7
|
-
import { n as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { t as
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
6
|
+
import { g as parsePollStart, h as isPollStartType, n as reactMatrixMessage, u as buildPollResponseContent, x as resolveMatrixRoomId } from "./send-ClHgDZLT.js";
|
|
7
|
+
import { i as isStrictDirectMembership, n as hasDirectMatrixMemberFlag, o as readJoinedMatrixMembers } from "./direct-room-RinHjtqX.js";
|
|
8
|
+
import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-D8XghqmX.js";
|
|
9
|
+
import { a as fetchEventSummary, c as resolveMatrixActionLimit, i as sendMatrixMessage, n as editMatrixMessage, o as readPinnedEvents, r as readMatrixMessages, s as EventType, t as deleteMatrixMessage } from "./messages-DEqg7HVy.js";
|
|
10
|
+
import { c as readReactionParams, d as resolveAllowlistProviderRuntimeGroupPolicy, f as resolveDefaultGroupPolicy, i as createActionGate, l as readStringArrayParam, n as ToolAuthorizationError, o as jsonResult, s as readPositiveIntegerParam, u as readStringParam } from "./runtime-api-BGO16Fu8.js";
|
|
11
|
+
import { t as applyMatrixProfileUpdate } from "./profile-update-BQlE5s2J.js";
|
|
12
|
+
import { _ as scanMatrixVerificationQr, a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, h as restoreMatrixRoomKeyBackup, i as confirmMatrixVerificationReciprocateQr, l as getMatrixVerificationSas, n as bootstrapMatrixVerification, o as generateMatrixVerificationQr, p as requestMatrixVerification, r as cancelMatrixVerification, s as getMatrixEncryptionStatus, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-CabtBTtB.js";
|
|
13
|
+
import { t as createMatrixRoomInfoResolver } from "./room-info-BXQA7y10.js";
|
|
13
14
|
import { normalizeOptionalLowercaseString, uniqueStrings, uniqueValues } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
15
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
15
16
|
//#region extensions/matrix/src/matrix/actions/polls.ts
|
|
@@ -64,12 +65,23 @@ async function voteMatrixPoll(roomId, pollId, opts = {}) {
|
|
|
64
65
|
}
|
|
65
66
|
//#endregion
|
|
66
67
|
//#region extensions/matrix/src/matrix/actions/reactions.ts
|
|
67
|
-
async function listMatrixReactionEvents(client, roomId, messageId, limit) {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
async function listMatrixReactionEvents(client, roomId, messageId, limit, opts = {}) {
|
|
69
|
+
const events = [];
|
|
70
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
71
|
+
let cursor;
|
|
72
|
+
while (true) {
|
|
73
|
+
const res = await client.doRequest("GET", buildMatrixReactionRelationsPath(roomId, messageId), {
|
|
74
|
+
dir: "b",
|
|
75
|
+
limit,
|
|
76
|
+
...cursor ? { from: cursor } : {}
|
|
77
|
+
});
|
|
78
|
+
if (Array.isArray(res.chunk)) events.push(...res.chunk);
|
|
79
|
+
const nextCursor = typeof res.next_batch === "string" ? res.next_batch.trim() : "";
|
|
80
|
+
if (!nextCursor || !opts.allPages && events.length >= limit) return events;
|
|
81
|
+
if (seenCursors.has(nextCursor)) throw new Error("Matrix reaction pagination returned a repeated cursor");
|
|
82
|
+
seenCursors.add(nextCursor);
|
|
83
|
+
cursor = nextCursor;
|
|
84
|
+
}
|
|
73
85
|
}
|
|
74
86
|
async function listMatrixReactions(roomId, messageId, opts = {}) {
|
|
75
87
|
return await withResolvedRoomAction(roomId, opts, async (client, resolvedRoom) => {
|
|
@@ -78,7 +90,7 @@ async function listMatrixReactions(roomId, messageId, opts = {}) {
|
|
|
78
90
|
}
|
|
79
91
|
async function removeMatrixReactions(roomId, messageId, opts = {}) {
|
|
80
92
|
return await withResolvedRoomAction(roomId, opts, async (client, resolvedRoom) => {
|
|
81
|
-
const chunk = await listMatrixReactionEvents(client, resolvedRoom, messageId, 200);
|
|
93
|
+
const chunk = await listMatrixReactionEvents(client, resolvedRoom, messageId, 200, { allPages: true });
|
|
82
94
|
const userId = await client.getUserId();
|
|
83
95
|
if (!userId) return { removed: 0 };
|
|
84
96
|
const toRemove = selectOwnMatrixReactionEventIds(chunk, userId, opts.emoji);
|
|
@@ -456,7 +468,8 @@ async function handleMatrixAction(params, cfg, opts = {}) {
|
|
|
456
468
|
const mediaUrl = readStringParam(params, "mediaUrl", { trim: false }) ?? readStringParam(params, "media", { trim: false }) ?? readStringParam(params, "filePath", { trim: false }) ?? readStringParam(params, "path", { trim: false });
|
|
457
469
|
const content = readStringParam(params, "content", {
|
|
458
470
|
required: !mediaUrl,
|
|
459
|
-
allowEmpty: true
|
|
471
|
+
allowEmpty: true,
|
|
472
|
+
trim: false
|
|
460
473
|
});
|
|
461
474
|
const replyToId = readStringParam(params, "replyToId") ?? readStringParam(params, "replyTo");
|
|
462
475
|
const threadId = readStringParam(params, "threadId");
|
|
@@ -465,6 +478,7 @@ async function handleMatrixAction(params, cfg, opts = {}) {
|
|
|
465
478
|
ok: true,
|
|
466
479
|
result: await sendMatrixMessage(to, content, {
|
|
467
480
|
mediaUrl: mediaUrl ?? void 0,
|
|
481
|
+
...opts.mediaAccess ? { mediaAccess: opts.mediaAccess } : {},
|
|
468
482
|
mediaLocalRoots: opts.mediaLocalRoots,
|
|
469
483
|
replyToId: replyToId ?? void 0,
|
|
470
484
|
threadId: threadId ?? void 0,
|
|
@@ -476,7 +490,10 @@ async function handleMatrixAction(params, cfg, opts = {}) {
|
|
|
476
490
|
case "editMessage": {
|
|
477
491
|
const roomId = readRoomId(params);
|
|
478
492
|
const messageId = readStringParam(params, "messageId", { required: true });
|
|
479
|
-
const content = readStringParam(params, "content", {
|
|
493
|
+
const content = readStringParam(params, "content", {
|
|
494
|
+
required: true,
|
|
495
|
+
trim: false
|
|
496
|
+
});
|
|
480
497
|
return jsonResult({
|
|
481
498
|
ok: true,
|
|
482
499
|
result: await withReadTarget(roomId, async (target) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-
|
|
3
|
-
import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-
|
|
2
|
+
import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-D8XghqmX.js";
|
|
3
|
+
import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-DmLY8NiO.js";
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
6
6
|
import { setTimeout } from "node:timers/promises";
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "matrix",
|
|
3
|
+
"doctorContract": {
|
|
4
|
+
"configRepair": true,
|
|
5
|
+
"stateMigrations": true
|
|
6
|
+
},
|
|
3
7
|
"name": "Matrix",
|
|
4
8
|
"description": "OpenClaw Matrix channel plugin for rooms and direct messages.",
|
|
9
|
+
"cliCommands": [
|
|
10
|
+
{
|
|
11
|
+
"name": "matrix",
|
|
12
|
+
"description": "Manage Matrix accounts, verification, devices, and profile state",
|
|
13
|
+
"hasSubcommands": true
|
|
14
|
+
}
|
|
15
|
+
],
|
|
5
16
|
"icon": "https://cdn.simpleicons.org/matrix",
|
|
6
17
|
"commandAliases": [
|
|
7
18
|
{
|
|
@@ -34,6 +45,9 @@
|
|
|
34
45
|
"enabled": {
|
|
35
46
|
"type": "boolean"
|
|
36
47
|
},
|
|
48
|
+
"configWrites": {
|
|
49
|
+
"type": "boolean"
|
|
50
|
+
},
|
|
37
51
|
"defaultAccount": {
|
|
38
52
|
"type": "string"
|
|
39
53
|
},
|
|
@@ -107,6 +121,29 @@
|
|
|
107
121
|
],
|
|
108
122
|
"additionalProperties": false
|
|
109
123
|
},
|
|
124
|
+
{
|
|
125
|
+
"type": "object",
|
|
126
|
+
"properties": {
|
|
127
|
+
"source": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"const": "store"
|
|
130
|
+
},
|
|
131
|
+
"provider": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"pattern": "^[a-z][a-z0-9_-]{0,63}$"
|
|
134
|
+
},
|
|
135
|
+
"id": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"pattern": "^[A-Z][A-Z0-9_]{0,127}$"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"required": [
|
|
141
|
+
"source",
|
|
142
|
+
"provider",
|
|
143
|
+
"id"
|
|
144
|
+
],
|
|
145
|
+
"additionalProperties": false
|
|
146
|
+
},
|
|
110
147
|
{
|
|
111
148
|
"type": "object",
|
|
112
149
|
"properties": {
|
|
@@ -185,6 +222,29 @@
|
|
|
185
222
|
],
|
|
186
223
|
"additionalProperties": false
|
|
187
224
|
},
|
|
225
|
+
{
|
|
226
|
+
"type": "object",
|
|
227
|
+
"properties": {
|
|
228
|
+
"source": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"const": "store"
|
|
231
|
+
},
|
|
232
|
+
"provider": {
|
|
233
|
+
"type": "string",
|
|
234
|
+
"pattern": "^[a-z][a-z0-9_-]{0,63}$"
|
|
235
|
+
},
|
|
236
|
+
"id": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"pattern": "^[A-Z][A-Z0-9_]{0,127}$"
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"required": [
|
|
242
|
+
"source",
|
|
243
|
+
"provider",
|
|
244
|
+
"id"
|
|
245
|
+
],
|
|
246
|
+
"additionalProperties": false
|
|
247
|
+
},
|
|
188
248
|
{
|
|
189
249
|
"type": "object",
|
|
190
250
|
"properties": {
|
|
@@ -963,7 +1023,7 @@
|
|
|
963
1023
|
},
|
|
964
1024
|
"streaming.progress.commandText": {
|
|
965
1025
|
"label": "Matrix Progress Command Text",
|
|
966
|
-
"help": "Command/exec detail in progress draft lines: \"
|
|
1026
|
+
"help": "Command/exec detail in progress draft lines: \"status\" is the safe default; \"raw\" opts into command text."
|
|
967
1027
|
}
|
|
968
1028
|
}
|
|
969
1029
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/matrix",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.8.1-beta.3",
|
|
4
4
|
"description": "OpenClaw Matrix channel plugin for rooms and direct messages.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"zod": "4.4.3"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"openclaw": ">=2026.
|
|
21
|
+
"openclaw": ">=2026.8.1-beta.3"
|
|
22
22
|
},
|
|
23
23
|
"peerDependenciesMeta": {
|
|
24
24
|
"openclaw": {
|
|
@@ -167,10 +167,10 @@
|
|
|
167
167
|
"allowInvalidConfigRecovery": true
|
|
168
168
|
},
|
|
169
169
|
"compat": {
|
|
170
|
-
"pluginApi": ">=2026.
|
|
170
|
+
"pluginApi": ">=2026.8.1-beta.3"
|
|
171
171
|
},
|
|
172
172
|
"build": {
|
|
173
|
-
"openclawVersion": "2026.
|
|
173
|
+
"openclawVersion": "2026.8.1-beta.3"
|
|
174
174
|
},
|
|
175
175
|
"release": {
|
|
176
176
|
"publishToClawHub": true,
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
2
|
-
//#region extensions/matrix/src/matrix/active-client.ts
|
|
3
|
-
const activeClients = /* @__PURE__ */ new Map();
|
|
4
|
-
function resolveAccountKey(accountId) {
|
|
5
|
-
return normalizeAccountId(accountId) || DEFAULT_ACCOUNT_ID;
|
|
6
|
-
}
|
|
7
|
-
function setActiveMatrixClient(client, accountId) {
|
|
8
|
-
const key = resolveAccountKey(accountId);
|
|
9
|
-
if (!client) {
|
|
10
|
-
activeClients.delete(key);
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
activeClients.set(key, client);
|
|
14
|
-
}
|
|
15
|
-
function getActiveMatrixClient(accountId) {
|
|
16
|
-
const key = resolveAccountKey(accountId);
|
|
17
|
-
return activeClients.get(key) ?? null;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { setActiveMatrixClient as n, getActiveMatrixClient as t };
|
package/dist/client-Dbso3-0V.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { t as getMatrixScopedEnvVarNames } from "./env-vars-B0NxQnPk.js";
|
|
3
|
-
import { i as resolveScopedMatrixEnvConfig, r as resolveMatrixEnvAuthReadiness, t as hasReadyMatrixEnvAuth } from "./env-auth-CQsYbz-p.js";
|
|
4
|
-
import { n as validateMatrixHomeserverUrl, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
5
|
-
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
6
|
-
import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, m as resolveMatrixConfigForAccount, n as releaseSharedClientInstance, o as stopSharedClientForAccount, p as resolveMatrixAuthContext, r as removeSharedClientInstance, s as stopSharedClientInstance, t as acquireSharedMatrixClient } from "./shared-CUMWxcMz.js";
|
|
7
|
-
import { t as createMatrixClient } from "./create-client-BmSU-q-D.js";
|
|
8
|
-
//#region extensions/matrix/src/matrix/client.ts
|
|
9
|
-
var client_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
-
acquireSharedMatrixClient: () => acquireSharedMatrixClient,
|
|
11
|
-
backfillMatrixAuthDeviceIdAfterStartup: () => backfillMatrixAuthDeviceIdAfterStartup,
|
|
12
|
-
createMatrixClient: () => createMatrixClient,
|
|
13
|
-
getMatrixScopedEnvVarNames: () => getMatrixScopedEnvVarNames,
|
|
14
|
-
hasReadyMatrixEnvAuth: () => hasReadyMatrixEnvAuth,
|
|
15
|
-
isBunRuntime: () => isBunRuntime,
|
|
16
|
-
releaseSharedClientInstance: () => releaseSharedClientInstance,
|
|
17
|
-
removeSharedClientInstance: () => removeSharedClientInstance,
|
|
18
|
-
resolveMatrixAuth: () => resolveMatrixAuth,
|
|
19
|
-
resolveMatrixAuthContext: () => resolveMatrixAuthContext,
|
|
20
|
-
resolveMatrixConfigForAccount: () => resolveMatrixConfigForAccount,
|
|
21
|
-
resolveMatrixEnvAuthReadiness: () => resolveMatrixEnvAuthReadiness,
|
|
22
|
-
resolveScopedMatrixEnvConfig: () => resolveScopedMatrixEnvConfig,
|
|
23
|
-
resolveSharedMatrixClient: () => resolveSharedMatrixClient,
|
|
24
|
-
resolveValidatedMatrixHomeserverUrl: () => resolveValidatedMatrixHomeserverUrl,
|
|
25
|
-
stopSharedClientForAccount: () => stopSharedClientForAccount,
|
|
26
|
-
stopSharedClientInstance: () => stopSharedClientInstance,
|
|
27
|
-
validateMatrixHomeserverUrl: () => validateMatrixHomeserverUrl
|
|
28
|
-
});
|
|
29
|
-
//#endregion
|
|
30
|
-
export { client_exports as t };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
3
|
-
import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage } from "./storage-BvAkgzvT.js";
|
|
4
|
-
import "./shared-CUMWxcMz.js";
|
|
5
|
-
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
-
import { ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
8
|
-
import fs from "node:fs";
|
|
9
|
-
//#region extensions/matrix/src/matrix/client/create-client.ts
|
|
10
|
-
var create_client_exports = /* @__PURE__ */ __exportAll({ createMatrixClient: () => createMatrixClient });
|
|
11
|
-
const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-bUytQHx7.js"), import("./logging-DV-p52N0.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
|
|
12
|
-
MatrixClient: sdkModule.MatrixClient,
|
|
13
|
-
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
14
|
-
})));
|
|
15
|
-
async function createMatrixClient(params) {
|
|
16
|
-
const { MatrixClient, ensureMatrixSdkLoggingConfigured } = await loadMatrixCreateClientRuntimeDeps();
|
|
17
|
-
ensureMatrixSdkLoggingConfigured();
|
|
18
|
-
const homeserver = await resolveValidatedMatrixHomeserverUrl(params.homeserver, { dangerouslyAllowPrivateNetwork: params.allowPrivateNetwork });
|
|
19
|
-
const matrixClientUserId = normalizeOptionalString(params.userId);
|
|
20
|
-
const userId = matrixClientUserId ?? "unknown";
|
|
21
|
-
const storagePaths = params.persistStorage !== false ? resolveMatrixStoragePaths({
|
|
22
|
-
homeserver,
|
|
23
|
-
userId,
|
|
24
|
-
accessToken: params.accessToken,
|
|
25
|
-
accountId: params.accountId,
|
|
26
|
-
deviceId: params.deviceId,
|
|
27
|
-
env: process.env
|
|
28
|
-
}) : null;
|
|
29
|
-
if (storagePaths) {
|
|
30
|
-
await maybeMigrateLegacyStorage({
|
|
31
|
-
storagePaths,
|
|
32
|
-
env: process.env
|
|
33
|
-
});
|
|
34
|
-
fs.mkdirSync(storagePaths.rootDir, { recursive: true });
|
|
35
|
-
writeStorageMeta({
|
|
36
|
-
storagePaths,
|
|
37
|
-
homeserver,
|
|
38
|
-
userId,
|
|
39
|
-
accountId: params.accountId,
|
|
40
|
-
deviceId: params.deviceId
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
const cryptoDatabasePrefix = storagePaths ? `openclaw-matrix-${storagePaths.accountKey}-${storagePaths.tokenHash}` : void 0;
|
|
44
|
-
return new MatrixClient(homeserver, params.accessToken, {
|
|
45
|
-
userId: matrixClientUserId,
|
|
46
|
-
password: params.password,
|
|
47
|
-
deviceId: params.deviceId,
|
|
48
|
-
encryption: params.encryption,
|
|
49
|
-
localTimeoutMs: params.localTimeoutMs,
|
|
50
|
-
initialSyncLimit: params.initialSyncLimit,
|
|
51
|
-
storageRootDir: storagePaths?.rootDir,
|
|
52
|
-
recoveryKeyPath: storagePaths?.recoveryKeyPath,
|
|
53
|
-
idbSnapshotPath: storagePaths?.idbSnapshotPath,
|
|
54
|
-
cryptoDatabasePrefix,
|
|
55
|
-
autoBootstrapCrypto: params.autoBootstrapCrypto,
|
|
56
|
-
ssrfPolicy: params.ssrfPolicy ?? ssrfPolicyFromDangerouslyAllowPrivateNetwork(params.allowPrivateNetwork),
|
|
57
|
-
dispatcherPolicy: params.dispatcherPolicy
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
export { create_client_exports as n, createMatrixClient as t };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { n as getOptionalMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
|
-
import "./storage-paths-gUmSydsW.js";
|
|
4
|
-
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
|
-
import { createPluginStateSyncKeyedStore } from "openclaw/plugin-sdk/runtime-doctor";
|
|
6
|
-
//#region extensions/matrix/src/matrix/credentials-read.ts
|
|
7
|
-
var credentials_read_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
-
MATRIX_CREDENTIALS_MAX_ENTRIES: () => 256,
|
|
9
|
-
MATRIX_CREDENTIALS_NAMESPACE: () => MATRIX_CREDENTIALS_NAMESPACE,
|
|
10
|
-
clearMatrixCredentials: () => clearMatrixCredentials,
|
|
11
|
-
credentialsMatchConfig: () => credentialsMatchConfig,
|
|
12
|
-
isMatrixCredentialRevocation: () => isMatrixCredentialRevocation,
|
|
13
|
-
loadMatrixCredentials: () => loadMatrixCredentials,
|
|
14
|
-
matrixCredentialsStoreKey: () => matrixCredentialsStoreKey,
|
|
15
|
-
normalizeMatrixStoredCredentials: () => normalizeMatrixStoredCredentials,
|
|
16
|
-
openMatrixCredentialsStore: () => openMatrixCredentialsStore
|
|
17
|
-
});
|
|
18
|
-
const MATRIX_CREDENTIALS_NAMESPACE = "credentials";
|
|
19
|
-
function matrixCredentialsStoreKey(accountId) {
|
|
20
|
-
return `account:${normalizeAccountId(accountId)}`;
|
|
21
|
-
}
|
|
22
|
-
function normalizeMatrixStoredCredentials(value, accountId) {
|
|
23
|
-
if (!value || typeof value !== "object") return null;
|
|
24
|
-
const parsed = value;
|
|
25
|
-
if (typeof parsed.homeserver !== "string" || !parsed.homeserver || typeof parsed.userId !== "string" || !parsed.userId || typeof parsed.accessToken !== "string" || !parsed.accessToken || typeof parsed.createdAt !== "string" || !parsed.createdAt) return null;
|
|
26
|
-
return {
|
|
27
|
-
accountId: normalizeAccountId(accountId ?? parsed.accountId),
|
|
28
|
-
homeserver: parsed.homeserver,
|
|
29
|
-
userId: parsed.userId,
|
|
30
|
-
accessToken: parsed.accessToken,
|
|
31
|
-
...typeof parsed.deviceId === "string" ? { deviceId: parsed.deviceId } : {},
|
|
32
|
-
createdAt: parsed.createdAt,
|
|
33
|
-
...typeof parsed.lastUsedAt === "string" ? { lastUsedAt: parsed.lastUsedAt } : {}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function isMatrixCredentialRevocation(value, accountId) {
|
|
37
|
-
if (!value || typeof value !== "object") return false;
|
|
38
|
-
const parsed = value;
|
|
39
|
-
return parsed.kind === "revoked" && typeof parsed.revokedAt === "string" && parsed.revokedAt.length > 0 && normalizeAccountId(parsed.accountId) === normalizeAccountId(accountId ?? parsed.accountId);
|
|
40
|
-
}
|
|
41
|
-
function openMatrixCredentialsStore(env = process.env) {
|
|
42
|
-
const runtime = getOptionalMatrixRuntime();
|
|
43
|
-
const resolvedEnv = env.OPENCLAW_STATE_DIR?.trim() || !runtime ? env : {
|
|
44
|
-
...env,
|
|
45
|
-
OPENCLAW_STATE_DIR: runtime.state.resolveStateDir(env)
|
|
46
|
-
};
|
|
47
|
-
return createPluginStateSyncKeyedStore("matrix", {
|
|
48
|
-
namespace: MATRIX_CREDENTIALS_NAMESPACE,
|
|
49
|
-
maxEntries: 256,
|
|
50
|
-
overflowPolicy: "reject-new",
|
|
51
|
-
env: resolvedEnv
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function loadMatrixCredentials(env = process.env, accountId) {
|
|
55
|
-
const normalizedAccountId = normalizeAccountId(accountId);
|
|
56
|
-
const parsed = normalizeMatrixStoredCredentials(openMatrixCredentialsStore(env).lookup(matrixCredentialsStoreKey(accountId)), normalizedAccountId);
|
|
57
|
-
if (!parsed || parsed.accountId !== normalizedAccountId) return null;
|
|
58
|
-
const { accountId: _accountId, ...credentials } = parsed;
|
|
59
|
-
return credentials;
|
|
60
|
-
}
|
|
61
|
-
function clearMatrixCredentials(env = process.env, accountId) {
|
|
62
|
-
const normalizedAccountId = normalizeAccountId(accountId);
|
|
63
|
-
openMatrixCredentialsStore(env).register(matrixCredentialsStoreKey(normalizedAccountId), {
|
|
64
|
-
accountId: normalizedAccountId,
|
|
65
|
-
kind: "revoked",
|
|
66
|
-
revokedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function credentialsMatchConfig(stored, config) {
|
|
70
|
-
if (!config.userId) {
|
|
71
|
-
if (!config.accessToken) return false;
|
|
72
|
-
return stored.homeserver === config.homeserver && stored.accessToken === config.accessToken;
|
|
73
|
-
}
|
|
74
|
-
return stored.homeserver === config.homeserver && stored.userId === config.userId;
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
export { isMatrixCredentialRevocation as a, normalizeMatrixStoredCredentials as c, credentials_read_exports as i, openMatrixCredentialsStore as l, clearMatrixCredentials as n, loadMatrixCredentials as o, credentialsMatchConfig as r, matrixCredentialsStoreKey as s, MATRIX_CREDENTIALS_NAMESPACE as t };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
|
|
2
|
-
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
3
|
-
//#region extensions/matrix/src/exec-approval-resolver.ts
|
|
4
|
-
async function resolveMatrixApproval(params) {
|
|
5
|
-
return await resolveApprovalOverGateway({
|
|
6
|
-
cfg: params.cfg,
|
|
7
|
-
approvalId: params.approvalId,
|
|
8
|
-
approvalKind: params.approvalKind,
|
|
9
|
-
decision: params.decision,
|
|
10
|
-
senderId: params.senderId,
|
|
11
|
-
gatewayUrl: params.gatewayUrl,
|
|
12
|
-
clientDisplayName: `Matrix approval (${params.senderId?.trim() || "unknown"})`
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { isApprovalNotFoundError, resolveMatrixApproval };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { sendDurableMessageBatch as sendDurableMessageBatch$1 } from "openclaw/plugin-sdk/channel-outbound";
|
|
2
|
-
import { transcribeFirstAudio as transcribeFirstAudio$1 } from "openclaw/plugin-sdk/media-runtime";
|
|
3
|
-
//#region extensions/matrix/src/matrix/monitor/preflight-audio.runtime.ts
|
|
4
|
-
async function transcribeFirstAudio(...args) {
|
|
5
|
-
return await transcribeFirstAudio$1(...args);
|
|
6
|
-
}
|
|
7
|
-
async function sendDurableMessageBatch(...args) {
|
|
8
|
-
return await sendDurableMessageBatch$1(...args);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { sendDurableMessageBatch, transcribeFirstAudio };
|