mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 03:12:42 +00:00
refactor: dedupe channel and gateway surfaces
This commit is contained in:
24
src/channels/session-meta.ts
Normal file
24
src/channels/session-meta.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { MsgContext } from "../auto-reply/templating.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { recordSessionMetaFromInbound, resolveStorePath } from "../config/sessions.js";
|
||||
|
||||
export async function recordInboundSessionMetaSafe(params: {
|
||||
cfg: OpenClawConfig;
|
||||
agentId: string;
|
||||
sessionKey: string;
|
||||
ctx: MsgContext;
|
||||
onError?: (error: unknown) => void;
|
||||
}): Promise<void> {
|
||||
const storePath = resolveStorePath(params.cfg.session?.store, {
|
||||
agentId: params.agentId,
|
||||
});
|
||||
try {
|
||||
await recordSessionMetaFromInbound({
|
||||
storePath,
|
||||
sessionKey: params.sessionKey,
|
||||
ctx: params.ctx,
|
||||
});
|
||||
} catch (err) {
|
||||
params.onError?.(err);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user