feat: persist session origin metadata across connectors

This commit is contained in:
Peter Steinberger
2026-01-18 02:41:06 +00:00
parent 0c93b9b7bb
commit 34590d2144
30 changed files with 246 additions and 66 deletions

View File

@@ -9,6 +9,7 @@ import {
import { loadConfig } from "../config/config.js";
import {
resolveMainSessionKeyFromConfig,
snapshotSessionOrigin,
type SessionEntry,
updateSessionStore,
} from "../config/sessions.js";
@@ -205,6 +206,7 @@ export const handleSessionsBridgeMethods: BridgeMethodHandler = async (
contextTokens: entry?.contextTokens,
sendPolicy: entry?.sendPolicy,
label: entry?.label,
origin: snapshotSessionOrigin(entry),
displayName: entry?.displayName,
chatType: entry?.chatType,
channel: entry?.channel,

View File

@@ -6,6 +6,7 @@ import { stopSubagentsForRequester } from "../../auto-reply/reply/abort.js";
import { clearSessionQueues } from "../../auto-reply/reply/queue.js";
import { loadConfig } from "../../config/config.js";
import {
snapshotSessionOrigin,
resolveMainSessionKey,
type SessionEntry,
updateSessionStore,
@@ -173,6 +174,7 @@ export const sessionsHandlers: GatewayRequestHandlers = {
contextTokens: entry?.contextTokens,
sendPolicy: entry?.sendPolicy,
label: entry?.label,
origin: snapshotSessionOrigin(entry),
lastChannel: entry?.lastChannel,
lastTo: entry?.lastTo,
skillsSnapshot: entry?.skillsSnapshot,

View File

@@ -381,6 +381,8 @@ export function listSessionsFromStore(params: {
const groupChannel = entry?.groupChannel;
const space = entry?.space;
const id = parsed?.id;
const origin = entry?.origin;
const originLabel = origin?.label;
const displayName =
entry?.displayName ??
(channel
@@ -393,7 +395,8 @@ export function listSessionsFromStore(params: {
key,
})
: undefined) ??
entry?.label;
entry?.label ??
originLabel;
const deliveryFields = normalizeSessionDeliveryFields(entry);
return {
key,
@@ -405,6 +408,7 @@ export function listSessionsFromStore(params: {
groupChannel,
space,
chatType: entry?.chatType,
origin,
updatedAt,
sessionId: entry?.sessionId,
systemSent: entry?.systemSent,

View File

@@ -18,6 +18,7 @@ export type GatewaySessionRow = {
groupChannel?: string;
space?: string;
chatType?: NormalizedChatType;
origin?: SessionEntry["origin"];
updatedAt: number | null;
sessionId?: string;
systemSent?: boolean;