The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | import * as Schema from "effect/Schema"; |
| 2 | import * as SchemaIssue from "effect/SchemaIssue"; |
| 3 | import * as Struct from "effect/Struct"; |
| 4 | |
| 5 | import { NonNegativeInt, ThreadId, TrimmedNonEmptyString } from "./baseSchemas.ts"; |
| 6 | |
| 7 | /** Ends a checkpoint diff the server cut off at its output size limit. */ |
| 8 | export const CHECKPOINT_DIFF_TRUNCATED_MARKER = "\n\n[truncated]"; |
| 9 | |
| 10 | export const TurnCountRange = Schema.Struct({ |
| 11 | fromTurnCount: NonNegativeInt, |
| 12 | toTurnCount: NonNegativeInt, |
| 13 | }).check( |
| 14 | Schema.makeFilter( |
| 15 | (input) => |
| 16 | input.fromTurnCount <= input.toTurnCount || |
| 17 | new SchemaIssue.InvalidValue({ |
| 18 | message: "fromTurnCount must be less than or equal to toTurnCount", |
| 19 | }), |
| 20 | { identifier: "OrchestrationTurnDiffRange" }, |
| 21 | ), |
| 22 | ); |
| 23 | |
| 24 | export const ThreadTurnDiff = TurnCountRange.mapFields( |
| 25 | Struct.assign({ |
| 26 | threadId: ThreadId, |
| 27 | diff: Schema.String, |
| 28 | }), |
| 29 | { unsafePreserveChecks: true }, |
| 30 | ); |
| 31 | |
| 32 | export const OrchestrationGetTurnDiffInput = TurnCountRange.mapFields( |
| 33 | Struct.assign({ |
| 34 | threadId: ThreadId, |
| 35 | ignoreWhitespace: Schema.optionalKey(Schema.Boolean), |
| 36 | }), |
| 37 | { unsafePreserveChecks: true }, |
| 38 | ); |
| 39 | export type OrchestrationGetTurnDiffInput = typeof OrchestrationGetTurnDiffInput.Type; |
| 40 | |
| 41 | export const OrchestrationGetTurnDiffResult = ThreadTurnDiff; |
| 42 | export type OrchestrationGetTurnDiffResult = typeof OrchestrationGetTurnDiffResult.Type; |
| 43 | |
| 44 | export const OrchestrationGetFullThreadDiffInput = Schema.Struct({ |
| 45 | threadId: ThreadId, |
| 46 | toTurnCount: NonNegativeInt, |
| 47 | ignoreWhitespace: Schema.optionalKey(Schema.Boolean), |
| 48 | }); |
| 49 | export type OrchestrationGetFullThreadDiffInput = typeof OrchestrationGetFullThreadDiffInput.Type; |
| 50 | |
| 51 | export const OrchestrationGetFullThreadDiffResult = ThreadTurnDiff; |
| 52 | export type OrchestrationGetFullThreadDiffResult = typeof OrchestrationGetFullThreadDiffResult.Type; |
| 53 | |
| 54 | export class OrchestrationGetTurnDiffError extends Schema.TaggedError<OrchestrationGetTurnDiffError>()( |
| 55 | "OrchestrationGetTurnDiffError", |
| 56 | { |
| 57 | message: TrimmedNonEmptyString, |
| 58 | cause: Schema.optional(Schema.Defect()), |
| 59 | }, |
| 60 | ) {} |
| 61 | |
| 62 | export class OrchestrationGetFullThreadDiffError extends Schema.TaggedError<OrchestrationGetFullThreadDiffError>()( |
| 63 | "OrchestrationGetFullThreadDiffError", |
| 64 | { |
| 65 | message: TrimmedNonEmptyString, |
| 66 | cause: Schema.optional(Schema.Defect()), |
| 67 | }, |
| 68 | ) {} |