Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

orchestration.ts

29 lines1.2 KB

1import { ORCHESTRATION_WS_METHODS } from "@t3tools/contracts";
2import { Atom } from "effect/unstable/reactivity";
3​
4import { createEnvironmentRpcCommand, createEnvironmentRpcQueryAtomFamily } from "./runtime.ts";
5import type { EnvironmentRegistry } from "../connection/registry.ts";
6​
7export function createOrchestrationEnvironmentAtoms<R, E>(
8 runtime: Atom.AtomRuntime<EnvironmentRegistry | R, E>,
9) {
10 return {
11 turnDiff: createEnvironmentRpcQueryAtomFamily(runtime, {
12 label: "environment-data:orchestration:turn-diff",
13 tag: ORCHESTRATION_WS_METHODS.getTurnDiff,
14 }),
15 // Imperative lazy-load of older thread activities (infinite scroll-up).
16 loadThreadActivities: createEnvironmentRpcCommand(runtime, {
17 label: "environment-data:orchestration:thread-activities",
18 tag: ORCHESTRATION_WS_METHODS.getThreadActivities,
19 }),
20 fullThreadDiff: createEnvironmentRpcQueryAtomFamily(runtime, {
21 label: "environment-data:orchestration:full-thread-diff",
22 tag: ORCHESTRATION_WS_METHODS.getFullThreadDiff,
23 }),
24 archivedShellSnapshot: createEnvironmentRpcQueryAtomFamily(runtime, {
25 label: "environment-data:orchestration:archived-shell-snapshot",
26 tag: ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot,
27 }),
28 };