Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

3.9 KB
Raw Blame
import type { installCloudSend } from "./cloud-send-main.mjs";
import type { OneHomeCloud, OneHomeView, createOneHome } from "./one-home.mjs";
import type { installTeamMove } from "./team-move-main.mjs";

export function oneHomeCloud(state: unknown): OneHomeCloud | null;
/** This computer's server's answer to the move's freeze: frozen, or what still holds the move. */
export function freezeAnswer(got: { ok: boolean; status: number; body: any }): { frozen: true } | { busy: string; what?: string };
export type KeepHereState = import("./cloud-send.mjs").KeepHereState;
export function installationOf(environmentId: string): string;
export declare const GONE_ASK_MS: number;
/** One home's `gone(origin)`, from the Admin's word (`ask`), kept per account. */
export function createGoneCheck(deps: { ask(origin: string): Promise<string | null>; account(): string | null; now?(): number }): (origin: string) => Promise<"deleted" | "ended" | null>;

type SendDeps = Parameters<typeof installCloudSend>[0];

export function installOneHome(deps: Omit<SendDeps, "local" | "move" | "moveSession"> & {
  /** This computer's server, as its owner. */
  localRequest(route: string, init?: RequestInit & { duplex?: "half" }): Promise<Response>;
  /** The MausBot Cloud sign-in (cloud-account.mjs). */
  account(): { state(): any; pairHome(): Promise<{ origin: string; code: string; expiresAt?: number }>; exportHome(options?: { installation?: string }): Promise<any>;
    reportMove?(options: { installation: string }): Promise<boolean>; reportKept?(options: { installation: string }): Promise<boolean>;
    movedTo?(origin: string): Promise<"deleted" | "ended" | "live" | "unknown" | null>;
    reportMoveStatus?(report: import("./move-status.mjs").MoveStatusReport): Promise<boolean>;
    pairTeam(teamId: string): Promise<{ origin: string; code: string; expiresAt?: number }> } | null;
  /** The person is asked which bots go before the first move starts. */
  chooses?: boolean;
  journalFile(): string;
  tempRoot(): string;
  lend?(projects: string[]): Promise<unknown>;
  phone?: { paired(): boolean; stop(): Promise<void>; start(): Promise<void> };
  openHome?(): void;
  openLocal?(): void;
  restart?(): void;
  version?: string;
  log?(line: string): void;
  journal?: { read(): unknown; write(value: unknown): void };
  /** The person's choice to keep this computer's bots here, one-home-keep.json beside journalFile by default. */
  keep?: { read(): unknown; write(value: unknown): void };
  /** Shows a team's page: where a bot moved there from My Cloud now lives. */
  openTeam?(team: { id: string; name: string }): void;
  /** The team moves' journal, team-moves.json beside journalFile by default. */
  teamJournal?: { read(): unknown; write(value: unknown): void };
  t?(key: string, params?: Record<string, string | number>): string;
  /** The waits of the move's report to the Admin (move-status.mjs), setTimeout's by default. */
  reportTimers?: { set(work: () => void, ms: number): unknown; clear(timer: unknown): void };
  /** The move to a server of the person's own: while it is chosen no move to My Cloud starts, and its line is this computer's page's. */
  other?(): null | { view(): unknown; seen(): unknown; retry(): Promise<unknown>; active(): boolean };
}): ReturnType<typeof installCloudSend> & {
  keep: { state(): KeepHereState; set(on: boolean): Promise<void> };
  /** Why the account signed in can't be left now, else null. */
  holding(): "moving" | null;
  /** A move to My Cloud, its way home, or a bot's move is under way: the session is read every minute for it. */
  underWay(): boolean;
  kick(): Promise<void>;
  away(): boolean;
  view(): OneHomeView | null;
  close(): void;
  oneHome: ReturnType<typeof createOneHome>;
  journal(): unknown;
  moveStatus: { read(): import("./move-status.mjs").MoveStatusReport; flush(): Promise<void> };
  marker(): Promise<{ frozen: boolean; cloud?: string; busy?: string }>;
  lastInput(): number;
  teamMove: ReturnType<typeof installTeamMove>;
};