import { ORCHESTRATION_WS_METHODS } from "@t3tools/contracts"; import { Atom } from "effect/unstable/reactivity"; import { createEnvironmentRpcQueryAtomFamily } from "./runtime.ts"; import type { EnvironmentRegistry } from "../connection/registry.ts"; export function createOrchestrationEnvironmentAtoms( runtime: Atom.AtomRuntime, ) { return { turnDiff: createEnvironmentRpcQueryAtomFamily(runtime, { label: "environment-data:orchestration:turn-diff", tag: ORCHESTRATION_WS_METHODS.getTurnDiff, }), workflowScript: createEnvironmentRpcQueryAtomFamily(runtime, { label: "environment-data:orchestration:workflow-script", tag: ORCHESTRATION_WS_METHODS.getWorkflowScript, // Scripts are immutable per run: cache generously. staleTimeMs: 300_000, idleTtlMs: 300_000, }), fullThreadDiff: createEnvironmentRpcQueryAtomFamily(runtime, { label: "environment-data:orchestration:full-thread-diff", tag: ORCHESTRATION_WS_METHODS.getFullThreadDiff, }), threadSearch: createEnvironmentRpcQueryAtomFamily(runtime, { label: "environment-data:orchestration:thread-search", tag: ORCHESTRATION_WS_METHODS.searchThreads, staleTimeMs: 30_000, idleTtlMs: 60_000, }), archivedShellSnapshot: createEnvironmentRpcQueryAtomFamily(runtime, { label: "environment-data:orchestration:archived-shell-snapshot", tag: ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot, }), }; }