Files
reverse-engineering-anything/src/domain/commandObservation.ts
T
gensokyo-dev 17f581ff75 perf(reverse): add retained GDB and objdump summaries (#5614)
Add opt-in retained GDB and objdump summaries using the shared analysis-view layer. Preserve default complete Evidence, ordered records, provenance and completion facts.

Validate real Bash disassembly, whole-client context costs, CLI publication and cleanup; retain the original measured cohorts and explicit coverage limitations.

Closes #5584.
2026-10-21 01:20:52 +08:00

45 lines
1.6 KiB
TypeScript

import { z } from "zod";
/** Opaque producer text and the command capture's explicit completion facts. */
export const commandObservationSchema = z.strictObject({
stdout: z.string(),
stderr: z.string(),
exit_code: z.union([z.string(), z.number(), z.null()]),
signal: z.string().nullable(),
output_truncated: z.boolean(),
completion_status: z.enum(["complete", "unknown"]),
artifact_sha256_after: z
.string()
.regex(/^[a-f0-9]{64}$/u)
.nullable(),
artifact_changed: z.boolean().nullable(),
});
/** The GDB owner retains ordered records and derives its stream groupings. */
export const gdbCommandResultSchema = z.strictObject({
command: z.string(),
mi: z.string(),
records: z.array(z.string()),
console: z.string(),
target: z.string(),
log: z.string(),
process_exit_observed: z.boolean().exactOptional(),
process_exit_code: z.number().int().nullable().exactOptional(),
process_exit_signal: z.string().nullable().exactOptional(),
output_truncated: z.boolean(),
output_invalid_utf8: z.literal(true).exactOptional(),
completion_status: z.enum(["complete", "unknown"]),
});
/** Read-only capture facts; protocol interpretation stays with the provider. */
export type GdbCommandResult = Readonly<
Omit<z.infer<typeof gdbCommandResultSchema>, "records">
> & { readonly records: readonly string[] };
export const commandEvidenceDetailSchema = z
.enum(["complete", "summary"])
.default("complete")
.describe(
"complete returns the original Evidence; summary retains that complete parent and returns command output once with completion and source context.",
);