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

orchestration.ts

37 lines1.5 KB

1import { ORCHESTRATION_WS_METHODS } from "@t3tools/contracts";
2import { Atom } from "effect/unstable/reactivity";
3​
4import { 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 workflowScript: createEnvironmentRpcQueryAtomFamily(runtime, {
16 label: "environment-data:orchestration:workflow-script",
17 tag: ORCHESTRATION_WS_METHODS.getWorkflowScript,
18 // Scripts are immutable per run: cache generously.
19 staleTimeMs: 300_000,
20 idleTtlMs: 300_000,
21 }),
22 fullThreadDiff: createEnvironmentRpcQueryAtomFamily(runtime, {
23 label: "environment-data:orchestration:full-thread-diff",
24 tag: ORCHESTRATION_WS_METHODS.getFullThreadDiff,
25 }),
26 threadSearch: createEnvironmentRpcQueryAtomFamily(runtime, {
27 label: "environment-data:orchestration:thread-search",
28 tag: ORCHESTRATION_WS_METHODS.searchThreads,
29 staleTimeMs: 30_000,
30 idleTtlMs: 60_000,
31 }),
32 archivedShellSnapshot: createEnvironmentRpcQueryAtomFamily(runtime, {
33 label: "environment-data:orchestration:archived-shell-snapshot",
34 tag: ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot,
35 }),
36 };