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

threadShell.ts

585 lines23.3 KB

1import type {
2 EnvironmentId,
3 OrchestrationV2ShellSnapshot,
4 ProjectId,
5 ScopedProjectRef,
6 ScopedThreadRef,
7 ThreadId,
8} from "@t3tools/contracts";
9import { isProviderNativeSubagentThread, OrchestrationV2ThreadShell } from "@t3tools/contracts";
10import * as Schema from "effect/Schema";
11import { Atom } from "effect/reactivity";
12​
13import type { EnvironmentThreadShell, PendingSubagentRequest } from "./models.ts";
14import { presentThreadShell, threadRuntimeIsActive } from "./models.ts";
15import { type EnvironmentCatalogState, enabledEnvironmentIds } from "./connections.ts";
16import {
17 arrayElementsEqual,
18 parseProjectRefCollectionKey,
19 parseThreadKey,
20 projectRefCollectionKey,
21 threadKey,
22 threadRefsEqual,
23} from "./entities.ts";
24​
25const EMPTY_THREADS: ReadonlyArray<OrchestrationV2ThreadShell> = Object.freeze([]);
26const EMPTY_SCOPED_THREAD_REFS: ReadonlyArray<ScopedThreadRef> = Object.freeze([]);
27const EMPTY_THREAD_INDEX: ReadonlyMap<ThreadId, OrchestrationV2ThreadShell> = new Map();
28const EMPTY_SUBAGENT_REQUESTS: ReadonlyMap<ThreadId, PendingSubagentRequest> = new Map();
29const EMPTY_THREAD_REFS_BY_PROJECT: ReadonlyMap<
30 ProjectId,
31 ReadonlyArray<ScopedThreadRef>
32> = new Map();
33​
34// An async question outlives the subagent's run, but once that run ends the
35// parent is no longer waiting on the answer, so it stops counting as input.
36// The activity run stays set when a follow-up is queued behind a blocked run;
37// older servers omit it, so fall back to the latest run's status.
38const isChildRunLive = (
39 thread: Pick<OrchestrationV2ThreadShell, "activityRunStatus" | "status">,
40) =>
41 thread.activityRunStatus !== undefined
42 ? thread.activityRunStatus !== null
43 : thread.status === "preparing" ||
44 thread.status === "starting" ||
45 thread.status === "running" ||
46 thread.status === "waiting";
47​
48/**
49 * Whether a thread shows under its parent rather than in thread lists: a
50 * subagent, or a task a linked environment delegated here whose parent the
51 * client lists (`delegatedUnderParent`, by thread key). A task whose parent
52 * the client cannot list stays in the lists, so its work is never out of reach.
53 */
54export function isShownUnderParent(
55 ref: ScopedThreadRef,
56 lineage: OrchestrationV2ThreadShell["lineage"],
57 delegatedUnderParent: ReadonlySet<string>,
58): boolean {
59 return lineage.relationshipToParent === "subagent" || delegatedUnderParent.has(threadKey(ref));
61​
62/** Provider-native
63 subagents ask on their parent, so they are skipped. */
64function subagentRequest(thread: OrchestrationV2ThreadShell): PendingSubagentRequest | null {
65 const kind = thread.pendingRuntimeRequest?.kind;
66 if (
67 kind === undefined ||
68 kind === "auth_refresh" ||
69 (thread.lineage.relationshipToParent !== "subagent" && thread.delegatedFrom === undefined) ||
70 isProviderNativeSubagentThread(thread) ||
71 !isChildRunLive(thread)
72 ) {
73 return null;
74 }
75 return kind === "user_input" ? "user_input" : "approval";
77​
78/**
79 * The threads to flag for a subagent's live question or approval, up its
80 * subagent chain. `delegated` are tasks this environment's threads delegated
81 * to linked environments, with what each one, or its own subagents, asks.
82 */
83function pendingSubagentRequestsByThread(
84 threads: ReadonlyArray<OrchestrationV2ThreadShell>,
85 delegated: ReadonlyArray<{
86 readonly parentThreadId: ThreadId;
87 readonly request: PendingSubagentRequest;
88 }> = [],
89): ReadonlyMap<ThreadId, PendingSubagentRequest> {
90 const requests = new Map<ThreadId, PendingSubagentRequest>();
91 let byId: ReadonlyMap<ThreadId, OrchestrationV2ThreadShell> | undefined;
92 const flag = (
93 firstParentId: ThreadId | null,
94 request: PendingSubagentRequest,
95 seen: Set<ThreadId>,
96 ) => {
97 byId ??= new Map(threads.map((thread) => [thread.id, thread] as const));
98 let parentId = firstParentId;
99 while (parentId !== null && !seen.has(parentId)) {
100 seen.add(parentId);
101 if (requests.get(parentId) !== "approval") requests.set(parentId, request);
102 const parent = byId.get(parentId);
103 parentId =
104 parent?.lineage.relationshipToParent === "subagent" ? parent.lineage.parentThreadId : null;
105 }
106 };
107 for (const child of threads) {
108 if (child.lineage.relationshipToParent !== "subagent") continue;
109 const request = subagentRequest(child);
110 if (request !== null) flag(child.lineage.parentThreadId, request, new Set([child.id]));
111 }
112 for (const task of delegated) flag(task.parentThreadId, task.request, new Set());
113 return requests.size === 0 ? EMPTY_SUBAGENT_REQUESTS : requests;
115​
116const sameRequests = (
117 left: ReadonlyMap<ThreadId, PendingSubagentRequest>,
118 right: ReadonlyMap<ThreadId, PendingSubagentRequest>,
119) =>
120 left.size === right.size &&
121 [...right].every(([threadId, request]) => left.get(threadId) === request);
122​
123export function childThreadInputsTitle(
124 children: ReadonlyArray<Pick<EnvironmentThreadShell, "hasPendingApprovals">>,
125): string {
126 const approvals = children.filter((child) => child.hasPendingApprovals).length;
127 const need = approvals === 0 ? "input" : approvals === children.length ? "approval" : "you";
128 return children.length === 1
129 ? `Subagent needs ${need}`
130 : `${children.length} subagents need ${need}`;
132​
133const sameWireThreadShell = Schema.toEquivalence(OrchestrationV2ThreadShell);
134​
135// While a run streams, the server bumps the shell's timestamps, item counts and
136// latest message several times a second. Only the zero crossing of the counts
137// says anything (whether the thread has started). Once the run stops every
138// field counts again, so snooze wakes and failure times read the current value.
139function sameApartFromStreaming(
140 previous: EnvironmentThreadShell,
141 next: EnvironmentThreadShell,
142): boolean {
143 if (
144 previous.environmentId !== next.environmentId ||
145 previous.pendingSubagentRequest !== next.pendingSubagentRequest ||
146 !threadRuntimeIsActive(next.runtime)
147 ) {
148 return false;
149 }
150 const before = previous.source;
151 const after = next.source;
152 return (
153 before.itemCount > 0 === after.itemCount > 0 &&
154 before.visibleItemCount > 0 === after.visibleItemCount > 0 &&
155 sameWireThreadShell(
156 {
157 ...before,
158 updatedAt: after.updatedAt,
159 itemCount: after.itemCount,
160 visibleItemCount: after.visibleItemCount,
161 latestVisibleMessage: after.latestVisibleMessage,
162 },
163 after,
164 )
165 );
167​
168export function createEnvironmentThreadShellAtoms(input: {
169 readonly catalogValueAtom: Atom.Atom<EnvironmentCatalogState>;
170 readonly snapshotAtom: (
171 environmentId: EnvironmentId,
172 ) => Atom.Atom<OrchestrationV2ShellSnapshot | null>;
173}) {
174 // Point reads and aggregate lists share values without keeping an atom alive
175 // for every listed thread. Replaced source objects can be collected.
176 const scopedThreads = new WeakMap<
177 OrchestrationV2ThreadShell,
178 Map<string, EnvironmentThreadShell>
179 >();
180 const scopedThread = (
181 environmentId: EnvironmentId,
182 thread: OrchestrationV2ThreadShell,
183 subagentRequests: ReadonlyMap<ThreadId, PendingSubagentRequest>,
184 ) => {
185 let byEnvironment = scopedThreads.get(thread);
186 if (byEnvironment === undefined) {
187 byEnvironment = new Map();
188 scopedThreads.set(thread, byEnvironment);
189 }
190 const request = subagentRequests.get(thread.id) ?? null;
191 const key = request === null ? environmentId : `${environmentId}:${request}`;
192 let value = byEnvironment.get(key);
193 if (value === undefined) {
194 value = presentThreadShell(environmentId, thread, request);
195 byEnvironment.set(key, value);
196 }
197 return value;
198 };
199​
200 const environmentThreadsAtom = Atom.family((environmentId: EnvironmentId) =>
201 Atom.make(
202 (get): ReadonlyArray<OrchestrationV2ThreadShell> =>
203 get(input.snapshotAtom(environmentId))?.threads ?? EMPTY_THREADS,
204 ).pipe(Atom.withLabel(`environment-threads:${environmentId}`)),
205 );
206​
207 const environmentThreadIndexAtom = Atom.family((environmentId: EnvironmentId) =>
208 Atom.make((get): ReadonlyMap<ThreadId, OrchestrationV2ThreadShell> => {
209 const threads = get(environmentThreadsAtom(environmentId));
210 if (threads.length === 0) {
211 return EMPTY_THREAD_INDEX;
212 }
213 return new Map(threads.map((thread) => [thread.id, thread] as const));
214 }).pipe(Atom.withLabel(`environment-thread-index:${environmentId}`)),
215 );
216​
217 // What an environment's own subagents ask. Kept apart from the tasks other
218 // environments run for it, so two environments delegating to each other
219 // never read each other's totals.
220 const localSubagentRequestsAtom = Atom.family((environmentId: EnvironmentId) => {
221 let previous = EMPTY_SUBAGENT_REQUESTS;
222 return Atom.make((get) => {
223 const next = pendingSubagentRequestsByThread(get(environmentThreadsAtom(environmentId)));
224 if (sameRequests(previous, next)) return previous;
225 previous = next;
226 return next;
227 }).pipe(Atom.withLabel(`environment-local-subagent-requests:${environmentId}`));
228 });
229​
230 // Flags for environments whose threads delegated tasks, counting what each task
231 // or anything it delegated on asks. Each pass settles one more hop of a chain;
232 // flags only grow, so environments delegating to each other settle too.
233 const delegatedSubagentRequestsAtom = Atom.make((get) => {
234 const tasksByDelegator = new Map<
235 EnvironmentId,
236 Array<{
237 readonly runsIn: EnvironmentId;
238 readonly thread: OrchestrationV2ThreadShell;
239 readonly parentThreadId: ThreadId;
240 }>
241 >();
242 for (const runsIn of enabledEnvironmentIds(get(input.catalogValueAtom))) {
243 for (const thread of get(environmentThreadsAtom(runsIn))) {
244 const from = thread.delegatedFrom;
245 if (from === undefined || from.environmentId === runsIn) continue;
246 const task = { runsIn, thread, parentThreadId: from.threadId };
247 const tasks = tasksByDelegator.get(from.environmentId);
248 if (tasks === undefined) tasksByDelegator.set(from.environmentId, [task]);
249 else tasks.push(task);
250 }
251 }
252 let flags = new Map<EnvironmentId, ReadonlyMap<ThreadId, PendingSubagentRequest>>();
253 const requestsOf = (environmentId: EnvironmentId) =>
254 flags.get(environmentId) ?? get(localSubagentRequestsAtom(environmentId));
255 for (let changed = tasksByDelegator.size > 0; changed;) {
256 changed = false;
257 const next = new Map(flags);
258 for (const [environmentId, tasks] of tasksByDelegator) {
259 const delegated = tasks.flatMap(({ runsIn, thread, parentThreadId }) => {
260 const own = subagentRequest(thread);
261 const nested = requestsOf(runsIn).get(thread.id);
262 const request = own === "approval" ? own : (nested ?? own);
263 return request === null ? [] : [{ parentThreadId, request }];
264 });
265 if (delegated.length === 0) continue;
266 const requests = pendingSubagentRequestsByThread(
267 get(environmentThreadsAtom(environmentId)),
268 delegated,
269 );
270 if (sameRequests(requestsOf(environmentId), requests)) continue;
271 next.set(environmentId, requests);
272 changed = true;
273 }
274 flags = next;
275 }
276 return flags;
277 }).pipe(Atom.withLabel("environment-delegated-subagent-requests"));
278​
279 const pendingSubagentRequestsAtom = Atom.family((environmentId: EnvironmentId) => {
280 let previous = EMPTY_SUBAGENT_REQUESTS;
281 return Atom.make((get) => {
282 const next =
283 get(delegatedSubagentRequestsAtom).get(environmentId) ??
284 get(localSubagentRequestsAtom(environmentId));
285 if (sameRequests(previous, next)) return previous;
286 previous = next;
287 return next;
288 }).pipe(Atom.withLabel(`environment-pending-subagent-requests:${environmentId}`));
289 });
290​
291 const environmentThreadRefsAtom = Atom.family((environmentId: EnvironmentId) => {
292 let previous: ReadonlyArray<ScopedThreadRef> = [];
293 return Atom.make((get) => {
294 const next = get(environmentThreadsAtom(environmentId)).map((thread) => ({
295 environmentId,
296 threadId: thread.id,
297 }));
298 if (threadRefsEqual(previous, next)) {
299 return previous;
300 }
301 previous = next;
302 return next;
303 }).pipe(Atom.withLabel(`environment-thread-refs:${environmentId}`));
304 });
305​
306 const environmentThreadRefsByProjectAtom = Atom.family((environmentId: EnvironmentId) => {
307 let previous: ReadonlyMap<
308 ProjectId,
309 ReadonlyArray<ScopedThreadRef>
310 > = EMPTY_THREAD_REFS_BY_PROJECT;
311 return Atom.make((get) => {
312 const grouped = new Map<ProjectId, ScopedThreadRef[]>();
313 for (const thread of get(environmentThreadsAtom(environmentId))) {
314 const refs = grouped.get(thread.projectId);
315 const ref = { environmentId, threadId: thread.id };
316 if (refs === undefined) {
317 grouped.set(thread.projectId, [ref]);
318 } else {
319 refs.push(ref);
320 }
321 }
322 if (grouped.size === 0) {
323 previous = EMPTY_THREAD_REFS_BY_PROJECT;
324 return previous;
325 }
326 const next = new Map<ProjectId, ReadonlyArray<ScopedThreadRef>>();
327 for (const [projectId, refs] of grouped) {
328 const previousRefs = previous.get(projectId);
329 next.set(
330 projectId,
331 previousRefs !== undefined && threadRefsEqual(previousRefs, refs) ? previousRefs : refs,
332 );
333 }
334 const previousProjectIds = [...previous.keys()];
335 if (
336 next.size === previous.size &&
337 [...next].every(
338 ([projectId, refs], index) =>
339 previousProjectIds[index] === projectId && previous.get(projectId) === refs,
340 )
341 ) {
342 return previous;
343 }
344 previous = next;
345 return previous;
346 }).pipe(Atom.withLabel(`environment-thread-refs-by-project:${environmentId}`));
347 });
348​
349 const threadShellAtomFamily = Atom.family((key: string) => {
350 const ref = parseThreadKey(key);
351 return Atom.make((get) => {
352 const source = get(environmentThreadIndexAtom(ref.environmentId)).get(ref.threadId) ?? null;
353 return source === null
354 ? null
355 : scopedThread(
356 ref.environmentId,
357 source,
358 get(pendingSubagentRequestsAtom(ref.environmentId)),
359 );
360 }).pipe(Atom.withLabel(`environment-thread-shell:${key}`));
361 });
362​
363 // Keeps the previous shell while only streaming ticks changed. During a run,
364 // its timestamps, item counts and latest message are as of the last kept
365 // change; anything that needs them current reads threadShellAtom.
366 const quietThreadShellAtomFamily = Atom.family((key: string) => {
367 let previous: EnvironmentThreadShell | null = null;
368 return Atom.make((get) => {
369 const next = get(threadShellAtomFamily(key));
370 if (previous !== null && next !== null && sameApartFromStreaming(previous, next)) {
371 return previous;
372 }
373 previous = next;
374 return next;
375 }).pipe(Atom.withLabel(`environment-quiet-thread-shell:${key}`));
376 });
377​
378 // Child approvals and questions are hidden with their sidebar rows. Read their
379 // shell summaries, without subscribing to every child transcript. A task
380 // delegated to a linked environment is a child too, with its own subagents.
381 const childThreadInputsAtomFamily = Atom.family((key: string) => {
382 let previous: ReadonlyArray<EnvironmentThreadShell> = [];
383 return Atom.make((get) => {
384 const children = new Map<
385 string,
386 Array<{ environmentId: EnvironmentId; thread: OrchestrationV2ThreadShell }>
387 >();
388 const addChild = (
389 parent: ScopedThreadRef,
390 environmentId: EnvironmentId,
391 thread: OrchestrationV2ThreadShell,
392 ) => {
393 const siblings = children.get(threadKey(parent));
394 if (siblings) siblings.push({ environmentId, thread });
395 else children.set(threadKey(parent), [{ environmentId, thread }]);
396 };
397 for (const environmentId of enabledEnvironmentIds(get(input.catalogValueAtom))) {
398 for (const thread of get(environmentThreadsAtom(environmentId))) {
399 const parent = thread.lineage.parentThreadId;
400 if (parent !== null && thread.lineage.relationshipToParent === "subagent") {
401 addChild({ environmentId, threadId: parent }, environmentId, thread);
402 } else if (thread.delegatedFrom !== undefined) {
403 addChild(thread.delegatedFrom, environmentId, thread);
404 }
405 }
406 }
407 const seen = new Set<string>([key]);
408 const pending = [key];
409 const next: EnvironmentThreadShell[] = [];
410 for (const parent of pending) {
411 for (const { environmentId, thread } of children.get(parent) ?? []) {
412 const childKey = threadKey({ environmentId, threadId: thread.id });
413 if (seen.has(childKey)) continue;
414 seen.add(childKey);
415 pending.push(childKey);
416 if (subagentRequest(thread) !== null) {
417 next.push(
418 scopedThread(environmentId, thread, get(pendingSubagentRequestsAtom(environmentId))),
419 );
420 }
421 }
422 }
423 // Indicators read only ids, titles and the request kind, so other shell
424 // updates keep the old array.
425 if (
426 previous.length === next.length &&
427 previous.every(
428 (thread, index) =>
429 thread.environmentId === next[index]?.environmentId &&
430 thread.id === next[index]?.id &&
431 thread.title === next[index]?.title &&
432 thread.hasPendingApprovals === next[index]?.hasPendingApprovals,
433 )
434 ) {
435 return previous;
436 }
437 previous = next;
438 return next;
439 }).pipe(Atom.withLabel(`environment-child-thread-inputs:${key}`));
440 });
441​
442 const threadShellsForProjectRefsAtomFamily = Atom.family((key: string) => {
443 const projectRefs = parseProjectRefCollectionKey(key);
444 let previous: ReadonlyArray<EnvironmentThreadShell> = [];
445 return Atom.make((get) => {
446 const next: EnvironmentThreadShell[] = [];
447 const seen = new Set<string>();
448 for (const projectRef of projectRefs) {
449 const refs =
450 get(environmentThreadRefsByProjectAtom(projectRef.environmentId)).get(
451 projectRef.projectId,
452 ) ?? EMPTY_SCOPED_THREAD_REFS;
453 if (refs.length === 0) continue;
454 const threads = get(environmentThreadIndexAtom(projectRef.environmentId));
455 const subagentRequests = get(pendingSubagentRequestsAtom(projectRef.environmentId));
456 for (const ref of refs) {
457 const key = threadKey(ref);
458 if (seen.has(key)) {
459 continue;
460 }
461 seen.add(key);
462 const thread = threads.get(ref.threadId);
463 if (thread !== undefined) {
464 next.push(scopedThread(ref.environmentId, thread, subagentRequests));
465 }
466 }
467 }
468 if (arrayElementsEqual(previous, next)) {
469 return previous;
470 }
471 previous = next;
472 return previous;
473 }).pipe(Atom.withLabel(`environment-thread-shells-for-projects:${key}`));
474 });
475​
476 let previousThreadRefs: ReadonlyArray<ScopedThreadRef> = [];
477 const threadRefsAtom = Atom.make((get) => {
478 const refs: ScopedThreadRef[] = [];
479 for (const environmentId of enabledEnvironmentIds(get(input.catalogValueAtom))) {
480 refs.push(...get(environmentThreadRefsAtom(environmentId)));
481 }
482 if (threadRefsEqual(previousThreadRefs, refs)) {
483 return previousThreadRefs;
484 }
485 previousThreadRefs = refs;
486 return refs;
487 }).pipe(Atom.withLabel("environment-thread-refs"));
488​
489 let previousThreadShells: ReadonlyArray<EnvironmentThreadShell> = [];
490 const threadShellsAtom = Atom.make((get) => {
491 const next: EnvironmentThreadShell[] = [];
492 for (const environmentId of enabledEnvironmentIds(get(input.catalogValueAtom))) {
493 const subagentRequests = get(pendingSubagentRequestsAtom(environmentId));
494 for (const thread of get(environmentThreadsAtom(environmentId))) {
495 next.push(scopedThread(environmentId, thread, subagentRequests));
496 }
497 }
498 if (arrayElementsEqual(previousThreadShells, next)) {
499 return previousThreadShells;
500 }
501 previousThreadShells = next;
502 return previousThreadShells;
503 }).pipe(Atom.withLabel("environment-thread-shell-list"));
504​
505 // Lists that arrange threads read this, so a running thread's streaming
506 // ticks reach only what reads its live shell.
507 let previousQuietThreadShells: ReadonlyArray<EnvironmentThreadShell> = [];
508 const quietThreadShellsAtom = Atom.make((get) => {
509 const next: EnvironmentThreadShell[] = [];
510 for (const ref of get(threadRefsAtom)) {
511 const shell = get(quietThreadShellAtomFamily(threadKey(ref)));
512 if (shell !== null) next.push(shell);
513 }
514 if (arrayElementsEqual(previousQuietThreadShells, next)) return previousQuietThreadShells;
515 previousQuietThreadShells = next;
516 return next;
517 }).pipe(Atom.withLabel("environment-quiet-thread-shell-list"));
518​
519 let previousDelegatedUnderParent: ReadonlySet<string> = new Set();
520 const delegatedUnderParentAtom = Atom.make((get) => {
521 const environmentIds = new Set(enabledEnvironmentIds(get(input.catalogValueAtom)));
522 const next = new Set<string>();
523 for (const environmentId of environmentIds) {
524 for (const thread of get(environmentThreadsAtom(environmentId))) {
525 const parent = thread.delegatedFrom;
526 if (
527 parent !== undefined &&
528 environmentIds.has(parent.environmentId) &&
529 // An archived parent leaves navigation; its task there stays listed on its own.
530 get(environmentThreadIndexAtom(parent.environmentId)).get(parent.threadId)?.archivedAt ===
531 null
532 ) {
533 next.add(threadKey({ environmentId, threadId: thread.id }));
534 }
535 }
536 }
537 if (
538 next.size === previousDelegatedUnderParent.size &&
539 [...next].every((key) => previousDelegatedUnderParent.has(key))
540 ) {
541 return previousDelegatedUnderParent;
542 }
543 previousDelegatedUnderParent = next;
544 return next;
545 }).pipe(Atom.withLabel("environment-delegated-under-parent"));
546​
547 let previousNavigationShells: ReadonlyArray<EnvironmentThreadShell> = [];
548 const navigationThreadShellsAtom = Atom.make((get) => {
549 const next: EnvironmentThreadShell[] = [];
550 const underParent = get(delegatedUnderParentAtom);
551 for (const environmentId of enabledEnvironmentIds(get(input.catalogValueAtom))) {
552 const subagentRequests = get(pendingSubagentRequestsAtom(environmentId));
553 for (const thread of get(environmentThreadsAtom(environmentId))) {
554 if (
555 thread.archivedAt !== null ||
556 isShownUnderParent({ environmentId, threadId: thread.id }, thread.lineage, underParent)
557 ) {
558 continue;
559 }
560 next.push(scopedThread(environmentId, thread, subagentRequests));
561 }
562 }
563 if (arrayElementsEqual(previousNavigationShells, next)) return previousNavigationShells;
564 previousNavigationShells = next;
565 return next;
566 }).pipe(Atom.withLabel("environment-navigation-thread-shells"));
567​
568 return {
569 environmentThreadsAtom,
570 environmentThreadIndexAtom,
571 environmentThreadRefsAtom,
572 environmentThreadRefsByProjectAtom,
573 threadRefsAtom,
574 threadShellsAtom,
575 quietThreadShellsAtom,
576 navigationThreadShellsAtom,
577 delegatedUnderParentAtom,
578 pendingSubagentRequestsAtom,
579 threadShellsForProjectRefsAtom: (refs: ReadonlyArray<ScopedProjectRef>) =>
580 threadShellsForProjectRefsAtomFamily(projectRefCollectionKey(refs)),
581 threadShellAtom: (ref: ScopedThreadRef) => threadShellAtomFamily(threadKey(ref)),
582 quietThreadShellAtom: (ref: ScopedThreadRef) => quietThreadShellAtomFamily(threadKey(ref)),
583 childThreadInputsAtom: (ref: ScopedThreadRef) => childThreadInputsAtomFamily(threadKey(ref)),
584 };