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

CheckpointDiffQuery.ts

49 lines1.5 KB

1/**
2 * CheckpointDiffQuery - Query interface for computed checkpoint diffs.
3 *
4 * Provides read-only diff operations across checkpoint snapshots used by
5 * orchestration APIs.
6 *
7 * @module CheckpointDiffQuery
8 */
9import type {
10 OrchestrationGetFullThreadDiffInput,
11 OrchestrationGetFullThreadDiffResult,
12 OrchestrationGetTurnDiffInput,
13 OrchestrationGetTurnDiffResult,
14} from "@t3tools/contracts";
15import { Context } from "effect";
16import type { Effect } from "effect";
17​
18import type { CheckpointServiceError } from "../Errors.ts";
19​
20/**
21 * CheckpointDiffQueryShape - Service API for checkpoint diff queries.
22 */
23export interface CheckpointDiffQueryShape {
24 /**
25 * Read the patch diff for a single turn checkpoint transition.
26 *
27 * Verifies checkpoint availability in both projection state and filesystem.
28 */
29 readonly getTurnDiff: (
30 input: OrchestrationGetTurnDiffInput,
31 ) => Effect.Effect<OrchestrationGetTurnDiffResult, CheckpointServiceError>;
32​
33 /**
34 * Read the full patch diff across a thread range of checkpoints.
35 *
36 * Delegates to turn diff with `fromTurnCount = 0`.
37 */
38 readonly getFullThreadDiff: (
39 input: OrchestrationGetFullThreadDiffInput,
40 ) => Effect.Effect<OrchestrationGetFullThreadDiffResult, CheckpointServiceError>;
42​
43/**
44 * CheckpointDiffQuery - Service tag for checkpoint diff queries.
45 */
46export class CheckpointDiffQuery extends Context.Service<
47 CheckpointDiffQuery,
48 CheckpointDiffQueryShape
49>()("t3/checkpointing/Services/CheckpointDiffQuery") {}