mirror of
https://github.com/VibedByKaKi/t3-code-android-nightly.git
synced 2026-10-10 12:21:16 +02:00
Prepare Relay production infrastructure for the PlanetScale PS_20 HA topology, upgrade Effect and Alchemy to compatible betas, reconcile migration state, and preserve patched MCP session termination behavior.\n\nCo-authored-by: codex <codex@users.noreply.github.com>
57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
import * as Alchemy from "alchemy";
|
|
import * as Cloudflare from "alchemy/Cloudflare";
|
|
import * as Effect from "effect/Effect";
|
|
|
|
import { Gateway } from "./src/AiGateway.ts";
|
|
import Api from "./src/Api.ts";
|
|
import { Bucket } from "./src/Bucket.ts";
|
|
import SandboxLive from "./src/Sandbox.ts";
|
|
import SecondaryApiLive, { SecondaryApi } from "./src/SecondaryApi.ts";
|
|
import WorkerTagLive, { WorkerTag } from "./src/WorkerTag.ts";
|
|
|
|
// Demo Action — runs at deploy time when its input (the resolved deployed
|
|
// URL) changes. Logs the new URL and returns a tiny manifest used as the
|
|
// stack output. Re-deploys with no changes skip the body.
|
|
const AnnounceDeploy = Alchemy.Action(
|
|
"AnnounceDeploy",
|
|
(input: { url: string; bucket: string }) =>
|
|
Effect.gen(function* () {
|
|
yield* Effect.log(`Deployed ${input.url} (bucket: ${input.bucket})`);
|
|
return { deployedAt: new Date().toISOString(), url: input.url };
|
|
}),
|
|
);
|
|
|
|
export default Alchemy.Stack(
|
|
"CloudflareWorkerExample",
|
|
{
|
|
providers: Cloudflare.providers(),
|
|
state: Cloudflare.state(),
|
|
},
|
|
Effect.gen(function* () {
|
|
const api = yield* Api;
|
|
const bucket = yield* Bucket;
|
|
const gateway = yield* Gateway;
|
|
const workerTag = yield* WorkerTag;
|
|
// Two Workers binding the same Agent DO triggers the regression where
|
|
// a single Container DO namespace appears in multiple bindings on the
|
|
// Sandbox ContainerApplication. See SecondaryApi.ts for details.
|
|
const secondaryApi = yield* SecondaryApi;
|
|
// The Queue consumer is wired automatically by
|
|
// `Cloudflare.Queues.consumeQueueMessages(Queue, handler)` inside src/Api.ts —
|
|
// no explicit `Cloudflare.Queues.Consumer(...)` is needed here.
|
|
|
|
const announcement = yield* AnnounceDeploy({
|
|
url: api.url.as<string>(),
|
|
bucket: bucket.bucketName,
|
|
});
|
|
|
|
return {
|
|
url: api.url.as<string>(),
|
|
bucket: bucket.bucketName,
|
|
gatewayId: gateway.gatewayId,
|
|
workerTagUrl: workerTag.url.as<string>(),
|
|
secondaryApiUrl: secondaryApi.url.as<string>(),
|
|
deployedAt: announcement.deployedAt,
|
|
};
|
|
}).pipe(Effect.provide([WorkerTagLive, SecondaryApiLive, SandboxLive])),
|
|
);
|