Skip to content

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.

897 B
Raw Blame
import * as Predicate from "effect/Predicate";
import type * as EffectAcpSchema from "effect-acp/schema";

export function formatConfigOptionValue(value: string | boolean): string {
  return JSON.stringify(value);
}

export function sessionConfigOptionsFromSetup(
  response:
    | {
        readonly configOptions?: ReadonlyArray<EffectAcpSchema.SessionConfigOption> | null;
      }
    | undefined,
): ReadonlyArray<EffectAcpSchema.SessionConfigOption> {
  return response?.configOptions ?? [];
}

export function configOptionCurrentValueMatches(
  configOption: EffectAcpSchema.SessionConfigOption,
  value: string | boolean,
): boolean {
  const currentValue = configOption.currentValue;

  if (configOption.type === "boolean") {
    return currentValue === value;
  }

  if (!Predicate.isString(currentValue)) {
    return false;
  }

  return currentValue.trim() === String(value).trim();
}