Threads: add Slack/Discord thread sessions

This commit is contained in:
Shadow authored and Peter Steinberger committed 2026-01-07 19:30:30 +01:00
1 parent 422477499c
commit 7e5cef29a0
17 files changed
+670 -27

No files matched your search

+13
View File
@@ -33,6 +33,7 @@ export type SessionChatType = "direct" | "group" | "room";
export type SessionEntry = {
sessionId: string;
updatedAt: number;
sessionFile?: string;
/** Parent session key that spawned this session (used for sandbox session-tool scoping). */
spawnedBy?: string;
systemSent?: boolean;
@@ -137,6 +138,17 @@ export function resolveSessionTranscriptPath(
return path.join(resolveAgentSessionsDir(agentId), `${sessionId}.jsonl`);
}
export function resolveSessionFilePath(
sessionId: string,
entry?: SessionEntry,
opts?: { agentId?: string },
): string {
const candidate = entry?.sessionFile?.trim();
return candidate
? candidate
: resolveSessionTranscriptPath(sessionId, opts?.agentId);
}
export function resolveStorePath(store?: string, opts?: { agentId?: string }) {
const agentId = normalizeAgentId(opts?.agentId ?? DEFAULT_AGENT_ID);
if (!store) return resolveDefaultSessionStorePath(agentId);
@@ -393,6 +405,7 @@ export async function updateLastRoute(params: {
const next: SessionEntry = {
sessionId: existing?.sessionId ?? crypto.randomUUID(),
updatedAt: Math.max(existing?.updatedAt ?? 0, now),
sessionFile: existing?.sessionFile,
systemSent: existing?.systemSent,
abortedLastRun: existing?.abortedLastRun,
thinkingLevel: existing?.thinkingLevel,