MCPcopy Create free account
hub / github.com/cloudflare/computer / bridge

Function bridge

packages/computer/src/runtime/bridge.test.ts:9–24  ·  view source on GitHub ↗
(limits: {
  maxCalls?: number;
  maxTotalRequestBytes?: number;
  maxTotalResponseBytes?: number;
})

Source from the content-addressed store, hash-verified

7const args = JSON.stringify(["run", "value"]);
8
9function bridge(limits: {
10 maxCalls?: number;
11 maxTotalRequestBytes?: number;
12 maxTotalResponseBytes?: number;
13}) {
14 return new WorkspaceRuntimeBridge({} as WorkspaceRuntimeCapability, {
15 ...limits,
16 trustedModules: {
17 "ws:test": {
18 async call() {
19 return "ok";
20 },
21 },
22 },
23 });
24}
25
26async function message(response: Promise<string>) {
27 return (JSON.parse(await response) as { error?: { message?: string } }).error?.message;

Callers 1

bridge.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected