28 lines · 1.3 KB · TypeScript
RawDownload
// ---------------------------------------------------------------------------// Shared execution stack — the wiring that turns an organization into a// runnable executor + engine. Used by the protected HTTP API (per-request)// and the MCP session DO (per-session) so changes to the stack flow to both.// --------------------------------------------------------------------------- import { env } from "cloudflare:workers";import { Effect } from "effect"; import { createExecutionEngine } from "@executor/execution";import { makeDynamicWorkerExecutor } from "@executor/runtime-dynamic-worker"; import { withExecutionUsageTracking } from "../api/execution-usage";import { AutumnService } from "./autumn";import { createScopedExecutor } from "./executor"; export const makeExecutionStack = (organizationId: string, organizationName: string) =>  Effect.gen(function* () {    const executor = yield* createScopedExecutor(organizationId, organizationName);    const codeExecutor = makeDynamicWorkerExecutor({ loader: env.LOADER });    const autumn = yield* AutumnService;    const engine = withExecutionUsageTracking(      organizationId,      createExecutionEngine({ executor, codeExecutor }),      (orgId) => Effect.runFork(autumn.trackExecution(orgId)),    );    return { executor, engine };  });

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t