execution-output-preview.ts 568 B

1234567891011121314
  1. import { z } from "zod";
  2. const OUTPUT_PREVIEW_MAX_CHARACTERS = 4096;
  3. /** 两端共用的 Bash 有界输出内容;不包含 replayable 传输恢复状态。 */
  4. export const executionOutputPreviewSchema = z
  5. .object({
  6. text: z.string().max(OUTPUT_PREVIEW_MAX_CHARACTERS),
  7. fullText: z.string().max(OUTPUT_PREVIEW_MAX_CHARACTERS),
  8. totalLines: z.number().int().nonnegative(),
  9. totalBytes: z.number().int().nonnegative(),
  10. linesEstimated: z.boolean(),
  11. })
  12. .strict();
  13. export type ExecutionOutputPreview = z.infer<typeof executionOutputPreviewSchema>;