mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 20:53:00 +00:00
* fix(hopper): report unavailable procedure body coverage * refactor!: simplify runtime tools and remove replay engines Keep direct inspection, capture, and comparison tools. Bind handlers to named contracts and let agents compose experiments with commands and local fixture servers. BREAKING CHANGE: Remove controlled replay, Node characterization, finite replay-machine, managed runtime planning, and redundant string-tracing tools. Retire process replay, shims, reactive scenarios, custom checkpoints, and active browser replay and origin-scope inputs.
67 lines
1.8 KiB
TypeScript
67 lines
1.8 KiB
TypeScript
import { z } from "zod";
|
|
|
|
const categorySchema = z.enum([
|
|
"invalid_input",
|
|
"unsupported_provider",
|
|
"integrity_mismatch",
|
|
"truncated",
|
|
"cancelled",
|
|
"timeout",
|
|
"unavailable",
|
|
"execution_failure",
|
|
]);
|
|
const remediationSchema = z
|
|
.object({
|
|
action: z.string().min(1),
|
|
})
|
|
.strict();
|
|
const common = {
|
|
category: categorySchema,
|
|
message: z.string().min(1),
|
|
retryable: z.boolean(),
|
|
remediation: remediationSchema,
|
|
};
|
|
const genericDetails = z.record(z.string(), z.json()).optional();
|
|
const generic = <Code extends string>(code: Code) =>
|
|
z
|
|
.object({ code: z.literal(code), ...common, details: genericDetails })
|
|
.strict();
|
|
|
|
/** Stable discriminated schema shared by every CLI and MCP error surface. */
|
|
export const analysisErrorProjectionSchema = z.discriminatedUnion("code", [
|
|
generic("invalid_request"),
|
|
generic("unreadable_output"),
|
|
generic("capability_unavailable"),
|
|
generic("provider_unavailable"),
|
|
generic("provider_timeout"),
|
|
generic("cancelled"),
|
|
z
|
|
.object({
|
|
code: z.literal("artifact_integrity_mismatch"),
|
|
...common,
|
|
details: z
|
|
.object({
|
|
logical_path: z.string(),
|
|
declared_sha256: z.string().nullable(),
|
|
calculated_sha256: z.string().nullable(),
|
|
unpacked: z.boolean(),
|
|
})
|
|
.strict(),
|
|
})
|
|
.strict(),
|
|
generic("artifact_operation_failed"),
|
|
generic("evidence_integrity_mismatch"),
|
|
generic("truncated"),
|
|
generic("process_capture_failed"),
|
|
generic("cleanup_incomplete"),
|
|
generic("revision_conflict"),
|
|
generic("configuration_invalid"),
|
|
generic("target_unavailable"),
|
|
generic("execution_failure"),
|
|
]);
|
|
|
|
/** JSON Schema document used by generated API documentation and clients. */
|
|
export const analysisErrorJsonSchema = z.toJSONSchema(
|
|
analysisErrorProjectionSchema,
|
|
);
|