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): stage plugins in Windows self-check (#121)

Leodaeed9e6102b
diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts
index 27127c1c7..6ffa5e933 100644
--- a/scripts/build-desktop-artifact.test.ts
+++ b/scripts/build-desktop-artifact.test.ts
@@ -113,7 +113,11 @@ const makeWindowsPayloadFixture = Effect.fn("test.makeWindowsPayloadFixture")(fu
const nativePath = path.join(sourceDir, "node_modules/native/addon.node");
yield* fs.makeDirectory(path.dirname(serverEntryPath), { recursive: true });
yield* fs.makeDirectory(path.dirname(nativePath), { recursive: true });
- yield* fs.writeFileString(serverEntryPath, input.serverEntrySource ?? "console.log('server');\n");
+ yield* fs.writeFileString(
+ serverEntryPath,
+ input.serverEntrySource ??
+ 'import { readdirSync } from "node:fs";\nreaddirSync(new URL("../../../../plugins/entries/", import.meta.url));\nconsole.log("server");\n',
+ );
yield* fs.writeFileString(nativePath, "native-binary");
const generatedAsarPath = path.join(tempDir, WINDOWS_SERVER_ASAR_RESOURCE);
@@ -123,6 +127,9 @@ const makeWindowsPayloadFixture = Effect.fn("test.makeWindowsPayloadFixture")(fu
const packagedAppDir = path.join(stageDistDir, "win-unpacked");
const resourcesDir = path.join(packagedAppDir, "resources");
yield* fs.makeDirectory(path.join(resourcesDir, "resource-monitor"), { recursive: true });
+ yield* fs.makeDirectory(path.join(resourcesDir, "plugins/entries/example"), {
+ recursive: true,
+ });
yield* fs.copyFile(generatedAsarPath, path.join(resourcesDir, WINDOWS_SERVER_ASAR_RESOURCE));
if (input.copyUnpackedNatives) {
yield* fs.copy(
@@ -134,6 +141,7 @@ const makeWindowsPayloadFixture = Effect.fn("test.makeWindowsPayloadFixture")(fu
path.join(resourcesDir, "resource-monitor/t3-resource-monitor.exe"),
"monitor",
);
+ yield* fs.writeFileString(path.join(resourcesDir, "plugins/entries/example/plugin.json"), "{}");
const appExecutableName = "t3code.exe";
yield* fs.writeFileString(path.join(packagedAppDir, appExecutableName), "electron");
yield* fs.writeFileString(path.join(packagedAppDir, "chrome_crashpad_handler.exe"), "crashpad");
diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts
index 1e25f16fe..46283aeed 100644
--- a/scripts/build-desktop-artifact.ts
+++ b/scripts/build-desktop-artifact.ts
@@ -1309,7 +1309,11 @@ export const copyDirectoryPreservingSymlinks = Effect.fn("copyDirectoryPreservin
);
const verifyPackagedBundleIsSelfContained = Effect.fn("verifyPackagedBundleIsSelfContained")(
- function* (input: { readonly asarPath: string; readonly verbose: boolean }) {
+ function* (input: {
+ readonly asarPath: string;
+ readonly pluginCatalogPath: string;
+ readonly verbose: boolean;
+ }) {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
@@ -1330,6 +1334,10 @@ const verifyPackagedBundleIsSelfContained = Effect.fn("verifyPackagedBundleIsSel
// is hoisted and should be physical. A future package-manager layout change
// must not let the probe resolve through the build tree.
yield* copyDirectoryPreservingSymlinks(extractedApp, probeApp);
+ yield* copyDirectoryPreservingSymlinks(
+ input.pluginCatalogPath,
+ path.join(probeRoot, "plugins"),
+ );
// Guard the guard: if anything above the probe provides a node_modules, a
// missing dependency would resolve there and the check would pass while the
@@ -2386,6 +2394,7 @@ export const validateWindowsPackagedPayload = Effect.fn(
yield* verifyPackagedBundleIsSelfContained({
asarPath,
+ pluginCatalogPath: path.join(resourcesDir, "plugins"),
verbose: input.verbose ?? false,
});