Datalayer VS Code Extension - v0.0.17
    Preparing search index...

    Module webview/agentChat/networkBridge

    Installs global window.fetch and window.WebSocket overrides that tunnel every outgoing HTTP/WebSocket call through the VS Code extension host.

    Why this exists: the Agent Chat webview runs at vscode-webview:// origin, but @datalayer/agent-runtimes contains many components and protocol adapters that perform raw fetch() / new WebSocket() against the Datalayer runtime. The runtime server does not include vscode-webview://* in its CORS allow-list, so every direct browser-side call is blocked.

    By swapping the globals before the main bundle loads we transparently proxy every call — including streaming (SSE) responses and WebSocket bidirectional traffic — through postMessage. The extension host (Node.js) then opens the real HTTP/WS connection, free from CORS.

    Requests to vscode-webview:// / blob: / data: URLs are passed through to the native implementation so local asset loads keep working.

    Wire protocol: webview -> host : { type: "net.fetch.request", requestId, ... } webview -> host : { type: "net.fetch.abort", requestId } host -> webview : { type: "net.fetch.head", requestId, status, statusText, headers } host -> webview : { type: "net.fetch.chunk", requestId, chunk: ArrayBuffer } host -> webview : { type: "net.fetch.end", requestId } host -> webview : { type: "net.fetch.error", requestId, message }

    webview -> host : { type: "net.ws.open", socketId, url, protocols } webview -> host : { type: "net.ws.send", socketId, data } webview -> host : { type: "net.ws.close", socketId, code?, reason? } host -> webview : { type: "net.ws.open.ack", socketId } host -> webview : { type: "net.ws.message", socketId, data, isBinary } host -> webview : { type: "net.ws.close", socketId, code, reason } host -> webview : { type: "net.ws.error", socketId, message }

    Interfaces

    VsCodeLike

    Functions

    installNetworkBridge