feat: add matrix channel plugin
This commit is contained in:
@@ -41,6 +41,7 @@ export function buildThreadingToolContext(params: {
|
||||
To: threadingTo,
|
||||
ReplyToId: sessionCtx.ReplyToId,
|
||||
ThreadLabel: sessionCtx.ThreadLabel,
|
||||
MessageThreadId: sessionCtx.MessageThreadId,
|
||||
},
|
||||
hasRepliedRef,
|
||||
}) ?? {}
|
||||
|
||||
@@ -216,9 +216,11 @@ export async function runReplyAgent(params: {
|
||||
abortedLastRun: false,
|
||||
};
|
||||
const agentId = resolveAgentIdFromSessionKey(sessionKey);
|
||||
const topicId =
|
||||
typeof sessionCtx.MessageThreadId === "number" ? sessionCtx.MessageThreadId : undefined;
|
||||
const nextSessionFile = resolveSessionTranscriptPath(nextSessionId, agentId, topicId);
|
||||
const nextSessionFile = resolveSessionTranscriptPath(
|
||||
nextSessionId,
|
||||
agentId,
|
||||
sessionCtx.MessageThreadId,
|
||||
);
|
||||
nextEntry.sessionFile = nextSessionFile;
|
||||
activeSessionStore[sessionKey] = nextEntry;
|
||||
try {
|
||||
|
||||
@@ -23,7 +23,10 @@ export function buildInboundDedupeKey(ctx: MsgContext): string | null {
|
||||
if (!peerId) return null;
|
||||
const sessionKey = ctx.SessionKey?.trim() ?? "";
|
||||
const accountId = ctx.AccountId?.trim() ?? "";
|
||||
const threadId = typeof ctx.MessageThreadId === "number" ? String(ctx.MessageThreadId) : "";
|
||||
const threadId =
|
||||
ctx.MessageThreadId !== undefined && ctx.MessageThreadId !== null
|
||||
? String(ctx.MessageThreadId)
|
||||
: "";
|
||||
return [provider, accountId, sessionKey, peerId, threadId, messageId].filter(Boolean).join("|");
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ export type FollowupRun = {
|
||||
originatingTo?: string;
|
||||
/** Provider account id (multi-account). */
|
||||
originatingAccountId?: string;
|
||||
/** Telegram forum topic thread id. */
|
||||
originatingThreadId?: number;
|
||||
/** Thread id for reply routing (Telegram topic id or Matrix thread event id). */
|
||||
originatingThreadId?: string | number;
|
||||
run: {
|
||||
agentId: string;
|
||||
agentDir: string;
|
||||
|
||||
@@ -27,8 +27,8 @@ export type RouteReplyParams = {
|
||||
sessionKey?: string;
|
||||
/** Provider account id (multi-account). */
|
||||
accountId?: string;
|
||||
/** Telegram message thread id (forum topics). */
|
||||
threadId?: number;
|
||||
/** Thread id for replies (Telegram topic id or Matrix thread event id). */
|
||||
threadId?: string | number;
|
||||
/** Config for provider-specific settings. */
|
||||
cfg: ClawdbotConfig;
|
||||
/** Optional abort signal for cooperative cancellation. */
|
||||
|
||||
@@ -53,8 +53,8 @@ export type MsgContext = {
|
||||
CommandAuthorized?: boolean;
|
||||
CommandSource?: "text" | "native";
|
||||
CommandTargetSessionKey?: string;
|
||||
/** Telegram forum topic thread ID. */
|
||||
MessageThreadId?: number;
|
||||
/** Thread identifier (Telegram topic id or Matrix thread event id). */
|
||||
MessageThreadId?: string | number;
|
||||
/** Telegram forum supergroup marker. */
|
||||
IsForum?: boolean;
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user