MAX_MEDIA_MEGABYTES (read-media-file/read-media-file.ts)

kimi-code · packages/agent-core-v2/src/agent/tools/read-media-file/read-media-file.ts · typescript · MIT
ai

Defines media size limits and a Zod schema for reading media files.

// Source: https://github.com/MoonshotAI/kimi-code | License: MIT | Copyright 2026 Moonshot AI
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from 'zod';

import type { VideoURLPart } from '#human/llm/message';
import type { VideoUploadInput as ProviderVideoUploadInput } from '#human/llm/media/upload';

export const MAX_MEDIA_MEGABYTES = 100;
export const MAX_MEDIA_BYTES = MAX_MEDIA_MEGABYTES * 1024 * 1024;

export type VideoUploadInput = ProviderVideoUploadInput;

export type VideoUploader = (
  input: VideoUploadInput,
  options?: { readonly signal?: AbortSignal },
) => Promise<VideoURLPart>;

export const ReadMediaFileInputSchema = z.object({
  path: z
    .string()
    .describe(
      'Path to an image or video file, or a kimi-file:// attachment referenc

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key