feat: Hosted Frontend, Tailscale Integration & SSH Lancher (#2361)

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex authored and GitHub committed 2026-05-03 22:19:15 -07:00
1 parent 92e340d80c
commit 3772fa127c
119 files changed
+12693 -1046

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env node
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
import * as NodeServices from "@effect/platform-node/NodeServices";
import { Effect, FileSystem, Option, Path } from "effect";
import { Argument, Command } from "effect/unstable/cli";
import { resolveWebIconOverrides, type WebAssetBrand } from "./lib/brand-assets.ts";
const WEB_ASSET_BRANDS = [
"development",
"production",
] as const satisfies ReadonlyArray<WebAssetBrand>;
export const applyWebBrandAssets = Effect.fn("applyWebBrandAssets")(function* (
brand: WebAssetBrand,
targetDirectory: string,
) {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const repoRoot = yield* path.fromFileUrl(new URL("..", import.meta.url));
yield* Effect.forEach(
resolveWebIconOverrides(brand, targetDirectory),
(override) =>
fs.copyFile(
path.join(repoRoot, override.sourceRelativePath),
path.join(repoRoot, override.targetRelativePath),
),
{ concurrency: "unbounded" },
);
});
export const applyWebBrandAssetsCommand = Command.make(
"apply-web-brand-assets",
{
brand: Argument.choice("brand", WEB_ASSET_BRANDS).pipe(
Argument.withDescription("Asset brand to copy into the hosted web output directory."),
),
targetDirectory: Argument.string("target-directory").pipe(
Argument.withDescription("Output directory that contains the hosted web build assets."),
Argument.optional,
),
},
({ brand, targetDirectory }) =>
applyWebBrandAssets(
brand,
Option.getOrElse(targetDirectory, () => "apps/web/dist"),
),
).pipe(Command.withDescription("Copy web brand assets into a built hosted web app."));
if (import.meta.main) {
Command.run(applyWebBrandAssetsCommand, { version: "0.0.0" }).pipe(
Effect.provide(NodeServices.layer),
NodeRuntime.runMain,
);
}
+45
View File
@@ -0,0 +1,45 @@
import { describe, expect, it } from "vitest";
import {
BRAND_ASSET_PATHS,
DEVELOPMENT_ICON_OVERRIDES,
PUBLISH_ICON_OVERRIDES,
resolveWebIconOverrides,
} from "./brand-assets.ts";
describe("brand-assets", () => {
it("maps server publish web assets to production icons", () => {
expect(PUBLISH_ICON_OVERRIDES).toEqual([
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFaviconIco,
targetRelativePath: "dist/client/favicon.ico",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon16Png,
targetRelativePath: "dist/client/favicon-16x16.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon32Png,
targetRelativePath: "dist/client/favicon-32x32.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
targetRelativePath: "dist/client/apple-touch-icon.png",
},
]);
});
it("maps server build web assets to development icons", () => {
expect(DEVELOPMENT_ICON_OVERRIDES[0]).toEqual({
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFaviconIco,
targetRelativePath: "dist/client/favicon.ico",
});
});
it("can target hosted web dist directly", () => {
expect(resolveWebIconOverrides("production", "apps/web/dist")).toContainEqual({
sourceRelativePath: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
targetRelativePath: "apps/web/dist/apple-touch-icon.png",
});
});
});
+49 -34
View File
@@ -19,45 +19,60 @@ export const BRAND_ASSET_PATHS = {
developmentWebAppleTouchIconPng: "assets/dev/blueprint-web-apple-touch-180.png",
} as const;
export type WebAssetBrand = "development" | "production";
export interface IconOverride {
readonly sourceRelativePath: string;
readonly targetRelativePath: string;
}
export const DEVELOPMENT_ICON_OVERRIDES: ReadonlyArray<IconOverride> = [
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFaviconIco,
targetRelativePath: "dist/client/favicon.ico",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFavicon16Png,
targetRelativePath: "dist/client/favicon-16x16.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFavicon32Png,
targetRelativePath: "dist/client/favicon-32x32.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebAppleTouchIconPng,
targetRelativePath: "dist/client/apple-touch-icon.png",
},
];
const WEB_ICON_TARGET_FILENAMES = {
faviconIco: "favicon.ico",
favicon16Png: "favicon-16x16.png",
favicon32Png: "favicon-32x32.png",
appleTouchIconPng: "apple-touch-icon.png",
} as const;
export const PUBLISH_ICON_OVERRIDES: ReadonlyArray<IconOverride> = [
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFaviconIco,
targetRelativePath: "dist/client/favicon.ico",
const WEB_ICON_SOURCE_PATHS_BY_BRAND = {
development: {
faviconIco: BRAND_ASSET_PATHS.developmentWebFaviconIco,
favicon16Png: BRAND_ASSET_PATHS.developmentWebFavicon16Png,
favicon32Png: BRAND_ASSET_PATHS.developmentWebFavicon32Png,
appleTouchIconPng: BRAND_ASSET_PATHS.developmentWebAppleTouchIconPng,
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon16Png,
targetRelativePath: "dist/client/favicon-16x16.png",
production: {
faviconIco: BRAND_ASSET_PATHS.productionWebFaviconIco,
favicon16Png: BRAND_ASSET_PATHS.productionWebFavicon16Png,
favicon32Png: BRAND_ASSET_PATHS.productionWebFavicon32Png,
appleTouchIconPng: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon32Png,
targetRelativePath: "dist/client/favicon-32x32.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
targetRelativePath: "dist/client/apple-touch-icon.png",
},
];
} as const satisfies Record<WebAssetBrand, Record<keyof typeof WEB_ICON_TARGET_FILENAMES, string>>;
export function resolveWebIconOverrides(
brand: WebAssetBrand,
targetDirectory: string,
): ReadonlyArray<IconOverride> {
const sourcePaths = WEB_ICON_SOURCE_PATHS_BY_BRAND[brand];
return [
{
sourceRelativePath: sourcePaths.faviconIco,
targetRelativePath: `${targetDirectory}/${WEB_ICON_TARGET_FILENAMES.faviconIco}`,
},
{
sourceRelativePath: sourcePaths.favicon16Png,
targetRelativePath: `${targetDirectory}/${WEB_ICON_TARGET_FILENAMES.favicon16Png}`,
},
{
sourceRelativePath: sourcePaths.favicon32Png,
targetRelativePath: `${targetDirectory}/${WEB_ICON_TARGET_FILENAMES.favicon32Png}`,
},
{
sourceRelativePath: sourcePaths.appleTouchIconPng,
targetRelativePath: `${targetDirectory}/${WEB_ICON_TARGET_FILENAMES.appleTouchIconPng}`,
},
];
}
export const DEVELOPMENT_ICON_OVERRIDES = resolveWebIconOverrides("development", "dist/client");
export const PUBLISH_ICON_OVERRIDES = resolveWebIconOverrides("production", "dist/client");
+13
View File
@@ -24,6 +24,8 @@ const workspaceFiles = [
"packages/client-runtime/package.json",
"packages/contracts/package.json",
"packages/shared/package.json",
"packages/ssh/package.json",
"packages/tailscale/package.json",
"packages/effect-acp/package.json",
"packages/effect-codex-app-server/package.json",
"scripts/package.json",
@@ -36,6 +38,17 @@ function copyWorkspaceManifestFixture(targetRoot: string): void {
mkdirSync(dirname(destinationPath), { recursive: true });
cpSync(sourcePath, destinationPath);
}
const packageJson = JSON.parse(readFileSync(resolve(repoRoot, "package.json"), "utf8")) as {
readonly patchedDependencies?: Record<string, string>;
};
for (const relativePath of Object.values(packageJson.patchedDependencies ?? {})) {
const sourcePath = resolve(repoRoot, relativePath);
const destinationPath = resolve(targetRoot, relativePath);
mkdirSync(dirname(destinationPath), { recursive: true });
cpSync(sourcePath, destinationPath);
}
}
function writeMacManifestFixtures(targetRoot: string): { arm64Path: string; x64Path: string } {