Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(release): exclude plugins from Windows file budget (#120)

Leob3e0c7fe1d60
diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts
index 05f4871f7..27127c1c7 100644
--- a/scripts/build-desktop-artifact.test.ts
+++ b/scripts/build-desktop-artifact.test.ts
@@ -694,6 +694,37 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
),
);
+ it.effect("excludes the plugin catalog from the Windows loose-file budget", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const fixture = yield* makeWindowsPayloadFixture({ copyUnpackedNatives: true });
+ const baseline = yield* validateWindowsPackagedPayload({
+ stageDistDir: fixture.stageDistDir,
+ appExecutableName: fixture.appExecutableName,
+ targetArch: "x64",
+ });
+ const pluginDir = path.join(fixture.packagedAppDir, "resources/plugins/entries/example");
+ yield* fs.makeDirectory(pluginDir, { recursive: true });
+ yield* Effect.forEach(
+ Array.from({ length: 100 }, (_, index) => index),
+ (index) => fs.writeFileString(path.join(pluginDir, `${String(index)}.json`), "{}"),
+ { concurrency: "unbounded" },
+ );
+
+ const withCatalog = yield* validateWindowsPackagedPayload({
+ stageDistDir: fixture.stageDistDir,
+ appExecutableName: fixture.appExecutableName,
+ targetArch: "x64",
+ fileLimit: baseline.fileCount,
+ });
+
+ assert.equal(withCatalog.fileCount, baseline.fileCount);
+ }),
+ ),
+ );
+
it.effect("probes fff through the packaged Windows primary instead of helper executables", () => {
const commands: Array<{
readonly command: string;
diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts
index 04dfc7fdd..1e25f16fe 100644
--- a/scripts/build-desktop-artifact.ts
+++ b/scripts/build-desktop-artifact.ts
@@ -2146,10 +2146,14 @@ function collectUnpackedAsarFiles(
return output;
}
-const countPayloadFiles = Effect.fn("desktopArtifact.countPayloadFiles")(function* (root: string) {
+const countPayloadFiles = Effect.fn("desktopArtifact.countPayloadFiles")(function* (input: {
+ readonly root: string;
+ readonly excludedDirectories?: ReadonlyArray<string>;
+}) {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
- const pendingDirectories = [root];
+ const excludedDirectories = new Set(input.excludedDirectories ?? []);
+ const pendingDirectories = [input.root];
let count = 0;
while (pendingDirectories.length > 0) {
@@ -2160,7 +2164,7 @@ const countPayloadFiles = Effect.fn("desktopArtifact.countPayloadFiles")(functio
const entryPath = path.join(directory, entry);
const stat = yield* fs.stat(entryPath);
if (stat.type === "Directory") {
- pendingDirectories.push(entryPath);
+ if (!excludedDirectories.has(entryPath)) pendingDirectories.push(entryPath);
} else if (stat.type === "File") {
count += 1;
}
@@ -2359,7 +2363,10 @@ export const validateWindowsPackagedPayload = Effect.fn(
});
}
- const fileCount = yield* countPayloadFiles(packagedAppDir);
+ const fileCount = yield* countPayloadFiles({
+ root: packagedAppDir,
+ excludedDirectories: [path.join(resourcesDir, "plugins")],
+ });
if (fileCount > fileLimit) {
return yield* new WindowsPackagedPayloadValidationError({
reason: "file-limit-exceeded",