mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:41:25 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -19,7 +19,9 @@ export function getBearerToken(req: IncomingMessage): string | undefined {
|
||||
|
||||
export function resolveAgentIdFromHeader(req: IncomingMessage): string | undefined {
|
||||
const raw =
|
||||
getHeader(req, "x-moltbot-agent-id")?.trim() || getHeader(req, "x-moltbot-agent")?.trim() || "";
|
||||
getHeader(req, "x-openclaw-agent-id")?.trim() ||
|
||||
getHeader(req, "x-openclaw-agent")?.trim() ||
|
||||
"";
|
||||
if (!raw) return undefined;
|
||||
return normalizeAgentId(raw);
|
||||
}
|
||||
@@ -29,7 +31,7 @@ export function resolveAgentIdFromModel(model: string | undefined): string | und
|
||||
if (!raw) return undefined;
|
||||
|
||||
const m =
|
||||
raw.match(/^moltbot[:/](?<agentId>[a-z0-9][a-z0-9_-]{0,63})$/i) ??
|
||||
raw.match(/^openclaw[:/](?<agentId>[a-z0-9][a-z0-9_-]{0,63})$/i) ??
|
||||
raw.match(/^agent:(?<agentId>[a-z0-9][a-z0-9_-]{0,63})$/i);
|
||||
const agentId = m?.groups?.agentId;
|
||||
if (!agentId) return undefined;
|
||||
@@ -53,7 +55,7 @@ export function resolveSessionKey(params: {
|
||||
user?: string | undefined;
|
||||
prefix: string;
|
||||
}): string {
|
||||
const explicit = getHeader(params.req, "x-moltbot-session-key")?.trim();
|
||||
const explicit = getHeader(params.req, "x-openclaw-session-key")?.trim();
|
||||
if (explicit) return explicit;
|
||||
|
||||
const user = params.user?.trim();
|
||||
|
||||
Reference in New Issue
Block a user