mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 11:20:37 +09:00
Reintroduce OpenClaw webhook transport alongside SSE
This commit is contained in:
parent
af09510f6a
commit
b155415d7d
8 changed files with 1292 additions and 810 deletions
|
|
@ -34,6 +34,13 @@ function isWakePath(pathname: string): boolean {
|
|||
return value === "/hooks/wake" || value.endsWith("/hooks/wake");
|
||||
}
|
||||
|
||||
function normalizeTransport(value: unknown): "sse" | "webhook" | null {
|
||||
const normalized = asString(value, "sse").trim().toLowerCase();
|
||||
if (!normalized || normalized === "sse") return "sse";
|
||||
if (normalized === "webhook") return "webhook";
|
||||
return null;
|
||||
}
|
||||
|
||||
function pushDeploymentDiagnostics(
|
||||
checks: AdapterEnvironmentCheck[],
|
||||
ctx: AdapterEnvironmentTestContext,
|
||||
|
|
@ -102,13 +109,15 @@ export async function testEnvironment(
|
|||
const checks: AdapterEnvironmentCheck[] = [];
|
||||
const config = parseObject(ctx.config);
|
||||
const urlValue = asString(config.url, "");
|
||||
const streamTransportValue = config.streamTransport ?? config.transport;
|
||||
const streamTransport = normalizeTransport(streamTransportValue);
|
||||
|
||||
if (!urlValue) {
|
||||
checks.push({
|
||||
code: "openclaw_url_missing",
|
||||
level: "error",
|
||||
message: "OpenClaw adapter requires a streaming endpoint URL.",
|
||||
hint: "Set adapterConfig.url to your OpenClaw SSE endpoint.",
|
||||
message: "OpenClaw adapter requires an endpoint URL.",
|
||||
hint: "Set adapterConfig.url to your OpenClaw transport endpoint.",
|
||||
});
|
||||
return {
|
||||
adapterType: ctx.adapterType,
|
||||
|
|
@ -154,23 +163,28 @@ export async function testEnvironment(
|
|||
});
|
||||
}
|
||||
|
||||
if (isWakePath(url.pathname)) {
|
||||
if (streamTransport === "sse" && isWakePath(url.pathname)) {
|
||||
checks.push({
|
||||
code: "openclaw_wake_endpoint_incompatible",
|
||||
level: "error",
|
||||
message: "Endpoint targets /hooks/wake, which is not stream-capable for strict SSE mode.",
|
||||
message: "Endpoint targets /hooks/wake, which is not stream-capable for SSE transport.",
|
||||
hint: "Use an endpoint that returns text/event-stream for the full run duration.",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const streamTransport = asString(config.streamTransport, "sse").trim().toLowerCase();
|
||||
if (streamTransport && streamTransport !== "sse") {
|
||||
if (!streamTransport) {
|
||||
checks.push({
|
||||
code: "openclaw_stream_transport_unsupported",
|
||||
level: "error",
|
||||
message: `Unsupported streamTransport: ${streamTransport}`,
|
||||
hint: "OpenClaw adapter now requires streamTransport=sse.",
|
||||
message: `Unsupported streamTransport: ${String(streamTransportValue)}`,
|
||||
hint: "Use streamTransport=sse or streamTransport=webhook.",
|
||||
});
|
||||
} else {
|
||||
checks.push({
|
||||
code: "openclaw_stream_transport_configured",
|
||||
level: "info",
|
||||
message: `Configured stream transport: ${streamTransport}`,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue