mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:00:42 +00:00
revert(acp): remove Coven bridge
Revert the bundled Coven ACP bridge extension, its ClawHub publishing wiring, and related ACP/proxy runtime changes.
This commit is contained in:
@@ -89,28 +89,6 @@ describe("debug proxy runtime", () => {
|
||||
expect(events.some((event) => event.kind === "response")).toBe(true);
|
||||
});
|
||||
|
||||
it("reinstalls ambient global fetch capture when fetch changes after initialization", async () => {
|
||||
globalThis.fetch = vi.fn(async () => ({ status: 200 }) as Response) as typeof fetch;
|
||||
|
||||
initializeDebugProxyCapture("test");
|
||||
const replacementFetch = vi.fn(async () => ({ status: 204 }) as Response) as typeof fetch;
|
||||
globalThis.fetch = replacementFetch;
|
||||
initializeDebugProxyCapture("test");
|
||||
|
||||
await globalThis.fetch("https://api.minimax.io/anthropic/messages", {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: '{"input":"hello"}',
|
||||
});
|
||||
finalizeDebugProxyCapture();
|
||||
|
||||
expect(replacementFetch).toHaveBeenCalledTimes(1);
|
||||
const events = storeState.events.filter((event) => event.sessionId === "runtime-test-session");
|
||||
expect(events.some((event) => event.host === "api.minimax.io")).toBe(true);
|
||||
expect(events.some((event) => event.kind === "request")).toBe(true);
|
||||
expect(events.some((event) => event.kind === "response" && event.status === 204)).toBe(true);
|
||||
});
|
||||
|
||||
it("redacts sensitive request and response headers before persistence", async () => {
|
||||
initializeDebugProxyCapture("test");
|
||||
captureHttpExchange({
|
||||
|
||||
@@ -41,7 +41,6 @@ const SENSITIVE_CAPTURE_HEADER_NAME_FRAGMENTS = [
|
||||
|
||||
type GlobalFetchPatchedState = {
|
||||
originalFetch: typeof globalThis.fetch;
|
||||
patchedFetch: typeof globalThis.fetch;
|
||||
};
|
||||
|
||||
type GlobalFetchPatchTarget = typeof globalThis & {
|
||||
@@ -135,16 +134,15 @@ function installDebugProxyGlobalFetchPatch(settings: DebugProxySettings): void {
|
||||
return;
|
||||
}
|
||||
const patched = globalThis as GlobalFetchPatchTarget;
|
||||
const existing = patched[DEBUG_PROXY_FETCH_PATCH_KEY];
|
||||
if (existing && globalThis.fetch === existing.patchedFetch) {
|
||||
if (patched[DEBUG_PROXY_FETCH_PATCH_KEY]) {
|
||||
return;
|
||||
}
|
||||
const originalFetch = globalThis.fetch;
|
||||
const callOriginalFetch = originalFetch.bind(globalThis);
|
||||
const patchedFetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const originalFetch = globalThis.fetch.bind(globalThis);
|
||||
patched[DEBUG_PROXY_FETCH_PATCH_KEY] = { originalFetch };
|
||||
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const url = resolveUrlString(input);
|
||||
try {
|
||||
const response = await callOriginalFetch(input, init);
|
||||
const response = await originalFetch(input, init);
|
||||
if (url && /^https?:/i.test(url)) {
|
||||
captureHttpExchange({
|
||||
url,
|
||||
@@ -201,8 +199,6 @@ function installDebugProxyGlobalFetchPatch(settings: DebugProxySettings): void {
|
||||
throw error;
|
||||
}
|
||||
}) as typeof globalThis.fetch;
|
||||
patched[DEBUG_PROXY_FETCH_PATCH_KEY] = { originalFetch, patchedFetch };
|
||||
globalThis.fetch = patchedFetch;
|
||||
}
|
||||
|
||||
function uninstallDebugProxyGlobalFetchPatch(): void {
|
||||
@@ -211,15 +207,12 @@ function uninstallDebugProxyGlobalFetchPatch(): void {
|
||||
if (!state) {
|
||||
return;
|
||||
}
|
||||
if (globalThis.fetch === state.patchedFetch) {
|
||||
globalThis.fetch = state.originalFetch;
|
||||
}
|
||||
globalThis.fetch = state.originalFetch;
|
||||
delete patched[DEBUG_PROXY_FETCH_PATCH_KEY];
|
||||
}
|
||||
|
||||
export function isDebugProxyGlobalFetchPatchInstalled(): boolean {
|
||||
const state = (globalThis as GlobalFetchPatchTarget)[DEBUG_PROXY_FETCH_PATCH_KEY];
|
||||
return Boolean(state && globalThis.fetch === state.patchedFetch);
|
||||
return Boolean((globalThis as GlobalFetchPatchTarget)[DEBUG_PROXY_FETCH_PATCH_KEY]);
|
||||
}
|
||||
|
||||
export function initializeDebugProxyCapture(mode: string, resolved?: DebugProxySettings): void {
|
||||
|
||||
Reference in New Issue
Block a user