UNPKG

@mondaydotcomorg/atp-protocol

Version:

Core protocol types and interfaces for Agent Tool Protocol

76 lines 3.06 kB
/** * Input validation utilities for ExecutionConfig and other types */ import { z } from 'zod'; import type { ExecutionConfig } from './types.js'; /** * Maximum allowed code size (1MB) */ export declare const MAX_CODE_SIZE = 1000000; export declare class ConfigValidationError extends Error { readonly field: string; readonly value: unknown; constructor(message: string, field: string, value: unknown); } export declare class SecurityViolationError extends Error { readonly violations: string[]; constructor(message: string, violations: string[]); } /** * Sanitizes input string by removing control characters and normalizing whitespace */ export declare function sanitizeInput(input: string, maxLength?: number): string; /** * Frames user code in a secure execution context to prevent injection attacks * Similar to SQL parameterized queries - treats user code as data within a safe boundary */ export declare function frameCodeExecution(userCode: string): string; /** * Zod schema for ExecutionConfig validation */ export declare const executionConfigSchema: z.ZodObject<{ timeout: z.ZodOptional<z.ZodNumber>; maxMemory: z.ZodOptional<z.ZodNumber>; maxLLMCalls: z.ZodOptional<z.ZodNumber>; allowedAPIs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>; allowLLMCalls: z.ZodOptional<z.ZodBoolean>; progressCallback: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>; customLLMHandler: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>; clientServices: z.ZodOptional<z.ZodAny>; provenanceMode: z.ZodOptional<z.ZodAny>; securityPolicies: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>; provenanceHints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { timeout?: number | undefined; maxMemory?: number | undefined; maxLLMCalls?: number | undefined; allowedAPIs?: string[] | undefined; allowLLMCalls?: boolean | undefined; progressCallback?: ((...args: unknown[]) => unknown) | undefined; customLLMHandler?: ((...args: unknown[]) => unknown) | undefined; clientServices?: any; provenanceMode?: any; securityPolicies?: any[] | undefined; provenanceHints?: string[] | undefined; }, { timeout?: number | undefined; maxMemory?: number | undefined; maxLLMCalls?: number | undefined; allowedAPIs?: string[] | undefined; allowLLMCalls?: boolean | undefined; progressCallback?: ((...args: unknown[]) => unknown) | undefined; customLLMHandler?: ((...args: unknown[]) => unknown) | undefined; clientServices?: any; provenanceMode?: any; securityPolicies?: any[] | undefined; provenanceHints?: string[] | undefined; }>; /** * Validates ExecutionConfig parameters using Zod */ export declare function validateExecutionConfig(config: Partial<ExecutionConfig>): void; /** * Validates client ID format */ export declare function validateClientId(clientId: string): void; //# sourceMappingURL=validation.d.ts.map