@openclaw/matrix 2026.8.1 → 2026.8.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-selection-C8nnBTxi.js → .setup/account-selection-DZMazUgX.mjs} +12 -10
- package/dist/{accounts-fC57n-Jo.js → .setup/accounts-BJ6ECCac.mjs} +3 -3
- package/dist/{approval-handler.runtime-BBjFZw1t.js → .setup/approval-handler.runtime-CdT1wQve.mjs} +6 -6
- package/dist/{approval-ids-DTIdXV-m.js → .setup/approval-ids-CU_nMQy9.mjs} +1 -1
- package/dist/{approval-reaction-auth-BDONXxnF.js → .setup/approval-reaction-auth-CpxhvOOT.mjs} +2 -2
- package/dist/{approval-reactions-tXh9KYrW.js → .setup/approval-reactions-D5eegob9.mjs} +2 -2
- package/dist/{channel-BkEcVUs_.js → .setup/channel-Q_N83Wwa.mjs} +57 -59
- package/dist/{channel.runtime-CTLSBFsP.js → .setup/channel.runtime-BFXlZFP1.mjs} +17 -13
- package/dist/{channel.setup-CSacbORr.js → .setup/channel.setup-2A6HBRbA.mjs} +22 -20
- package/dist/{cli-DRVtgrq5.js → .setup/cli-CyuDGiIr.mjs} +43 -34
- package/dist/{cli-metadata-Ddx_y4Os.js → .setup/cli-metadata-B_y2Z5Np.mjs} +1 -1
- package/dist/{client-CZ_JvrO0.js → .setup/client-CpHMD-C2.mjs} +3 -3
- package/dist/{client-kSi51NKp.js → .setup/client-DvcYcTSy.mjs} +76 -23
- package/dist/{client-bootstrap-D8irSL2i.js → .setup/client-bootstrap-Cb1tHsT4.mjs} +3 -3
- package/dist/{client-support-DLj4vDeu.js → .setup/client-support-Bn9Bk0-H.mjs} +1 -1
- package/dist/{config-update-DC0fWBxc.js → .setup/config-update-B_4qZ5bV.mjs} +49 -31
- package/dist/{credentials-BdAaWuiR.js → .setup/credentials-B2roKThT.mjs} +6 -10
- package/dist/{credentials-read-B37cQknZ.js → .setup/credentials-read-DaemdXHy.mjs} +11 -9
- package/dist/{credentials-write.runtime-nAV2-5uR.js → .setup/credentials-write.runtime-D83HEGcL.mjs} +1 -1
- package/dist/{crypto-runtime-C4WDYxlP.js → .setup/crypto-runtime-Ch4WOG1y.mjs} +8 -8
- package/dist/{deps-CcVJfvRM.js → .setup/deps-mtxF2mHI.mjs} +1 -1
- package/dist/{device-health-B4-YXtJR.js → .setup/device-health-CWOuIirq.mjs} +1 -1
- package/dist/{direct-room-RinHjtqX.js → .setup/direct-room-CKyU8upP.mjs} +1 -1
- package/dist/{directory-live-DKr0w35b.js → .setup/directory-live-DggLE-28.mjs} +10 -8
- package/dist/{doctor-EWf9CDso.js → .setup/doctor-BLCvdOFo.mjs} +1 -1
- package/dist/{doctor-contract-DEt4O4Zt.js → .setup/doctor-contract-HyWFZQVG.mjs} +5 -4
- package/dist/{draft-stream-0CEpNrBk.js → .setup/draft-stream-DfUFwKfN.mjs} +1 -1
- package/dist/{encryption-guidance-D4ZdAqzM.js → .setup/encryption-guidance-CvN_NQUJ.mjs} +4 -3
- package/dist/{http-client-D8o8b9u6.js → .setup/http-client-Bv6a2OfI.mjs} +11 -8
- package/dist/{idb-persistence-DfgW720p.js → .setup/idb-persistence-BiscLSq4.mjs} +3 -3
- package/dist/{idb-persistence-lock-DAJ49nZX.js → .setup/idb-persistence-lock-B3fZXyF_.mjs} +1 -1
- package/dist/{inbound-dedupe-RvSLqdsz.js → .setup/inbound-dedupe-BOsuMiaj.mjs} +2 -2
- package/dist/{logger-B_71hN6W.js → .setup/logger-B3tfcB-m.mjs} +1 -1
- package/dist/{logging-DRjvUOIh.js → .setup/logging-CkohOZwO.mjs} +2 -2
- package/dist/{messages-DaGRt-tu.js → .setup/messages-C3v-jkaN.mjs} +4 -4
- package/dist/{monitor-CLPbPcR9.js → .setup/monitor-CQ6pGvZh.mjs} +56 -81
- package/dist/.setup/probe.runtime-ni46ImsO.mjs +2 -0
- package/dist/{profile-D-Wubo0A.js → .setup/profile-ClrB3IgR.mjs} +2 -2
- package/dist/{profile-update-zXVCMg7y.js → .setup/profile-update-B9Q6Ox2O.mjs} +6 -5
- package/dist/{reaction-events-CjVUiqcY.js → .setup/reaction-events-Dtd3W-rj.mjs} +10 -8
- package/dist/{resolve-targets-qG6gceps.js → .setup/resolve-targets-Bke5jHKS.mjs} +3 -3
- package/dist/{resolver.runtime-zX3TR3TN.js → .setup/resolver.runtime-BtrbC025.mjs} +1 -1
- package/dist/{room-info-yheP1mod.js → .setup/room-info-B0VNxsF8.mjs} +4 -4
- package/dist/.setup/runtime-setter-api-DGMubGUq.mjs +3 -0
- package/dist/{sdk-TZYyo0XQ.js → .setup/sdk-DoObvds0.mjs} +528 -30
- package/dist/{secret-contract-CufozuyJ.js → .setup/secret-contract-JlB6VmI3.mjs} +1 -1
- package/dist/.setup/secret-contract-api-B-iJoQEv.mjs +3 -0
- package/dist/{send-BL_iH5Ox.js → .setup/send-SmBzUhD-.mjs} +19 -15
- package/dist/{setup-bootstrap-D8M7FmcO.js → .setup/setup-bootstrap-CUKhebeX.mjs} +3 -3
- package/dist/{setup-core-r6L0nno-.js → .setup/setup-core-BnqoLunq.mjs} +9 -8
- package/dist/.setup/setup-plugin-api-Dg95tydH.mjs +3 -0
- package/dist/{setup-surface-g174ElFO.js → .setup/setup-surface-sWwADrZ8.mjs} +87 -81
- package/dist/{startup-verification-Cs08ca8u.js → .setup/startup-verification-E46yu4fh.mjs} +3 -3
- package/dist/{storage-BsGuHngK.js → .setup/storage-B-nf2ReN.mjs} +7 -6
- package/dist/{subagent-hooks-CMoZaARG.js → .setup/subagent-hooks-jFgft_Mr.mjs} +6 -2
- package/dist/.setup/sync-cache-state-6Hjn1K-v.mjs +234 -0
- package/dist/{thread-binding-api-CzkeLZCU.js → .setup/thread-binding-api-DRMC62cs.mjs} +1 -1
- package/dist/{thread-bindings-ERWNousC.js → .setup/thread-bindings-_WJ8RYWJ.mjs} +4 -4
- package/dist/{tool-actions.runtime-DcBCSwY4.js → .setup/tool-actions.runtime-DLICojA3.mjs} +230 -168
- package/dist/{verification-4vsW_WSn.js → .setup/verification-DOT16noD.mjs} +4 -3
- package/dist/api.js +8 -8
- package/dist/auth-presence.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/doctor-contract-api.js +9 -9
- package/dist/helper-api.js +3 -3
- package/dist/index.js +1 -1
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/runtime-api.js +6 -6
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/session-binding-contract-api.js +2 -2
- package/dist/setup-entry.js +4 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/thread-binding-api.js +1 -1
- package/dist/thread-bindings-runtime.js +1 -1
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +525 -484
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -1
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +7 -7
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -1
- package/node_modules/markdown-it/dist/markdown-it.cjs.js +129 -121
- package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -1
- package/node_modules/markdown-it/dist/markdown-it.d.mts +42 -71
- package/node_modules/markdown-it/dist/markdown-it.mjs +129 -121
- package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -1
- package/node_modules/markdown-it/package.json +1 -2
- package/node_modules/matrix-js-sdk/lib/client.d.ts +2 -1
- package/node_modules/matrix-js-sdk/lib/client.js +6 -2
- package/node_modules/matrix-js-sdk/lib/sync.js +8 -8
- package/node_modules/matrix-js-sdk/src/client.ts +7 -3
- package/node_modules/matrix-js-sdk/src/sync.ts +8 -8
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/package.json +6 -6
- package/dist/file-sync-store-DjskBX2o.js +0 -436
- package/dist/probe.runtime-Bxpr1FFy.js +0 -2
- package/dist/recovery-key-store-CognuDys.js +0 -276
- /package/dist/{account-config-CRsKoMqJ.js → .setup/account-config-CRsKoMqJ.mjs} +0 -0
- /package/dist/{backup-health-Dm_YMVFT.js → .setup/backup-health-Dm_YMVFT.mjs} +0 -0
- /package/dist/{config-paths-CnREYb1Y.js → .setup/config-paths-CnREYb1Y.mjs} +0 -0
- /package/dist/{config-secret-input.runtime-CwsP3--c.js → .setup/config-secret-input.runtime-CwsP3--c.mjs} +0 -0
- /package/dist/{credentials-state-B3cuUFwZ.js → .setup/credentials-state-B3cuUFwZ.mjs} +0 -0
- /package/dist/{crypto-node.runtime-6Aj_ltHQ.js → .setup/crypto-node.runtime-6Aj_ltHQ.mjs} +0 -0
- /package/dist/{env-vars-dGqak9dN.js → .setup/env-vars-dGqak9dN.mjs} +0 -0
- /package/dist/{errors-DKVS3_DO.js → .setup/errors-DKVS3_DO.mjs} +0 -0
- /package/dist/{event-helpers-XRfAbOIh.js → .setup/event-helpers-XRfAbOIh.mjs} +0 -0
- /package/dist/{reaction-common-DkrQdBSZ.js → .setup/reaction-common-DkrQdBSZ.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{runtime-6S3DNFNv.js → .setup/runtime-6S3DNFNv.mjs} +0 -0
- /package/dist/{runtime-BefyhPWv.js → .setup/runtime-BefyhPWv.mjs} +0 -0
- /package/dist/{storage-paths-gUmSydsW.js → .setup/storage-paths-gUmSydsW.mjs} +0 -0
- /package/dist/{target-ids-Nwx7cMVE.js → .setup/target-ids-Nwx7cMVE.mjs} +0 -0
- /package/dist/{thread-bindings-shared-oNPiyMWY.js → .setup/thread-bindings-shared-oNPiyMWY.mjs} +0 -0
- /package/dist/{url-validation-GRHde6lq.js → .setup/url-validation-GRHde6lq.mjs} +0 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
+
import { M as resolveMatrixSqliteStateEnv } from "./storage-B-nf2ReN.mjs";
|
|
3
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
//#region extensions/matrix/src/matrix/client/sync-cache-state.ts
|
|
8
|
+
var sync_cache_state_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
+
MATRIX_SYNC_CACHE_VERSION: () => 1,
|
|
10
|
+
deleteMatrixSyncCacheStateFromSyncStore: () => deleteMatrixSyncCacheStateFromSyncStore,
|
|
11
|
+
hasMatrixSyncCacheStateInStore: () => hasMatrixSyncCacheStateInStore,
|
|
12
|
+
openMatrixSyncCacheStoreOptions: () => openMatrixSyncCacheStoreOptions,
|
|
13
|
+
readLegacyMatrixSyncCacheState: () => readLegacyMatrixSyncCacheState,
|
|
14
|
+
readPersistedStoreFromSyncStore: () => readPersistedStoreFromSyncStore,
|
|
15
|
+
writeMatrixSyncCacheStateToStore: () => writeMatrixSyncCacheStateToStore,
|
|
16
|
+
writeMatrixSyncCacheStateToSyncStore: () => writeMatrixSyncCacheStateToSyncStore
|
|
17
|
+
});
|
|
18
|
+
const MATRIX_SYNC_CACHE_VERSION = 1;
|
|
19
|
+
const SYNC_CACHE_NAMESPACE = "sync-cache";
|
|
20
|
+
const SYNC_CACHE_MAX_ENTRIES = 2e4;
|
|
21
|
+
const SYNC_CACHE_MAX_CHUNKS = Math.floor(19999 / 2);
|
|
22
|
+
const SYNC_CACHE_STATE_KEY = "current";
|
|
23
|
+
const SYNC_CACHE_CHUNK_BYTES = 24e3;
|
|
24
|
+
function normalizeRoomsData(value) {
|
|
25
|
+
if (!isRecord(value)) return null;
|
|
26
|
+
return {
|
|
27
|
+
join: isRecord(value.join) ? value.join : {},
|
|
28
|
+
invite: isRecord(value.invite) ? value.invite : {},
|
|
29
|
+
leave: isRecord(value.leave) ? value.leave : {},
|
|
30
|
+
knock: isRecord(value.knock) ? value.knock : {}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function toPersistedSyncData(value) {
|
|
34
|
+
if (!isRecord(value)) return null;
|
|
35
|
+
if (typeof value.nextBatch === "string" && value.nextBatch.trim()) {
|
|
36
|
+
const roomsData = normalizeRoomsData(value.roomsData);
|
|
37
|
+
if (!Array.isArray(value.accountData) || !roomsData) return null;
|
|
38
|
+
return {
|
|
39
|
+
nextBatch: value.nextBatch,
|
|
40
|
+
accountData: value.accountData,
|
|
41
|
+
roomsData
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (typeof value.next_batch === "string" && value.next_batch.trim()) {
|
|
45
|
+
const roomsData = normalizeRoomsData(value.rooms);
|
|
46
|
+
if (!roomsData) return null;
|
|
47
|
+
return {
|
|
48
|
+
nextBatch: value.next_batch,
|
|
49
|
+
accountData: isRecord(value.account_data) && Array.isArray(value.account_data.events) ? value.account_data.events : [],
|
|
50
|
+
roomsData
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
function normalizePersistedStore(value) {
|
|
56
|
+
if (!isRecord(value) || value.version !== 1) return null;
|
|
57
|
+
return {
|
|
58
|
+
version: 1,
|
|
59
|
+
savedSync: toPersistedSyncData(value.savedSync),
|
|
60
|
+
clientOptions: isRecord(value.clientOptions) ? value.clientOptions : void 0,
|
|
61
|
+
cleanShutdown: value.cleanShutdown === true
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function normalizeLegacyPersistedStore(value) {
|
|
65
|
+
const persisted = normalizePersistedStore(value);
|
|
66
|
+
if (persisted) return persisted;
|
|
67
|
+
return {
|
|
68
|
+
version: 1,
|
|
69
|
+
savedSync: toPersistedSyncData(value),
|
|
70
|
+
cleanShutdown: false
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function readPersistedStoreFromSyncStore(store) {
|
|
74
|
+
const stateKey = SYNC_CACHE_STATE_KEY;
|
|
75
|
+
const meta = store.lookup(metaKey(stateKey));
|
|
76
|
+
if (!isSyncCacheMeta(meta)) return null;
|
|
77
|
+
const chunks = [];
|
|
78
|
+
for (let index = 0; index < meta.chunkCount; index += 1) {
|
|
79
|
+
const chunk = store.lookup(chunkKey(stateKey, meta.generation, index));
|
|
80
|
+
if (!isSyncCacheChunk(chunk) || chunk.index !== index) return normalizePersistedStore({
|
|
81
|
+
version: 1,
|
|
82
|
+
savedSync: null,
|
|
83
|
+
clientOptions: meta.clientOptions,
|
|
84
|
+
cleanShutdown: false
|
|
85
|
+
});
|
|
86
|
+
chunks.push(chunk.data);
|
|
87
|
+
}
|
|
88
|
+
let savedSync = null;
|
|
89
|
+
if (chunks.length > 0) {
|
|
90
|
+
const syncJson = chunks.join("");
|
|
91
|
+
if (meta.syncDigest !== digestText(syncJson)) return normalizePersistedStore({
|
|
92
|
+
version: 1,
|
|
93
|
+
savedSync: null,
|
|
94
|
+
clientOptions: meta.clientOptions,
|
|
95
|
+
cleanShutdown: false
|
|
96
|
+
});
|
|
97
|
+
try {
|
|
98
|
+
savedSync = toPersistedSyncData(JSON.parse(syncJson));
|
|
99
|
+
} catch {
|
|
100
|
+
savedSync = null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return normalizePersistedStore({
|
|
104
|
+
version: 1,
|
|
105
|
+
savedSync,
|
|
106
|
+
clientOptions: meta.clientOptions,
|
|
107
|
+
cleanShutdown: meta.cleanShutdown
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function metaKey(stateKey) {
|
|
111
|
+
return `${stateKey}:meta`;
|
|
112
|
+
}
|
|
113
|
+
function chunkKeyPrefix(stateKey) {
|
|
114
|
+
return `${stateKey}:sync:`;
|
|
115
|
+
}
|
|
116
|
+
function chunkKey(stateKey, generation, index) {
|
|
117
|
+
return `${chunkKeyPrefix(stateKey)}${generation}:${index}`;
|
|
118
|
+
}
|
|
119
|
+
function resolveLegacySyncCachePath(storageRootDir) {
|
|
120
|
+
return path.join(storageRootDir, "bot-storage.json");
|
|
121
|
+
}
|
|
122
|
+
function digestText(value) {
|
|
123
|
+
return createHash("sha256").update(value, "utf8").digest("hex");
|
|
124
|
+
}
|
|
125
|
+
function isSyncCacheMeta(value) {
|
|
126
|
+
return isRecord(value) && value.kind === "meta" && value.version === 1 && typeof value.generation === "string" && value.generation.trim() !== "" && typeof value.chunkCount === "number" && Number.isSafeInteger(value.chunkCount) && value.chunkCount >= 0 && value.chunkCount <= SYNC_CACHE_MAX_CHUNKS;
|
|
127
|
+
}
|
|
128
|
+
function isSyncCacheChunk(value) {
|
|
129
|
+
return isRecord(value) && value.kind === "sync-chunk" && typeof value.index === "number" && Number.isSafeInteger(value.index) && value.index >= 0 && typeof value.data === "string";
|
|
130
|
+
}
|
|
131
|
+
function chunkSyncCacheJson(value) {
|
|
132
|
+
const chunks = [];
|
|
133
|
+
const pushChunk = (chunk) => {
|
|
134
|
+
if (chunks.length >= SYNC_CACHE_MAX_CHUNKS) throw new Error("Matrix sync cache exceeds SQLite chunk limit");
|
|
135
|
+
chunks.push(chunk);
|
|
136
|
+
};
|
|
137
|
+
let current = "";
|
|
138
|
+
let currentBytes = 0;
|
|
139
|
+
for (const char of value) {
|
|
140
|
+
const charBytes = Buffer.byteLength(char, "utf8");
|
|
141
|
+
if (current && currentBytes + charBytes > SYNC_CACHE_CHUNK_BYTES) {
|
|
142
|
+
pushChunk(current);
|
|
143
|
+
current = "";
|
|
144
|
+
currentBytes = 0;
|
|
145
|
+
}
|
|
146
|
+
current += char;
|
|
147
|
+
currentBytes += charBytes;
|
|
148
|
+
}
|
|
149
|
+
if (current) pushChunk(current);
|
|
150
|
+
return chunks;
|
|
151
|
+
}
|
|
152
|
+
function buildSyncCacheRows(stateKey, payload) {
|
|
153
|
+
const generation = randomUUID().replaceAll("-", "");
|
|
154
|
+
const syncJson = payload.savedSync ? JSON.stringify(payload.savedSync) : "";
|
|
155
|
+
const chunks = (syncJson ? chunkSyncCacheJson(syncJson) : []).map((data, index) => ({
|
|
156
|
+
key: chunkKey(stateKey, generation, index),
|
|
157
|
+
value: {
|
|
158
|
+
kind: "sync-chunk",
|
|
159
|
+
index,
|
|
160
|
+
data
|
|
161
|
+
}
|
|
162
|
+
}));
|
|
163
|
+
return {
|
|
164
|
+
chunks,
|
|
165
|
+
nextChunkKeys: new Set(chunks.map((chunk) => chunk.key)),
|
|
166
|
+
meta: {
|
|
167
|
+
key: metaKey(stateKey),
|
|
168
|
+
value: {
|
|
169
|
+
kind: "meta",
|
|
170
|
+
version: 1,
|
|
171
|
+
generation,
|
|
172
|
+
chunkCount: chunks.length,
|
|
173
|
+
...syncJson ? { syncDigest: digestText(syncJson) } : {},
|
|
174
|
+
...payload.clientOptions ? { clientOptions: payload.clientOptions } : {},
|
|
175
|
+
cleanShutdown: payload.cleanShutdown === true
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
async function readLegacyMatrixSyncCacheState(storageRootDir) {
|
|
181
|
+
try {
|
|
182
|
+
const raw = await fs.readFile(resolveLegacySyncCachePath(storageRootDir), "utf8");
|
|
183
|
+
const persisted = normalizeLegacyPersistedStore(JSON.parse(raw));
|
|
184
|
+
if (!persisted?.savedSync && !persisted?.clientOptions) return null;
|
|
185
|
+
return persisted;
|
|
186
|
+
} catch {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async function hasMatrixSyncCacheStateInStore(params) {
|
|
191
|
+
const stateKey = SYNC_CACHE_STATE_KEY;
|
|
192
|
+
const meta = await params.store.lookup(metaKey(stateKey));
|
|
193
|
+
if (!isSyncCacheMeta(meta) || meta.chunkCount <= 0) return false;
|
|
194
|
+
const chunks = [];
|
|
195
|
+
for (let index = 0; index < meta.chunkCount; index += 1) {
|
|
196
|
+
const chunk = await params.store.lookup(chunkKey(stateKey, meta.generation, index));
|
|
197
|
+
if (!isSyncCacheChunk(chunk) || chunk.index !== index) return false;
|
|
198
|
+
chunks.push(chunk.data);
|
|
199
|
+
}
|
|
200
|
+
const syncJson = chunks.join("");
|
|
201
|
+
if (meta.syncDigest !== digestText(syncJson)) return false;
|
|
202
|
+
try {
|
|
203
|
+
return toPersistedSyncData(JSON.parse(syncJson)) !== null;
|
|
204
|
+
} catch {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async function writeMatrixSyncCacheStateToStore(params) {
|
|
209
|
+
const stateKey = SYNC_CACHE_STATE_KEY;
|
|
210
|
+
const rows = buildSyncCacheRows(stateKey, params.payload);
|
|
211
|
+
for (const row of rows.chunks) await params.store.register(row.key, row.value);
|
|
212
|
+
await params.store.register(rows.meta.key, rows.meta.value);
|
|
213
|
+
for (const row of await params.store.entries()) if (row.key.startsWith(chunkKeyPrefix(stateKey)) && !rows.nextChunkKeys.has(row.key)) await params.store.delete(row.key);
|
|
214
|
+
}
|
|
215
|
+
function openMatrixSyncCacheStoreOptions(storageRootDir) {
|
|
216
|
+
return {
|
|
217
|
+
namespace: SYNC_CACHE_NAMESPACE,
|
|
218
|
+
maxEntries: SYNC_CACHE_MAX_ENTRIES,
|
|
219
|
+
env: resolveMatrixSqliteStateEnv({ stateDir: storageRootDir })
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function writeMatrixSyncCacheStateToSyncStore(params) {
|
|
223
|
+
const rows = buildSyncCacheRows(SYNC_CACHE_STATE_KEY, params.payload);
|
|
224
|
+
for (const row of rows.chunks) params.store.register(row.key, row.value);
|
|
225
|
+
params.store.register(rows.meta.key, rows.meta.value);
|
|
226
|
+
for (const row of params.store.entries()) if (row.key.startsWith(chunkKeyPrefix(SYNC_CACHE_STATE_KEY)) && !rows.nextChunkKeys.has(row.key)) params.store.delete(row.key);
|
|
227
|
+
}
|
|
228
|
+
async function deleteMatrixSyncCacheStateFromSyncStore(params) {
|
|
229
|
+
params.store.delete(metaKey(SYNC_CACHE_STATE_KEY));
|
|
230
|
+
for (const row of params.store.entries()) if (row.key.startsWith(chunkKeyPrefix(SYNC_CACHE_STATE_KEY))) params.store.delete(row.key);
|
|
231
|
+
await fs.rm(resolveLegacySyncCachePath(params.storageRootDir), { force: true }).catch(() => void 0);
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
export { readLegacyMatrixSyncCacheState as a, writeMatrixSyncCacheStateToStore as c, openMatrixSyncCacheStoreOptions as i, writeMatrixSyncCacheStateToSyncStore as l, deleteMatrixSyncCacheStateFromSyncStore as n, readPersistedStoreFromSyncStore as o, hasMatrixSyncCacheStateInStore as r, sync_cache_state_exports as s, MATRIX_SYNC_CACHE_VERSION as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as resolveMatrixTargetIdentity } from "./target-ids-Nwx7cMVE.
|
|
1
|
+
import { o as resolveMatrixTargetIdentity } from "./target-ids-Nwx7cMVE.mjs";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/matrix/src/thread-binding-api.ts
|
|
4
4
|
const defaultTopLevelPlacement = "child";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.
|
|
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.
|
|
3
|
-
import { M as resolveMatrixSqliteStateEnv, N as resolveMatrixSqliteStateKey, c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-
|
|
4
|
-
import { r as sendMessageMatrix } from "./send-
|
|
1
|
+
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.mjs";
|
|
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.mjs";
|
|
3
|
+
import { M as resolveMatrixSqliteStateEnv, N as resolveMatrixSqliteStateKey, c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-B-nf2ReN.mjs";
|
|
4
|
+
import { r as sendMessageMatrix } from "./send-SmBzUhD-.mjs";
|
|
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";
|