| 1 | import type { DiffineryEvent } from "@diffinery/shared"; |
| 2 | import type { Env } from "./env.js"; |
| 3 | import type { MailJob } from "./mail/types.js"; |
| 4 | import { app, queue, scheduled } from "./app.js"; |
| 5 | import { apiNotFound } from "./http/common.js"; |
| 6 | import { web } from "./web/routes.js"; |
| 7 | |
| 8 | export { RepoDO } from "./repo/RepoDO.js"; |
| 9 | export { SchedulerDO } from "./scheduler.js"; |
| 10 | export { ComposeDO } from "./compose.js"; |
| 11 | export { RunnerContainer, RunnerContainerMedium, RunnerContainerSmall, RunnerContainerTiny, SandboxContainer, SandboxPoolDO } from "./runner/containers.js"; |
| 12 | export { RunWorkflow } from "./runner/workflow.js"; |
| 13 | export { ImportWorkflow } from "./imports/workflow.js"; |
| 14 | export { AccountWorkflow } from "./accounts/workflow.js"; |
| 15 | export { ImportContainer } from "./imports/container.js"; |
| 16 | export { ProjectDO } from "./agentic/ProjectDO.js"; |
| 17 | // Carries hosted containers' HTTP and HTTPS out under EGRESS=web (lib/egress.ts). |
| 18 | export { ContainerProxy } from "@cloudflare/containers"; |
| 19 | |
| 20 | // The web UI is mounted last so API, git and runner routes take precedence; |
| 21 | // unknown API paths answer in JSON rather than falling through to its HTML 404. |
| 22 | app.all("/api/*", () => apiNotFound()); |
| 23 | app.route("/", web); |
| 24 | |
| 25 | export default { |
| 26 | fetch: app.fetch, |
| 27 | queue, |
| 28 | scheduled, |
| 29 | } satisfies ExportedHandler<Env, DiffineryEvent | MailJob>; |