/** * SkillKit Core Types * Complete TypeScript definitions for the SkillKit runtime system. * Covers skill definitions, configuration, execution, and security. */ /** * Supported AI model providers */ export declare enum ModelProvider { OPENAI = "openai", ANTHROPIC = "anthropic", GOOGLE = "google", OLLAMA = "ollama", DEEPSEEK = "deepseek", QWEN = "qwen", GROQ = "groq", TOGETHER = "together", FIREWORKS = "fireworks", LOCAL = "local" } /** * Threat severity levels for security scanning */ export declare enum ThreatLevel { CRITICAL = "CRITICAL", HIGH = "HIGH", MEDIUM = "MEDIUM", LOW = "LOW", SAFE = "SAFE" } /** * Multi-channel message types */ export declare enum ChannelType { CLI = "cli", WHATSAPP = "whatsapp", TELEGRAM = "telegram", DISCORD = "discord", SLACK = "slack" } /** * Tool definition as specified in SKILL.md */ export interface SkillTool { /** Tool name - must be unique within skill */ name: string; /** Human-readable description */ description: string; /** Tool input parameters schema (JSON Schema format) */ inputSchema: Record; /** Optional: Example usage */ example?: string; /** Optional: Tool-specific security restrictions */ securityLevel?: 'public' | 'restricted' | 'admin'; } /** * Input parameter definition with validation */ export interface SkillInput { /** Parameter name */ name: string; /** Data type: string, number, boolean, array, object */ type: 'string' | 'number' | 'boolean' | 'array' | 'object'; /** Human-readable description */ description: string; /** Whether this parameter is required */ required: boolean; /** Default value if not provided */ default?: unknown; /** JSON Schema constraints (minLength, maxLength, pattern, etc.) */ schema?: Record; /** Example value */ example?: unknown; } /** * Output specification */ export interface SkillOutput { /** Output name/key */ name: string; /** Data type returned */ type: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'stream'; /** Human-readable description */ description: string; /** JSON Schema for validation */ schema?: Record; /** Example output */ example?: unknown; } /** * Model requirements from SKILL.md */ export interface ModelRequirements { /** Minimum context window size */ minContextWindow?: number; /** Whether tool/function calling is required */ requiresTools?: boolean; /** Required provider capability flags */ capabilities?: string[]; /** Recommended model for optimal performance */ recommended?: string; /** Minimum model size (parameters) */ minSize?: 'tiny' | 'small' | 'medium' | 'large' | 'xlarge'; } /** * Parsed SKILL.md file structure */ export interface SkillDefinition { /** Skill metadata from frontmatter */ metadata: { /** Skill name (unique identifier) */ name: string; /** Human-readable title */ title?: string; /** Detailed description of what skill does */ description: string; /** Semantic version following semver */ version: string; /** Skill author/creator */ author: string; /** List of semantic tags for discovery */ tags: string[]; /** License type (MIT, Apache-2.0, etc.) */ license?: string; /** Homepage or documentation URL */ homepage?: string; /** Model requirements and constraints */ modelRequirements?: ModelRequirements; /** Estimated execution time in ms */ estimatedRuntime?: number; /** Supported input/output channels */ channels?: ChannelType[]; /** Whether skill requires authentication */ requiresAuth?: boolean; /** Cost per execution (if applicable) */ costPerExecution?: number; /** Custom metadata */ custom?: Record; }; /** System prompt for model - defines behavior */ systemPrompt: string; /** Main instructions for the task */ instructions: string; /** Input parameters specification */ inputs: SkillInput[]; /** Expected outputs specification */ outputs: SkillOutput[]; /** Tools/functions the skill can use */ tools?: SkillTool[]; /** Usage examples */ examples: SkillExample[]; /** Raw body content (markdown) */ body: string; /** Original file path */ filepath?: string; /** Parsed timestamp */ parsedAt?: Date; /** Raw frontmatter content */ rawFrontmatter?: string; } /** * Usage example for documentation */ export interface SkillExample { /** Example title/description */ title: string; /** Input values for the example */ input: Record; /** Expected output */ expectedOutput: Record; /** Example explanation */ explanation?: string; } /** * Model-specific configuration */ export interface ModelConfig { /** API key for authentication */ apiKey?: string; /** Custom API endpoint URL */ baseUrl?: string; /** Specific model identifier */ model: string; /** Sampling temperature (0-2) */ temperature?: number; /** Top-p nucleus sampling */ topP?: number; /** Top-k sampling */ topK?: number; /** Maximum tokens for completion */ maxTokens?: number; /** Stop sequences */ stopSequences?: string[]; /** Whether to use caching (if supported) */ useCache?: boolean; /** Provider-specific options */ providerOptions?: Record; } /** * Global SkillKit runtime configuration */ export interface SkillKitConfig { /** Default model provider */ defaultProvider: ModelProvider; /** Model configurations per provider */ models: Record; /** Preferred language for outputs */ language: string; /** Enable sandboxing for security */ sandbox: boolean; /** Default execution timeout in ms */ timeout: number; /** Default max tokens per execution */ maxTokens: number; /** Directory for installed skills */ skillsDirectory: string; /** ClawHub registry base URL */ clawHubUrl: string; /** Security scan level: strict, normal, permissive */ securityLevel: 'strict' | 'normal' | 'permissive'; /** Enable telemetry/analytics */ telemetry: boolean; /** Current user/agent identifier */ userId?: string; /** Custom configuration */ custom?: Record; } /** * Individual security threat finding */ export interface Threat { /** Type of threat (injection, exec, privesc, etc.) */ type: string; /** Severity level */ severity: ThreatLevel; /** Detailed description of the threat */ description: string; /** Line number in source (if applicable) */ line?: number; /** Evidence excerpt showing the threat */ evidence: string; /** Recommended remediation */ recommendation?: string; /** Whether threat is blocking (prevents execution) */ isBlocking: boolean; } /** * SkillGuard security scan result */ export interface SecurityReport { /** Overall safety score 0-100 */ score: number; /** Overall safety verdict */ safe: boolean; /** Timestamp of scan */ scannedAt: Date; /** List of detected threats */ threats: Threat[]; /** Security recommendations */ recommendations: string[]; /** Which security rules were checked */ rulesChecked: string[]; /** Scan duration in ms */ duration: number; /** Skill hash for caching results */ skillHash?: string; } /** * Unified message format across channels */ export interface ChannelMessage { /** Channel type */ channel: ChannelType; /** Message content */ content: string; /** Optional message metadata */ metadata?: { /** Message sender/user ID */ userId?: string; /** Message thread ID (for channels supporting threads) */ threadId?: string; /** Timestamp */ timestamp?: Date; /** Custom channel-specific data */ custom?: Record; }; } /** * Tool call made during skill execution */ export interface ToolCall { /** Tool name being called */ toolName: string; /** Input arguments */ arguments: Record; /** Execution status */ status: 'pending' | 'executing' | 'completed' | 'failed'; /** Tool result */ result?: unknown; /** Error if execution failed */ error?: string; /** Execution duration in ms */ duration?: number; } /** * Skill execution result */ export interface SkillExecutionResult { /** Whether execution succeeded */ success: boolean; /** Execution status */ status: 'pending' | 'running' | 'completed' | 'failed' | 'timeout'; /** Primary output from skill */ output?: Record; /** Structured outputs */ outputs: Record; /** Execution error (if failed) */ error?: Error | string; /** Tool calls made during execution */ toolCalls?: ToolCall[]; /** Model used for execution */ modelUsed: string; /** Token usage */ usage?: { /** Tokens in prompt */ promptTokens: number; /** Tokens in completion */ completionTokens: number; /** Total tokens */ totalTokens: number; }; /** Execution time in ms */ duration: number; /** Raw model response (if available) */ rawResponse?: string; /** Skill that was executed */ skill: SkillDefinition; /** Input provided to skill */ input: Record; /** Execution timestamp */ executedAt: Date; } /** * Stream chunk during skill execution */ export interface SkillStreamChunk { /** Chunk type */ type: 'start' | 'content' | 'toolCall' | 'toolResult' | 'complete' | 'error'; /** Chunk content */ content?: string; /** For tool calls */ toolCall?: ToolCall; /** For errors */ error?: Error | string; /** Cumulative usage to this point */ usage?: { promptTokens: number; completionTokens: number; totalTokens: number; }; } /** * Skill from ClawHub registry */ export interface HubSkill { /** Unique skill identifier */ id: string; /** Skill name */ name: string; /** Display title */ title: string; /** Short description */ description: string; /** Semantic version */ version: string; /** Skill author */ author: string; /** Download URL for SKILL.md */ downloadUrl: string; /** Documentation URL */ documentationUrl?: string; /** Tags for discovery */ tags: string[]; /** Download count */ downloads: number; /** Average user rating 0-5 */ rating?: number; /** License type */ license: string; /** When skill was published */ publishedAt: Date; /** When skill was last updated */ updatedAt: Date; /** Whether skill is verified/official */ verified: boolean; } /** * Result of ClawHub search */ export interface HubSearchResult { /** Total matching skills */ total: number; /** Results page size */ pageSize: number; /** Current page number */ page: number; /** Skills in this page */ skills: HubSkill[]; } /** * Execution context passed to skill */ export interface ExecutionContext { /** Unique execution ID */ executionId: string; /** Skill being executed */ skill: SkillDefinition; /** Input provided */ input: Record; /** Current model configuration */ modelConfig: ModelConfig; /** Model provider */ provider: ModelProvider; /** Execution start time */ startTime: Date; /** Timeout in ms */ timeout: number; /** Whether to stream results */ streaming: boolean; /** Callback for stream chunks */ onChunk?: (chunk: SkillStreamChunk) => void; /** Execution metadata */ metadata?: Record; } /** * Options for skill execution */ export interface ExecutionOptions { /** Override default model */ model?: string; /** Override default provider */ provider?: ModelProvider; /** Custom model configuration */ modelConfig?: Partial; /** Execution timeout in ms */ timeout?: number; /** Maximum tokens for completion */ maxTokens?: number; /** Enable streaming */ streaming?: boolean; /** Stream chunk handler */ onChunk?: (chunk: SkillStreamChunk) => void; /** Skip security scan */ skipSecurityScan?: boolean; /** Custom execution context data */ metadata?: Record; } /** * Skill runner options */ export interface SkillRunnerOptions { /** Config directory path */ configDir?: string; /** Enable verbose logging */ verbose?: boolean; /** Skip security scans */ skipSecurityScans?: boolean; /** Maximum concurrent executions */ maxConcurrent?: number; } /** * Cache entry for execution results */ export interface CacheEntry { /** Cache key (hash of skill + input) */ key: string; /** Cached result */ result: SkillExecutionResult; /** When entry was cached */ cachedAt: Date; /** Cache TTL in ms */ ttl?: number; } /** * Batch execution request */ export interface BatchExecutionRequest { /** Skill file path or registry ID */ skillPath: string; /** Array of input sets */ inputs: Record[]; /** Execution options */ options?: ExecutionOptions; /** Continue on error */ continueOnError?: boolean; } /** * Batch execution result */ export interface BatchExecutionResult { /** Total items processed */ total: number; /** Successful executions */ succeeded: number; /** Failed executions */ failed: number; /** Results for each input */ results: (SkillExecutionResult | SkillExecutionError)[]; /** Overall duration in ms */ duration: number; } /** * Execution error with context */ export interface SkillExecutionError { /** Error identifier */ id: string; /** Input that caused error */ input: Record; /** Error message */ error: Error | string; /** Stack trace */ stack?: string; } //# sourceMappingURL=types.d.ts.map