@openclaw/matrix 2026.8.2 → 2026.9.1
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/api.js +4 -4
- package/dist/{approval-handler.runtime-xcVrZw9o.js → approval-handler.runtime-B_6ytY5I.js} +32 -9
- package/dist/{approval-ids-hmvhDNBj.js → approval-ids-CfHtZ9d1.js} +1 -1
- package/dist/{approval-reaction-auth-DziFGHSk.js → approval-reaction-auth-BpDvJqfy.js} +1 -1
- package/dist/{channel-D6-ajB_u.js → channel-b-jES-oi.js} +18 -11
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-BkqjwEDU.js +76 -0
- package/dist/{channel.setup-OIEzCzSs.js → channel.setup-BY42QaL7.js} +2 -2
- package/dist/{cli-B6HF7Hmn.js → cli-CtYeU7ol.js} +8 -8
- package/dist/{cli-metadata-Mtzu5-AY.js → cli-metadata-B7MQjR5S.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-B0yMDho1.js → client-D2utPQ1E.js} +2 -2
- package/dist/{client-DFsRJEgB.js → client-Dj4mcf-s.js} +2 -2
- package/dist/{client-bootstrap-DjXCKEtg.js → client-bootstrap-n1Rqc8Go.js} +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/{crypto-runtime-QvlgyCkj.js → crypto-runtime-m1eplj3b.js} +3 -3
- package/dist/crypto-snapshot-doctor.runtime-D0v841D_.js +91 -0
- package/dist/{directory-live-Drh343TW.js → directory-live-DLUgWBhA.js} +1 -1
- package/dist/doctor-contract-api.js +85 -105
- package/dist/{draft-stream-DhGHVdO4.js → draft-stream-DPYdv4fE.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-DlMQaC02.js → messages-C1U3b1oN.js} +2 -2
- package/dist/{monitor-U2LcVtHt.js → monitor-SNnu-0bp.js} +29 -17
- package/dist/outbound-CeCEtF_q.js +220 -0
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-B1YPxG9x.js +2 -0
- package/dist/{profile-update-CsyKA9jI.js → profile-update-Cd1p8ABr.js} +1 -1
- package/dist/{reaction-events-lwNc5I1X.js → reaction-events-DveJRUaX.js} +3 -3
- package/dist/{resolve-targets-D3Eakgzs.js → resolve-targets-B64O69Nd.js} +1 -1
- package/dist/{resolver.runtime-DJQxR35r.js → resolver.runtime-TRmePJDV.js} +1 -1
- package/dist/{room-info-DIU67XLP.js → room-info-DVkKDscD.js} +3 -3
- package/dist/{sdk-Jl2CgAbJ.js → sdk-C1yfda1L.js} +4 -4
- package/dist/{send-DfS5ciUL.js → send-DG7Bnj7_.js} +12 -14
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-CWoIWudw.js → setup-bootstrap-Co985F63.js} +1 -1
- package/dist/{setup-core-CZM496H-.js → setup-core-CEF6exLW.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DSZtOsWK.js → setup-surface-BSlj1vnL.js} +4 -4
- package/dist/{thread-bindings-2HN2AyLu.js → thread-bindings-DgxQEB99.js} +1 -1
- package/dist/{tool-actions.runtime-CFZZPG5g.js → tool-actions.runtime-vbkQgU7D.js} +7 -7
- package/dist/{verification-CD7k5vE9.js → verification-D-iOebn4.js} +1 -1
- package/package.json +6 -5
- package/dist/channel.runtime-BMA0dG2k.js +0 -280
- package/dist/probe.runtime-CNo-5_iz.js +0 -2
- package/dist/{idb-persistence-D4NGNQxt.js → idb-persistence-CU7CNLlX.js} +1 -1
|
@@ -2,99 +2,74 @@ import { a as resolveMatrixDefaultOrOnlyAccountId, n as requiresExplicitMatrixDe
|
|
|
2
2
|
import { i as normalizeMatrixStoredCredentials, n as isMatrixCredentialRevocation, r as matrixCredentialsStoreKey, t as MATRIX_CREDENTIALS_NAMESPACE } from "./credentials-state-B3cuUFwZ.js";
|
|
3
3
|
import { r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.js";
|
|
4
4
|
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-HyWFZQVG.js";
|
|
5
|
-
import { C as readLegacyMatrixRecoveryKeyState,
|
|
5
|
+
import { C as readLegacyMatrixRecoveryKeyState, M as resolveMatrixSqliteStateEnv, a as openMatrixStorageMetaStoreOptions, b as openMatrixRecoveryKeyStoreOptions, f as MATRIX_IDB_SNAPSHOT_FILENAME, g as hasMatrixRecoveryKeyStateInStore, h as hasMatrixLegacyCryptoMigrationStateInStore, 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, x as readLegacyMatrixLegacyCryptoMigrationState, y as openMatrixLegacyCryptoMigrationStoreOptions } from "./storage-BVf4uucD.js";
|
|
6
6
|
import { a as readLegacyMatrixSyncCacheState, c as writeMatrixSyncCacheStateToStore, i as openMatrixSyncCacheStoreOptions, r as hasMatrixSyncCacheStateInStore } from "./sync-cache-state-d-A_OhbU.js";
|
|
7
|
-
import { n as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS } from "./idb-persistence-lock-B3fZXyF_.js";
|
|
8
|
-
import { r as readLegacyMatrixIdbSnapshotStateUnlocked, t as isValidMatrixIdbSnapshotJson } from "./idb-persistence-D4NGNQxt.js";
|
|
9
7
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
8
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
11
|
-
import { createHash
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
12
10
|
import path from "node:path";
|
|
13
11
|
import { archiveLegacyStateSource } from "openclaw/plugin-sdk/runtime-doctor-migrations";
|
|
14
|
-
import fs from "node:fs";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, () => migrateLegacyMatrixIdbSnapshotLocked(params));
|
|
23
|
-
} catch (err) {
|
|
24
|
-
params.warnings.push(`Failed locking Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async function migrateLegacyMatrixIdbSnapshotLocked(params) {
|
|
28
|
-
const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
29
|
-
let snapshot;
|
|
30
|
-
try {
|
|
31
|
-
snapshot = readLegacyMatrixIdbSnapshotStateUnlocked(params.storageRootDir);
|
|
32
|
-
} catch (err) {
|
|
33
|
-
params.warnings.push(`Failed reading Matrix IndexedDB snapshot legacy source for ${params.storageRootDir}: ${String(err)}; left source in place`);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if (!snapshot) {
|
|
37
|
-
if (!fs.existsSync(sourcePath)) return;
|
|
38
|
-
const archived = await archiveLegacyMatrixIdbSnapshot(params);
|
|
39
|
-
params.warnings.push(archived ? `Matrix IndexedDB snapshot legacy source is invalid for ${params.storageRootDir}; archived without import` : `Matrix IndexedDB snapshot legacy source is invalid for ${params.storageRootDir}; left active because archival failed`);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const snapshotJson = JSON.stringify(snapshot);
|
|
43
|
-
const store = params.context.openPluginStateKeyedStore(openMatrixIdbSnapshotStoreOptions(params.storageRootDir));
|
|
44
|
-
let persisted;
|
|
45
|
-
let hadPartialState;
|
|
46
|
-
try {
|
|
47
|
-
persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
|
|
48
|
-
const persistedIsValid = persisted ? isValidMatrixIdbSnapshotJson(persisted) : false;
|
|
49
|
-
hadPartialState = !persistedIsValid && (await store.entries()).length > 0;
|
|
50
|
-
if (!persistedIsValid) persisted = null;
|
|
51
|
-
} catch (err) {
|
|
52
|
-
params.warnings.push(`Failed inspecting Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (persisted && !snapshotContentMatches(persisted, snapshot)) {
|
|
56
|
-
if (await archiveLegacyMatrixIdbSnapshot(params)) params.notices.push(`Kept the canonical Matrix IndexedDB snapshot in SQLite and archived a differing legacy source for ${params.storageRootDir}`);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (!persisted) {
|
|
12
|
+
import fs from "node:fs/promises";
|
|
13
|
+
//#region extensions/matrix/src/matrix/account-state-schema-doctor.ts
|
|
14
|
+
const STATE_DATABASE_FILENAME = "openclaw.sqlite";
|
|
15
|
+
async function collectMatrixAccountStateRoots(stateDir) {
|
|
16
|
+
const accountsRoot = path.join(stateDir, "matrix", "accounts");
|
|
17
|
+
const roots = /* @__PURE__ */ new Set();
|
|
18
|
+
async function visit(dir, allowMissing = false) {
|
|
19
|
+
let entries;
|
|
60
20
|
try {
|
|
61
|
-
await
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
|
|
67
|
-
} catch (err) {
|
|
68
|
-
params.warnings.push(`Failed importing Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
69
|
-
return;
|
|
21
|
+
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (allowMissing && typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") return;
|
|
24
|
+
throw error;
|
|
70
25
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
26
|
+
for (const entry of entries) {
|
|
27
|
+
const entryPath = path.join(dir, entry.name);
|
|
28
|
+
if (entry.isFile() && entry.name === STATE_DATABASE_FILENAME && path.basename(dir) === "state") roots.add(path.dirname(dir));
|
|
29
|
+
else if (entry.isDirectory()) await visit(entryPath);
|
|
74
30
|
}
|
|
75
|
-
params.changes.push(hadPartialState ? `Repaired partial or invalid Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}` : `Migrated Matrix IndexedDB snapshot JSON to SQLite for ${params.storageRootDir}`);
|
|
76
31
|
}
|
|
77
|
-
await
|
|
32
|
+
await visit(accountsRoot, true);
|
|
33
|
+
return [...roots].toSorted();
|
|
78
34
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
return isDeepStrictEqual(JSON.parse(persistedJson), snapshot);
|
|
82
|
-
} catch {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
35
|
+
function describeMatrixAccountStateMigration(storageRootDir, migration) {
|
|
36
|
+
return `Matrix account SQLite schema migration (${migration.kind}): ${storageRootDir}`;
|
|
85
37
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
await
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
38
|
+
const matrixAccountStateSchemaMigration = {
|
|
39
|
+
id: "matrix-account-sqlite-schema",
|
|
40
|
+
label: "Matrix account SQLite schemas",
|
|
41
|
+
async detectLegacyState(params) {
|
|
42
|
+
const { detectOpenClawStateDatabaseSchemaMigrations } = await import("openclaw/plugin-sdk/doctor-repair-runtime");
|
|
43
|
+
const preview = [];
|
|
44
|
+
for (const storageRootDir of await collectMatrixAccountStateRoots(params.stateDir)) {
|
|
45
|
+
const env = resolveMatrixSqliteStateEnv({
|
|
46
|
+
env: params.env,
|
|
47
|
+
stateDir: storageRootDir
|
|
48
|
+
});
|
|
49
|
+
preview.push(...detectOpenClawStateDatabaseSchemaMigrations({ env }).map((migration) => describeMatrixAccountStateMigration(storageRootDir, migration)));
|
|
50
|
+
}
|
|
51
|
+
return preview.length > 0 ? { preview } : null;
|
|
52
|
+
},
|
|
53
|
+
async migrateLegacyState(params) {
|
|
54
|
+
const { detectOpenClawStateDatabaseSchemaMigrations, repairOpenClawStateDatabaseSchema } = await import("openclaw/plugin-sdk/doctor-repair-runtime");
|
|
55
|
+
const changes = [];
|
|
56
|
+
const warnings = [];
|
|
57
|
+
for (const storageRootDir of await collectMatrixAccountStateRoots(params.stateDir)) {
|
|
58
|
+
const env = resolveMatrixSqliteStateEnv({
|
|
59
|
+
env: params.env,
|
|
60
|
+
stateDir: storageRootDir
|
|
61
|
+
});
|
|
62
|
+
if (detectOpenClawStateDatabaseSchemaMigrations({ env }).length === 0) continue;
|
|
63
|
+
const repaired = repairOpenClawStateDatabaseSchema({ env });
|
|
64
|
+
changes.push(...repaired.changes.map((change) => `Matrix account SQLite ${storageRootDir}: ${change}`));
|
|
65
|
+
warnings.push(...repaired.warnings.map((warning) => `Matrix account SQLite ${storageRootDir}: ${warning}`));
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
changes,
|
|
69
|
+
warnings
|
|
70
|
+
};
|
|
96
71
|
}
|
|
97
|
-
}
|
|
72
|
+
};
|
|
98
73
|
//#endregion
|
|
99
74
|
//#region extensions/matrix/src/matrix/monitor/inbound-dedupe-migration.ts
|
|
100
75
|
const LEGACY_SQLITE_NAMESPACE = "inbound-dedupe";
|
|
@@ -143,7 +118,7 @@ async function collectMatrixInboundDedupeSources(stateDir) {
|
|
|
143
118
|
async function visit(dir, allowMissing = false) {
|
|
144
119
|
let entries;
|
|
145
120
|
try {
|
|
146
|
-
entries = await fs
|
|
121
|
+
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
147
122
|
} catch (err) {
|
|
148
123
|
if (allowMissing && err.code === "ENOENT") return;
|
|
149
124
|
warnings.push(`Failed scanning Matrix inbound dedupe sources under ${dir}: ${String(err)}`);
|
|
@@ -269,7 +244,7 @@ async function verifyMatrixInboundDedupeSourcesRetired(stateDir) {
|
|
|
269
244
|
}
|
|
270
245
|
async function resolveJsonRootAccountId(storageRootDir) {
|
|
271
246
|
for (const filename of [STORAGE_META_FILENAME, `${STORAGE_META_FILENAME}.migrated`]) try {
|
|
272
|
-
const metadata = normalizeMatrixStorageMetadata(JSON.parse(await fs
|
|
247
|
+
const metadata = normalizeMatrixStorageMetadata(JSON.parse(await fs.readFile(path.join(storageRootDir, filename), "utf8")));
|
|
273
248
|
if (metadata?.accountId) return metadata.accountId;
|
|
274
249
|
} catch {}
|
|
275
250
|
return "default";
|
|
@@ -281,7 +256,7 @@ async function resolveJsonRootAccountId(storageRootDir) {
|
|
|
281
256
|
*/
|
|
282
257
|
async function readLegacyInboundDedupeJsonSource(storageRootDir) {
|
|
283
258
|
const jsonPath = path.join(storageRootDir, MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME);
|
|
284
|
-
const raw = await fs
|
|
259
|
+
const raw = await fs.readFile(jsonPath, "utf8");
|
|
285
260
|
let parsed;
|
|
286
261
|
try {
|
|
287
262
|
parsed = JSON.parse(raw);
|
|
@@ -389,7 +364,7 @@ async function collectLegacyMatrixCredentialSources(params) {
|
|
|
389
364
|
const credentialsDir = resolveMatrixCredentialsDir(params.stateDir);
|
|
390
365
|
let entries;
|
|
391
366
|
try {
|
|
392
|
-
entries = await fs
|
|
367
|
+
entries = await fs.readdir(credentialsDir, { withFileTypes: true });
|
|
393
368
|
} catch {
|
|
394
369
|
return [];
|
|
395
370
|
}
|
|
@@ -408,8 +383,8 @@ async function collectLegacyMatrixCredentialSources(params) {
|
|
|
408
383
|
async function readLegacyMatrixCredentials(source) {
|
|
409
384
|
if (!source.accountId) return null;
|
|
410
385
|
try {
|
|
411
|
-
const raw = JSON.parse(await fs
|
|
412
|
-
const createdAt = isRecord(raw) && typeof raw.createdAt === "string" && raw.createdAt ? raw.createdAt : (await fs
|
|
386
|
+
const raw = JSON.parse(await fs.readFile(source.filePath, "utf8"));
|
|
387
|
+
const createdAt = isRecord(raw) && typeof raw.createdAt === "string" && raw.createdAt ? raw.createdAt : (await fs.stat(source.filePath)).mtime.toISOString();
|
|
413
388
|
return normalizeMatrixStoredCredentials(isRecord(raw) ? {
|
|
414
389
|
...raw,
|
|
415
390
|
createdAt
|
|
@@ -424,7 +399,7 @@ async function collectLegacyMatrixStateRoots(stateDir, filename, options) {
|
|
|
424
399
|
async function visit(dir) {
|
|
425
400
|
let entries;
|
|
426
401
|
try {
|
|
427
|
-
entries = await fs
|
|
402
|
+
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
428
403
|
} catch {
|
|
429
404
|
return;
|
|
430
405
|
}
|
|
@@ -440,12 +415,18 @@ async function collectLegacyMatrixStateRoots(stateDir, filename, options) {
|
|
|
440
415
|
await visit(matrixRoot);
|
|
441
416
|
return roots.filter((root) => options?.includeMatrixRoot || path.resolve(root) !== path.resolve(matrixRoot)).toSorted();
|
|
442
417
|
}
|
|
443
|
-
async function
|
|
444
|
-
|
|
418
|
+
async function* readLegacyMatrixSyncCaches(stateDir) {
|
|
419
|
+
for (const storageRootDir of await collectLegacyMatrixStateRoots(stateDir, MATRIX_SYNC_CACHE_FILENAME)) {
|
|
420
|
+
const persisted = await readLegacyMatrixSyncCacheState(storageRootDir);
|
|
421
|
+
if (persisted) yield {
|
|
422
|
+
storageRootDir,
|
|
423
|
+
persisted
|
|
424
|
+
};
|
|
425
|
+
}
|
|
445
426
|
}
|
|
446
427
|
async function readLegacyMatrixStorageMetadata(storageRootDir) {
|
|
447
428
|
try {
|
|
448
|
-
return normalizeMatrixStorageMetadata(JSON.parse(await fs
|
|
429
|
+
return normalizeMatrixStorageMetadata(JSON.parse(await fs.readFile(path.join(storageRootDir, MATRIX_STORAGE_META_FILENAME), "utf8")));
|
|
449
430
|
} catch {
|
|
450
431
|
return null;
|
|
451
432
|
}
|
|
@@ -468,6 +449,7 @@ async function archiveLegacyMatrixStateFile(params) {
|
|
|
468
449
|
if (params.notice && params.warnings.length === warningCount) params.notices?.push(params.notice);
|
|
469
450
|
}
|
|
470
451
|
const stateMigrations = [
|
|
452
|
+
matrixAccountStateSchemaMigration,
|
|
471
453
|
{
|
|
472
454
|
id: "matrix-credentials-json-to-plugin-state",
|
|
473
455
|
label: "Matrix credentials",
|
|
@@ -698,19 +680,14 @@ const stateMigrations = [
|
|
|
698
680
|
label: "Matrix sync cache",
|
|
699
681
|
async detectLegacyState(params) {
|
|
700
682
|
const previews = [];
|
|
701
|
-
for (const storageRootDir of
|
|
702
|
-
if (!await readLegacyMatrixSyncCacheState(storageRootDir)) continue;
|
|
703
|
-
previews.push(`Matrix sync cache JSON can migrate to SQLite: ${storageRootDir}`);
|
|
704
|
-
}
|
|
683
|
+
for await (const { storageRootDir } of readLegacyMatrixSyncCaches(params.stateDir)) previews.push(`Matrix sync cache JSON can migrate to SQLite: ${storageRootDir}`);
|
|
705
684
|
return previews.length > 0 ? { preview: previews } : null;
|
|
706
685
|
},
|
|
707
686
|
async migrateLegacyState(params) {
|
|
708
687
|
const changes = [];
|
|
709
688
|
const warnings = [];
|
|
710
689
|
const notices = [];
|
|
711
|
-
for (const storageRootDir of
|
|
712
|
-
const persisted = await readLegacyMatrixSyncCacheState(storageRootDir);
|
|
713
|
-
if (!persisted) continue;
|
|
690
|
+
for await (const { storageRootDir, persisted } of readLegacyMatrixSyncCaches(params.stateDir)) {
|
|
714
691
|
const store = params.context.openPluginStateKeyedStore(openMatrixSyncCacheStoreOptions(storageRootDir));
|
|
715
692
|
if (await hasMatrixSyncCacheStateInStore({
|
|
716
693
|
storageRootDir,
|
|
@@ -840,13 +817,16 @@ const stateMigrations = [
|
|
|
840
817
|
warnings
|
|
841
818
|
});
|
|
842
819
|
}
|
|
843
|
-
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME, { includeMatrixRoot: true }))
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
820
|
+
for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME, { includeMatrixRoot: true })) {
|
|
821
|
+
const { migrateLegacyMatrixIdbSnapshot } = await import("./crypto-snapshot-doctor.runtime-D0v841D_.js");
|
|
822
|
+
await migrateLegacyMatrixIdbSnapshot({
|
|
823
|
+
storageRootDir,
|
|
824
|
+
context: params.context,
|
|
825
|
+
changes,
|
|
826
|
+
notices,
|
|
827
|
+
warnings
|
|
828
|
+
});
|
|
829
|
+
}
|
|
850
830
|
return {
|
|
851
831
|
changes,
|
|
852
832
|
warnings,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as MsgType, a as sendSingleTextMessageMatrix, c as prepareMatrixSingleText, t as editMessageMatrix } from "./send-
|
|
1
|
+
import { T as MsgType, a as sendSingleTextMessageMatrix, c as prepareMatrixSingleText, t as editMessageMatrix } from "./send-DG7Bnj7_.js";
|
|
2
2
|
import { createFinalizableDraftStreamControlsForState } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
3
|
//#region extensions/matrix/src/matrix/draft-stream.ts
|
|
4
4
|
const DEFAULT_THROTTLE_MS = 1e3;
|
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-B7MQjR5S.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,6 +1,6 @@
|
|
|
1
1
|
import { n as MATRIX_REACTION_EVENT_TYPE } from "./reaction-common-DkrQdBSZ.js";
|
|
2
|
-
import { _ as resolvePollReferenceEventId, d as formatPollAsText, f as formatPollResultsAsText, g as parsePollStartContent, m as isPollStartType, p as isPollEventType, r as sendMessageMatrix, t as editMessageMatrix, u as buildPollResultsSummary } from "./send-
|
|
3
|
-
import { r as withResolvedRoomAction } from "./client-
|
|
2
|
+
import { _ as resolvePollReferenceEventId, d as formatPollAsText, f as formatPollResultsAsText, g as parsePollStartContent, m as isPollStartType, p as isPollEventType, r as sendMessageMatrix, t as editMessageMatrix, u as buildPollResultsSummary } from "./send-DG7Bnj7_.js";
|
|
3
|
+
import { r as withResolvedRoomAction } from "./client-D2utPQ1E.js";
|
|
4
4
|
import { n as isMatrixNotFoundError } from "./errors-DKVS3_DO.js";
|
|
5
5
|
import { asNullableObjectRecord, asNullableRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import path from "node:path";
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig, i as resolveMatrixAccountAllowlistConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
2
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
3
|
import { n as resolveConfiguredMatrixBotUserIds } from "./accounts-DR1c4xF_.js";
|
|
4
|
-
import { _ as logInboundDrop, a as resolveMatrixThreadRootId, b as summarizeMapping, c as RelationType, d as buildAllowlistResolutionSummary, f as canonicalizeAllowlistWithResolvedIds, g as getAgentScopedMediaLocalRoots, h as formatLocationText, i as resolveMatrixReplyToEventId, l as resolveMatrixRoomConfig, m as createTypingCallbacks, n as resolveMatrixStoredSessionMeta, o as resolveMatrixThreadRouting, p as createReplyPrefixOptions, r as resolveMatrixInboundRoute, s as EventType, u as addAllowlistUserEntriesFromConfigEntry, v as logTypingFailure, x as toLocationContext, y as patchAllowlistUsersInConfigEntries } from "./channel-
|
|
5
|
-
import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./channel.setup-
|
|
4
|
+
import { _ as logInboundDrop, a as resolveMatrixThreadRootId, b as summarizeMapping, c as RelationType, d as buildAllowlistResolutionSummary, f as canonicalizeAllowlistWithResolvedIds, g as getAgentScopedMediaLocalRoots, h as formatLocationText, i as resolveMatrixReplyToEventId, l as resolveMatrixRoomConfig, m as createTypingCallbacks, n as resolveMatrixStoredSessionMeta, o as resolveMatrixThreadRouting, p as createReplyPrefixOptions, r as resolveMatrixInboundRoute, s as EventType, u as addAllowlistUserEntriesFromConfigEntry, v as logTypingFailure, x as toLocationContext, y as patchAllowlistUsersInConfigEntries } from "./channel-b-jES-oi.js";
|
|
5
|
+
import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./channel.setup-BY42QaL7.js";
|
|
6
6
|
import { n as isMatrixRoomId, t as isMatrixQualifiedUserId } from "./target-ids-Nwx7cMVE.js";
|
|
7
|
-
import { S as promoteMatrixDirectRoomCandidate, d as formatPollAsText, g as parsePollStartContent, m as isPollStartType, p as isPollEventType, r as sendMessageMatrix, w as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY } from "./send-
|
|
7
|
+
import { S as promoteMatrixDirectRoomCandidate, d as formatPollAsText, g as parsePollStartContent, m as isPollStartType, p as isPollEventType, r as sendMessageMatrix, w as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY } from "./send-DG7Bnj7_.js";
|
|
8
8
|
import { i as isStrictDirectMembership, n as hasDirectMatrixMemberFlag, o as readJoinedMatrixMembers } from "./direct-room-RinHjtqX.js";
|
|
9
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
10
|
-
import { c as formatMatrixMediaTooLargeText, d as isLikelyBareFilename, f as resolveBundledMatrixReplacementContent, l as formatMatrixMediaUnavailableText, m as fetchMatrixPollSnapshot, r as readMatrixMessages, u as formatMatrixMessageText } from "./messages-
|
|
9
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-DgxQEB99.js";
|
|
10
|
+
import { c as formatMatrixMediaTooLargeText, d as isLikelyBareFilename, f as resolveBundledMatrixReplacementContent, l as formatMatrixMediaUnavailableText, m as fetchMatrixPollSnapshot, r as readMatrixMessages, u as formatMatrixMessageText } from "./messages-C1U3b1oN.js";
|
|
11
11
|
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
12
|
-
import { a as throwIfMatrixStartupAborted, c as backfillMatrixAuthDeviceIdAfterStartup, i as isMatrixStartupAbortError, l as resolveMatrixAuth, n as acquireSharedMatrixClient, o as createMatrixMonitorTaskRunner, u as resolveMatrixAuthContext } from "./client-
|
|
12
|
+
import { a as throwIfMatrixStartupAborted, c as backfillMatrixAuthDeviceIdAfterStartup, i as isMatrixStartupAbortError, l as resolveMatrixAuth, n as acquireSharedMatrixClient, o as createMatrixMonitorTaskRunner, u as resolveMatrixAuthContext } from "./client-Dj4mcf-s.js";
|
|
13
13
|
import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-DOmFvKvB.js";
|
|
14
|
-
import {
|
|
14
|
+
import { n as prepareMatrixReplyPayload, r as resolveMatrixExtraContent } from "./outbound-CeCEtF_q.js";
|
|
15
|
+
import { t as resolveMatrixTargets } from "./resolve-targets-B64O69Nd.js";
|
|
15
16
|
import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-BNcZNQZI.js";
|
|
16
17
|
import { createMatrixInboundEventDeduper } from "./inbound-dedupe-Ch33GU06.js";
|
|
17
18
|
import { a as isMatrixAccessTokenInvalidatedError, d as isMatrixDisconnectedSyncState, f as isMatrixReadySyncState, p as isMatrixTerminalSyncState } from "./client-support-DLj4vDeu.js";
|
|
18
|
-
import { i as setBoundedMap, r as getMatrixRoomInfo, t as createMatrixRoomInfoResolver } from "./room-info-
|
|
19
|
+
import { i as setBoundedMap, r as getMatrixRoomInfo, t as createMatrixRoomInfoResolver } from "./room-info-DVkKDscD.js";
|
|
19
20
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
20
21
|
import { buildChannelProgressDraftLineForEntry, createChannelProgressDraftCompositor, createMessageReceiptFromOutboundResults, createPreviewMessageReceipt, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, formatChannelProgressDraftLine, formatChannelProgressDraftText, listMessageReceiptPlatformIds, resolveChannelStreamingBlockEnabled, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
|
|
21
22
|
import { normalizeLowercaseStringOrEmpty, normalizeNullableString, normalizeOptionalString, normalizeStringifiedEntries, readStringValue, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -822,7 +823,7 @@ const matrixVerificationConstants = {
|
|
|
822
823
|
const MAX_TRACKED_VERIFICATION_EVENTS = 1024;
|
|
823
824
|
const SAS_NOTICE_RETRY_DELAY_MS = 750;
|
|
824
825
|
const VERIFICATION_EVENT_STARTUP_GRACE_MS = 3e4;
|
|
825
|
-
const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-
|
|
826
|
+
const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-DG7Bnj7_.js").then((n) => n.x), import("./direct-room-RinHjtqX.js").then((n) => n.t)]).then(([directManagementModule, directRoomModule]) => ({
|
|
826
827
|
inspectMatrixDirectRooms: directManagementModule.inspectMatrixDirectRooms,
|
|
827
828
|
isStrictDirectRoom: directRoomModule.isStrictDirectRoom
|
|
828
829
|
})));
|
|
@@ -1640,11 +1641,11 @@ async function redactMatrixDraftEvent(client, roomId, draftEventId) {
|
|
|
1640
1641
|
function buildMatrixFinalizedPreviewContent() {
|
|
1641
1642
|
return { [MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY]: true };
|
|
1642
1643
|
}
|
|
1643
|
-
const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-
|
|
1644
|
+
const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-DG7Bnj7_.js").then((n) => n.s));
|
|
1644
1645
|
const loadAcpBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/acp-binding-runtime"));
|
|
1645
1646
|
const loadSessionBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/session-binding-runtime"));
|
|
1646
|
-
const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-
|
|
1647
|
-
const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-
|
|
1647
|
+
const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-DveJRUaX.js"));
|
|
1648
|
+
const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-DPYdv4fE.js"));
|
|
1648
1649
|
async function matrixTextWouldActivateMentions(client, text) {
|
|
1649
1650
|
const { resolveMatrixMentionsForBody } = await loadMatrixSendModule();
|
|
1650
1651
|
const mentions = await resolveMatrixMentionsForBody({
|
|
@@ -3308,6 +3309,7 @@ async function deliverMatrixReplies(params) {
|
|
|
3308
3309
|
acceptedResults.push(result);
|
|
3309
3310
|
if (replyToIdForReply) hasRepliedRef.value = true;
|
|
3310
3311
|
};
|
|
3312
|
+
const extraContent = resolveMatrixExtraContent(reply);
|
|
3311
3313
|
if (mediaUrls.length === 0) {
|
|
3312
3314
|
await sendMessageMatrix(params.roomId, rawText, {
|
|
3313
3315
|
client: params.client,
|
|
@@ -3315,6 +3317,7 @@ async function deliverMatrixReplies(params) {
|
|
|
3315
3317
|
replyToId: replyToIdForReply,
|
|
3316
3318
|
threadId: params.threadId,
|
|
3317
3319
|
accountId: params.accountId,
|
|
3320
|
+
extraContent,
|
|
3318
3321
|
onDeliveryResult
|
|
3319
3322
|
});
|
|
3320
3323
|
continue;
|
|
@@ -3331,6 +3334,7 @@ async function deliverMatrixReplies(params) {
|
|
|
3331
3334
|
threadId: params.threadId,
|
|
3332
3335
|
audioAsVoice: reply.audioAsVoice,
|
|
3333
3336
|
accountId: params.accountId,
|
|
3337
|
+
extraContent: first ? extraContent : void 0,
|
|
3334
3338
|
onDeliveryResult
|
|
3335
3339
|
});
|
|
3336
3340
|
first = false;
|
|
@@ -3452,11 +3456,18 @@ function createMatrixReplyDispatcher(config) {
|
|
|
3452
3456
|
discardPending: async () => {},
|
|
3453
3457
|
id: () => draftEventId
|
|
3454
3458
|
},
|
|
3455
|
-
buildFinalEdit: () =>
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3459
|
+
buildFinalEdit: () => {
|
|
3460
|
+
const presentationContent = resolveMatrixExtraContent(payload);
|
|
3461
|
+
const extraContent = {
|
|
3462
|
+
...quietDraftStreaming ? buildMatrixFinalizedPreviewContent() : {},
|
|
3463
|
+
...presentationContent
|
|
3464
|
+
};
|
|
3465
|
+
return {
|
|
3466
|
+
text: finalPreviewText,
|
|
3467
|
+
finalizeLive: !(quietDraftStreaming || Boolean(presentationContent) || !draftStream.matchesPreparedText(finalPreviewText)),
|
|
3468
|
+
...Object.keys(extraContent).length > 0 ? { extraContent } : {}
|
|
3469
|
+
};
|
|
3470
|
+
},
|
|
3460
3471
|
editFinal: async (_draftEventId, edit) => {
|
|
3461
3472
|
if (edit.finalizeLive) {
|
|
3462
3473
|
if (!await draftStream.finalizeLive()) throw new Error("Matrix draft live finalize failed");
|
|
@@ -4077,6 +4088,7 @@ function createMatrixRoomMessageHandler(params) {
|
|
|
4077
4088
|
},
|
|
4078
4089
|
delivery: {
|
|
4079
4090
|
observeMessageSent: true,
|
|
4091
|
+
preparePayload: prepareMatrixReplyPayload,
|
|
4080
4092
|
deliver: deliverReply,
|
|
4081
4093
|
onError: (err, info) => onReplyError(err, info)
|
|
4082
4094
|
},
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { i as sendPollMatrix, r as sendMessageMatrix } from "./send-DG7Bnj7_.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-D-iOebn4.js").then((n) => n.y));
|
|
6
6
|
function sendError(respond, err) {
|
|
7
7
|
respond(false, { error: formatErrorMessage(err) });
|
|
8
8
|
}
|