- Add `thread.proposed-plan-upserted` orchestration flow from ingestion through decider/projector - Store proposed plans in a dedicated projection table and include them in snapshot queries - Update provider runtime/web handling and tests to use proposed plans instead of assistant message wrappers
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
import {
|
|
IsoDateTime,
|
|
OrchestrationProposedPlanId,
|
|
ThreadId,
|
|
TrimmedNonEmptyString,
|
|
TurnId,
|
|
} from "@t3tools/contracts";
|
|
import { Schema, ServiceMap } from "effect";
|
|
import type { Effect } from "effect";
|
|
|
|
import type { ProjectionRepositoryError } from "../Errors.ts";
|
|
|
|
export const ProjectionThreadProposedPlan = Schema.Struct({
|
|
planId: OrchestrationProposedPlanId,
|
|
threadId: ThreadId,
|
|
turnId: Schema.NullOr(TurnId),
|
|
planMarkdown: TrimmedNonEmptyString,
|
|
createdAt: IsoDateTime,
|
|
updatedAt: IsoDateTime,
|
|
});
|
|
export type ProjectionThreadProposedPlan = typeof ProjectionThreadProposedPlan.Type;
|
|
|
|
export const ListProjectionThreadProposedPlansInput = Schema.Struct({
|
|
threadId: ThreadId,
|
|
});
|
|
export type ListProjectionThreadProposedPlansInput =
|
|
typeof ListProjectionThreadProposedPlansInput.Type;
|
|
|
|
export const DeleteProjectionThreadProposedPlansInput = Schema.Struct({
|
|
threadId: ThreadId,
|
|
});
|
|
export type DeleteProjectionThreadProposedPlansInput =
|
|
typeof DeleteProjectionThreadProposedPlansInput.Type;
|
|
|
|
export interface ProjectionThreadProposedPlanRepositoryShape {
|
|
readonly upsert: (
|
|
proposedPlan: ProjectionThreadProposedPlan,
|
|
) => Effect.Effect<void, ProjectionRepositoryError>;
|
|
readonly listByThreadId: (
|
|
input: ListProjectionThreadProposedPlansInput,
|
|
) => Effect.Effect<ReadonlyArray<ProjectionThreadProposedPlan>, ProjectionRepositoryError>;
|
|
readonly deleteByThreadId: (
|
|
input: DeleteProjectionThreadProposedPlansInput,
|
|
) => Effect.Effect<void, ProjectionRepositoryError>;
|
|
}
|
|
|
|
export class ProjectionThreadProposedPlanRepository extends ServiceMap.Service<
|
|
ProjectionThreadProposedPlanRepository,
|
|
ProjectionThreadProposedPlanRepositoryShape
|
|
>()(
|
|
"t3/persistence/Services/ProjectionThreadProposedPlans/ProjectionThreadProposedPlanRepository",
|
|
) {}
|