mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
24 lines
740 B
TypeScript
24 lines
740 B
TypeScript
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
|
|
|
|
export type ResolveNativeCommandSessionTargetsParams = {
|
|
agentId: string;
|
|
sessionPrefix: string;
|
|
userId: string;
|
|
targetSessionKey: string;
|
|
boundSessionKey?: string;
|
|
lowercaseSessionKey?: boolean;
|
|
};
|
|
|
|
export function resolveNativeCommandSessionTargets(
|
|
params: ResolveNativeCommandSessionTargetsParams,
|
|
) {
|
|
const rawSessionKey =
|
|
params.boundSessionKey ?? `agent:${params.agentId}:${params.sessionPrefix}:${params.userId}`;
|
|
return {
|
|
sessionKey: params.lowercaseSessionKey
|
|
? normalizeLowercaseStringOrEmpty(rawSessionKey)
|
|
: rawSessionKey,
|
|
commandTargetSessionKey: params.boundSessionKey ?? params.targetSessionKey,
|
|
};
|
|
}
|