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 { TurnId, type OrchestrationEvent, type ProviderRuntimeEvent } from "@akeru/contracts";
import * as DateTime from "effect/DateTime";
import * as Effect from "effect/Effect";
export const nowIso = Effect.map(DateTime.now, DateTime.formatIso);
export type ReactorInput =
| {
readonly source: "runtime";
readonly event: ProviderRuntimeEvent;
}
| {
readonly source: "domain";
readonly event: OrchestrationEvent;
};
export function toTurnId(value: string | undefined): TurnId | null {
return value === undefined ? null : TurnId.make(String(value));
}
export function sameId(left: string | null | undefined, right: string | null | undefined): boolean {
if (left === null || left === undefined || right === null || right === undefined) {
return false;
}
return left === right;
}
export function checkpointStatusFromRuntime(
status: string | undefined,
): "ready" | "missing" | "error" {
switch (status) {
case "failed":
return "error";
case "cancelled":
case "interrupted":
return "missing";
case "completed":
default:
return "ready";
}
}