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.
import type { ExpoConfig } from "expo/config";
import { BRAND_ASSET_PATHS } from "../../scripts/lib/brand-assets.ts";
import { loadRepoEnv } from "../../scripts/lib/public-config.ts";
type AppVariant = "development" | "production";
const repoEnv: Readonly<Record<string, string | undefined>> = loadRepoEnv();
Object.assign(process.env, repoEnv);
const APP_VARIANT = resolveAppVariant(repoEnv.APP_VARIANT);
const isIosPersonalTeamBuild = repoEnv.T3CODE_IOS_PERSONAL_TEAM === "1";
const appleTeamId = repoEnv.AKERU_APPLE_TEAM_ID?.trim();
const expoProjectId = repoEnv.AKERU_EXPO_PROJECT_ID?.trim();
const expoOwner = repoEnv.AKERU_EXPO_OWNER?.trim();
const personalTeamBundleIdentifier = repoEnv.T3CODE_IOS_PERSONAL_TEAM_BUNDLE_ID?.trim();
const IOS_BUNDLE_IDENTIFIER_PATTERN = /^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/;
const APPLE_TEAM_ID_PATTERN = /^[A-Z0-9]{10}$/;
const EXPO_PROJECT_ID_PATTERN =
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
const EXPO_OWNER_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
const fromRepoRoot = (relativePath: string) => `../../${relativePath}`;
if (
isIosPersonalTeamBuild &&
(!personalTeamBundleIdentifier ||
!IOS_BUNDLE_IDENTIFIER_PATTERN.test(personalTeamBundleIdentifier))
) {
throw new Error(
"T3CODE_IOS_PERSONAL_TEAM_BUNDLE_ID must be a reverse-DNS identifier such as dev.example.akeru when T3CODE_IOS_PERSONAL_TEAM=1.",
);
}
if (appleTeamId && !APPLE_TEAM_ID_PATTERN.test(appleTeamId)) {
throw new Error("AKERU_APPLE_TEAM_ID must be a 10-character Apple team identifier.");
}
if (expoProjectId && !EXPO_PROJECT_ID_PATTERN.test(expoProjectId)) {
throw new Error("AKERU_EXPO_PROJECT_ID must be an Expo project UUID.");
}
if (expoOwner && !EXPO_OWNER_PATTERN.test(expoOwner)) {
throw new Error("AKERU_EXPO_OWNER must be an Expo account name.");
}
const DEVELOPMENT_ASSETS = {
appIcon: fromRepoRoot(BRAND_ASSET_PATHS.productionIosIconPng),
iosIcon: fromRepoRoot(BRAND_ASSET_PATHS.productionIosIconPng),
splashIcon: fromRepoRoot(BRAND_ASSET_PATHS.productionIosIconPng),
androidAdaptiveForeground: fromRepoRoot(BRAND_ASSET_PATHS.productionIosIconPng),
androidAdaptiveBackgroundColor: "#F4F1EA",
androidMonochromeIcon: "./assets/android-akeru-monochrome.png",
androidNotificationIcon: "./assets/android-akeru-monochrome.png",
androidNotificationColor: "#F4F1EA",
} as const;
const RELEASE_ASSETS = {
appIcon: fromRepoRoot(BRAND_ASSET_PATHS.productionIosIconPng),
iosIcon: {
light: fromRepoRoot(BRAND_ASSET_PATHS.productionIosIconPng),
dark: fromRepoRoot(BRAND_ASSET_PATHS.productionIosIconPng),
},
splashIcon: fromRepoRoot(BRAND_ASSET_PATHS.productionIosIconPng),
androidAdaptiveForeground: fromRepoRoot(BRAND_ASSET_PATHS.productionIosIconPng),
androidAdaptiveBackgroundColor: "#F4F1EA",
androidMonochromeIcon: "./assets/android-akeru-monochrome.png",
androidNotificationIcon: "./assets/android-akeru-monochrome.png",
androidNotificationColor: "#F4F1EA",
} as const;
const VARIANT_CONFIG = {
development: {
appName: "Akeru Bot Dev",
scheme: "akeru-dev",
iosBundleIdentifier: "dev.leodoes.akeru.dev",
androidPackage: "dev.leodoes.akeru.dev",
assets: DEVELOPMENT_ASSETS,
},
production: {
appName: "Akeru Bot",
scheme: "akeru",
iosBundleIdentifier: "dev.leodoes.akeru",
androidPackage: "dev.leodoes.akeru",
assets: RELEASE_ASSETS,
},
} as const;
function resolveAppVariant(value: string | undefined): AppVariant {
switch (value) {
case "development":
case "production":
return value;
default:
return "production";
}
}
const variant = VARIANT_CONFIG[APP_VARIANT];
const iosBundleIdentifier = isIosPersonalTeamBuild
? personalTeamBundleIdentifier!
: variant.iosBundleIdentifier;
const dmSansFonts = {
regular: "@expo-google-fonts/dm-sans/400Regular/DMSans_400Regular.ttf",
medium: "@expo-google-fonts/dm-sans/500Medium/DMSans_500Medium.ttf",
bold: "@expo-google-fonts/dm-sans/700Bold/DMSans_700Bold.ttf",
} as const;
const widgetsPlugin: NonNullable<ExpoConfig["plugins"]>[number] = [
"expo-widgets",
{
bundleIdentifier: `${iosBundleIdentifier}.widgets`,
groupIdentifier: `group.${iosBundleIdentifier}`,
enablePushNotifications: true,
// Agent activity can update many times an hour; without the
// frequent-updates entitlement iOS throttles the update budget sooner.
frequentUpdates: true,
widgets: [
{
name: "AgentActivity",
displayName: "Bot Work",
description: "Shows current bot work in Akeru Bot.",
supportedFamilies: ["systemSmall", "systemMedium", "accessoryRectangular"],
},
],
},
];
const sharingPlugin: NonNullable<ExpoConfig["plugins"]>[number] = [
"expo-sharing",
{
ios: {
// Personal Teams cannot sign App Groups or extension targets. Keep the
// reduced-capability local build usable while release builds expose the
// real system share target.
enabled: !isIosPersonalTeamBuild,
extensionBundleIdentifier: `${iosBundleIdentifier}.sharing`,
appGroupId: `group.${iosBundleIdentifier}`,
activationRule: {
supportsText: true,
supportsWebUrlWithMaxCount: 1,
supportsImageWithMaxCount: 8,
},
},
android: {
enabled: true,
singleShareMimeTypes: ["text/plain", "image/*"],
multipleShareMimeTypes: ["image/*"],
},
},
];
// These aliases match the fonts' PostScript names on iOS. Register the same
// names on Android so React Native and the native composer use one set of
// family names without waiting for runtime font loading.
const MICROPHONE_PERMISSION = "Allow Akeru Bot to use your microphone to dictate messages.";
const config: ExpoConfig = {
name: variant.appName,
slug: "akeru-bot",
platforms: ["ios", "android"],
scheme: variant.scheme === "akeru" ? ["akeru"] : [variant.scheme, "akeru"],
version: "1.0.4",
runtimeVersion: {
// Fingerprint (not appVersion) so an OTA only reaches binaries whose native
// project — native deps, config plugins, AND patches/ — matches the update.
// With appVersion, every 0.1.0 build shares a runtime version, so a JS update
// could land on a binary missing the native changes it needs and crash.
policy: process.env.MOBILE_VERSION_POLICY ?? "fingerprint",
},
orientation: "portrait",
icon: variant.assets.appIcon,
userInterfaceStyle: "automatic",
updates: expoProjectId
? {
enabled: true,
url: `https://u.expo.dev/${expoProjectId}`,
checkAutomatically: "ON_LOAD",
fallbackToCacheTimeout: 0,
}
: { enabled: false },
ios: {
icon: variant.assets.iosIcon,
supportsTablet: true,
// Multitasking-capable iPad apps cannot rotate programmatically, so the
// showcase capture build requires full screen (see infoPlist below).
requireFullScreen: process.env.T3_SHOWCASE_CAPTURE_BUILD === "1",
bundleIdentifier: iosBundleIdentifier,
// Release builders can pin their own Apple team. Personal-team builds let
// Xcode select the local account because they remove restricted capabilities.
...(!isIosPersonalTeamBuild && appleTeamId ? { appleTeamId } : {}),
infoPlist: {
NSAppTransportSecurity: {
NSAllowsArbitraryLoads: true,
},
NSLocalNetworkUsageDescription:
"Allow Akeru Bot to connect to Akeru Bot servers on your local network or tailnet.",
ITSAppUsesNonExemptEncryption: false,
// The App Store screenshot harness rotates the iPad interface from
// inside the app (CI denies osascript the Accessibility access that
// Simulator menu scripting needs), and iPadOS ignores programmatic
// orientation requests for multitasking-capable apps — so the capture
// build opts out of multitasking and declares landscape support.
...(process.env.T3_SHOWCASE_CAPTURE_BUILD === "1"
? {
"UISupportedInterfaceOrientations~ipad": [
"UIInterfaceOrientationPortrait",
"UIInterfaceOrientationPortraitUpsideDown",
"UIInterfaceOrientationLandscapeLeft",
"UIInterfaceOrientationLandscapeRight",
],
}
: {}),
},
},
android: {
icon: variant.assets.appIcon,
package: variant.androidPackage,
adaptiveIcon: {
backgroundColor: variant.assets.androidAdaptiveBackgroundColor,
foregroundImage: variant.assets.androidAdaptiveForeground,
monochromeImage: variant.assets.androidMonochromeIcon,
},
// Opts into OnBackInvokedCallback-based back dispatch (Android 13+).
// JS back handling survives it via react-native's Android 16 shim plus
// withAndroidPredictiveBackCompat on Android 13-15.
predictiveBackGestureEnabled: true,
},
web: {
favicon: variant.assets.appIcon,
},
plugins: [
"expo-asset",
[
"expo-font",
{
ios: {
fonts: [dmSansFonts.regular, dmSansFonts.medium, dmSansFonts.bold],
},
android: {
fonts: [
{
fontFamily: "DMSans-Regular",
fontDefinitions: [{ path: dmSansFonts.regular, weight: 400 }],
},
{
fontFamily: "DMSans-Medium",
fontDefinitions: [{ path: dmSansFonts.medium, weight: 500 }],
},
{
fontFamily: "DMSans-Bold",
fontDefinitions: [{ path: dmSansFonts.bold, weight: 700 }],
},
],
},
},
],
"expo-secure-store",
"expo-sqlite",
...(isIosPersonalTeamBuild
? [sharingPlugin]
: ["./plugins/withShareExtensionDisplayName.cjs", sharingPlugin]),
[
"expo-notifications",
{
icon: variant.assets.androidNotificationIcon,
color: variant.assets.androidNotificationColor,
mode: APP_VARIANT === "development" ? "development" : "production",
},
],
"expo-web-browser",
[
"expo-quick-actions",
{
// Adaptive launcher-shortcut icon; referenced by resource name from
// the shortcut items set in src/features/shortcuts.
androidIcons: {
shortcut_icon: {
foregroundImage: variant.assets.androidAdaptiveForeground,
backgroundColor: variant.assets.androidAdaptiveBackgroundColor,
},
},
},
],
[
"expo-audio",
{
microphonePermission: MICROPHONE_PERMISSION,
recordAudioAndroid: true,
enableBackgroundPlayback: false,
enableBackgroundRecording: false,
},
],
// Camera and image picker never record audio, but each plugin rewrites the microphone
// usage string, and `false` would delete it (and block RECORD_AUDIO) for dictation.
[
"expo-camera",
{
cameraPermission: "Allow Akeru Bot to access your camera so you can scan pairing QR codes.",
microphonePermission: MICROPHONE_PERMISSION,
barcodeScannerEnabled: true,
recordAudioAndroid: false,
},
],
["expo-image-picker", { photosPermission: false, microphonePermission: MICROPHONE_PERMISSION }],
[
"expo-splash-screen",
{
image: variant.assets.splashIcon,
resizeMode: "contain",
backgroundColor: "#ffffff",
imageWidth: 220,
dark: {
image: variant.assets.splashIcon,
backgroundColor: "#0a0a0a",
},
},
],
[
"expo-build-properties",
{
ios: {
deploymentTarget: "18.0",
// AppCheckCore 11.3+ includes Swift and needs module maps for these Objective-C dependencies.
extraPods: [
{ name: "GoogleUtilities", modular_headers: true },
{ name: "RecaptchaInterop", modular_headers: true },
],
},
},
],
"./plugins/withIosCocoaPodsUuidCache.cjs",
// Must be listed BEFORE expo-widgets: same-type mods run last-registered-
// first, so registering earlier makes this plugin's mods run AFTER
// expo-widgets' — its dangerous mod wipes ios/ExpoWidgetsTarget/ (which
// would delete the asset catalog) and its xcodeproj mod creates the widget
// target (which must exist before the compile phase can be attached).
...(!isIosPersonalTeamBuild ? ["./plugins/withWidgetLogoAsset.cjs", widgetsPlugin] : []),
"./plugins/withIosSceneLifecycle.cjs",
"./plugins/withAndroidCleartextTraffic.cjs",
"./plugins/withAndroidGradleHeap.cjs",
"./plugins/withAndroidModernPopupMenu.cjs",
"./plugins/withAndroidModernAlertDialog.cjs",
"./plugins/withAndroidPredictiveBackCompat.cjs",
"./plugins/withAndroidTabletOrientation.cjs",
...(isIosPersonalTeamBuild ? ["./plugins/withoutIosPersonalTeamCapabilities.cjs"] : []),
],
extra: {
appVariant: APP_VARIANT,
iosPersonalTeamBuild: isIosPersonalTeamBuild,
observability: {
tracesUrl: repoEnv.EXPO_PUBLIC_OTLP_TRACES_URL ?? "https://api.axiom.co/v1/traces",
tracesDataset: repoEnv.EXPO_PUBLIC_OTLP_TRACES_DATASET ?? null,
tracesToken: repoEnv.EXPO_PUBLIC_OTLP_TRACES_TOKEN ?? null,
},
...(expoProjectId ? { eas: { projectId: expoProjectId } } : {}),
},
...(expoOwner ? { owner: expoOwner } : {}),
};
export default config;