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.

477 B
Raw Blame
import { hasTag } from "~/lib/taggedUnion";
import { Atom } from "effect/unstable/reactivity";

import { environmentCatalog } from "../connection/catalog";

export const primaryEnvironmentIdAtom = Atom.make((get) => {
  for (const [environmentId, entry] of get(environmentCatalog.catalogValueAtom).entries) {
    if (hasTag(entry.target, "PrimaryConnectionTarget")) {
      return environmentId;
    }
  }

  return null;
}).pipe(Atom.withLabel("web-primary-environment-id"));