fix: support L1 Workbench AgentRun activity dispatch

This commit is contained in:
root
2026-07-18 03:49:47 +02:00
parent 5735d6ef78
commit 3bb7b67a4e
2 changed files with 14 additions and 1 deletions
@@ -0,0 +1,9 @@
import { expect, test } from "bun:test";
import { workbenchActivityDispatchRequested } from "./workbench-command-proxy.ts";
test("accepts activity dispatch header from Node and Fetch request shapes", () => {
expect(workbenchActivityDispatchRequested({ headers: { "x-workbench-activity-dispatch": "1" } })).toBe(true);
expect(workbenchActivityDispatchRequested({ headers: new Headers({ "x-workbench-activity-dispatch": "1" }) })).toBe(true);
expect(workbenchActivityDispatchRequested({ headers: new Headers({ "x-workbench-activity-dispatch": "0" }) })).toBe(false);
});
+5 -1
View File
@@ -5,7 +5,11 @@ export function workbenchTemporalProxyEnabled(env: Record<string, string | undef
}
export function workbenchActivityDispatchRequested(request: any) {
return String(request.headers?.["x-workbench-activity-dispatch"] ?? "").trim() === "1";
const headers = request?.headers;
const value = typeof headers?.get === "function"
? headers.get("x-workbench-activity-dispatch")
: headers?.["x-workbench-activity-dispatch"];
return String(value ?? "").trim() === "1";
}
export async function proxyWorkbenchCommandHttp(request: any, response: any, options: any, route: string) {