@diegoaltoworks/chatter 0.61.0 → 0.62.0
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/README.md +55 -17
- package/dist/auth/secretStrength.d.ts +1 -1
- package/dist/auth/secretStrength.d.ts.map +1 -1
- package/dist/bin/create-apikey.js +45 -28
- package/dist/bin/wa-pair.js +113 -46
- package/dist/channels/backoff.d.ts +10 -0
- package/dist/channels/backoff.d.ts.map +1 -0
- package/dist/channels/gates.d.ts +15 -8
- package/dist/channels/gates.d.ts.map +1 -1
- package/dist/channels/index.d.ts +1 -1
- package/dist/channels/index.d.ts.map +1 -1
- package/dist/channels/index.js +38 -5
- package/dist/channels/index.mjs +37 -5
- package/dist/channels/matrix/api.d.ts +25 -6
- package/dist/channels/matrix/api.d.ts.map +1 -1
- package/dist/channels/matrix/channel.d.ts +4 -56
- package/dist/channels/matrix/channel.d.ts.map +1 -1
- package/dist/channels/matrix/handler.d.ts +16 -9
- package/dist/channels/matrix/handler.d.ts.map +1 -1
- package/dist/channels/matrix/index.d.ts +2 -2
- package/dist/channels/matrix/index.d.ts.map +1 -1
- package/dist/channels/matrix/index.js +196 -40
- package/dist/channels/matrix/index.mjs +189 -39
- package/dist/channels/matrix/sync.d.ts +4 -1
- package/dist/channels/matrix/sync.d.ts.map +1 -1
- package/dist/channels/matrix/updates.d.ts +39 -10
- package/dist/channels/matrix/updates.d.ts.map +1 -1
- package/dist/channels/pipeline.d.ts +14 -14
- package/dist/channels/pipeline.d.ts.map +1 -1
- package/dist/channels/polling.d.ts +67 -0
- package/dist/channels/polling.d.ts.map +1 -0
- package/dist/channels/telegram/channel.d.ts +2 -56
- package/dist/channels/telegram/channel.d.ts.map +1 -1
- package/dist/channels/telegram/index.js +53 -23
- package/dist/channels/telegram/index.mjs +53 -23
- package/dist/channels/telegram/poll.d.ts +5 -1
- package/dist/channels/telegram/poll.d.ts.map +1 -1
- package/dist/channels/telegram/webhook.d.ts +2 -10
- package/dist/channels/telegram/webhook.d.ts.map +1 -1
- package/dist/channels/whatsapp/authState.d.ts +40 -9
- package/dist/channels/whatsapp/authState.d.ts.map +1 -1
- package/dist/channels/whatsapp/channel.d.ts +25 -4
- package/dist/channels/whatsapp/channel.d.ts.map +1 -1
- package/dist/channels/whatsapp/inbound.d.ts +23 -25
- package/dist/channels/whatsapp/inbound.d.ts.map +1 -1
- package/dist/channels/whatsapp/index.d.ts +3 -3
- package/dist/channels/whatsapp/index.d.ts.map +1 -1
- package/dist/channels/whatsapp/index.js +123 -41
- package/dist/channels/whatsapp/index.mjs +120 -41
- package/dist/channels/whatsapp/pairing.d.ts.map +1 -1
- package/dist/client/src/Chat.d.ts.map +1 -1
- package/dist/client/src/ChatButton.d.ts.map +1 -1
- package/dist/client/src/browser.d.ts.map +1 -1
- package/dist/core/answer.d.ts +8 -0
- package/dist/core/answer.d.ts.map +1 -1
- package/dist/core/buildLock.d.ts +52 -0
- package/dist/core/buildLock.d.ts.map +1 -0
- package/dist/core/pipeline.d.ts +42 -5
- package/dist/core/pipeline.d.ts.map +1 -1
- package/dist/core/prompts.d.ts +2 -0
- package/dist/core/prompts.d.ts.map +1 -1
- package/dist/core/retrieval.d.ts +100 -25
- package/dist/core/retrieval.d.ts.map +1 -1
- package/dist/core/session.d.ts +8 -0
- package/dist/core/session.d.ts.map +1 -1
- package/dist/flows/index.d.ts +1 -1
- package/dist/flows/index.d.ts.map +1 -1
- package/dist/flows/index.js +8 -6
- package/dist/flows/index.mjs +7 -6
- package/dist/flows/intent.d.ts +1 -1
- package/dist/flows/intent.d.ts.map +1 -1
- package/dist/flows/loader.d.ts +1 -2
- package/dist/flows/loader.d.ts.map +1 -1
- package/dist/flows/params.d.ts +1 -1
- package/dist/flows/params.d.ts.map +1 -1
- package/dist/flows/session.d.ts +4 -2
- package/dist/flows/session.d.ts.map +1 -1
- package/dist/flows/types.d.ts +2 -3
- package/dist/flows/types.d.ts.map +1 -1
- package/dist/history/index.d.ts +1 -1
- package/dist/history/index.d.ts.map +1 -1
- package/dist/history/index.js +6 -3
- package/dist/history/index.mjs +5 -3
- package/dist/history/tursoStore.d.ts +6 -4
- package/dist/history/tursoStore.d.ts.map +1 -1
- package/dist/images/index.js +2 -2
- package/dist/images/index.mjs +2 -2
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +596 -295
- package/dist/index.mjs +595 -295
- package/dist/mcp-server/index.d.ts +5 -5
- package/dist/mcp-server/index.d.ts.map +1 -1
- package/dist/mcp-server/logger.d.ts +12 -2
- package/dist/mcp-server/logger.d.ts.map +1 -1
- package/dist/mcp-server/rate-limiter.d.ts +10 -3
- package/dist/mcp-server/rate-limiter.d.ts.map +1 -1
- package/dist/mcp-server/types.d.ts +20 -5
- package/dist/mcp-server/types.d.ts.map +1 -1
- package/dist/mcp-server.js +479 -244
- package/dist/mcp-server.mjs +485 -244
- package/dist/middleware/apiKey.d.ts +10 -0
- package/dist/middleware/apiKey.d.ts.map +1 -0
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/cors.d.ts.map +1 -1
- package/dist/middleware/ratelimit.d.ts.map +1 -1
- package/dist/middleware/referrer.d.ts.map +1 -1
- package/dist/middleware/session.d.ts +1 -1
- package/dist/middleware/session.d.ts.map +1 -1
- package/dist/routes/demo.d.ts.map +1 -1
- package/dist/routes/openai.d.ts.map +1 -1
- package/dist/routes/private.d.ts.map +1 -1
- package/dist/routes/public.d.ts.map +1 -1
- package/dist/scheduler/index.js +1 -1
- package/dist/scheduler/index.mjs +1 -1
- package/dist/scheduler/scheduler.d.ts +9 -1
- package/dist/scheduler/scheduler.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +491 -268
- package/dist/server.mjs +497 -268
- package/dist/shortener.d.ts +5 -4
- package/dist/shortener.d.ts.map +1 -1
- package/dist/types.d.ts +129 -75
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -1
package/dist/channels/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
isBlockedByAllowlist: () => isBlockedByAllowlist,
|
|
28
28
|
isEffectivelyFromSelf: () => isEffectivelyFromSelf,
|
|
29
29
|
isFromAnySession: () => isFromAnySession,
|
|
30
|
+
resolveBrainHooks: () => resolveBrainHooks,
|
|
30
31
|
underReplyRateLimit: () => underReplyRateLimit
|
|
31
32
|
});
|
|
32
33
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -163,7 +164,8 @@ async function answerOnce({
|
|
|
163
164
|
async function applyTransformReply(transformReply, input, logger) {
|
|
164
165
|
if (!transformReply) return input.text;
|
|
165
166
|
try {
|
|
166
|
-
|
|
167
|
+
const result = await transformReply(input);
|
|
168
|
+
return typeof result === "string" ? result : null;
|
|
167
169
|
} catch (error) {
|
|
168
170
|
logger?.error(
|
|
169
171
|
`transformReply threw for channel "${input.channel}"; sending the original reply`,
|
|
@@ -225,6 +227,7 @@ async function prepareChat({
|
|
|
225
227
|
sender,
|
|
226
228
|
rewriteQuery,
|
|
227
229
|
rerankContext,
|
|
230
|
+
fallbackFn,
|
|
228
231
|
logger
|
|
229
232
|
}) {
|
|
230
233
|
const lastUserMsg = lastUserMessage(messages);
|
|
@@ -241,21 +244,39 @@ async function prepareChat({
|
|
|
241
244
|
logger?.error("rewriteQuery threw; falling back to the original query", error);
|
|
242
245
|
}
|
|
243
246
|
}
|
|
244
|
-
|
|
247
|
+
const resolvedBuckets = buckets ?? defaultBuckets(mode);
|
|
248
|
+
const retrievedChunks = await store.query(query, topK, resolvedBuckets);
|
|
249
|
+
let ctx = retrievedChunks;
|
|
245
250
|
if (rerankContext) {
|
|
246
251
|
try {
|
|
247
|
-
const reranked = await rerankContext({ query, chunks: ctx });
|
|
252
|
+
const reranked = await rerankContext({ query, chunks: [...ctx] });
|
|
248
253
|
if (Array.isArray(reranked) && reranked.every((c) => typeof c === "string")) ctx = reranked;
|
|
249
254
|
} catch (error) {
|
|
250
255
|
logger?.error("rerankContext threw; falling back to the original chunks", error);
|
|
251
256
|
}
|
|
252
257
|
}
|
|
258
|
+
let fallback;
|
|
259
|
+
if (ctx.length === 0 && fallbackFn) {
|
|
260
|
+
try {
|
|
261
|
+
const guidance = await fallbackFn({
|
|
262
|
+
query,
|
|
263
|
+
mode,
|
|
264
|
+
buckets: resolvedBuckets,
|
|
265
|
+
sender,
|
|
266
|
+
retrievedChunks
|
|
267
|
+
});
|
|
268
|
+
if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
|
|
269
|
+
} catch (error) {
|
|
270
|
+
logger?.error("fallbackFn threw; proceeding without fallback guidance", error);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
253
273
|
const persona = personaLayer?.trim() || (mode === "private" ? prompts.privatePersona : prompts.publicPersona);
|
|
254
274
|
const hint = channelHint?.trim();
|
|
255
275
|
const system = [
|
|
256
276
|
prompts.baseSystemRules,
|
|
257
277
|
persona,
|
|
258
278
|
...hint ? [hint] : [],
|
|
279
|
+
...fallback ? [fallback] : [],
|
|
259
280
|
`${label}:
|
|
260
281
|
${ctx.join("\n\n")}`
|
|
261
282
|
].join("\n\n");
|
|
@@ -263,7 +284,7 @@ ${ctx.join("\n\n")}`
|
|
|
263
284
|
}
|
|
264
285
|
|
|
265
286
|
// src/history/compaction.ts
|
|
266
|
-
var
|
|
287
|
+
var COMPACTION_TIMEOUT_MS = 8e3;
|
|
267
288
|
var LOAD_ALL = Number.MAX_SAFE_INTEGER;
|
|
268
289
|
var SUMMARY_PREFIX = "Summary of earlier conversation: ";
|
|
269
290
|
function defaultSummarize(client, model) {
|
|
@@ -291,7 +312,7 @@ function createHistoryCompactor(deps, options) {
|
|
|
291
312
|
throw new Error(`Invalid history compaction keep: ${keep}`);
|
|
292
313
|
}
|
|
293
314
|
const summarize = options.summarize ?? defaultSummarize(deps.client, options.model);
|
|
294
|
-
const timeoutMs = options.timeoutMs ??
|
|
315
|
+
const timeoutMs = options.timeoutMs ?? COMPACTION_TIMEOUT_MS;
|
|
295
316
|
return {
|
|
296
317
|
async maybeCompact(store, conversationId) {
|
|
297
318
|
const turns = await store.load(conversationId, LOAD_ALL);
|
|
@@ -332,6 +353,16 @@ function createHistoryCompactor(deps, options) {
|
|
|
332
353
|
}
|
|
333
354
|
|
|
334
355
|
// src/channels/pipeline.ts
|
|
356
|
+
function resolveBrainHooks(config, fallback) {
|
|
357
|
+
return {
|
|
358
|
+
answerFn: config.answerFn ?? fallback?.answerFn,
|
|
359
|
+
bucketsFor: config.bucketsFor ?? fallback?.bucketsFor,
|
|
360
|
+
rewriteQuery: config.rewriteQuery ?? fallback?.rewriteQuery,
|
|
361
|
+
rerankContext: config.rerankContext ?? fallback?.rerankContext,
|
|
362
|
+
fallbackFn: config.fallbackFn ?? fallback?.fallbackFn,
|
|
363
|
+
transformReply: config.transformReply ?? fallback?.transformReply
|
|
364
|
+
};
|
|
365
|
+
}
|
|
335
366
|
var DEFAULT_HISTORY_LIMIT = 20;
|
|
336
367
|
var DEFAULT_GROUP_RATE_LIMIT = { max: 30, windowMs: 60 * 60 * 1e3 };
|
|
337
368
|
var DEFAULT_DM_RATE_LIMIT = { max: 20, windowMs: 60 * 60 * 1e3 };
|
|
@@ -416,6 +447,7 @@ function createInboundPipeline(deps, config) {
|
|
|
416
447
|
sender,
|
|
417
448
|
rewriteQuery: config.rewriteQuery,
|
|
418
449
|
rerankContext: config.rerankContext,
|
|
450
|
+
fallbackFn: config.fallbackFn,
|
|
419
451
|
logger: config.logger
|
|
420
452
|
});
|
|
421
453
|
const { content: produced } = await answerOnce({
|
|
@@ -539,5 +571,6 @@ function createSenderRegistry(logger = createConsoleLogger()) {
|
|
|
539
571
|
isBlockedByAllowlist,
|
|
540
572
|
isEffectivelyFromSelf,
|
|
541
573
|
isFromAnySession,
|
|
574
|
+
resolveBrainHooks,
|
|
542
575
|
underReplyRateLimit
|
|
543
576
|
});
|
package/dist/channels/index.mjs
CHANGED
|
@@ -130,7 +130,8 @@ async function answerOnce({
|
|
|
130
130
|
async function applyTransformReply(transformReply, input, logger) {
|
|
131
131
|
if (!transformReply) return input.text;
|
|
132
132
|
try {
|
|
133
|
-
|
|
133
|
+
const result = await transformReply(input);
|
|
134
|
+
return typeof result === "string" ? result : null;
|
|
134
135
|
} catch (error) {
|
|
135
136
|
logger?.error(
|
|
136
137
|
`transformReply threw for channel "${input.channel}"; sending the original reply`,
|
|
@@ -192,6 +193,7 @@ async function prepareChat({
|
|
|
192
193
|
sender,
|
|
193
194
|
rewriteQuery,
|
|
194
195
|
rerankContext,
|
|
196
|
+
fallbackFn,
|
|
195
197
|
logger
|
|
196
198
|
}) {
|
|
197
199
|
const lastUserMsg = lastUserMessage(messages);
|
|
@@ -208,21 +210,39 @@ async function prepareChat({
|
|
|
208
210
|
logger?.error("rewriteQuery threw; falling back to the original query", error);
|
|
209
211
|
}
|
|
210
212
|
}
|
|
211
|
-
|
|
213
|
+
const resolvedBuckets = buckets ?? defaultBuckets(mode);
|
|
214
|
+
const retrievedChunks = await store.query(query, topK, resolvedBuckets);
|
|
215
|
+
let ctx = retrievedChunks;
|
|
212
216
|
if (rerankContext) {
|
|
213
217
|
try {
|
|
214
|
-
const reranked = await rerankContext({ query, chunks: ctx });
|
|
218
|
+
const reranked = await rerankContext({ query, chunks: [...ctx] });
|
|
215
219
|
if (Array.isArray(reranked) && reranked.every((c) => typeof c === "string")) ctx = reranked;
|
|
216
220
|
} catch (error) {
|
|
217
221
|
logger?.error("rerankContext threw; falling back to the original chunks", error);
|
|
218
222
|
}
|
|
219
223
|
}
|
|
224
|
+
let fallback;
|
|
225
|
+
if (ctx.length === 0 && fallbackFn) {
|
|
226
|
+
try {
|
|
227
|
+
const guidance = await fallbackFn({
|
|
228
|
+
query,
|
|
229
|
+
mode,
|
|
230
|
+
buckets: resolvedBuckets,
|
|
231
|
+
sender,
|
|
232
|
+
retrievedChunks
|
|
233
|
+
});
|
|
234
|
+
if (typeof guidance === "string" && guidance.trim()) fallback = guidance.trim();
|
|
235
|
+
} catch (error) {
|
|
236
|
+
logger?.error("fallbackFn threw; proceeding without fallback guidance", error);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
220
239
|
const persona = personaLayer?.trim() || (mode === "private" ? prompts.privatePersona : prompts.publicPersona);
|
|
221
240
|
const hint = channelHint?.trim();
|
|
222
241
|
const system = [
|
|
223
242
|
prompts.baseSystemRules,
|
|
224
243
|
persona,
|
|
225
244
|
...hint ? [hint] : [],
|
|
245
|
+
...fallback ? [fallback] : [],
|
|
226
246
|
`${label}:
|
|
227
247
|
${ctx.join("\n\n")}`
|
|
228
248
|
].join("\n\n");
|
|
@@ -230,7 +250,7 @@ ${ctx.join("\n\n")}`
|
|
|
230
250
|
}
|
|
231
251
|
|
|
232
252
|
// src/history/compaction.ts
|
|
233
|
-
var
|
|
253
|
+
var COMPACTION_TIMEOUT_MS = 8e3;
|
|
234
254
|
var LOAD_ALL = Number.MAX_SAFE_INTEGER;
|
|
235
255
|
var SUMMARY_PREFIX = "Summary of earlier conversation: ";
|
|
236
256
|
function defaultSummarize(client, model) {
|
|
@@ -258,7 +278,7 @@ function createHistoryCompactor(deps, options) {
|
|
|
258
278
|
throw new Error(`Invalid history compaction keep: ${keep}`);
|
|
259
279
|
}
|
|
260
280
|
const summarize = options.summarize ?? defaultSummarize(deps.client, options.model);
|
|
261
|
-
const timeoutMs = options.timeoutMs ??
|
|
281
|
+
const timeoutMs = options.timeoutMs ?? COMPACTION_TIMEOUT_MS;
|
|
262
282
|
return {
|
|
263
283
|
async maybeCompact(store, conversationId) {
|
|
264
284
|
const turns = await store.load(conversationId, LOAD_ALL);
|
|
@@ -299,6 +319,16 @@ function createHistoryCompactor(deps, options) {
|
|
|
299
319
|
}
|
|
300
320
|
|
|
301
321
|
// src/channels/pipeline.ts
|
|
322
|
+
function resolveBrainHooks(config, fallback) {
|
|
323
|
+
return {
|
|
324
|
+
answerFn: config.answerFn ?? fallback?.answerFn,
|
|
325
|
+
bucketsFor: config.bucketsFor ?? fallback?.bucketsFor,
|
|
326
|
+
rewriteQuery: config.rewriteQuery ?? fallback?.rewriteQuery,
|
|
327
|
+
rerankContext: config.rerankContext ?? fallback?.rerankContext,
|
|
328
|
+
fallbackFn: config.fallbackFn ?? fallback?.fallbackFn,
|
|
329
|
+
transformReply: config.transformReply ?? fallback?.transformReply
|
|
330
|
+
};
|
|
331
|
+
}
|
|
302
332
|
var DEFAULT_HISTORY_LIMIT = 20;
|
|
303
333
|
var DEFAULT_GROUP_RATE_LIMIT = { max: 30, windowMs: 60 * 60 * 1e3 };
|
|
304
334
|
var DEFAULT_DM_RATE_LIMIT = { max: 20, windowMs: 60 * 60 * 1e3 };
|
|
@@ -383,6 +413,7 @@ function createInboundPipeline(deps, config) {
|
|
|
383
413
|
sender,
|
|
384
414
|
rewriteQuery: config.rewriteQuery,
|
|
385
415
|
rerankContext: config.rerankContext,
|
|
416
|
+
fallbackFn: config.fallbackFn,
|
|
386
417
|
logger: config.logger
|
|
387
418
|
});
|
|
388
419
|
const { content: produced } = await answerOnce({
|
|
@@ -505,5 +536,6 @@ export {
|
|
|
505
536
|
isBlockedByAllowlist,
|
|
506
537
|
isEffectivelyFromSelf,
|
|
507
538
|
isFromAnySession,
|
|
539
|
+
resolveBrainHooks,
|
|
508
540
|
underReplyRateLimit
|
|
509
541
|
};
|
|
@@ -37,13 +37,21 @@ export interface MatrixRoomTimeline {
|
|
|
37
37
|
export interface MatrixJoinedRoom {
|
|
38
38
|
timeline: MatrixRoomTimeline;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* A state event as it arrives in an invite's `invite_state`: the homeserver
|
|
42
|
+
* strips it down to type/state_key/sender/content for a room the bot has not
|
|
43
|
+
* joined, so there is no `event_id` or `origin_server_ts` here the way there
|
|
44
|
+
* is on a timeline event.
|
|
45
|
+
*/
|
|
46
|
+
export interface MatrixStrippedStateEvent {
|
|
47
|
+
type: string;
|
|
48
|
+
state_key?: string;
|
|
49
|
+
sender?: string;
|
|
50
|
+
content?: Record<string, unknown>;
|
|
51
|
+
}
|
|
40
52
|
export interface MatrixInvitedRoom {
|
|
41
53
|
invite_state?: {
|
|
42
|
-
events:
|
|
43
|
-
type: string;
|
|
44
|
-
sender?: string;
|
|
45
|
-
content?: unknown;
|
|
46
|
-
}>;
|
|
54
|
+
events: MatrixStrippedStateEvent[];
|
|
47
55
|
};
|
|
48
56
|
}
|
|
49
57
|
export interface MatrixAccountDataEvent {
|
|
@@ -82,12 +90,19 @@ export type MatrixMediaKind = "image" | "file" | "video" | "audio";
|
|
|
82
90
|
export interface MatrixMediaPayload {
|
|
83
91
|
/** @default "image" */
|
|
84
92
|
kind?: MatrixMediaKind;
|
|
85
|
-
/** An `mxc://` content URI (sent as-is) or an https URL (fetched, then uploaded). */
|
|
93
|
+
/** An `mxc://` content URI (sent as-is) or an https URL (fetched under {@link MatrixApiConfig.maxMediaBytes}, then uploaded). Any other scheme is rejected. */
|
|
86
94
|
url: string;
|
|
87
95
|
caption?: string;
|
|
88
96
|
/** @default derived from the URL's last path segment, or the media kind */
|
|
89
97
|
filename?: string;
|
|
90
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Default ceiling on a fetched media source. `sendMedia` is reachable from a
|
|
101
|
+
* scheduler, a flow or an `answerFn` tool call, so its URL is not necessarily
|
|
102
|
+
* one an operator chose: an unbounded fetch would let whatever produced that
|
|
103
|
+
* URL decide how much memory this process allocates.
|
|
104
|
+
*/
|
|
105
|
+
export declare const DEFAULT_MAX_MEDIA_BYTES: number;
|
|
91
106
|
export interface MatrixApiConfig {
|
|
92
107
|
/** Homeserver client-server API origin, e.g. `https://matrix.example.org`. */
|
|
93
108
|
homeserverUrl: string;
|
|
@@ -95,6 +110,8 @@ export interface MatrixApiConfig {
|
|
|
95
110
|
accessToken: string;
|
|
96
111
|
/** Overridable for tests and for hosts routing through a proxy; defaults to `globalThis.fetch`. */
|
|
97
112
|
fetch?: typeof fetch;
|
|
113
|
+
/** Cap on the bytes `sendMedia` will pull from a remote https URL before uploading. @default 25 MiB */
|
|
114
|
+
maxMediaBytes?: number;
|
|
98
115
|
}
|
|
99
116
|
export interface MatrixApi {
|
|
100
117
|
/** Raw call, for an endpoint this interface does not wrap. Rejects with {@link MatrixApiError} on any non-2xx response. */
|
|
@@ -113,6 +130,8 @@ export interface MatrixApi {
|
|
|
113
130
|
}): Promise<MatrixSyncResponse>;
|
|
114
131
|
/** A user's global account data of `type` (e.g. `m.direct`), or `undefined` if it was never set (`M_NOT_FOUND`). */
|
|
115
132
|
getAccountData<T>(userId: string, type: string): Promise<T | undefined>;
|
|
133
|
+
/** Replaces a user's global account data of `type`. Whole-document semantics: the homeserver stores exactly what is sent, so merge before calling. */
|
|
134
|
+
setAccountData(userId: string, type: string, content: Record<string, unknown>): Promise<void>;
|
|
116
135
|
/** Sends an `m.room.message` (or any event type, via `eventType`) and returns its event id. */
|
|
117
136
|
sendEvent(roomId: string, content: Record<string, unknown>, options?: {
|
|
118
137
|
eventType?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/channels/matrix/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED,MAAM,WAAW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AAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnC,2IAA2I;IAC3I,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAuGD,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAuMlE"}
|
|
@@ -12,32 +12,16 @@
|
|
|
12
12
|
* unencrypted rooms; see docs/matrix.md for the full explanation and why
|
|
13
13
|
* that rules out most default-E2EE personal homeservers for DMs.
|
|
14
14
|
*/
|
|
15
|
-
import type { AnswerFn, TransformReply } from "../../core/answer";
|
|
16
|
-
import type { BucketsFor } from "../../core/buckets";
|
|
17
|
-
import { type Logger } from "../../core/logger";
|
|
18
|
-
import type { RerankContext, RewriteQuery } from "../../core/pipeline";
|
|
19
|
-
import type { HistoryCompactionOptions } from "../../history/compaction";
|
|
20
|
-
import type { HistoryStore } from "../../history/types";
|
|
21
15
|
import type { Channel } from "../index";
|
|
16
|
+
import { type PollingChannelConfig } from "../polling";
|
|
22
17
|
import { type MatrixApi } from "./api";
|
|
23
|
-
export interface MatrixChannelConfig {
|
|
18
|
+
export interface MatrixChannelConfig extends PollingChannelConfig {
|
|
24
19
|
/** Homeserver client-server API origin, e.g. `https://matrix.example.org`. */
|
|
25
20
|
homeserverUrl: string;
|
|
26
21
|
/** A logged-in bot user's access token. A credential — pass it from the environment, never commit it. */
|
|
27
22
|
accessToken: string;
|
|
28
23
|
/** Channel and sender-registry name. Override to run more than one bot in one process. @default "matrix" */
|
|
29
24
|
name?: string;
|
|
30
|
-
/** Group rooms eligible for a reply. Empty (default) = every room. Has no effect on DMs, which always reply. */
|
|
31
|
-
allowedChats?: string[];
|
|
32
|
-
answerFn?: AnswerFn;
|
|
33
|
-
bucketsFor?: BucketsFor;
|
|
34
|
-
/** Rewrites the retrieval query before it reaches the vector store — see `ChatterConfig.rewriteQuery`. Falls back to the server's own. */
|
|
35
|
-
rewriteQuery?: RewriteQuery;
|
|
36
|
-
/** Post-processes retrieved chunks before they're folded into the prompt — see `ChatterConfig.rerankContext`. Falls back to the server's own. */
|
|
37
|
-
rerankContext?: RerankContext;
|
|
38
|
-
/** Modifies or vetoes the produced reply before delivery — see `ChatterConfig.transformReply`. Falls back to the server's own. */
|
|
39
|
-
transformReply?: TransformReply;
|
|
40
|
-
model?: string;
|
|
41
25
|
/** Extra system-prompt section describing the delivery channel; passed through to `prepareChat`. @default "Channel: Matrix." */
|
|
42
26
|
channelHint?: string;
|
|
43
27
|
/** A throw/rejection is treated as "no persona" for that turn. `sender` is the namespaced `mx:<user id>` key. */
|
|
@@ -45,37 +29,6 @@ export interface MatrixChannelConfig {
|
|
|
45
29
|
sender: string;
|
|
46
30
|
text: string;
|
|
47
31
|
}) => string | undefined | Promise<string | undefined>;
|
|
48
|
-
/** Off by default — the channel stays single-turn until a store is configured. */
|
|
49
|
-
history?: {
|
|
50
|
-
store: HistoryStore;
|
|
51
|
-
/** Most recent turns to load per reply. @default 20 */
|
|
52
|
-
limit?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Excludes a sender from history entirely — see
|
|
55
|
-
* `InboundPipelineConfig.history.historyEnabledFor` in `./channels`.
|
|
56
|
-
* @default every sender is enabled
|
|
57
|
-
*/
|
|
58
|
-
historyEnabledFor?: (sender: string) => boolean | Promise<boolean>;
|
|
59
|
-
/**
|
|
60
|
-
* Summarize-then-truncate compaction — see
|
|
61
|
-
* `InboundPipelineConfig.history.compaction` in `./channels`.
|
|
62
|
-
* @default off
|
|
63
|
-
*/
|
|
64
|
-
compaction?: HistoryCompactionOptions;
|
|
65
|
-
};
|
|
66
|
-
muteRegex?: RegExp;
|
|
67
|
-
unmuteRegex?: RegExp;
|
|
68
|
-
/** Neutral, overridable acknowledgements — this module ships no bot personality; unset = silent mute/unmute. */
|
|
69
|
-
muteReply?: string;
|
|
70
|
-
unmuteReply?: string;
|
|
71
|
-
dmRateLimit?: {
|
|
72
|
-
max: number;
|
|
73
|
-
windowMs: number;
|
|
74
|
-
};
|
|
75
|
-
groupRateLimit?: {
|
|
76
|
-
max: number;
|
|
77
|
-
windowMs: number;
|
|
78
|
-
};
|
|
79
32
|
/** Auto-accept room invites, so the bot can actually receive messages in a room a user just invited it to. @default true */
|
|
80
33
|
autoJoin?: boolean;
|
|
81
34
|
/** @default 30000 */
|
|
@@ -84,15 +37,10 @@ export interface MatrixChannelConfig {
|
|
|
84
37
|
initialSince?: string;
|
|
85
38
|
/** Called with each acknowledged `since` token, for a host that wants to persist it across restarts. */
|
|
86
39
|
onSince?: (since: string) => void;
|
|
87
|
-
/**
|
|
88
|
-
|
|
40
|
+
/** Cap on the bytes a `sendMedia` https URL may pull before upload. @default 25 MiB */
|
|
41
|
+
maxMediaBytes?: number;
|
|
89
42
|
/** Overridable for tests, which fake the client-server API instead of calling it; defaults to a `fetch` client over {@link MatrixChannelConfig.homeserverUrl}/{@link MatrixChannelConfig.accessToken}. */
|
|
90
43
|
api?: MatrixApi;
|
|
91
|
-
/** Overridable for tests; defaults to a `setTimeout`-based sleep. */
|
|
92
|
-
sleep?: (ms: number) => Promise<void>;
|
|
93
|
-
now?: () => number;
|
|
94
|
-
/** Logger for sync/gate diagnostics. Falls back to the host's `deps.logger`, then a console logger. */
|
|
95
|
-
logger?: Logger;
|
|
96
44
|
}
|
|
97
45
|
export declare function createMatrixChannel(config: MatrixChannelConfig): Channel;
|
|
98
46
|
//# sourceMappingURL=channel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../src/channels/matrix/channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../src/channels/matrix/channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAgB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAQxD,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,8EAA8E;IAC9E,aAAa,EAAE,MAAM,CAAC;IACtB,yGAAyG;IACzG,WAAW,EAAE,MAAM,CAAC;IACpB,4GAA4G;IAC5G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gIAAgI;IAChI,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iHAAiH;IACjH,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACvD,4HAA4H;IAC5H,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kHAAkH;IAClH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wGAAwG;IACxG,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uFAAuF;IACvF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0MAA0M;IAC1M,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CA8HxE"}
|
|
@@ -9,7 +9,7 @@ import type { Logger } from "../../core/logger";
|
|
|
9
9
|
import type { InboundPipeline } from "../pipeline";
|
|
10
10
|
import type { ChannelSender } from "../senders";
|
|
11
11
|
import type { MatrixApi, MatrixSyncResponse } from "./api";
|
|
12
|
-
import { type MatrixIdentity } from "./updates";
|
|
12
|
+
import { type MatrixDirectMapping, type MatrixIdentity } from "./updates";
|
|
13
13
|
export interface MatrixSyncHandlerDeps {
|
|
14
14
|
api: MatrixApi;
|
|
15
15
|
me: MatrixIdentity;
|
|
@@ -23,17 +23,24 @@ export interface MatrixSyncHandlerDeps {
|
|
|
23
23
|
* pipeline turn (a scheduler, a flow) is still recognised.
|
|
24
24
|
*/
|
|
25
25
|
sentEventIds: Set<string>;
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Auto-accept room invites so the bot can actually receive messages there.
|
|
28
|
+
* Gated by {@link MatrixSyncHandlerDeps.allowedChats} when that is set:
|
|
29
|
+
* an invite is an unauthenticated request from any user on any federated
|
|
30
|
+
* homeserver, so a configured allowlist governs which rooms the bot will
|
|
31
|
+
* join, not just which ones it will answer in.
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
27
34
|
autoJoin?: boolean;
|
|
28
35
|
/**
|
|
29
|
-
* The
|
|
30
|
-
* `getAccountData("m.direct")` fetch)
|
|
31
|
-
* `/sync` response's `account_data` isn't guaranteed to repeat
|
|
32
|
-
* and a resumed sync (with `initialSince`) never carries it
|
|
33
|
-
* it changes, so without this a restart would treat every
|
|
34
|
-
* addressing-required group until
|
|
36
|
+
* The bot's own `m.direct` mapping as of `start()` (see `./channel`'s
|
|
37
|
+
* upfront `getAccountData("m.direct")` fetch), seeded here because an
|
|
38
|
+
* initial `/sync` response's `account_data` isn't guaranteed to repeat
|
|
39
|
+
* `m.direct` and a resumed sync (with `initialSince`) never carries it
|
|
40
|
+
* again unless it changes, so without this a restart would treat every
|
|
41
|
+
* known DM as an addressing-required group until it next changes.
|
|
35
42
|
*/
|
|
36
|
-
|
|
43
|
+
initialDirect?: MatrixDirectMapping;
|
|
37
44
|
logger: Logger;
|
|
38
45
|
/** Log-line prefix, e.g. `Matrix[@bot:example.org]`. */
|
|
39
46
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/channels/matrix/handler.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/channels/matrix/handler.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAKpB,MAAM,WAAW,CAAC;AAmBnB,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,SAAS,CAAC;IACf,EAAE,EAAE,cAAc,CAAC;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,4DAA4D;IAC5D,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB;;;;;OAKG;IACH,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,qBAAqB,GAC1B,CAAC,QAAQ,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAsGjD;AAED,kHAAkH;AAClH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,aAAa,CAkB3F"}
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
*
|
|
30
30
|
* @packageDocumentation
|
|
31
31
|
*/
|
|
32
|
-
export { createMatrixApi, type MatrixAccountDataEvent, type MatrixApi, type MatrixApiConfig, MatrixApiError, type MatrixEvent, type MatrixInvitedRoom, type MatrixJoinedRoom, type MatrixMediaKind, type MatrixMediaPayload, type MatrixRoomTimeline, type MatrixSyncResponse, redactToken, } from "./api";
|
|
32
|
+
export { createMatrixApi, DEFAULT_MAX_MEDIA_BYTES, type MatrixAccountDataEvent, type MatrixApi, type MatrixApiConfig, MatrixApiError, type MatrixEvent, type MatrixInvitedRoom, type MatrixJoinedRoom, type MatrixMediaKind, type MatrixMediaPayload, type MatrixRoomTimeline, type MatrixStrippedStateEvent, type MatrixSyncResponse, redactToken, } from "./api";
|
|
33
33
|
export { createMatrixChannel, type MatrixChannelConfig } from "./channel";
|
|
34
34
|
export { createMatrixSender, createMatrixSyncHandler, type MatrixSyncHandlerDeps, } from "./handler";
|
|
35
35
|
export { retryDelayMs, runMatrixSyncLoop, syncBackoffMs } from "./sync";
|
|
36
|
-
export { directRoomIds, isReplyToBot, MAX_TRACKED_SENT_EVENTS, type MatrixIdentity, matrixSenderKey, mentionsBot, messageText, recordSentEventId, toChannelMessage, } from "./updates";
|
|
36
|
+
export { directInviteFrom, directMappingFromEvents, directMappingRooms, directRoomIds, isReplyToBot, MAX_TRACKED_SENT_EVENTS, type MatrixDirectMapping, type MatrixIdentity, matrixSenderKey, mentionsBot, messageText, recordSentEventId, toChannelMessage, toDirectMapping, withDirectRoom, } from "./updates";
|
|
37
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channels/matrix/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,WAAW,GACZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,qBAAqB,GAC3B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACxE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,uBAAuB,EACvB,KAAK,cAAc,EACnB,eAAe,EACf,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channels/matrix/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,WAAW,GACZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,qBAAqB,GAC3B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACxE,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,eAAe,EACf,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,WAAW,CAAC"}
|