mirror of https://github.com/openclaw/openclaw.git
20 lines
630 B
TypeScript
20 lines
630 B
TypeScript
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 ? rawSessionKey.toLowerCase() : rawSessionKey,
|
|
commandTargetSessionKey: params.boundSessionKey ?? params.targetSessionKey,
|
|
};
|
|
}
|