@kodelyth/matrix 2026.5.39 → 2026.6.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/account-selection-Y50DNJ2l.js +158 -0
- package/dist/active-client-CmFdvPdO.js +20 -0
- package/dist/api.js +12 -0
- package/dist/approval-handler.runtime-BIi4fL0R.js +377 -0
- package/dist/approval-ids-BGHK7PnZ.js +7 -0
- package/dist/approval-reaction-auth-CL0-nCNV.js +27 -0
- package/dist/approval-reactions-nDm2x-K5.js +162 -0
- package/dist/async-lock-SsmtFXtt.js +19 -0
- package/dist/auth-presence.js +26 -0
- package/dist/backup-health-3BHbHxyd.js +60 -0
- package/dist/channel-C0kCyTNB.js +1380 -0
- package/dist/channel-plugin-api.js +2 -0
- package/dist/channel.runtime-CdrdEN-0.js +250 -0
- package/dist/cli-FtY6Nuzw.js +1338 -0
- package/dist/cli-metadata-Dkwua7CB.js +22 -0
- package/dist/cli-metadata.js +2 -0
- package/dist/client-BnohYygh.js +25 -0
- package/dist/client-PhrTwuC4.js +30 -0
- package/dist/client-bootstrap-Mcj8ChJ5.js +114 -0
- package/dist/config-paths-DVvt6vM3.js +114 -0
- package/dist/config-schema-BMGOlhdI.js +308 -0
- package/dist/config-secret-input.runtime-Dv_4Br_f.js +2 -0
- package/dist/contract-api.js +8 -0
- package/dist/create-client-J0htTaRj.js +64 -0
- package/dist/credentials-B7GsBbgQ.js +56 -0
- package/dist/credentials-read-8fE4qoWs.js +112 -0
- package/dist/credentials-write.runtime-BibplB4Y.js +17 -0
- package/dist/crypto-node.runtime-D9qxgRPa.js +12 -0
- package/dist/crypto-runtime-1pKW4O2F.js +1214 -0
- package/dist/deps-DVpDS81G.js +208 -0
- package/dist/device-health-Ct2wDSPG.js +16 -0
- package/dist/directory-live-i3T8uORc.js +150 -0
- package/dist/doctor-contract-BLzYHl_9.js +246 -0
- package/dist/doctor-contract-api.js +2 -0
- package/dist/doctor-diR5gE7D.js +153 -0
- package/dist/draft-stream-HpPJ_VJt.js +143 -0
- package/dist/encryption-guidance-BNEgckrZ.js +15 -0
- package/dist/env-auth-UFiTGkDM.js +63 -0
- package/dist/env-vars-EQKQv-FE.js +63 -0
- package/dist/errors-BETj3zr9.js +17 -0
- package/dist/exec-approval-resolver-BxPorU_t.js +15 -0
- package/dist/helper-api.js +4 -0
- package/dist/http-client-DoQgbQsU.js +331 -0
- package/dist/index.js +46 -0
- package/dist/legacy-crypto-inspector-zK0hDCbt.js +41 -0
- package/dist/legacy-crypto-restore-DSFIXuDo.js +85 -0
- package/dist/logging-Df7aPD1z.js +99 -0
- package/dist/matrix-migration.runtime-BNoT1Prt.js +525 -0
- package/dist/media-text-ZhGA8Pcs.js +146 -0
- package/dist/messages-CRA9WGg0.js +140 -0
- package/dist/migration-snapshot-backup-BR-xD7Ew.js +69 -0
- package/dist/migration-snapshot.runtime-BLcy_Nvw.js +2 -0
- package/dist/monitor-DQm7_13y.js +4331 -0
- package/dist/plugin-entry.handlers.runtime.js +51 -0
- package/dist/probe.runtime-CjJS53Kz.js +3 -0
- package/dist/profile-update-DqkPgZ1P.js +68 -0
- package/dist/reaction-common-CmVLzP-u.js +71 -0
- package/dist/reaction-events-D0nUJuZV.js +121 -0
- package/dist/record-shared-DGvSFn5M.js +2 -0
- package/dist/resolve-targets-ChECUzD2.js +140 -0
- package/dist/resolver.runtime-hdY3n0GO.js +5 -0
- package/dist/rolldown-runtime-DUslC3ob.js +14 -0
- package/dist/route-xRKj_ESW.js +161 -0
- package/dist/runtime-B-Fyrmxo.js +8 -0
- package/dist/runtime-api-BYXXkxq2.js +24 -0
- package/dist/runtime-api.js +25 -0
- package/dist/runtime-heavy-api.js +3 -0
- package/dist/runtime-lwTSy9Yt.js +6 -0
- package/dist/runtime-setter-api.js +2 -0
- package/dist/sdk-Jhq7mLtD.js +1704 -0
- package/dist/secret-contract-DEMcDsjl.js +120 -0
- package/dist/secret-contract-api.js +2 -0
- package/dist/send-CJunc6QM.js +1517 -0
- package/dist/setup-bootstrap-rJ0qZWPe.js +62 -0
- package/dist/setup-core-BEYoXF3J.js +677 -0
- package/dist/setup-entry.js +19 -0
- package/dist/setup-plugin-api.js +43 -0
- package/dist/setup-surface-c28ON6jq.js +537 -0
- package/dist/shared-D6MFMnpG.js +642 -0
- package/dist/startup-abort-B2J3MU_h.js +109 -0
- package/dist/startup-verification-CkD4Cwce.js +132 -0
- package/dist/storage-nyO0DOFE.js +281 -0
- package/dist/storage-paths-BTAketfg.js +52 -0
- package/dist/subagent-hooks-api-Dr_xnMRG.js +170 -0
- package/dist/subagent-hooks-api.js +2 -0
- package/dist/sync-state-Bx0gPaGA.js +12 -0
- package/dist/target-ids-Bsazo8si.js +77 -0
- package/dist/test-api.js +4 -0
- package/dist/thread-binding-api-IGU0-L70.js +17 -0
- package/dist/thread-binding-api.js +2 -0
- package/dist/thread-bindings-FjAZmDUP.js +352 -0
- package/dist/thread-bindings-runtime.js +2 -0
- package/dist/thread-bindings-shared-fvfP7jVs.js +97 -0
- package/dist/timeout-abort-signal-DpSHDHhR.js +2 -0
- package/dist/tool-actions.runtime-Cbo7YcYZ.js +532 -0
- package/dist/url-validation-DlrXNjAE.js +36 -0
- package/dist/verification-7tDPRpJU.js +345 -0
- package/package.json +19 -7
- package/api.js +0 -7
- package/auth-presence.js +0 -7
- package/channel-plugin-api.js +0 -7
- package/cli-metadata.js +0 -7
- package/contract-api.js +0 -7
- package/doctor-contract-api.js +0 -7
- package/helper-api.js +0 -7
- package/index.js +0 -7
- package/plugin-entry.handlers.runtime.js +0 -7
- package/runtime-api.js +0 -7
- package/runtime-heavy-api.js +0 -7
- package/runtime-setter-api.js +0 -7
- package/secret-contract-api.js +0 -7
- package/setup-entry.js +0 -7
- package/setup-plugin-api.js +0 -7
- package/subagent-hooks-api.js +0 -7
- package/test-api.js +0 -7
- package/thread-binding-api.js +0 -7
- package/thread-bindings-runtime.js +0 -7
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
|
+
import { a as resolveMatrixTargetIdentity } from "./target-ids-Bsazo8si.js";
|
|
3
|
+
import { a as listBindingsForAccount, c as resolveBindingKey, i as listAllBindings, n as getMatrixThreadBindingManager, o as removeBindingRecord } from "./thread-bindings-shared-fvfP7jVs.js";
|
|
4
|
+
import { DEFAULT_ACCOUNT_ID } from "klaw/plugin-sdk/account-id";
|
|
5
|
+
import { getSessionBindingService } from "klaw/plugin-sdk/conversation-binding-runtime";
|
|
6
|
+
import { formatThreadBindingDisabledError, formatThreadBindingSpawnDisabledError, resolveThreadBindingSpawnPolicy } from "klaw/plugin-sdk/conversation-runtime";
|
|
7
|
+
import { normalizeOptionalString } from "klaw/plugin-sdk/string-coerce-runtime";
|
|
8
|
+
//#region extensions/matrix/src/matrix/subagent-hooks.ts
|
|
9
|
+
var subagent_hooks_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
handleMatrixSubagentDeliveryTarget: () => handleMatrixSubagentDeliveryTarget,
|
|
11
|
+
handleMatrixSubagentEnded: () => handleMatrixSubagentEnded,
|
|
12
|
+
handleMatrixSubagentSpawning: () => handleMatrixSubagentSpawning
|
|
13
|
+
});
|
|
14
|
+
function summarizeError(err) {
|
|
15
|
+
if (err instanceof Error) return err.message;
|
|
16
|
+
if (typeof err === "string") return err;
|
|
17
|
+
return "error";
|
|
18
|
+
}
|
|
19
|
+
function resolveMatrixBindingThreadId(binding) {
|
|
20
|
+
const { conversationId, parentConversationId } = binding.conversation;
|
|
21
|
+
return parentConversationId && parentConversationId !== conversationId ? conversationId : void 0;
|
|
22
|
+
}
|
|
23
|
+
function resolveMatrixBindingDeliveryOrigin(binding, fallbackAccountId) {
|
|
24
|
+
const boundRoomId = binding.conversation.parentConversationId ?? binding.conversation.conversationId;
|
|
25
|
+
const threadId = resolveMatrixBindingThreadId(binding);
|
|
26
|
+
return {
|
|
27
|
+
channel: "matrix",
|
|
28
|
+
accountId: binding.conversation.accountId ?? fallbackAccountId,
|
|
29
|
+
to: `room:${boundRoomId}`,
|
|
30
|
+
...threadId ? { threadId } : {}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function handleMatrixSubagentSpawning(api, event) {
|
|
34
|
+
if (!event.threadRequested) return;
|
|
35
|
+
if (event.requester?.channel?.trim().toLowerCase() !== "matrix") return;
|
|
36
|
+
const accountId = normalizeOptionalString(event.requester?.accountId) || DEFAULT_ACCOUNT_ID;
|
|
37
|
+
const policy = resolveThreadBindingSpawnPolicy({
|
|
38
|
+
cfg: api.config,
|
|
39
|
+
channel: "matrix",
|
|
40
|
+
accountId,
|
|
41
|
+
kind: "subagent"
|
|
42
|
+
});
|
|
43
|
+
if (!policy.enabled) return {
|
|
44
|
+
status: "error",
|
|
45
|
+
error: formatThreadBindingDisabledError({
|
|
46
|
+
channel: policy.channel,
|
|
47
|
+
accountId: policy.accountId,
|
|
48
|
+
kind: "subagent"
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
if (!policy.spawnEnabled) return {
|
|
52
|
+
status: "error",
|
|
53
|
+
error: formatThreadBindingSpawnDisabledError({
|
|
54
|
+
channel: policy.channel,
|
|
55
|
+
accountId: policy.accountId,
|
|
56
|
+
kind: "subagent"
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
const rawTo = normalizeOptionalString(event.requester?.to) ?? "";
|
|
60
|
+
const matrixTarget = rawTo ? resolveMatrixTargetIdentity(rawTo) : null;
|
|
61
|
+
const roomId = matrixTarget?.kind === "room" ? matrixTarget.id : "";
|
|
62
|
+
if (!roomId) return {
|
|
63
|
+
status: "error",
|
|
64
|
+
error: "Cannot create Matrix thread binding: no room target in spawn request (requester.to must be a Matrix room ID)."
|
|
65
|
+
};
|
|
66
|
+
const bindingService = getSessionBindingService();
|
|
67
|
+
const capabilities = bindingService.getCapabilities({
|
|
68
|
+
channel: "matrix",
|
|
69
|
+
accountId
|
|
70
|
+
});
|
|
71
|
+
if (!capabilities.adapterAvailable || !capabilities.bindSupported) return {
|
|
72
|
+
status: "error",
|
|
73
|
+
error: `No Matrix session binding adapter available for account "${accountId}". Is the Matrix channel running?`
|
|
74
|
+
};
|
|
75
|
+
if (!capabilities.placements.includes("child")) return {
|
|
76
|
+
status: "error",
|
|
77
|
+
error: `Matrix session binding adapter for account "${accountId}" does not support child thread bindings.`
|
|
78
|
+
};
|
|
79
|
+
try {
|
|
80
|
+
return {
|
|
81
|
+
status: "ok",
|
|
82
|
+
threadBindingReady: true,
|
|
83
|
+
deliveryOrigin: resolveMatrixBindingDeliveryOrigin(await bindingService.bind({
|
|
84
|
+
targetSessionKey: event.childSessionKey,
|
|
85
|
+
targetKind: "subagent",
|
|
86
|
+
conversation: {
|
|
87
|
+
channel: "matrix",
|
|
88
|
+
accountId,
|
|
89
|
+
conversationId: roomId
|
|
90
|
+
},
|
|
91
|
+
placement: "child",
|
|
92
|
+
metadata: {
|
|
93
|
+
agentId: event.agentId?.trim() || void 0,
|
|
94
|
+
label: normalizeOptionalString(event.label) || void 0,
|
|
95
|
+
boundBy: "system"
|
|
96
|
+
}
|
|
97
|
+
}), accountId)
|
|
98
|
+
};
|
|
99
|
+
} catch (err) {
|
|
100
|
+
return {
|
|
101
|
+
status: "error",
|
|
102
|
+
error: `Matrix thread bind failed: ${summarizeError(err)}`
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async function handleMatrixSubagentEnded(event) {
|
|
107
|
+
const accountId = normalizeOptionalString(event.accountId) || void 0;
|
|
108
|
+
const matching = (accountId ? listBindingsForAccount(accountId) : listAllBindings()).filter((entry) => entry.targetSessionKey === event.targetSessionKey && entry.targetKind === "subagent");
|
|
109
|
+
const removedBindingKeys = /* @__PURE__ */ new Set();
|
|
110
|
+
if (event.sendFarewell) {
|
|
111
|
+
const bindingService = getSessionBindingService();
|
|
112
|
+
const reason = normalizeOptionalString(event.reason) || "subagent-ended";
|
|
113
|
+
for (const binding of matching) {
|
|
114
|
+
const bindingId = resolveBindingKey(binding);
|
|
115
|
+
if ((await bindingService.unbind({
|
|
116
|
+
bindingId,
|
|
117
|
+
reason
|
|
118
|
+
})).some((entry) => entry.bindingId === bindingId)) removedBindingKeys.add(bindingId);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const affectedAccountIds = /* @__PURE__ */ new Set();
|
|
122
|
+
for (const binding of matching) {
|
|
123
|
+
if (removedBindingKeys.has(resolveBindingKey(binding))) continue;
|
|
124
|
+
if (removeBindingRecord(binding)) affectedAccountIds.add(binding.accountId);
|
|
125
|
+
}
|
|
126
|
+
for (const acctId of affectedAccountIds) await getMatrixThreadBindingManager(acctId)?.persist();
|
|
127
|
+
}
|
|
128
|
+
function handleMatrixSubagentDeliveryTarget(event) {
|
|
129
|
+
if (!event.expectsCompletionMessage) return;
|
|
130
|
+
if (event.requesterOrigin?.channel?.trim().toLowerCase() !== "matrix") return;
|
|
131
|
+
const requesterAccountId = normalizeOptionalString(event.requesterOrigin?.accountId);
|
|
132
|
+
const requesterThreadId = event.requesterOrigin?.threadId != null && event.requesterOrigin.threadId !== "" ? String(event.requesterOrigin.threadId).trim() : "";
|
|
133
|
+
const bindings = (requesterAccountId ? listBindingsForAccount(requesterAccountId) : listAllBindings()).filter((entry) => entry.targetSessionKey === event.childSessionKey && entry.targetKind === "subagent");
|
|
134
|
+
if (bindings.length === 0) return;
|
|
135
|
+
let binding;
|
|
136
|
+
if (requesterThreadId) binding = bindings.find((entry) => entry.conversationId === requesterThreadId && (!requesterAccountId || entry.accountId === requesterAccountId));
|
|
137
|
+
if (!binding && bindings.length === 1) binding = bindings[0];
|
|
138
|
+
if (!binding) return;
|
|
139
|
+
const roomId = binding.parentConversationId ?? binding.conversationId;
|
|
140
|
+
const threadId = binding.parentConversationId && binding.parentConversationId !== binding.conversationId ? binding.conversationId : void 0;
|
|
141
|
+
return { origin: {
|
|
142
|
+
channel: "matrix",
|
|
143
|
+
accountId: binding.accountId,
|
|
144
|
+
to: `room:${roomId}`,
|
|
145
|
+
...threadId ? { threadId } : {}
|
|
146
|
+
} };
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region extensions/matrix/subagent-hooks-api.ts
|
|
150
|
+
let matrixSubagentHooksPromise = null;
|
|
151
|
+
function loadMatrixSubagentHooksModule() {
|
|
152
|
+
matrixSubagentHooksPromise ??= Promise.resolve().then(() => subagent_hooks_exports);
|
|
153
|
+
return matrixSubagentHooksPromise;
|
|
154
|
+
}
|
|
155
|
+
function registerMatrixSubagentHooks(api) {
|
|
156
|
+
api.on("subagent_spawning", async (event) => {
|
|
157
|
+
const { handleMatrixSubagentSpawning } = await loadMatrixSubagentHooksModule();
|
|
158
|
+
return await handleMatrixSubagentSpawning(api, event);
|
|
159
|
+
});
|
|
160
|
+
api.on("subagent_ended", async (event) => {
|
|
161
|
+
const { handleMatrixSubagentEnded } = await loadMatrixSubagentHooksModule();
|
|
162
|
+
await handleMatrixSubagentEnded(event);
|
|
163
|
+
});
|
|
164
|
+
api.on("subagent_delivery_target", async (event) => {
|
|
165
|
+
const { handleMatrixSubagentDeliveryTarget } = await loadMatrixSubagentHooksModule();
|
|
166
|
+
return handleMatrixSubagentDeliveryTarget(event);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
export { subagent_hooks_exports as a, handleMatrixSubagentSpawning as i, handleMatrixSubagentDeliveryTarget as n, handleMatrixSubagentEnded as r, registerMatrixSubagentHooks as t };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { i as handleMatrixSubagentSpawning, n as handleMatrixSubagentDeliveryTarget, r as handleMatrixSubagentEnded, t as registerMatrixSubagentHooks } from "./subagent-hooks-api-Dr_xnMRG.js";
|
|
2
|
+
export { handleMatrixSubagentDeliveryTarget, handleMatrixSubagentEnded, handleMatrixSubagentSpawning, registerMatrixSubagentHooks };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region extensions/matrix/src/matrix/sync-state.ts
|
|
2
|
+
function isMatrixReadySyncState(state) {
|
|
3
|
+
return state === "PREPARED" || state === "SYNCING" || state === "CATCHUP";
|
|
4
|
+
}
|
|
5
|
+
function isMatrixDisconnectedSyncState(state) {
|
|
6
|
+
return state === "RECONNECTING" || state === "ERROR" || state === "STOPPED";
|
|
7
|
+
}
|
|
8
|
+
function isMatrixTerminalSyncState(state) {
|
|
9
|
+
return state === "STOPPED";
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isMatrixReadySyncState as n, isMatrixTerminalSyncState as r, isMatrixDisconnectedSyncState as t };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { normalizeLowercaseStringOrEmpty } from "klaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
//#region extensions/matrix/src/matrix/target-ids.ts
|
|
3
|
+
const MATRIX_PREFIX = "matrix:";
|
|
4
|
+
const ROOM_PREFIX = "room:";
|
|
5
|
+
const CHANNEL_PREFIX = "channel:";
|
|
6
|
+
const USER_PREFIX = "user:";
|
|
7
|
+
function stripKnownPrefixes(raw, prefixes) {
|
|
8
|
+
let normalized = raw.trim();
|
|
9
|
+
while (normalized) {
|
|
10
|
+
const lowered = normalizeLowercaseStringOrEmpty(normalized);
|
|
11
|
+
const matched = prefixes.find((prefix) => lowered.startsWith(prefix));
|
|
12
|
+
if (!matched) return normalized;
|
|
13
|
+
normalized = normalized.slice(matched.length).trim();
|
|
14
|
+
}
|
|
15
|
+
return normalized;
|
|
16
|
+
}
|
|
17
|
+
function resolveMatrixTargetIdentity(raw) {
|
|
18
|
+
const normalized = stripKnownPrefixes(raw, [MATRIX_PREFIX]);
|
|
19
|
+
if (!normalized) return null;
|
|
20
|
+
const lowered = normalizeLowercaseStringOrEmpty(normalized);
|
|
21
|
+
if (lowered.startsWith(USER_PREFIX)) {
|
|
22
|
+
const id = normalized.slice(5).trim();
|
|
23
|
+
return id ? {
|
|
24
|
+
kind: "user",
|
|
25
|
+
id
|
|
26
|
+
} : null;
|
|
27
|
+
}
|
|
28
|
+
if (lowered.startsWith(ROOM_PREFIX)) {
|
|
29
|
+
const id = normalized.slice(5).trim();
|
|
30
|
+
return id ? {
|
|
31
|
+
kind: "room",
|
|
32
|
+
id
|
|
33
|
+
} : null;
|
|
34
|
+
}
|
|
35
|
+
if (lowered.startsWith(CHANNEL_PREFIX)) {
|
|
36
|
+
const id = normalized.slice(8).trim();
|
|
37
|
+
return id ? {
|
|
38
|
+
kind: "room",
|
|
39
|
+
id
|
|
40
|
+
} : null;
|
|
41
|
+
}
|
|
42
|
+
if (isMatrixQualifiedUserId(normalized)) return {
|
|
43
|
+
kind: "user",
|
|
44
|
+
id: normalized
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
kind: "room",
|
|
48
|
+
id: normalized
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function isMatrixQualifiedUserId(raw) {
|
|
52
|
+
const trimmed = raw.trim();
|
|
53
|
+
return trimmed.startsWith("@") && trimmed.includes(":");
|
|
54
|
+
}
|
|
55
|
+
function normalizeMatrixResolvableTarget(raw) {
|
|
56
|
+
return stripKnownPrefixes(raw, [
|
|
57
|
+
MATRIX_PREFIX,
|
|
58
|
+
ROOM_PREFIX,
|
|
59
|
+
CHANNEL_PREFIX
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
function normalizeMatrixMessagingTarget(raw) {
|
|
63
|
+
return stripKnownPrefixes(raw, [
|
|
64
|
+
MATRIX_PREFIX,
|
|
65
|
+
ROOM_PREFIX,
|
|
66
|
+
CHANNEL_PREFIX,
|
|
67
|
+
USER_PREFIX
|
|
68
|
+
]) || void 0;
|
|
69
|
+
}
|
|
70
|
+
function resolveMatrixDirectUserId(params) {
|
|
71
|
+
if (params.chatType !== "direct") return;
|
|
72
|
+
if (!normalizeMatrixResolvableTarget(params.to ?? "").startsWith("!")) return;
|
|
73
|
+
const userId = stripKnownPrefixes(params.from ?? "", [MATRIX_PREFIX, USER_PREFIX]);
|
|
74
|
+
return isMatrixQualifiedUserId(userId) ? userId : void 0;
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { resolveMatrixTargetIdentity as a, resolveMatrixDirectUserId as i, normalizeMatrixMessagingTarget as n, normalizeMatrixResolvableTarget as r, isMatrixQualifiedUserId as t };
|
package/dist/test-api.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { a as resolveMatrixTargetIdentity } from "./target-ids-Bsazo8si.js";
|
|
2
|
+
import { normalizeOptionalString } from "klaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
//#region extensions/matrix/src/thread-binding-api.ts
|
|
4
|
+
const defaultTopLevelPlacement = "child";
|
|
5
|
+
function resolveMatrixInboundConversation(params) {
|
|
6
|
+
const rawTarget = params.to?.trim() || params.conversationId?.trim() || "";
|
|
7
|
+
const target = rawTarget ? resolveMatrixTargetIdentity(rawTarget) : null;
|
|
8
|
+
const parentConversationId = target?.kind === "room" ? target.id : void 0;
|
|
9
|
+
const threadId = params.threadId != null ? normalizeOptionalString(String(params.threadId)) : void 0;
|
|
10
|
+
if (threadId) return {
|
|
11
|
+
conversationId: threadId,
|
|
12
|
+
...parentConversationId ? { parentConversationId } : {}
|
|
13
|
+
};
|
|
14
|
+
return parentConversationId ? { conversationId: parentConversationId } : null;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { resolveMatrixInboundConversation as n, defaultTopLevelPlacement as t };
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { a as listBindingsForAccount, c as resolveBindingKey, f as setMatrixThreadBindingManagerEntry, h as toSessionBindingRecord, l as resolveEffectiveBindingExpiry, m as toMatrixBindingTargetKind, o as removeBindingRecord, r as getMatrixThreadBindingManagerEntry, t as deleteMatrixThreadBindingManagerEntry, u as setBindingRecord } from "./thread-bindings-shared-fvfP7jVs.js";
|
|
2
|
+
import { i as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-nyO0DOFE.js";
|
|
3
|
+
import { a as sendMessageMatrix } from "./send-CJunc6QM.js";
|
|
4
|
+
import { normalizeOptionalString } from "klaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
import { registerSessionBindingAdapter, resolveThreadBindingFarewellText, unregisterSessionBindingAdapter } from "klaw/plugin-sdk/thread-bindings-session-runtime";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { readJsonFileWithFallback, writeJsonFileAtomically } from "klaw/plugin-sdk/json-store";
|
|
8
|
+
import { resolveAgentIdFromSessionKey } from "klaw/plugin-sdk/session-key-runtime";
|
|
9
|
+
//#region extensions/matrix/src/matrix/thread-bindings.ts
|
|
10
|
+
const STORE_VERSION = 1;
|
|
11
|
+
const THREAD_BINDINGS_SWEEP_INTERVAL_MS = 6e4;
|
|
12
|
+
const TOUCH_PERSIST_DELAY_MS = 3e4;
|
|
13
|
+
function resolveBindingsPath(params) {
|
|
14
|
+
return resolveMatrixStateFilePath({
|
|
15
|
+
auth: params.auth,
|
|
16
|
+
accountId: params.accountId,
|
|
17
|
+
env: params.env,
|
|
18
|
+
stateDir: params.stateDir,
|
|
19
|
+
filename: "thread-bindings.json"
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async function loadBindingsFromDisk(filePath, accountId) {
|
|
23
|
+
const { value } = await readJsonFileWithFallback(filePath, null);
|
|
24
|
+
if (value?.version !== STORE_VERSION || !Array.isArray(value.bindings)) return [];
|
|
25
|
+
const loaded = [];
|
|
26
|
+
for (const entry of value.bindings) {
|
|
27
|
+
const conversationId = normalizeOptionalString(entry?.conversationId);
|
|
28
|
+
const parentConversationId = normalizeOptionalString(entry?.parentConversationId);
|
|
29
|
+
const targetSessionKey = normalizeOptionalString(entry?.targetSessionKey) ?? "";
|
|
30
|
+
if (!conversationId || !targetSessionKey) continue;
|
|
31
|
+
const boundAt = typeof entry?.boundAt === "number" && Number.isFinite(entry.boundAt) ? Math.floor(entry.boundAt) : Date.now();
|
|
32
|
+
const lastActivityAt = typeof entry?.lastActivityAt === "number" && Number.isFinite(entry.lastActivityAt) ? Math.floor(entry.lastActivityAt) : boundAt;
|
|
33
|
+
loaded.push({
|
|
34
|
+
accountId,
|
|
35
|
+
conversationId,
|
|
36
|
+
...parentConversationId ? { parentConversationId } : {},
|
|
37
|
+
targetKind: entry?.targetKind === "subagent" ? "subagent" : "acp",
|
|
38
|
+
targetSessionKey,
|
|
39
|
+
agentId: normalizeOptionalString(entry?.agentId) || void 0,
|
|
40
|
+
label: normalizeOptionalString(entry?.label) || void 0,
|
|
41
|
+
boundBy: normalizeOptionalString(entry?.boundBy) || void 0,
|
|
42
|
+
boundAt,
|
|
43
|
+
lastActivityAt: Math.max(lastActivityAt, boundAt),
|
|
44
|
+
idleTimeoutMs: typeof entry?.idleTimeoutMs === "number" && Number.isFinite(entry.idleTimeoutMs) ? Math.max(0, Math.floor(entry.idleTimeoutMs)) : void 0,
|
|
45
|
+
maxAgeMs: typeof entry?.maxAgeMs === "number" && Number.isFinite(entry.maxAgeMs) ? Math.max(0, Math.floor(entry.maxAgeMs)) : void 0
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return loaded;
|
|
49
|
+
}
|
|
50
|
+
function toStoredBindingsState(bindings) {
|
|
51
|
+
return {
|
|
52
|
+
version: STORE_VERSION,
|
|
53
|
+
bindings: [...bindings].toSorted((a, b) => a.boundAt - b.boundAt)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async function persistBindingsSnapshot(filePath, bindings) {
|
|
57
|
+
await writeJsonFileAtomically(filePath, toStoredBindingsState(bindings));
|
|
58
|
+
claimCurrentTokenStorageState({ rootDir: path.dirname(filePath) });
|
|
59
|
+
}
|
|
60
|
+
function buildMatrixBindingIntroText(params) {
|
|
61
|
+
const introText = normalizeOptionalString(params.metadata?.introText);
|
|
62
|
+
if (introText) return introText;
|
|
63
|
+
const label = normalizeOptionalString(params.metadata?.label);
|
|
64
|
+
const agentId = normalizeOptionalString(params.metadata?.agentId) || resolveAgentIdFromSessionKey(params.targetSessionKey);
|
|
65
|
+
return `⚙️ ${label || agentId || "session"} session active. Messages here go directly to this session.`;
|
|
66
|
+
}
|
|
67
|
+
async function sendBindingMessage(params) {
|
|
68
|
+
const trimmed = params.text.trim();
|
|
69
|
+
if (!trimmed) return null;
|
|
70
|
+
return (await sendMessageMatrix(`room:${params.roomId}`, trimmed, {
|
|
71
|
+
cfg: params.cfg,
|
|
72
|
+
client: params.client,
|
|
73
|
+
accountId: params.accountId,
|
|
74
|
+
...params.threadId ? { threadId: params.threadId } : {}
|
|
75
|
+
})).messageId || null;
|
|
76
|
+
}
|
|
77
|
+
async function sendFarewellMessage(params) {
|
|
78
|
+
const roomId = params.record.parentConversationId ?? params.record.conversationId;
|
|
79
|
+
const idleTimeoutMs = typeof params.record.idleTimeoutMs === "number" ? params.record.idleTimeoutMs : params.defaultIdleTimeoutMs;
|
|
80
|
+
const maxAgeMs = typeof params.record.maxAgeMs === "number" ? params.record.maxAgeMs : params.defaultMaxAgeMs;
|
|
81
|
+
const farewellText = resolveThreadBindingFarewellText({
|
|
82
|
+
reason: params.reason,
|
|
83
|
+
idleTimeoutMs,
|
|
84
|
+
maxAgeMs
|
|
85
|
+
});
|
|
86
|
+
await sendBindingMessage({
|
|
87
|
+
cfg: params.cfg,
|
|
88
|
+
client: params.client,
|
|
89
|
+
accountId: params.accountId,
|
|
90
|
+
roomId,
|
|
91
|
+
threadId: params.record.parentConversationId && params.record.parentConversationId !== params.record.conversationId ? params.record.conversationId : void 0,
|
|
92
|
+
text: farewellText
|
|
93
|
+
}).catch(() => {});
|
|
94
|
+
}
|
|
95
|
+
async function createMatrixThreadBindingManager(params) {
|
|
96
|
+
if (params.auth.accountId !== params.accountId) throw new Error(`Matrix thread binding account mismatch: requested ${params.accountId}, auth resolved ${params.auth.accountId}`);
|
|
97
|
+
const filePath = resolveBindingsPath({
|
|
98
|
+
auth: params.auth,
|
|
99
|
+
accountId: params.accountId,
|
|
100
|
+
env: params.env,
|
|
101
|
+
stateDir: params.stateDir
|
|
102
|
+
});
|
|
103
|
+
const existingEntry = getMatrixThreadBindingManagerEntry(params.accountId);
|
|
104
|
+
if (existingEntry) {
|
|
105
|
+
if (existingEntry.filePath === filePath) return existingEntry.manager;
|
|
106
|
+
existingEntry.manager.stop();
|
|
107
|
+
}
|
|
108
|
+
const loaded = await loadBindingsFromDisk(filePath, params.accountId);
|
|
109
|
+
for (const record of loaded) setBindingRecord(record);
|
|
110
|
+
let persistQueue = Promise.resolve();
|
|
111
|
+
const enqueuePersist = (bindings) => {
|
|
112
|
+
const snapshot = bindings ?? listBindingsForAccount(params.accountId);
|
|
113
|
+
const next = persistQueue.catch(() => {}).then(async () => {
|
|
114
|
+
await persistBindingsSnapshot(filePath, snapshot);
|
|
115
|
+
});
|
|
116
|
+
persistQueue = next;
|
|
117
|
+
return next;
|
|
118
|
+
};
|
|
119
|
+
const persist = async () => await enqueuePersist();
|
|
120
|
+
const persistSafely = (reason, bindings) => {
|
|
121
|
+
enqueuePersist(bindings).catch((err) => {
|
|
122
|
+
params.logVerboseMessage?.(`matrix: failed persisting thread bindings account=${params.accountId} action=${reason}: ${String(err)}`);
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
const defaults = {
|
|
126
|
+
idleTimeoutMs: params.idleTimeoutMs,
|
|
127
|
+
maxAgeMs: params.maxAgeMs
|
|
128
|
+
};
|
|
129
|
+
let persistTimer = null;
|
|
130
|
+
const schedulePersist = (delayMs) => {
|
|
131
|
+
if (persistTimer) return;
|
|
132
|
+
persistTimer = setTimeout(() => {
|
|
133
|
+
persistTimer = null;
|
|
134
|
+
persistSafely("delayed-touch");
|
|
135
|
+
}, delayMs);
|
|
136
|
+
persistTimer.unref?.();
|
|
137
|
+
};
|
|
138
|
+
const updateBindingsBySessionKey = (input) => {
|
|
139
|
+
const targetSessionKey = input.targetSessionKey.trim();
|
|
140
|
+
if (!targetSessionKey) return [];
|
|
141
|
+
const now = Date.now();
|
|
142
|
+
const nextBindings = listBindingsForAccount(params.accountId).filter((entry) => entry.targetSessionKey === targetSessionKey).map((entry) => input.update(entry, now));
|
|
143
|
+
if (nextBindings.length === 0) return [];
|
|
144
|
+
for (const entry of nextBindings) setBindingRecord(entry);
|
|
145
|
+
persistSafely(input.persistReason);
|
|
146
|
+
return nextBindings;
|
|
147
|
+
};
|
|
148
|
+
const manager = {
|
|
149
|
+
accountId: params.accountId,
|
|
150
|
+
getIdleTimeoutMs: () => defaults.idleTimeoutMs,
|
|
151
|
+
getMaxAgeMs: () => defaults.maxAgeMs,
|
|
152
|
+
persist,
|
|
153
|
+
getByConversation: ({ conversationId, parentConversationId }) => listBindingsForAccount(params.accountId).find((entry) => {
|
|
154
|
+
if (entry.conversationId !== conversationId.trim()) return false;
|
|
155
|
+
if (!parentConversationId) return true;
|
|
156
|
+
return (entry.parentConversationId ?? "") === parentConversationId.trim();
|
|
157
|
+
}),
|
|
158
|
+
listBySessionKey: (targetSessionKey) => listBindingsForAccount(params.accountId).filter((entry) => entry.targetSessionKey === targetSessionKey.trim()),
|
|
159
|
+
listBindings: () => listBindingsForAccount(params.accountId),
|
|
160
|
+
touchBinding: (bindingId, at) => {
|
|
161
|
+
const record = listBindingsForAccount(params.accountId).find((entry) => resolveBindingKey(entry) === bindingId.trim());
|
|
162
|
+
if (!record) return null;
|
|
163
|
+
const nextRecord = {
|
|
164
|
+
...record,
|
|
165
|
+
lastActivityAt: typeof at === "number" && Number.isFinite(at) ? Math.max(record.lastActivityAt, Math.floor(at)) : Date.now()
|
|
166
|
+
};
|
|
167
|
+
setBindingRecord(nextRecord);
|
|
168
|
+
schedulePersist(TOUCH_PERSIST_DELAY_MS);
|
|
169
|
+
return nextRecord;
|
|
170
|
+
},
|
|
171
|
+
setIdleTimeoutBySessionKey: ({ targetSessionKey, idleTimeoutMs }) => {
|
|
172
|
+
return updateBindingsBySessionKey({
|
|
173
|
+
targetSessionKey,
|
|
174
|
+
persistReason: "idle-timeout-update",
|
|
175
|
+
update: (entry, now) => ({
|
|
176
|
+
...entry,
|
|
177
|
+
idleTimeoutMs: Math.max(0, Math.floor(idleTimeoutMs)),
|
|
178
|
+
lastActivityAt: now
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
setMaxAgeBySessionKey: ({ targetSessionKey, maxAgeMs }) => {
|
|
183
|
+
return updateBindingsBySessionKey({
|
|
184
|
+
targetSessionKey,
|
|
185
|
+
persistReason: "max-age-update",
|
|
186
|
+
update: (entry, now) => ({
|
|
187
|
+
...entry,
|
|
188
|
+
maxAgeMs: Math.max(0, Math.floor(maxAgeMs)),
|
|
189
|
+
lastActivityAt: now
|
|
190
|
+
})
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
stop: () => {
|
|
194
|
+
if (sweepTimer) clearInterval(sweepTimer);
|
|
195
|
+
if (persistTimer) {
|
|
196
|
+
clearTimeout(persistTimer);
|
|
197
|
+
persistTimer = null;
|
|
198
|
+
persistSafely("shutdown-flush");
|
|
199
|
+
}
|
|
200
|
+
unregisterSessionBindingAdapter({
|
|
201
|
+
channel: "matrix",
|
|
202
|
+
accountId: params.accountId,
|
|
203
|
+
adapter: sessionBindingAdapter
|
|
204
|
+
});
|
|
205
|
+
if (getMatrixThreadBindingManagerEntry(params.accountId)?.manager === manager) deleteMatrixThreadBindingManagerEntry(params.accountId);
|
|
206
|
+
for (const record of listBindingsForAccount(params.accountId)) removeBindingRecord(record);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
let sweepTimer = null;
|
|
210
|
+
const removeRecords = (records) => {
|
|
211
|
+
if (records.length === 0) return [];
|
|
212
|
+
return records.map((record) => removeBindingRecord(record)).filter((record) => Boolean(record));
|
|
213
|
+
};
|
|
214
|
+
const sendFarewellMessages = async (removed, reason) => {
|
|
215
|
+
await Promise.all(removed.map(async (record) => {
|
|
216
|
+
await sendFarewellMessage({
|
|
217
|
+
cfg: params.cfg,
|
|
218
|
+
client: params.client,
|
|
219
|
+
accountId: params.accountId,
|
|
220
|
+
record,
|
|
221
|
+
defaultIdleTimeoutMs: defaults.idleTimeoutMs,
|
|
222
|
+
defaultMaxAgeMs: defaults.maxAgeMs,
|
|
223
|
+
reason: typeof reason === "function" ? reason(record) : reason
|
|
224
|
+
});
|
|
225
|
+
}));
|
|
226
|
+
};
|
|
227
|
+
const unbindRecords = async (records, reason) => {
|
|
228
|
+
const removed = removeRecords(records);
|
|
229
|
+
if (removed.length === 0) return [];
|
|
230
|
+
await persist();
|
|
231
|
+
await sendFarewellMessages(removed, reason);
|
|
232
|
+
return removed.map((record) => toSessionBindingRecord(record, defaults));
|
|
233
|
+
};
|
|
234
|
+
const sessionBindingAdapter = {
|
|
235
|
+
channel: "matrix",
|
|
236
|
+
accountId: params.accountId,
|
|
237
|
+
capabilities: {
|
|
238
|
+
placements: ["current", "child"],
|
|
239
|
+
bindSupported: true,
|
|
240
|
+
unbindSupported: true
|
|
241
|
+
},
|
|
242
|
+
bind: async (input) => {
|
|
243
|
+
const conversationId = input.conversation.conversationId.trim();
|
|
244
|
+
const parentConversationId = normalizeOptionalString(input.conversation.parentConversationId);
|
|
245
|
+
const targetSessionKey = input.targetSessionKey.trim();
|
|
246
|
+
if (!conversationId || !targetSessionKey) return null;
|
|
247
|
+
let boundConversationId = conversationId;
|
|
248
|
+
let boundParentConversationId = parentConversationId;
|
|
249
|
+
const introText = buildMatrixBindingIntroText({
|
|
250
|
+
metadata: input.metadata,
|
|
251
|
+
targetSessionKey
|
|
252
|
+
});
|
|
253
|
+
if (input.placement === "child") {
|
|
254
|
+
const roomId = parentConversationId || conversationId;
|
|
255
|
+
const rootEventId = await sendBindingMessage({
|
|
256
|
+
cfg: params.cfg,
|
|
257
|
+
client: params.client,
|
|
258
|
+
accountId: params.accountId,
|
|
259
|
+
roomId,
|
|
260
|
+
text: introText
|
|
261
|
+
});
|
|
262
|
+
if (!rootEventId) return null;
|
|
263
|
+
boundConversationId = rootEventId;
|
|
264
|
+
boundParentConversationId = roomId;
|
|
265
|
+
}
|
|
266
|
+
const now = Date.now();
|
|
267
|
+
const record = {
|
|
268
|
+
accountId: params.accountId,
|
|
269
|
+
conversationId: boundConversationId,
|
|
270
|
+
...boundParentConversationId ? { parentConversationId: boundParentConversationId } : {},
|
|
271
|
+
targetKind: toMatrixBindingTargetKind(input.targetKind),
|
|
272
|
+
targetSessionKey,
|
|
273
|
+
agentId: normalizeOptionalString(input.metadata?.agentId) || resolveAgentIdFromSessionKey(targetSessionKey),
|
|
274
|
+
label: normalizeOptionalString(input.metadata?.label) || void 0,
|
|
275
|
+
boundBy: normalizeOptionalString(input.metadata?.boundBy) || "system",
|
|
276
|
+
boundAt: now,
|
|
277
|
+
lastActivityAt: now,
|
|
278
|
+
idleTimeoutMs: defaults.idleTimeoutMs,
|
|
279
|
+
maxAgeMs: defaults.maxAgeMs
|
|
280
|
+
};
|
|
281
|
+
setBindingRecord(record);
|
|
282
|
+
await persist();
|
|
283
|
+
if (input.placement === "current" && introText) {
|
|
284
|
+
const roomId = boundParentConversationId || boundConversationId;
|
|
285
|
+
const threadId = boundParentConversationId && boundParentConversationId !== boundConversationId ? boundConversationId : void 0;
|
|
286
|
+
await sendBindingMessage({
|
|
287
|
+
cfg: params.cfg,
|
|
288
|
+
client: params.client,
|
|
289
|
+
accountId: params.accountId,
|
|
290
|
+
roomId,
|
|
291
|
+
threadId,
|
|
292
|
+
text: introText
|
|
293
|
+
}).catch(() => {});
|
|
294
|
+
}
|
|
295
|
+
return toSessionBindingRecord(record, defaults);
|
|
296
|
+
},
|
|
297
|
+
listBySession: (targetSessionKey) => manager.listBySessionKey(targetSessionKey).map((record) => toSessionBindingRecord(record, defaults)),
|
|
298
|
+
resolveByConversation: (ref) => {
|
|
299
|
+
const record = manager.getByConversation({
|
|
300
|
+
conversationId: ref.conversationId,
|
|
301
|
+
parentConversationId: ref.parentConversationId
|
|
302
|
+
});
|
|
303
|
+
return record ? toSessionBindingRecord(record, defaults) : null;
|
|
304
|
+
},
|
|
305
|
+
touch: (bindingId, at) => {
|
|
306
|
+
manager.touchBinding(bindingId, at);
|
|
307
|
+
},
|
|
308
|
+
unbind: async (input) => {
|
|
309
|
+
return await unbindRecords(listBindingsForAccount(params.accountId).filter((record) => {
|
|
310
|
+
if (input.bindingId?.trim()) return resolveBindingKey(record) === input.bindingId.trim();
|
|
311
|
+
if (input.targetSessionKey?.trim()) return record.targetSessionKey === input.targetSessionKey.trim();
|
|
312
|
+
return false;
|
|
313
|
+
}), input.reason);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
registerSessionBindingAdapter(sessionBindingAdapter);
|
|
317
|
+
if (params.enableSweeper !== false) {
|
|
318
|
+
sweepTimer = setInterval(() => {
|
|
319
|
+
const now = Date.now();
|
|
320
|
+
const expired = listBindingsForAccount(params.accountId).map((record) => ({
|
|
321
|
+
record,
|
|
322
|
+
lifecycle: resolveEffectiveBindingExpiry({
|
|
323
|
+
record,
|
|
324
|
+
defaultIdleTimeoutMs: defaults.idleTimeoutMs,
|
|
325
|
+
defaultMaxAgeMs: defaults.maxAgeMs
|
|
326
|
+
})
|
|
327
|
+
})).filter((entry) => typeof entry.lifecycle.expiresAt === "number" && entry.lifecycle.expiresAt <= now && Boolean(entry.lifecycle.reason));
|
|
328
|
+
if (expired.length === 0) return;
|
|
329
|
+
const reasonByBindingKey = new Map(expired.map(({ record, lifecycle }) => [resolveBindingKey(record), lifecycle.reason]));
|
|
330
|
+
(async () => {
|
|
331
|
+
const removed = removeRecords(expired.map(({ record }) => record));
|
|
332
|
+
if (removed.length === 0) return;
|
|
333
|
+
for (const record of removed) {
|
|
334
|
+
const reason = reasonByBindingKey.get(resolveBindingKey(record));
|
|
335
|
+
params.logVerboseMessage?.(`matrix: auto-unbinding ${record.conversationId} due to ${reason}`);
|
|
336
|
+
}
|
|
337
|
+
await persist();
|
|
338
|
+
await sendFarewellMessages(removed, (record) => reasonByBindingKey.get(resolveBindingKey(record)));
|
|
339
|
+
})().catch((err) => {
|
|
340
|
+
params.logVerboseMessage?.(`matrix: failed auto-unbinding expired bindings account=${params.accountId}: ${String(err)}`);
|
|
341
|
+
});
|
|
342
|
+
}, THREAD_BINDINGS_SWEEP_INTERVAL_MS);
|
|
343
|
+
sweepTimer.unref?.();
|
|
344
|
+
}
|
|
345
|
+
setMatrixThreadBindingManagerEntry(params.accountId, {
|
|
346
|
+
filePath,
|
|
347
|
+
manager
|
|
348
|
+
});
|
|
349
|
+
return manager;
|
|
350
|
+
}
|
|
351
|
+
//#endregion
|
|
352
|
+
export { createMatrixThreadBindingManager as t };
|