Open History to see the last commit
1/**
2 * ThreadBootstrap - Create-and-start sequence for a thread's first turn.
3 *
4 * Runs the `thread.turn.start` bootstrap: create the thread, prepare a
5 * worktree, run the setup script, then dispatch the turn.
6 *
7 * @module ThreadBootstrap
8 */
9import type {
10 OrchestrationClientOrigin,
11 OrchestrationCommand,
12 OrchestrationDispatchCommandError,
13} from "@t3tools/contracts";
14import * as Context from "effect/Context";
15import type * as Effect from "effect/Effect";
16
17export type ThreadTurnStartCommand = Extract<OrchestrationCommand, { type: "thread.turn.start" }>;
18
19export interface ThreadBootstrapShape {
20 readonly dispatchTurnStart: (
21 command: ThreadTurnStartCommand,
22 options?: { readonly origin?: OrchestrationClientOrigin },
23 ) => Effect.Effect<{ readonly sequence: number }, OrchestrationDispatchCommandError>;
24}
25
26export class ThreadBootstrap extends Context.Service<ThreadBootstrap, ThreadBootstrapShape>()(
27 "t3/orchestration/Services/ThreadBootstrap",
28) {}