@openclaw/matrix 2026.7.2-beta.2 → 2026.7.2-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-Bz00QTmQ.js → account-selection-kqquRzCf.js} +5 -5
- package/dist/api.js +6 -6
- package/dist/{approval-handler.runtime-BQZdg_dJ.js → approval-handler.runtime-BEa98wwG.js} +4 -4
- package/dist/{approval-ids-De4IhOSN.js → approval-ids-Dfn7oQAm.js} +1 -1
- package/dist/{approval-reaction-auth-BLJKPLku.js → approval-reaction-auth-kXkCJBGi.js} +2 -2
- package/dist/auth-presence.js +13 -21
- package/dist/{channel-B1woOUgk.js → channel-j331Xd7b.js} +13 -13
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-BvJm9z0w.js → channel.runtime-BIwlVfQw.js} +15 -16
- package/dist/{cli-CLWOkMvw.js → cli-0EcKfqFw.js} +18 -11
- package/dist/{cli-metadata-9Naf7in0.js → cli-metadata-Xq1Xb15R.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-BUai6s29.js → client-BtG4quUl.js} +2 -2
- package/dist/{client-CPuYbNL8.js → client-CA0PULls.js} +2 -2
- package/dist/{client-bootstrap-CNVF73sF.js → client-bootstrap-Dk5EAn3n.js} +1 -1
- package/dist/{config-schema-BTSatSY3.js → config-schema-B5GRV8wL.js} +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/{create-client-85ttAWDP.js → create-client-WQExaby_.js} +4 -4
- package/dist/credentials-W2EmwRhu.js +65 -0
- package/dist/credentials-read-DVmFCm7X.js +77 -0
- package/dist/{credentials-write.runtime-BDtpqvj0.js → credentials-write.runtime-Be9zNSUw.js} +1 -1
- package/dist/{crypto-runtime-DoEB5RpM.js → crypto-runtime-CAff-n15.js} +3 -3
- package/dist/{directory-live-0TyS9xep.js → directory-live-DiC-0XBC.js} +3 -3
- package/dist/{doctor-BGTs609f.js → doctor-DwUVm5Lw.js} +1 -1
- package/dist/{doctor-contract-D2qTLe-C.js → doctor-contract-BA2Y6Crx.js} +1 -1
- package/dist/doctor-contract-api.js +116 -10
- package/dist/{draft-stream-GOdPZMBm.js → draft-stream-CTLKtJJ0.js} +1 -1
- package/dist/{encryption-guidance-BFfgq7c7.js → encryption-guidance-CbEFe38F.js} +1 -1
- package/dist/{file-sync-store-CUE9WwD2.js → file-sync-store-CPkgnSXp.js} +21 -4
- package/dist/helper-api.js +2 -2
- package/dist/{idb-persistence-BiHEEzD7.js → idb-persistence-Dyy6ipgU.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{media-text-DPCtdFjk.js → media-text-BMXEXb1j.js} +1 -1
- package/dist/{messages-DCRbGLMh.js → messages-3UBHfZrN.js} +3 -3
- package/dist/{monitor-C5EOF9et.js → monitor-BtUIds8T.js} +87 -89
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-sBV-Govx.js +3 -0
- package/dist/{profile-update-DompcDyu.js → profile-update-Bh2XtJwN.js} +2 -2
- package/dist/{reaction-events-QUgxkQKQ.js → reaction-events-BwAKtUyQ.js} +2 -2
- package/dist/record-shared-CWWx6fvI.js +2 -0
- package/dist/{recovery-key-store-B2RglalK.js → recovery-key-store-CW6eePfp.js} +1 -1
- package/dist/{resolve-targets-Cx1VVArA.js → resolve-targets-DVoj-YxB.js} +1 -1
- package/dist/{resolver.runtime-PPrv3ZHu.js → resolver.runtime-CC0VVsAt.js} +1 -1
- package/dist/runtime-api.js +3 -3
- package/dist/{sdk-1TXuSiXZ.js → sdk-CIDZXWpZ.js} +5 -5
- package/dist/{secret-contract-OZoQf0kI.js → secret-contract-M3hRmGO-.js} +21 -5
- package/dist/secret-contract-api.js +1 -1
- package/dist/{send-yre1krm8.js → send-BJbrdmNm.js} +3 -2
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-DXVRCd4G.js → setup-bootstrap-DGPOOdz-.js} +2 -2
- package/dist/{setup-core-CYQRY2oG.js → setup-core-XCdAx1nY.js} +3 -3
- package/dist/setup-plugin-api.js +3 -3
- package/dist/{setup-surface-BjvRQzK6.js → setup-surface-CzUiTe_k.js} +6 -6
- package/dist/{shared-BfW4lxGu.js → shared-DquM1oz6.js} +6 -6
- package/dist/{startup-verification-DSiyDKM5.js → startup-verification-CA00kebL.js} +2 -2
- package/dist/{storage-DD-EnNJE.js → storage-CzHxeF5E.js} +8 -8
- package/dist/{thread-bindings-U5ZroBeZ.js → thread-bindings-Cw194yEn.js} +3 -3
- package/dist/{tool-actions.runtime-BlfTr9b0.js → tool-actions.runtime-C0jgWYhX.js} +7 -7
- package/dist/{verification-CGnI9k1O.js → verification-DjxyWTNP.js} +2 -2
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
- package/dist/async-lock-BcLS4KOc.js +0 -19
- package/dist/credentials-CncWUieb.js +0 -56
- package/dist/credentials-read-CwNJrmwu.js +0 -112
- package/dist/probe.runtime-BBvciVfo.js +0 -3
- package/dist/record-shared-CvzjvHRn.js +0 -2
- package/dist/{deps-DDbghaZH.js → deps-CcVJfvRM.js} +1 -1
- package/dist/{http-client-Jw5_bwQo.js → http-client-BmrgOZTL.js} +1 -1
- package/dist/{storage-paths-B4_I9iqO.js → storage-paths-gUmSydsW.js} +1 -1
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
1
|
+
import { a as resolveMatrixDefaultOrOnlyAccountId, n as requiresExplicitMatrixDefaultAccount } from "./account-selection-kqquRzCf.js";
|
|
2
|
+
import { t as isRecord$1 } from "./record-shared-CWWx6fvI.js";
|
|
3
|
+
import { r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.js";
|
|
4
|
+
import { a as isMatrixCredentialRevocation, c as normalizeMatrixStoredCredentials, s as matrixCredentialsStoreKey, t as MATRIX_CREDENTIALS_NAMESPACE } from "./credentials-read-DVmFCm7X.js";
|
|
5
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BA2Y6Crx.js";
|
|
6
|
+
import { O as writeMatrixIdbSnapshotJsonToStore, S as readLegacyMatrixLegacyCryptoMigrationState, _ as hasMatrixRecoveryKeyStateInStore, a as openMatrixStorageMetaStoreOptions, b as openMatrixLegacyCryptoMigrationStoreOptions, f as MATRIX_IDB_SNAPSHOT_FILENAME, g as hasMatrixLegacyCryptoMigrationStateInStore, h as hasMatrixIdbSnapshotStateInStore, i as normalizeMatrixStorageMetadata, j as writeMatrixRecoveryKeyStateToStore, k as writeMatrixLegacyCryptoMigrationStateToStore, m as MATRIX_RECOVERY_KEY_FILENAME, n as hasMatrixStorageMetaStateInStore, p as MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, u as writeMatrixStorageMetaStateToStore, w as readLegacyMatrixRecoveryKeyState, x as openMatrixRecoveryKeyStoreOptions, y as openMatrixIdbSnapshotStoreOptions } from "./storage-CzHxeF5E.js";
|
|
7
|
+
import { a as readLegacyMatrixSyncCacheState, i as openMatrixSyncCacheStoreOptions, o as writeMatrixSyncCacheStateToStore, r as hasMatrixSyncCacheStateInStore } from "./file-sync-store-CPkgnSXp.js";
|
|
5
8
|
import { a as resolveMatrixInboundDedupeStateNamespace, n as MATRIX_INBOUND_DEDUPE_TTL_MS, r as buildMatrixInboundDedupeEventKey } from "./inbound-dedupe-CaBLblef.js";
|
|
6
|
-
import { r as readLegacyMatrixIdbSnapshotState } from "./idb-persistence-
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
+
import { r as readLegacyMatrixIdbSnapshotState } from "./idb-persistence-Dyy6ipgU.js";
|
|
10
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
|
+
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
9
12
|
import { archiveLegacyStateSource } from "openclaw/plugin-sdk/runtime-doctor";
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
14
|
+
import path from "node:path";
|
|
10
15
|
import fs from "node:fs/promises";
|
|
11
16
|
import { createPersistentDedupeImportEntry } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
12
17
|
//#region extensions/matrix/src/matrix/monitor/inbound-dedupe-migration.ts
|
|
@@ -71,7 +76,7 @@ function normalizeLegacyTimestamp(raw) {
|
|
|
71
76
|
return Math.max(0, Math.floor(raw));
|
|
72
77
|
}
|
|
73
78
|
function parseLegacySqliteRow(row) {
|
|
74
|
-
const value = isRecord(row.value) ? row.value : {};
|
|
79
|
+
const value = isRecord$1(row.value) ? row.value : {};
|
|
75
80
|
const roomId = typeof value.roomId === "string" ? value.roomId.trim() : "";
|
|
76
81
|
const eventId = typeof value.eventId === "string" ? value.eventId.trim() : "";
|
|
77
82
|
const ts = normalizeLegacyTimestamp(value.ts);
|
|
@@ -127,11 +132,11 @@ async function readLegacyInboundDedupeJsonSource(storageRootDir) {
|
|
|
127
132
|
} catch {
|
|
128
133
|
return null;
|
|
129
134
|
}
|
|
130
|
-
if (!isRecord(parsed) || parsed.version !== LEGACY_JSON_VERSION || !Array.isArray(parsed.entries)) return null;
|
|
135
|
+
if (!isRecord$1(parsed) || parsed.version !== LEGACY_JSON_VERSION || !Array.isArray(parsed.entries)) return null;
|
|
131
136
|
const accountId = await resolveJsonRootAccountId(storageRootDir);
|
|
132
137
|
const markers = [];
|
|
133
138
|
for (const entry of parsed.entries) {
|
|
134
|
-
if (!isRecord(entry) || typeof entry.key !== "string") continue;
|
|
139
|
+
if (!isRecord$1(entry) || typeof entry.key !== "string") continue;
|
|
135
140
|
const separator = entry.key.indexOf("|");
|
|
136
141
|
if (separator <= 0) continue;
|
|
137
142
|
const roomId = entry.key.slice(0, separator).trim();
|
|
@@ -199,6 +204,39 @@ async function importNewestInboundDedupeMarkers(params) {
|
|
|
199
204
|
//#region extensions/matrix/doctor-contract-api.ts
|
|
200
205
|
const MATRIX_SYNC_CACHE_FILENAME = "bot-storage.json";
|
|
201
206
|
const MATRIX_STORAGE_META_FILENAME = "storage-meta.json";
|
|
207
|
+
async function collectLegacyMatrixCredentialSources(params) {
|
|
208
|
+
const credentialsDir = resolveMatrixCredentialsDir(params.stateDir);
|
|
209
|
+
let entries;
|
|
210
|
+
try {
|
|
211
|
+
entries = await fs.readdir(credentialsDir, { withFileTypes: true });
|
|
212
|
+
} catch {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
return entries.filter((entry) => entry.isFile() && /^credentials(?:-[a-z0-9._-]+)?\.json$/iu.test(entry.name)).toSorted((left, right) => {
|
|
216
|
+
if (left.name === "credentials.json") return 1;
|
|
217
|
+
if (right.name === "credentials.json") return -1;
|
|
218
|
+
return left.name.localeCompare(right.name);
|
|
219
|
+
}).map((entry) => {
|
|
220
|
+
const namedAccount = /^credentials(?:-([a-z0-9._-]+))?\.json$/iu.exec(entry.name)?.[1];
|
|
221
|
+
return {
|
|
222
|
+
accountId: namedAccount ? normalizeAccountId(namedAccount) : requiresExplicitMatrixDefaultAccount(params.config, params.env) ? null : normalizeAccountId(resolveMatrixDefaultOrOnlyAccountId(params.config, params.env)),
|
|
223
|
+
filePath: path.join(credentialsDir, entry.name)
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
async function readLegacyMatrixCredentials(source) {
|
|
228
|
+
if (!source.accountId) return null;
|
|
229
|
+
try {
|
|
230
|
+
const raw = JSON.parse(await fs.readFile(source.filePath, "utf8"));
|
|
231
|
+
const createdAt = isRecord(raw) && typeof raw.createdAt === "string" && raw.createdAt ? raw.createdAt : (await fs.stat(source.filePath)).mtime.toISOString();
|
|
232
|
+
return normalizeMatrixStoredCredentials(isRecord(raw) ? {
|
|
233
|
+
...raw,
|
|
234
|
+
createdAt
|
|
235
|
+
} : raw, source.accountId);
|
|
236
|
+
} catch {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
202
240
|
async function collectLegacyMatrixStateRoots(stateDir, filename) {
|
|
203
241
|
const matrixRoot = path.join(stateDir, "matrix");
|
|
204
242
|
const roots = [];
|
|
@@ -249,6 +287,74 @@ async function archiveLegacyMatrixStateFile(params) {
|
|
|
249
287
|
if (params.notice && params.warnings.length === warningCount) params.notices?.push(params.notice);
|
|
250
288
|
}
|
|
251
289
|
const stateMigrations = [
|
|
290
|
+
{
|
|
291
|
+
id: "matrix-credentials-json-to-plugin-state",
|
|
292
|
+
label: "Matrix credentials",
|
|
293
|
+
async detectLegacyState(params) {
|
|
294
|
+
const sources = await collectLegacyMatrixCredentialSources(params);
|
|
295
|
+
return sources.length > 0 ? { preview: [`Matrix credential JSON can migrate to SQLite (${sources.length} ${sources.length === 1 ? "file" : "files"})`] } : null;
|
|
296
|
+
},
|
|
297
|
+
async migrateLegacyState(params) {
|
|
298
|
+
const changes = [];
|
|
299
|
+
const warnings = [];
|
|
300
|
+
const sources = await collectLegacyMatrixCredentialSources(params);
|
|
301
|
+
const store = params.context.openPluginStateKeyedStore({
|
|
302
|
+
namespace: MATRIX_CREDENTIALS_NAMESPACE,
|
|
303
|
+
maxEntries: 256,
|
|
304
|
+
overflowPolicy: "reject-new"
|
|
305
|
+
});
|
|
306
|
+
for (const source of sources) {
|
|
307
|
+
if (!source.accountId) {
|
|
308
|
+
warnings.push(`Left ambiguous Matrix credential legacy source in place because no default account is selected: ${source.filePath}`);
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
const credentials = await readLegacyMatrixCredentials(source);
|
|
312
|
+
if (!credentials) {
|
|
313
|
+
warnings.push(`Left invalid Matrix credential legacy source in place: ${source.filePath}`);
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
const key = matrixCredentialsStoreKey(source.accountId);
|
|
317
|
+
const stored = await store.lookup(key);
|
|
318
|
+
if (isMatrixCredentialRevocation(stored, source.accountId)) {
|
|
319
|
+
changes.push(`Archived revoked Matrix credential legacy source for account ${source.accountId}`);
|
|
320
|
+
await archiveLegacyStateSource({
|
|
321
|
+
filePath: source.filePath,
|
|
322
|
+
label: "Matrix credentials",
|
|
323
|
+
changes,
|
|
324
|
+
warnings
|
|
325
|
+
});
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
const existing = normalizeMatrixStoredCredentials(stored, source.accountId);
|
|
329
|
+
if (existing && JSON.stringify(existing) !== JSON.stringify(credentials)) {
|
|
330
|
+
warnings.push(`Kept existing Matrix credentials for account ${source.accountId}; left differing legacy source in place`);
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
if (!existing) try {
|
|
334
|
+
await store.registerIfAbsent(key, credentials);
|
|
335
|
+
} catch (error) {
|
|
336
|
+
warnings.push(`Failed importing Matrix credentials for account ${source.accountId}: ${String(error)}; left legacy source in place`);
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
const persisted = normalizeMatrixStoredCredentials(await store.lookup(key), source.accountId);
|
|
340
|
+
if (!persisted || JSON.stringify(persisted) !== JSON.stringify(credentials)) {
|
|
341
|
+
warnings.push(`Failed verifying Matrix credentials for account ${source.accountId}; left legacy source in place`);
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
changes.push(`Migrated Matrix credentials for account ${source.accountId} to SQLite`);
|
|
345
|
+
await archiveLegacyStateSource({
|
|
346
|
+
filePath: source.filePath,
|
|
347
|
+
label: "Matrix credentials",
|
|
348
|
+
changes,
|
|
349
|
+
warnings
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
return {
|
|
353
|
+
changes,
|
|
354
|
+
warnings
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
},
|
|
252
358
|
{
|
|
253
359
|
id: "matrix-inbound-dedupe-to-claimable-dedupe",
|
|
254
360
|
label: "Matrix inbound dedupe markers",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as editMessageMatrix, r as prepareMatrixSingleText, s as sendSingleTextMessageMatrix, y as MsgType } from "./send-
|
|
1
|
+
import { n as editMessageMatrix, r as prepareMatrixSingleText, s as sendSingleTextMessageMatrix, y as MsgType } from "./send-BJbrdmNm.js";
|
|
2
2
|
import { createDraftStreamLoop } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
3
|
//#region extensions/matrix/src/matrix/draft-stream.ts
|
|
4
4
|
const DEFAULT_THROTTLE_MS = 1e3;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveMatrixDefaultOrOnlyAccountId } from "./account-selection-
|
|
1
|
+
import { a as resolveMatrixDefaultOrOnlyAccountId } from "./account-selection-kqquRzCf.js";
|
|
2
2
|
import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
|
|
3
3
|
import { normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
4
4
|
//#region extensions/matrix/src/matrix/encryption-guidance.ts
|
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { t as isRecord } from "./record-shared-
|
|
2
|
+
import { t as isRecord } from "./record-shared-CWWx6fvI.js";
|
|
3
3
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
4
|
-
import { M as resolveMatrixSqliteStateEnv, t as claimCurrentTokenStorageState } from "./storage-
|
|
5
|
-
import { t as createAsyncLock } from "./async-lock-BcLS4KOc.js";
|
|
4
|
+
import { M as resolveMatrixSqliteStateEnv, t as claimCurrentTokenStorageState } from "./storage-CzHxeF5E.js";
|
|
6
5
|
import { n as LogService } from "./logger-D0GCSDQq.js";
|
|
7
|
-
import path from "node:path";
|
|
8
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
|
+
import path from "node:path";
|
|
9
8
|
import fs from "node:fs/promises";
|
|
10
9
|
import { Category, MemoryStore, SyncAccumulator } from "matrix-js-sdk/lib/matrix.js";
|
|
10
|
+
//#region extensions/matrix/src/matrix/async-lock.ts
|
|
11
|
+
function createAsyncLock() {
|
|
12
|
+
let lock = Promise.resolve();
|
|
13
|
+
return async function withLock(fn) {
|
|
14
|
+
const previous = lock;
|
|
15
|
+
let release;
|
|
16
|
+
lock = new Promise((resolve) => {
|
|
17
|
+
release = resolve;
|
|
18
|
+
});
|
|
19
|
+
await previous;
|
|
20
|
+
try {
|
|
21
|
+
return await fn();
|
|
22
|
+
} finally {
|
|
23
|
+
release?.();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
11
28
|
//#region extensions/matrix/src/matrix/client/file-sync-store.ts
|
|
12
29
|
var file_sync_store_exports = /* @__PURE__ */ __exportAll({
|
|
13
30
|
SqliteBackedMatrixSyncStore: () => SqliteBackedMatrixSyncStore,
|
package/dist/helper-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-
|
|
1
|
+
import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-kqquRzCf.js";
|
|
2
2
|
import { n as listMatrixEnvAccountIds, r as resolveMatrixEnvAccountToken, t as getMatrixScopedEnvVarNames } from "./env-vars-B0NxQnPk.js";
|
|
3
|
-
import { a as resolveMatrixCredentialsPath, i as resolveMatrixCredentialsFilename, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as sanitizeMatrixPathSegment, t as hashMatrixAccessToken } from "./storage-paths-
|
|
3
|
+
import { a as resolveMatrixCredentialsPath, i as resolveMatrixCredentialsFilename, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as sanitizeMatrixPathSegment, t as hashMatrixAccessToken } from "./storage-paths-gUmSydsW.js";
|
|
4
4
|
export { findMatrixAccountEntry, getMatrixScopedEnvVarNames, hashMatrixAccessToken, listMatrixEnvAccountIds, requiresExplicitMatrixDefaultAccount, resolveConfiguredMatrixAccountIds, resolveMatrixAccountStorageRoot, resolveMatrixChannelConfig, resolveMatrixCredentialsDir, resolveMatrixCredentialsFilename, resolveMatrixCredentialsPath, resolveMatrixDefaultOrOnlyAccountId, resolveMatrixEnvAccountToken, resolveMatrixHomeserverKey, sanitizeMatrixPathSegment };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { D as writeMatrixIdbSnapshotJson, T as readMatrixIdbSnapshotJson, f as MATRIX_IDB_SNAPSHOT_FILENAME } from "./storage-
|
|
2
|
+
import { D as writeMatrixIdbSnapshotJson, T as readMatrixIdbSnapshotJson, f as MATRIX_IDB_SNAPSHOT_FILENAME } from "./storage-CzHxeF5E.js";
|
|
3
3
|
import { n as LogService } from "./logger-D0GCSDQq.js";
|
|
4
4
|
import { n as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS } from "./idb-persistence-lock-DAJ49nZX.js";
|
|
5
|
-
import fs from "node:fs";
|
|
6
5
|
import path from "node:path";
|
|
6
|
+
import fs from "node:fs";
|
|
7
7
|
import { indexedDB } from "fake-indexeddb";
|
|
8
8
|
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
9
9
|
//#region extensions/matrix/src/matrix/sdk/idb-persistence.ts
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as registerMatrixCliMetadata } from "./cli-metadata-
|
|
1
|
+
import { n as registerMatrixCliMetadata } from "./cli-metadata-Xq1Xb15R.js";
|
|
2
2
|
import { registerMatrixSubagentHooks } from "./subagent-hooks-api.js";
|
|
3
3
|
import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
4
4
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as formatPollResultsAsText, D as parsePollStartContent, O as resolvePollReferenceEventId, S as formatPollAsText, T as isPollStartType, w as isPollEventType, x as buildPollResultsSummary } from "./send-
|
|
1
|
+
import { C as formatPollResultsAsText, D as parsePollStartContent, O as resolvePollReferenceEventId, S as formatPollAsText, T as isPollStartType, w as isPollEventType, x as buildPollResultsSummary } from "./send-BJbrdmNm.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
//#region extensions/matrix/src/matrix/poll-summary.ts
|
|
4
4
|
function resolveMatrixPollRootEventId(event) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as isMatrixNotFoundError } from "./errors-C47hvAF8.js";
|
|
2
|
-
import { T as isPollStartType, a as sendMessageMatrix, n as editMessageMatrix, w as isPollEventType } from "./send-
|
|
2
|
+
import { T as isPollStartType, a as sendMessageMatrix, n as editMessageMatrix, w as isPollEventType } from "./send-BJbrdmNm.js";
|
|
3
3
|
import { n as MATRIX_REACTION_EVENT_TYPE } from "./reaction-common-DkrQdBSZ.js";
|
|
4
|
-
import { a as resolveMatrixMessageAttachment, l as resolveMatrixPollRootEventId, o as resolveMatrixMessageBody, s as fetchMatrixPollMessageSummary } from "./media-text-
|
|
5
|
-
import { r as withResolvedRoomAction } from "./client-
|
|
4
|
+
import { a as resolveMatrixMessageAttachment, l as resolveMatrixPollRootEventId, o as resolveMatrixMessageBody, s as fetchMatrixPollMessageSummary } from "./media-text-BMXEXb1j.js";
|
|
5
|
+
import { r as withResolvedRoomAction } from "./client-BtG4quUl.js";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
8
8
|
//#region extensions/matrix/src/matrix/actions/limits.ts
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig, i as resolveMatrixAccountAllowlistConfig } from "./account-config-BZWN9tGS.js";
|
|
2
2
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
|
-
import { m as resolveConfiguredMatrixBotUserIds } from "./setup-core-
|
|
4
|
-
import { a as buildAllowlistResolutionSummary, c as createTypingCallbacks, d as logInboundDrop, f as logTypingFailure, h as toLocationContext, i as addAllowlistUserEntriesFromConfigEntry, l as formatLocationText, m as summarizeMapping, n as resolveMatrixStoredSessionMeta, o as canonicalizeAllowlistWithResolvedIds, p as patchAllowlistUsersInConfigEntries, r as resolveMatrixRoomConfig, s as createReplyPrefixOptions, u as getAgentScopedMediaLocalRoots } from "./channel-
|
|
5
|
-
import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./config-schema-
|
|
3
|
+
import { m as resolveConfiguredMatrixBotUserIds } from "./setup-core-XCdAx1nY.js";
|
|
4
|
+
import { a as buildAllowlistResolutionSummary, c as createTypingCallbacks, d as logInboundDrop, f as logTypingFailure, h as toLocationContext, i as addAllowlistUserEntriesFromConfigEntry, l as formatLocationText, m as summarizeMapping, n as resolveMatrixStoredSessionMeta, o as canonicalizeAllowlistWithResolvedIds, p as patchAllowlistUsersInConfigEntries, r as resolveMatrixRoomConfig, s as createReplyPrefixOptions, u as getAgentScopedMediaLocalRoots } from "./channel-j331Xd7b.js";
|
|
5
|
+
import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./config-schema-B5GRV8wL.js";
|
|
6
6
|
import { t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
|
|
7
7
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
8
|
-
import { D as parsePollStartContent, S as formatPollAsText, T as isPollStartType, _ as readJoinedMatrixMembers, a as sendMessageMatrix, f as promoteMatrixDirectRoomCandidate, g as isStrictDirectMembership, h as hasDirectMatrixMemberFlag, t as chunkMatrixText, v as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY, w as isPollEventType } from "./send-
|
|
9
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
8
|
+
import { D as parsePollStartContent, S as formatPollAsText, T as isPollStartType, _ as readJoinedMatrixMembers, a as sendMessageMatrix, f as promoteMatrixDirectRoomCandidate, g as isStrictDirectMembership, h as hasDirectMatrixMemberFlag, t as chunkMatrixText, v as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY, w as isPollEventType } from "./send-BJbrdmNm.js";
|
|
9
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-Cw194yEn.js";
|
|
10
10
|
import { i as createMatrixInboundEventDeduper } from "./inbound-dedupe-CaBLblef.js";
|
|
11
|
-
import { a as resolveMatrixMessageAttachment, c as fetchMatrixPollSnapshot, i as isLikelyBareFilename, n as formatMatrixMediaUnavailableText, o as resolveMatrixMessageBody, r as formatMatrixMessageText, t as formatMatrixMediaTooLargeText } from "./media-text-
|
|
11
|
+
import { a as resolveMatrixMessageAttachment, c as fetchMatrixPollSnapshot, i as isLikelyBareFilename, n as formatMatrixMediaUnavailableText, o as resolveMatrixMessageBody, r as formatMatrixMessageText, t as formatMatrixMediaTooLargeText } from "./media-text-BMXEXb1j.js";
|
|
12
12
|
import { n as setActiveMatrixClient } from "./active-client-DXvz2gCo.js";
|
|
13
13
|
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
14
|
-
import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, l as isMatrixStartupAbortError, n as releaseSharedClientInstance, p as resolveMatrixAuthContext, u as throwIfMatrixStartupAborted } from "./shared-
|
|
15
|
-
import "./client-
|
|
16
|
-
import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-
|
|
14
|
+
import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, l as isMatrixStartupAbortError, n as releaseSharedClientInstance, p as resolveMatrixAuthContext, u as throwIfMatrixStartupAborted } from "./shared-DquM1oz6.js";
|
|
15
|
+
import "./client-CA0PULls.js";
|
|
16
|
+
import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-BmrgOZTL.js";
|
|
17
17
|
import { d as resolveAllowlistProviderRuntimeGroupPolicy, f as resolveDefaultGroupPolicy, g as warnMissingProviderGroupPolicyFallbackOnce, h as resolveThreadBindingMaxAgeMsForChannel, m as resolveThreadBindingIdleTimeoutMsForChannel, t as GROUP_POLICY_BLOCKED_LABEL } from "./runtime-api-D1xI_cvh.js";
|
|
18
|
-
import { t as resolveMatrixTargets } from "./resolve-targets-
|
|
19
|
-
import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-
|
|
18
|
+
import { t as resolveMatrixTargets } from "./resolve-targets-DVoj-YxB.js";
|
|
19
|
+
import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-CbEFe38F.js";
|
|
20
20
|
import { n as isMatrixReadySyncState, r as isMatrixTerminalSyncState, t as isMatrixDisconnectedSyncState } from "./sync-state-CWbp0QSY.js";
|
|
21
21
|
import { a as EventType, i as resolveMatrixThreadRouting, n as resolveMatrixReplyToEventId, o as RelationType, r as resolveMatrixThreadRootId, t as resolveMatrixInboundRoute } from "./route-DY6at4qJ.js";
|
|
22
22
|
import { t as createMatrixRoomInfoResolver } from "./room-info-B6vKD5DF.js";
|
|
@@ -25,8 +25,8 @@ import { buildChannelProgressDraftLineForEntry, createChannelProgressDraftGate,
|
|
|
25
25
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
26
26
|
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
27
27
|
import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
|
|
28
|
-
import { buildChannelInboundEventContext, hasFinalInboundReplyDispatch, toInboundMediaFacts } from "openclaw/plugin-sdk/channel-inbound";
|
|
29
|
-
import { getSessionEntry } from "openclaw/plugin-sdk/session-store-runtime";
|
|
28
|
+
import { buildChannelInboundEventContext, createChannelInboundEnvelopeBuilder, hasFinalInboundReplyDispatch, resolveInboundMentionDecision, toInboundMediaFacts } from "openclaw/plugin-sdk/channel-inbound";
|
|
29
|
+
import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
30
30
|
import { isFutureDateTimestampMs, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
31
31
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
32
32
|
import { format } from "node:util";
|
|
@@ -36,6 +36,7 @@ import { resolveAckReaction } from "openclaw/plugin-sdk/channel-feedback";
|
|
|
36
36
|
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
|
37
37
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
38
38
|
import { createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
39
|
+
import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
39
40
|
import { evaluateSupplementalContextVisibility, resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
|
|
40
41
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
41
42
|
import { buildInboundHistoryFromEntries } from "openclaw/plugin-sdk/reply-history";
|
|
@@ -817,7 +818,7 @@ const matrixVerificationConstants = {
|
|
|
817
818
|
const MAX_TRACKED_VERIFICATION_EVENTS = 1024;
|
|
818
819
|
const SAS_NOTICE_RETRY_DELAY_MS = 750;
|
|
819
820
|
const VERIFICATION_EVENT_STARTUP_GRACE_MS = 3e4;
|
|
820
|
-
const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-
|
|
821
|
+
const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-BJbrdmNm.js").then((n) => n.d), import("./send-BJbrdmNm.js").then((n) => n.m)]).then(([directManagementModule, directRoomModule]) => ({
|
|
821
822
|
inspectMatrixDirectRooms: directManagementModule.inspectMatrixDirectRooms,
|
|
822
823
|
isStrictDirectRoom: directRoomModule.isStrictDirectRoom
|
|
823
824
|
})));
|
|
@@ -2204,11 +2205,11 @@ function createMatrixThreadContextResolver(params) {
|
|
|
2204
2205
|
const ALLOW_FROM_STORE_CACHE_TTL_MS = 3e4;
|
|
2205
2206
|
const PAIRING_REPLY_COOLDOWN_MS = 5 * 6e4;
|
|
2206
2207
|
const MATRIX_TOOL_PROGRESS_MAX_CHARS = 300;
|
|
2207
|
-
const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-
|
|
2208
|
+
const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-BJbrdmNm.js").then((n) => n.l));
|
|
2208
2209
|
const loadAcpBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/acp-binding-runtime"));
|
|
2209
2210
|
const loadSessionBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/session-binding-runtime"));
|
|
2210
|
-
const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-
|
|
2211
|
-
const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-
|
|
2211
|
+
const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-BwAKtUyQ.js"));
|
|
2212
|
+
const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-CTLKtJJ0.js"));
|
|
2212
2213
|
async function matrixTextWouldActivateMentions(client, text) {
|
|
2213
2214
|
const { resolveMatrixMentionsForBody } = await loadMatrixSendModule();
|
|
2214
2215
|
const mentions = await resolveMatrixMentionsForBody({
|
|
@@ -2328,7 +2329,7 @@ function formatMatrixToolProgressMarkdownCode(text) {
|
|
|
2328
2329
|
return `\`${(text.length <= MATRIX_TOOL_PROGRESS_MAX_CHARS ? text : `${truncateUtf16Safe(text, MATRIX_TOOL_PROGRESS_MAX_CHARS - 1).trimEnd()}...`).replaceAll("`", "'")}\``;
|
|
2329
2330
|
}
|
|
2330
2331
|
function createMatrixRoomMessageHandler(params) {
|
|
2331
|
-
const { client, core, cfg, accountId, accountConfig, runtime, logger, logVerboseMessage, allowFromResolvedEntries = [], groupAllowFromResolvedEntries = [], roomsConfig, accountAllowBots, configuredBotUserIds = /* @__PURE__ */ new Set(), groupPolicy, replyToMode, threadReplies, dmThreadReplies, dmSessionScope, streaming, previewToolProgressEnabled, blockStreamingEnabled, dmEnabled, dmPolicy, textLimit, mediaMaxBytes, historyLimit, startupMs, startupGraceMs, dropPreStartupMessages, inboundDeduper, directTracker, getRoomInfo, getMemberDisplayName, needsRoomAliasesForConfig, resolveLiveUserAllowlist = resolveMatrixMonitorLiveUserAllowlist } = params;
|
|
2332
|
+
const { client, core, cfg, accountId, accountConfig, runtime, logger, logVerboseMessage, allowFromResolvedEntries = [], groupAllowFromResolvedEntries = [], roomsConfig, accountAllowBots, configuredBotUserIds = /* @__PURE__ */ new Set(), groupPolicy, replyToMode, threadReplies, dmThreadReplies, dmSessionScope, streaming, previewToolProgressEnabled, blockStreamingEnabled, dmEnabled, dmPolicy, textLimit, mediaMaxBytes, historyLimit, startupMs, startupGraceMs, dropPreStartupMessages, inboundDeduper, directTracker, getRoomInfo, getMemberDisplayName, needsRoomAliasesForConfig, resolveLiveUserAllowlist = resolveMatrixMonitorLiveUserAllowlist, resolveStorePath: resolveStorePathImpl = resolveStorePath, createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl = createChannelInboundEnvelopeBuilder, finalizeInboundContext, resolveHumanDelayConfig: resolveHumanDelayConfigImpl = resolveHumanDelayConfig } = params;
|
|
2332
2333
|
const contextVisibilityMode = resolveChannelContextVisibilityMode({
|
|
2333
2334
|
cfg,
|
|
2334
2335
|
channel: "matrix",
|
|
@@ -2821,9 +2822,23 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
2821
2822
|
return;
|
|
2822
2823
|
}
|
|
2823
2824
|
const shouldRequireMention = isRoom ? roomConfig?.autoReply === true ? false : roomConfig?.autoReply === false ? true : typeof roomConfig?.requireMention === "boolean" ? roomConfig?.requireMention : true : false;
|
|
2824
|
-
const
|
|
2825
|
+
const mentionDecision = resolveInboundMentionDecision({
|
|
2826
|
+
facts: {
|
|
2827
|
+
canDetectMention: true,
|
|
2828
|
+
wasMentioned,
|
|
2829
|
+
hasAnyMention: hasExplicitMention
|
|
2830
|
+
},
|
|
2831
|
+
policy: {
|
|
2832
|
+
isGroup: isRoom,
|
|
2833
|
+
requireMention: shouldRequireMention,
|
|
2834
|
+
allowTextCommands,
|
|
2835
|
+
hasControlCommand: hasControlCommandInMessage,
|
|
2836
|
+
commandAuthorized
|
|
2837
|
+
}
|
|
2838
|
+
});
|
|
2839
|
+
const { effectiveWasMentioned, shouldBypassMention } = mentionDecision;
|
|
2825
2840
|
const canDetectMention = agentMentionRegexes.length > 0 || hasExplicitMention;
|
|
2826
|
-
if (
|
|
2841
|
+
if (mentionDecision.shouldSkip) {
|
|
2827
2842
|
const pendingHistoryBody = preflightAudioTranscript ? formatMatrixAudioTranscript(preflightAudioTranscript) : pendingHistoryText || pendingHistoryPollText;
|
|
2828
2843
|
if (historyLimit > 0 && pendingHistoryBody) {
|
|
2829
2844
|
const pendingEntry = {
|
|
@@ -2956,6 +2971,7 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
2956
2971
|
isRoom,
|
|
2957
2972
|
shouldRequireMention,
|
|
2958
2973
|
wasMentioned,
|
|
2974
|
+
effectiveWasMentioned,
|
|
2959
2975
|
shouldBypassMention,
|
|
2960
2976
|
canDetectMention,
|
|
2961
2977
|
commandAuthorized,
|
|
@@ -2998,7 +3014,7 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
2998
3014
|
})();
|
|
2999
3015
|
if (!resolvedIngressResult) return;
|
|
3000
3016
|
if ("deferredPrefix" in resolvedIngressResult) return;
|
|
3001
|
-
const { route: _route, hasExplicitSessionBinding, roomConfig, isDirectMessage, isRoom, shouldRequireMention, wasMentioned, shouldBypassMention, canDetectMention, commandAuthorized, inboundHistory, senderName, bodyText, commandBodyText, media, preflightAudioTranscript, locationPayload, messageId, triggerSnapshot, threadRootId, thread, botLoopProtection, effectiveGroupAllowFrom, effectiveRoomUsers } = resolvedIngressResult;
|
|
3017
|
+
const { route: _route, hasExplicitSessionBinding, roomConfig, isDirectMessage, isRoom, shouldRequireMention, wasMentioned, effectiveWasMentioned, shouldBypassMention, canDetectMention, commandAuthorized, inboundHistory, senderName, bodyText, commandBodyText, media, preflightAudioTranscript, locationPayload, messageId, triggerSnapshot, threadRootId, thread, botLoopProtection, effectiveGroupAllowFrom, effectiveRoomUsers } = resolvedIngressResult;
|
|
3002
3018
|
const replyToEventId = resolveMatrixReplyToEventId(event.content);
|
|
3003
3019
|
const threadTarget = thread.threadId;
|
|
3004
3020
|
const isRoomContextSenderAllowed = (contextSenderId) => {
|
|
@@ -3046,11 +3062,10 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3046
3062
|
const roomName = (isRoom ? await getRoomInfo(roomId) : void 0)?.name;
|
|
3047
3063
|
const envelopeFrom = isDirectMessage ? senderName : roomName ?? roomId;
|
|
3048
3064
|
const textWithId = `${bodyText}\n[matrix event id: ${messageId} room: ${roomId}]`;
|
|
3049
|
-
const storePath =
|
|
3050
|
-
const
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
sessionKey: _route.sessionKey
|
|
3065
|
+
const storePath = resolveStorePathImpl(cfg.session?.store, { agentId: _route.agentId });
|
|
3066
|
+
const buildEnvelope = createChannelInboundEnvelopeBuilderImpl({
|
|
3067
|
+
cfg,
|
|
3068
|
+
route: _route
|
|
3054
3069
|
});
|
|
3055
3070
|
const sharedDmNoticeSessionKey = threadTarget ? _route.mainSessionKey || _route.sessionKey : _route.sessionKey;
|
|
3056
3071
|
const sharedDmContextNotice = isDirectMessage ? hasExplicitSessionBinding ? null : resolveMatrixSharedDmContextNotice({
|
|
@@ -3062,12 +3077,10 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3062
3077
|
sentRooms: sharedDmContextNoticeRooms,
|
|
3063
3078
|
logVerboseMessage
|
|
3064
3079
|
}) : null;
|
|
3065
|
-
const body =
|
|
3080
|
+
const body = buildEnvelope({
|
|
3066
3081
|
channel: "Matrix",
|
|
3067
3082
|
from: envelopeFrom,
|
|
3068
3083
|
timestamp: eventTs ?? void 0,
|
|
3069
|
-
previousTimestamp,
|
|
3070
|
-
envelope: envelopeOptions,
|
|
3071
3084
|
body: textWithId
|
|
3072
3085
|
});
|
|
3073
3086
|
const groupSystemPrompt = normalizeOptionalString(roomConfig?.systemPrompt);
|
|
@@ -3078,8 +3091,8 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3078
3091
|
}).include);
|
|
3079
3092
|
const ctxPayload = buildChannelInboundEventContext({
|
|
3080
3093
|
channel: "matrix",
|
|
3081
|
-
finalize: core.channel.reply.finalizeInboundContext,
|
|
3082
3094
|
contextVisibility: contextVisibilityMode,
|
|
3095
|
+
finalize: finalizeInboundContext,
|
|
3083
3096
|
supplemental: {
|
|
3084
3097
|
quote: replyContext ? {
|
|
3085
3098
|
id: threadTarget ? void 0 : replyToEventId ?? void 0,
|
|
@@ -3116,6 +3129,7 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3116
3129
|
},
|
|
3117
3130
|
route: {
|
|
3118
3131
|
agentId: _route.agentId,
|
|
3132
|
+
dmScope: _route.dmScope,
|
|
3119
3133
|
accountId: _route.accountId,
|
|
3120
3134
|
routeSessionKey: _route.sessionKey
|
|
3121
3135
|
},
|
|
@@ -3169,7 +3183,7 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3169
3183
|
isMentionableGroup: isRoom,
|
|
3170
3184
|
requireMention: shouldRequireMention,
|
|
3171
3185
|
canDetectMention,
|
|
3172
|
-
effectiveWasMentioned
|
|
3186
|
+
effectiveWasMentioned,
|
|
3173
3187
|
shouldBypassMention
|
|
3174
3188
|
}));
|
|
3175
3189
|
if (shouldAckReaction() && messageId) loadMatrixSendModule().then(({ reactMatrixMessage }) => reactMatrixMessage(roomId, messageId, ackReaction, client)).catch((err) => {
|
|
@@ -3350,7 +3364,7 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3350
3364
|
},
|
|
3351
3365
|
onPlanUpdate: async (payload) => {
|
|
3352
3366
|
if (payload.phase !== "update") return;
|
|
3353
|
-
await pushPlanProgress(payload.
|
|
3367
|
+
await pushPlanProgress(payload.steps, payload.explanation);
|
|
3354
3368
|
},
|
|
3355
3369
|
onApprovalEvent: async (payload) => {
|
|
3356
3370
|
if (payload.phase !== "requested") return;
|
|
@@ -3439,9 +3453,9 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3439
3453
|
progressDraftGate.reset();
|
|
3440
3454
|
resetPreviewToolProgress();
|
|
3441
3455
|
};
|
|
3442
|
-
const {
|
|
3456
|
+
const { deliver: deliverReply, onError: onReplyError, ...turnDispatcherOptions } = {
|
|
3443
3457
|
...prefixOptions,
|
|
3444
|
-
humanDelay:
|
|
3458
|
+
humanDelay: resolveHumanDelayConfigImpl(cfg, _route.agentId),
|
|
3445
3459
|
deliver: async (payload, info) => {
|
|
3446
3460
|
if (draftStream && info.kind !== "tool" && !payload.isCompactionNotice) {
|
|
3447
3461
|
const hasMedia = Boolean(payload.mediaUrl) || (payload.mediaUrls?.length ?? 0) > 0;
|
|
@@ -3626,7 +3640,7 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3626
3640
|
},
|
|
3627
3641
|
onReplyStart: typingCallbacks.onReplyStart,
|
|
3628
3642
|
onIdle: typingCallbacks.onIdle
|
|
3629
|
-
}
|
|
3643
|
+
};
|
|
3630
3644
|
const pinnedMainDmOwner = isDirectMessage ? await (async () => {
|
|
3631
3645
|
const livePinnedCfg = core.config.current();
|
|
3632
3646
|
const livePinnedAllowlists = resolveMatrixAccountAllowlistConfig({
|
|
@@ -3665,12 +3679,14 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3665
3679
|
raw: event
|
|
3666
3680
|
}),
|
|
3667
3681
|
resolveTurn: () => ({
|
|
3682
|
+
cfg,
|
|
3668
3683
|
channel: "matrix",
|
|
3669
3684
|
accountId: _route.accountId,
|
|
3670
|
-
|
|
3671
|
-
|
|
3685
|
+
route: {
|
|
3686
|
+
agentId: _route.agentId,
|
|
3687
|
+
sessionKey: _route.sessionKey
|
|
3688
|
+
},
|
|
3672
3689
|
ctxPayload,
|
|
3673
|
-
recordInboundSession: core.channel.session.recordInboundSession,
|
|
3674
3690
|
botLoopProtection,
|
|
3675
3691
|
record: {
|
|
3676
3692
|
updateLastRoute: isDirectMessage ? {
|
|
@@ -3694,14 +3710,7 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3694
3710
|
});
|
|
3695
3711
|
}
|
|
3696
3712
|
},
|
|
3697
|
-
|
|
3698
|
-
dispatcher,
|
|
3699
|
-
onSettled: () => {
|
|
3700
|
-
markRunComplete();
|
|
3701
|
-
markDispatchIdle();
|
|
3702
|
-
}
|
|
3703
|
-
}),
|
|
3704
|
-
runDispatch: async () => {
|
|
3713
|
+
afterRecord: async () => {
|
|
3705
3714
|
if (sharedDmContextNotice && markTrackedRoomIfFirst(sharedDmContextNoticeRooms, roomId)) try {
|
|
3706
3715
|
await client.sendMessage(roomId, {
|
|
3707
3716
|
msgtype: "m.notice",
|
|
@@ -3710,46 +3719,35 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
3710
3719
|
} catch (err) {
|
|
3711
3720
|
logVerboseMessage(`matrix: failed sending shared DM session notice room=${roomId}: ${String(err)}`);
|
|
3712
3721
|
}
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
onQueuedFollowupAdmitted: draftStream ? resetDraftDeliveryState : void 0,
|
|
3743
|
-
...buildPreviewToolProgressReplyOptions(),
|
|
3744
|
-
onModelSelected
|
|
3745
|
-
}
|
|
3746
|
-
});
|
|
3747
|
-
} finally {
|
|
3748
|
-
progressDraftGate.cancel();
|
|
3749
|
-
markRunComplete();
|
|
3750
|
-
}
|
|
3751
|
-
}
|
|
3752
|
-
});
|
|
3722
|
+
},
|
|
3723
|
+
delivery: {
|
|
3724
|
+
deliver: deliverReply,
|
|
3725
|
+
onError: (err, info) => onReplyError(err, info)
|
|
3726
|
+
},
|
|
3727
|
+
dispatcherOptions: {
|
|
3728
|
+
...turnDispatcherOptions,
|
|
3729
|
+
onSettled: () => progressDraftGate.cancel()
|
|
3730
|
+
},
|
|
3731
|
+
replyOptions: {
|
|
3732
|
+
skillFilter: roomConfig?.skills,
|
|
3733
|
+
disableBlockStreaming: !blockStreamingEnabled,
|
|
3734
|
+
onPartialReply: draftStream ? (payload) => {
|
|
3735
|
+
if (progressDraftStreaming) return;
|
|
3736
|
+
latestDraftFullText = payload.text ?? "";
|
|
3737
|
+
suppressPreviewToolProgressForAnswerText(latestDraftFullText);
|
|
3738
|
+
updateDraftFromLatestFullText();
|
|
3739
|
+
} : void 0,
|
|
3740
|
+
onBlockReplyQueued: draftStream ? (payload, context) => {
|
|
3741
|
+
if (payload.isCompactionNotice === true) return;
|
|
3742
|
+
queueDraftBlockBoundary(payload, context);
|
|
3743
|
+
} : void 0,
|
|
3744
|
+
onAssistantMessageStart: draftStream ? () => {
|
|
3745
|
+
resetDraftBlockOffsets();
|
|
3746
|
+
resetPreviewToolProgress();
|
|
3747
|
+
} : void 0,
|
|
3748
|
+
onQueuedFollowupAdmitted: draftStream ? resetDraftDeliveryState : void 0,
|
|
3749
|
+
...buildPreviewToolProgressReplyOptions(),
|
|
3750
|
+
onModelSelected
|
|
3753
3751
|
}
|
|
3754
3752
|
})
|
|
3755
3753
|
}
|
|
@@ -3807,10 +3805,10 @@ function shouldPromoteRecentInviteRoom(params) {
|
|
|
3807
3805
|
//#endregion
|
|
3808
3806
|
//#region extensions/matrix/src/matrix/monitor/startup.ts
|
|
3809
3807
|
const loadMatrixStartupMaintenanceDeps = createLazyRuntimeModule(() => Promise.all([
|
|
3810
|
-
import("./setup-core-
|
|
3808
|
+
import("./setup-core-XCdAx1nY.js").then((n) => n.s),
|
|
3811
3809
|
import("./device-health-D4LBxuPq.js"),
|
|
3812
|
-
import("./setup-core-
|
|
3813
|
-
import("./startup-verification-
|
|
3810
|
+
import("./setup-core-XCdAx1nY.js").then((n) => n.a),
|
|
3811
|
+
import("./startup-verification-CA00kebL.js")
|
|
3814
3812
|
]).then(([configUpdateModule, deviceHealthModule, profileModule, startupVerificationModule]) => ({
|
|
3815
3813
|
updateMatrixAccountConfig: configUpdateModule.updateMatrixAccountConfig,
|
|
3816
3814
|
summarizeMatrixDeviceHealth: deviceHealthModule.summarizeMatrixDeviceHealth,
|
|
@@ -2,7 +2,7 @@ import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
|
2
2
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
//#region extensions/matrix/src/plugin-entry.runtime.ts
|
|
5
|
-
const loadMatrixVerificationRuntime = createLazyRuntimeModule(() => import("./verification-
|
|
5
|
+
const loadMatrixVerificationRuntime = createLazyRuntimeModule(() => import("./verification-DjxyWTNP.js").then((n) => n.y));
|
|
6
6
|
function sendError(respond, err) {
|
|
7
7
|
respond(false, { error: formatMatrixErrorMessage(err) });
|
|
8
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
|
-
import { c as resolveMatrixConfigPath, l as updateMatrixAccountConfig, o as syncMatrixOwnProfile } from "./setup-core-
|
|
3
|
-
import { n as withResolvedActionClient } from "./client-
|
|
2
|
+
import { c as resolveMatrixConfigPath, l as updateMatrixAccountConfig, o as syncMatrixOwnProfile } from "./setup-core-XCdAx1nY.js";
|
|
3
|
+
import { n as withResolvedActionClient } from "./client-BtG4quUl.js";
|
|
4
4
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
5
|
//#region extensions/matrix/src/matrix/actions/profile.ts
|
|
6
6
|
async function updateMatrixOwnProfile(opts = {}) {
|