- packages/core/api: HttpApi contract with ToolsApi + SecretsApi groups SDK tagged errors pass through directly with status annotations (ToolNotFoundError→404, PolicyDeniedError→403, etc.) - apps/server: API handler implementation via HttpApiBuilder Exports createApiHandler() for reuse (no baked-in server runtime) Handlers are pure pass-through — no manual error catching - apps/web: Vite + React frontend served on same port as API Vite plugin forwards /v1/*, /docs, /openapi.json to Effect handler effect-atom integration: AtomHttpApi.Tag typed client, query/mutation atoms RegistryProvider + useAtomValue with Result pattern matching - Catalog pins @effect/platform, platform-bun, platform-node, cluster - All 9 packages typecheck clean
Showing the changes to apps/server/src/services (1 of 26 files). Show all
Unified · Split
| @@ -0,0 +1,22 @@ | ||
| 1 | +import { Context, Effect, Layer } from "effect"; | |
| 2 | +import { createExecutor, makeTestConfig } from "@executor/sdk"; | |
| 3 | + | |
| 4 | +import type { Executor } from "@executor/sdk"; | |
| 5 | + | |
| 6 | +// --------------------------------------------------------------------------- | |
| 7 | +// Service tag — provides the executor instance to HTTP handlers | |
| 8 | +// --------------------------------------------------------------------------- | |
| 9 | + | |
| 10 | +export class ExecutorService extends Context.Tag("ExecutorService")< | |
| 11 | + ExecutorService, | |
| 12 | + Executor | |
| 13 | +>() {} | |
| 14 | + | |
| 15 | +// --------------------------------------------------------------------------- | |
| 16 | +// Default layer — creates an in-memory executor | |
| 17 | +// --------------------------------------------------------------------------- | |
| 18 | + | |
| 19 | +export const ExecutorServiceLive = Layer.effect( | |
| 20 | + ExecutorService, | |
| 21 | + createExecutor(makeTestConfig()), | |
| 22 | +); | |