- Schema.UnknownFromJsonString -> Schema.fromJsonString(Schema.Unknown) - SchemaIssue.InvalidValue single-argument form in checkpointDiff - McpServerClient requires protocolVersion Co-Authored-By: Claude Fable 5 <[email protected]>
66 lines
2.1 KiB
TypeScript
66 lines
2.1 KiB
TypeScript
import * as Schema from "effect/Schema";
|
|
import * as SchemaIssue from "effect/SchemaIssue";
|
|
import * as Struct from "effect/Struct";
|
|
|
|
import { NonNegativeInt, ThreadId, TrimmedNonEmptyString } from "./baseSchemas.ts";
|
|
|
|
export const TurnCountRange = Schema.Struct({
|
|
fromTurnCount: NonNegativeInt,
|
|
toTurnCount: NonNegativeInt,
|
|
}).check(
|
|
Schema.makeFilter(
|
|
(input) =>
|
|
input.fromTurnCount <= input.toTurnCount ||
|
|
new SchemaIssue.InvalidValue({
|
|
message: "fromTurnCount must be less than or equal to toTurnCount",
|
|
}),
|
|
{ identifier: "OrchestrationTurnDiffRange" },
|
|
),
|
|
);
|
|
|
|
export const ThreadTurnDiff = TurnCountRange.mapFields(
|
|
Struct.assign({
|
|
threadId: ThreadId,
|
|
diff: Schema.String,
|
|
}),
|
|
{ unsafePreserveChecks: true },
|
|
);
|
|
|
|
export const OrchestrationGetTurnDiffInput = TurnCountRange.mapFields(
|
|
Struct.assign({
|
|
threadId: ThreadId,
|
|
ignoreWhitespace: Schema.optionalKey(Schema.Boolean),
|
|
}),
|
|
{ unsafePreserveChecks: true },
|
|
);
|
|
export type OrchestrationGetTurnDiffInput = typeof OrchestrationGetTurnDiffInput.Type;
|
|
|
|
export const OrchestrationGetTurnDiffResult = ThreadTurnDiff;
|
|
export type OrchestrationGetTurnDiffResult = typeof OrchestrationGetTurnDiffResult.Type;
|
|
|
|
export const OrchestrationGetFullThreadDiffInput = Schema.Struct({
|
|
threadId: ThreadId,
|
|
toTurnCount: NonNegativeInt,
|
|
ignoreWhitespace: Schema.optionalKey(Schema.Boolean),
|
|
});
|
|
export type OrchestrationGetFullThreadDiffInput = typeof OrchestrationGetFullThreadDiffInput.Type;
|
|
|
|
export const OrchestrationGetFullThreadDiffResult = ThreadTurnDiff;
|
|
export type OrchestrationGetFullThreadDiffResult = typeof OrchestrationGetFullThreadDiffResult.Type;
|
|
|
|
export class OrchestrationGetTurnDiffError extends Schema.TaggedErrorClass<OrchestrationGetTurnDiffError>()(
|
|
"OrchestrationGetTurnDiffError",
|
|
{
|
|
message: TrimmedNonEmptyString,
|
|
cause: Schema.optional(Schema.Defect()),
|
|
},
|
|
) {}
|
|
|
|
export class OrchestrationGetFullThreadDiffError extends Schema.TaggedErrorClass<OrchestrationGetFullThreadDiffError>()(
|
|
"OrchestrationGetFullThreadDiffError",
|
|
{
|
|
message: TrimmedNonEmptyString,
|
|
cause: Schema.optional(Schema.Defect()),
|
|
},
|
|
) {}
|