Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
/**
* The Vault: saved logins (shared/logins.ts) and saved secrets, kept
* encrypted on the computer OpenMausBot runs on. A bot uses a saved secret
* through a one-use reference or a private file and never sees it. Clients
* see a saved secret as a list row, never its value.
*/
import { CUSTOM_SECRET_LABEL_MAX } from "./credential-request.ts";
import type { LoginBots, OnePasswordItemRef } from "./logins.ts";
/** One saved secret as Settings shows it. There is no value field, and no
* route ever returns one: a saved value is only ever replaced. */
export interface VaultSecret {
id: string;
/** What the person or the asking bot called it, such as Stripe secret key. */
name: string;
/** A bot's secure card, or Settings. */
source: "card" | "settings";
bots: LoginBots;
/** Given on a card for OpenMausBot's own tools only, so it is never written to a file a bot's commands read. */
refOnly?: true;
createdAt: number;
updatedAt: number;
lastUsedAt?: number;
}
export const VAULT_SECRET_NAME_MAX = CUSTOM_SECRET_LABEL_MAX;
export const SECRET_VALUE_MAX_BYTES = 4_096;
/** The form two secret names are compared in: "Stripe secret key" and "stripe-secret-key" are one name. */
export function vaultNameKey(name: string): string {
return name.normalize("NFKC").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
}
/** A secret from a linked password manager, as the Vault lists it: its name and field names, never a value. It is
* changed in the manager, and its group in the manager says which bots may use it. */
export interface LinkedSecret {
id: string;
name: string;
/** Its other fields, each asked for as "<name> <field>"; the name alone is its main value. */
fields: string[];
source: "linked";
/** Who it is linked from, such as 1password. */
provider: string;
bots: LoginBots;
readOnly: true;
lastUsedAt?: number;
/** From 1Password: its item, and whether its bots are its own choice rather than its vault's. */
onePassword?: OnePasswordItemRef;
}
/** A saved item a secure card offers under "Use a saved one": its name only. Picking it lets the asking bot use it. */
export interface VaultChoice {
id: string;
name: string;
/** Who it is linked from, such as 1password; absent for one saved in the Vault. */
provider?: string;
}