openclaw: force webhook transport to use hooks/wake

This commit is contained in:
Dotta
2026-03-06 16:11:11 -06:00
parent 5ab1c18530
commit aa7e069044
4 changed files with 91 additions and 24 deletions

View File

@@ -93,6 +93,28 @@ export function isOpenResponsesEndpoint(url: string): boolean {
}
}
export function normalizeWebhookInvocationUrl(url: string): {
url: string;
normalizedFromOpenResponses: boolean;
} {
try {
const parsed = new URL(url);
const path = parsed.pathname;
const normalizedPath = path.toLowerCase();
const suffix = "/v1/responses";
if (normalizedPath !== suffix && !normalizedPath.endsWith(suffix)) {
return { url: parsed.toString(), normalizedFromOpenResponses: false };
}
const prefix = path.slice(0, path.length - suffix.length);
parsed.pathname = `${prefix}/hooks/wake`;
return { url: parsed.toString(), normalizedFromOpenResponses: true };
} catch {
return { url, normalizedFromOpenResponses: false };
}
}
export function toStringRecord(value: unknown): Record<string, string> {
const parsed = parseObject(value);
const out: Record<string, string> = {};