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(desktop): start fresh installs without legacy keychain errors (#289)

Leocedae46081f9
diff --git a/.changeset/akeru-keychain-identity.md b/.changeset/akeru-keychain-identity.md
new file mode 100644
index 000000000..3cbebf429
--- /dev/null
+++ b/.changeset/akeru-keychain-identity.md
@@ -0,0 +1,5 @@
+---
+"@t3tools/desktop": patch
+---
+
+Use Akeru Bot's package identity for packaged Electron safe storage instead of the legacy T3 Code keychain service.
diff --git a/.changeset/desktop-startup-catalog-path.md b/.changeset/desktop-startup-catalog-path.md
new file mode 100644
index 000000000..bf1053d87
--- /dev/null
+++ b/.changeset/desktop-startup-catalog-path.md
@@ -0,0 +1,5 @@
+---
+"akeru-bot": patch
+---
+
+Fix desktop startup when the bundled server loads the plugin catalog from a worktree.
diff --git a/apps/desktop/src/app/DesktopConnectionCatalogStore.ts b/apps/desktop/src/app/DesktopConnectionCatalogStore.ts
index 947c8a0cf..caa3d1dd9 100644
--- a/apps/desktop/src/app/DesktopConnectionCatalogStore.ts
+++ b/apps/desktop/src/app/DesktopConnectionCatalogStore.ts
@@ -417,9 +417,6 @@ export const make = Effect.gen(function* () {
});
const migrateLegacyCatalog = Effect.gen(function* () {
- if (!(yield* encryptionAvailable)) {
- return Option.none<string>();
- }
const records = yield* savedEnvironments.getRegistry.pipe(
Effect.mapError(
(cause) =>
@@ -433,6 +430,12 @@ export const make = Effect.gen(function* () {
if (records.length === 0) {
return Option.none<string>();
}
+ // A brand-new install has no catalog and no legacy records. Do not touch
+ // Electron safe storage in that case: on macOS the availability check can
+ // open the keychain prompt even though there is nothing to decrypt.
+ if (!(yield* encryptionAvailable)) {
+ return Option.none<string>();
+ }
const catalog = yield* migrateSavedEnvironmentRecords(records, savedEnvironments, catalogPath);
const encoded = yield* encodeRuntimeConnectionCatalogDocumentJson(catalog).pipe(
Effect.mapError(
diff --git a/apps/server/src/provider/AkeruCatalogToolHandlers.ts b/apps/server/src/provider/AkeruCatalogToolHandlers.ts
index 60d6e19ad..f63c5530c 100644
--- a/apps/server/src/provider/AkeruCatalogToolHandlers.ts
+++ b/apps/server/src/provider/AkeruCatalogToolHandlers.ts
@@ -35,7 +35,31 @@ declare global {
}
function loadNodeCatalogModules(): CatalogManifestModules {
- const entriesUrl = new URL("../../../../plugins/entries/", import.meta.url);
+ // The server bundle lives at `apps/server/dist`, while source files live
+ // one directory deeper under `apps/server/src/provider`. Resolve the
+ // repository catalog from the bundled location, with the packaged desktop
+ // resource as a fallback.
+ const sourceTree = import.meta.url.includes("/src/provider/");
+ const candidates = sourceTree
+ ? [
+ new URL("../../../../plugins/entries/", import.meta.url),
+ new URL("../../../plugins/entries/", import.meta.url),
+ ]
+ : [
+ new URL("../../../plugins/entries/", import.meta.url),
+ new URL("../../../../plugins/entries/", import.meta.url),
+ new URL("../../../apps/desktop/prod-resources/plugins/entries/", import.meta.url),
+ ];
+ const entriesUrl = candidates.find((candidate) => {
+ try {
+ return NodeFS.statSync(candidate).isDirectory();
+ } catch {
+ return false;
+ }
+ });
+ if (!entriesUrl) {
+ throw new Error("Akeru plugin catalog directory is unavailable.");
+ }
return Object.fromEntries(
NodeFS.readdirSync(entriesUrl, { withFileTypes: true })
.filter((entry) => entry.isDirectory())
diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts
index 0388deca5..14a8dc0d7 100644
--- a/scripts/build-desktop-artifact.test.ts
+++ b/scripts/build-desktop-artifact.test.ts
@@ -17,6 +17,7 @@ import {
createStageWorkspaceConfig,
createStagePatchedDependencies,
createBuildConfig,
+ DESKTOP_PACKAGE_NAME,
DESKTOP_ELECTRON_LANGUAGES,
DESKTOP_FILE_EXCLUSIONS,
DESKTOP_EXTRA_RESOURCES,
@@ -177,6 +178,10 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
assert.equal(resolveDesktopProductName("0.0.17"), "Akeru Bot (Alpha)");
});
+ it("uses the Akeru package identity for Electron safe storage", () => {
+ assert.equal(DESKTOP_PACKAGE_NAME, "akeru-bot");
+ });
+
it("uses production desktop artwork", () => {
assert.deepStrictEqual(resolveDesktopBuildIconAssets("0.0.17"), {
macIconPng: BRAND_ASSET_PATHS.productionMacIconPng,
diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts
index 6941280b3..7eb571fd6 100644
--- a/scripts/build-desktop-artifact.ts
+++ b/scripts/build-desktop-artifact.ts
@@ -51,6 +51,7 @@ import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
const LINUX_ICON_SIZES = [16, 22, 24, 32, 48, 64, 128, 256, 512] as const;
const DESKTOP_APP_ID = "dev.leodoes.akeru";
+export const DESKTOP_PACKAGE_NAME = "akeru-bot";
const BuildPlatform = Schema.Literals(["mac", "linux", "win"]);
const BuildArch = Schema.Literals(["arm64", "x64", "universal"]);
@@ -2733,7 +2734,10 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
? path.join(stageAppDir, WINDOWS_SERVER_RESOURCE_SOURCE_DIR, WINDOWS_SERVER_ASAR_RESOURCE)
: undefined;
const stagePackageJson: StagePackageJson = {
- name: "t3code",
+ // Electron derives app.name (and therefore the macOS safe-storage
+ // keychain service) from this manifest name. Keep the packaged identity
+ // in Akeru's namespace instead of reusing T3 Code's `t3code` service.
+ name: DESKTOP_PACKAGE_NAME,
version: appVersion,
buildVersion: appVersion,
t3codeCommitHash: commitHash,