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 * as Schema from "effect/Schema";
import { type QuitConfirmationMode } from "../settings/client.ts";
export interface ContextMenuItem<T extends string = string> {
id: T;
label: string;
destructive?: boolean;
disabled?: boolean;
/** Renders as a non-interactive section header label. Web fallback only — stripped on desktop native menus. */
header?: boolean;
/** Icon keyword resolved by the web fallback. Stripped on desktop native menus. */
icon?: string;
/** Inserts a visual section divider immediately before this item. */
separatorBefore?: boolean;
children?: readonly ContextMenuItem<T>[];
}
export type QuitShortcutHintEvent =
| { readonly state: "down"; readonly mode: Exclude<QuitConfirmationMode, "direct"> }
| { readonly state: "up" };
export interface ContextMenuItemSchemaType {
readonly id: string;
readonly label: string;
readonly destructive?: boolean;
readonly disabled?: boolean;
readonly header?: boolean;
readonly icon?: string;
readonly separatorBefore?: boolean;
readonly children?: readonly ContextMenuItemSchemaType[];
}
export const ContextMenuItemSchema: Schema.Codec<ContextMenuItemSchemaType> = Schema.Struct({
id: Schema.String,
label: Schema.String,
destructive: Schema.optionalKey(Schema.Boolean),
disabled: Schema.optionalKey(Schema.Boolean),
header: Schema.optionalKey(Schema.Boolean),
icon: Schema.optionalKey(Schema.String),
separatorBefore: Schema.optionalKey(Schema.Boolean),
children: Schema.optionalKey(
Schema.Array(
Schema.suspend((): Schema.Codec<ContextMenuItemSchemaType> => ContextMenuItemSchema),
),
),
});
export type DesktopUpdateStatus =
| "disabled"
| "idle"
| "checking"
| "up-to-date"
| "available"
| "downloading"
| "downloaded"
| "error";
export type DesktopRuntimeArch = "arm64" | "x64" | "other";
export type DesktopTheme = "light" | "dark" | "system";
export type DesktopUpdateChannel = "latest";
export type DesktopAppStageLabel = "Alpha" | "Dev";
export const DesktopUpdateStatusSchema = Schema.Literals([
"disabled",
"idle",
"checking",
"up-to-date",
"available",
"downloading",
"downloaded",
"error",
]);
export const DesktopRuntimeArchSchema = Schema.Literals(["arm64", "x64", "other"]);
export const DesktopThemeSchema = Schema.Literals(["light", "dark", "system"]);
export const DesktopUpdateChannelSchema = Schema.Literal("latest");
export const DesktopAppStageLabelSchema = Schema.Literals(["Alpha", "Dev"]);
export interface DesktopAppBranding {
baseName: string;
stageLabel: DesktopAppStageLabel;
displayName: string;
isPackaged: boolean;
}
export const DesktopAppBrandingSchema = Schema.Struct({
baseName: Schema.String,
stageLabel: DesktopAppStageLabelSchema,
displayName: Schema.String,
isPackaged: Schema.Boolean,
});
export interface DesktopRuntimeInfo {
hostArch: DesktopRuntimeArch;
appArch: DesktopRuntimeArch;
runningUnderArm64Translation: boolean;
}
export const DesktopRuntimeInfoSchema = Schema.Struct({
hostArch: DesktopRuntimeArchSchema,
appArch: DesktopRuntimeArchSchema,
runningUnderArm64Translation: Schema.Boolean,
});
export interface DesktopUpdateState {
enabled: boolean;
status: DesktopUpdateStatus;
channel: DesktopUpdateChannel;
currentVersion: string;
hostArch: DesktopRuntimeArch;
appArch: DesktopRuntimeArch;
runningUnderArm64Translation: boolean;
availableVersion: string | null;
downloadedVersion: string | null;
releaseNotes: ReadonlyArray<DesktopUpdateReleaseNote>;
downloadPercent: number | null;
checkedAt: string | null;
message: string | null;
errorContext: "check" | "download" | "install" | null;
canRetry: boolean;
}
export interface DesktopUpdateReleaseNote {
version: string;
items: ReadonlyArray<string>;
}
export const DesktopUpdateReleaseNoteSchema = Schema.Struct({
version: Schema.String,
items: Schema.Array(Schema.String),
});
export const DesktopUpdateStateSchema = Schema.Struct({
enabled: Schema.Boolean,
status: DesktopUpdateStatusSchema,
channel: DesktopUpdateChannelSchema,
currentVersion: Schema.String,
hostArch: DesktopRuntimeArchSchema,
appArch: DesktopRuntimeArchSchema,
runningUnderArm64Translation: Schema.Boolean,
availableVersion: Schema.NullOr(Schema.String),
downloadedVersion: Schema.NullOr(Schema.String),
releaseNotes: Schema.Array(DesktopUpdateReleaseNoteSchema),
downloadPercent: Schema.NullOr(Schema.Number),
checkedAt: Schema.NullOr(Schema.String),
message: Schema.NullOr(Schema.String),
errorContext: Schema.NullOr(Schema.Literals(["check", "download", "install"])),
canRetry: Schema.Boolean,
});