Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.
Rebuild the app when a shared module it bundles changes (#594)
kevin67db69cb2d91
diff --git a/app/scripts/build-cache.ts b/app/scripts/build-cache.tsindex 44056dbc..1a3f87c0 100644--- a/app/scripts/build-cache.ts+++ b/app/scripts/build-cache.ts@@ -171,15 +171,25 @@ async function collectBuildInputs(include: (path) => hasSourceExtension(path),skipDirectory: (path) => basename(path) === "node_modules",});+ // The app bundles modules from `shared/` too (attachment limits, handoff markers), so a change+ // there has to rebuild it just as a change under `app/src` does.+ const sharedFiles = await collectFiles(join(resolvedRoot, "shared"), {+ prefix: "shared",+ include: (path) => hasSourceExtension(path),+ skipDirectory: (path) => basename(path) === "node_modules",+ });const tenantFiles = await collectFiles(tenantDir, {prefix: `tenant/${slashPath(relative(resolvedRoot, tenantDir))}`,include: (path) => hasSourceExtension(path),skipDirectory: (path) => basename(path) === "node_modules",});- return [...explicitFiles, ...sourceFiles, ...tenantFiles].sort(- (left, right) => left.path.localeCompare(right.path),- );+ return [+ ...explicitFiles,+ ...sourceFiles,+ ...sharedFiles,+ ...tenantFiles,+ ].sort((left, right) => left.path.localeCompare(right.path));}export async function buildCacheKey(diff --git a/app/tests/build-cache.test.ts b/app/tests/build-cache.test.tsindex 23657182..1a10b69c 100644--- a/app/tests/build-cache.test.ts+++ b/app/tests/build-cache.test.ts@@ -25,6 +25,7 @@ async function withProject(await mkdir(join(appDir, "src/lib/generated"), { recursive: true });await mkdir(join(appDir, "dist"), { recursive: true });await mkdir(join(rootDir, "examples/brand"), { recursive: true });+ await mkdir(join(rootDir, "shared"), { recursive: true });await writeFile(join(rootDir, "package.json"), '{"version":"1.2.3"}\n');await writeFile(join(rootDir, "bun.lock"), "lock-a\n");await writeFile(join(appDir, "package.json"), '{"version":"0.0.0"}\n');@@ -36,6 +37,10 @@ async function withProject("export const appConfig = { brand: { tenantId: 'a' } };\n",);await writeFile(join(rootDir, "examples/brand/brand.yaml"), "name: A\n");+ await writeFile(+ join(rootDir, "shared/attachments.ts"),+ "export const MAX_ATTACHMENTS_PER_MESSAGE = 8;\n",+ );await writeFile(join(appDir, "dist/index.html"), "<html></html>\n");await callback({ rootDir, appDir });} finally {@@ -76,6 +81,11 @@ describe("production build cache", () => {["root package version", "package.json", '{"version":"1.2.4"}\n'],["app package manifest", "app/package.json", '{"version":"0.0.1"}\n'],["tenant branding", "examples/brand/brand.yaml", "name: B\n"],+ [+ "a shared module the app imports",+ "shared/attachments.ts",+ "export const MAX_ATTACHMENTS_PER_MESSAGE = 10;\n",+ ],] as const)("rejects a build when %s changes",async (_name, path, contents) => {