UNPKG

@vfarcic/dot-ai

Version:

AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance

146 lines 4.95 kB
/** * Operate Tool - AI-powered Kubernetes application operations */ import { z } from 'zod'; import { Logger } from '../core/error-handling'; import { PluginManager } from '../core/plugin-manager'; import { OrganizationalPattern, PolicyIntent } from '../core/organizational-types'; import { ResourceCapability } from '../core/capabilities'; import { BaseVisualizationData } from '../core/visualization'; export declare const OPERATE_TOOL_NAME = "operate"; export declare const OPERATE_TOOL_DESCRIPTION = "AI-powered Kubernetes application operations tool for Day 2 operations. Handles updates, scaling, enhancements, rollbacks, and deletions through natural language intents. Analyzes current state, applies organizational patterns and policies, validates changes via dry-run, and executes approved operations safely."; export declare const OPERATE_TOOL_INPUT_SCHEMA: { intent: z.ZodOptional<z.ZodString>; sessionId: z.ZodOptional<z.ZodString>; executeChoice: z.ZodOptional<z.ZodNumber>; refinedIntent: z.ZodOptional<z.ZodString>; interaction_id: z.ZodOptional<z.ZodString>; }; export interface OperateInput { intent?: string; sessionId?: string; executeChoice?: number; refinedIntent?: string; interaction_id?: string; } export interface OperateSessionData extends BaseVisualizationData { toolName: 'operate'; intent: string; interaction_id?: string; context: EmbeddedContext; proposedChanges: ProposedChanges; commands: string[]; dryRunValidation: { status: 'success' | 'failed'; details: string; }; patternsApplied: string[]; capabilitiesUsed: string[]; policiesChecked: string[]; risks: { level: 'low' | 'medium' | 'high'; description: string; }; validationIntent: string; status: 'analyzing' | 'analysis_complete' | 'executing' | 'executed_successfully' | 'executed_with_errors' | 'failed'; executionResults?: ExecutionResult[]; } export type OperateSession = { sessionId: string; createdAt: string; updatedAt: string; data: OperateSessionData; }; export interface EmbeddedContext { patterns: OrganizationalPattern[]; policies: PolicyIntent[]; capabilities: ResourceCapability[]; } export interface ProposedChanges { create: ResourceChange[]; update: ResourceChange[]; delete: ResourceChange[]; } export interface ResourceChange { kind: string; name: string; namespace?: string; manifest?: string; changes?: string; rationale: string; } export interface ExecutionResult { command: string; success: boolean; output?: string; error?: string; timestamp: Date; } export interface OperateOutput { status: 'success' | 'failed' | 'awaiting_user_approval'; sessionId: string; visualizationUrl?: string; analysis?: { summary: string; currentState: unknown; proposedChanges: ProposedChanges; commands: string[]; dryRunValidation: { status: 'success' | 'failed'; details: string; }; patternsApplied: string[]; capabilitiesUsed: string[]; policiesChecked: string[]; risks: { level: 'low' | 'medium' | 'high'; description: string; }; validationIntent: string; }; execution?: { results: ExecutionResult[]; validation: string; }; message: string; agentInstructions?: string; } /** * Embed context (patterns, policies, capabilities) for AI analysis * @param intent User's operational intent * @returns Embedded context with patterns, policies, and capabilities * @throws Error if capabilities are not available (mandatory) */ export declare function embedContext(intent: string, logger: Logger): Promise<EmbeddedContext>; /** * Format patterns for template placeholder */ export declare function formatPatterns(patterns: OrganizationalPattern[]): string; /** * Format policies for template placeholder */ export declare function formatPolicies(policies: PolicyIntent[]): string; /** * Format capabilities for template placeholder * Capabilities are already ordered by relevance from vector search */ export declare function formatCapabilities(capabilities: ResourceCapability[]): string; /** * Main operate tool entry point * * PRD #343: pluginManager is required - all kubectl operations go through plugin. */ export declare function operate(args: OperateInput, pluginManager: PluginManager): Promise<OperateOutput>; /** * MCP handler for operate tool * Wraps the main operate function with consistent return format * * PRD #343: pluginManager is required - all kubectl operations go through plugin. */ export declare function handleOperateTool(args: OperateInput, pluginManager: PluginManager): Promise<{ content: Array<{ type: 'text'; text: string; }>; }>; //# sourceMappingURL=operate.d.ts.map