/** * EDIT BUBBLEFLOW TOOL * * A tool bubble that applies code edits to BubbleFlow files using find-and-replace. * This tool performs simple string replacement matching Claude Code's Edit tool behavior. * * Features: * - Exact string find-and-replace * - Uniqueness validation (prevents ambiguous edits) * - Replace-all mode for renaming variables/strings * - No external API calls required */ import { z } from 'zod'; import { ToolBubble } from '../../types/tool-bubble-class.js'; export interface CodeEditResult { code: string; applied: boolean; error?: string; } /** * Apply a find-and-replace edit to source code. * * - `oldString` must exist in `initialCode`. * - Unless `replaceAll` is true, `oldString` must be unique (appear exactly once). * - `newString` must differ from `oldString`. */ export declare function applyCodeEdit(initialCode: string, oldString: string, newString: string, replaceAll?: boolean): CodeEditResult; /** * Define the parameters schema using Zod * This schema validates and types the input parameters for the edit tool */ declare const EditBubbleFlowToolParamsSchema: z.ZodObject<{ initialCode: z.ZodString; old_string: z.ZodString; new_string: z.ZodString; replace_all: z.ZodOptional>; credentials: z.ZodOptional>; config: z.ZodOptional>; }, "strip", z.ZodTypeAny, { initialCode: string; old_string: string; new_string: string; credentials?: Record | undefined; config?: Record | undefined; replace_all?: boolean | undefined; }, { initialCode: string; old_string: string; new_string: string; credentials?: Record | undefined; config?: Record | undefined; replace_all?: boolean | undefined; }>; /** * Type definitions derived from schemas */ type EditBubbleFlowToolParams = z.output; type EditBubbleFlowToolResult = z.output; /** * Define the result schema * This schema defines what the edit tool returns */ declare const EditBubbleFlowToolResultSchema: z.ZodObject<{ mergedCode: z.ZodString; applied: z.ZodBoolean; success: z.ZodBoolean; error: z.ZodString; }, "strip", z.ZodTypeAny, { error: string; success: boolean; mergedCode: string; applied: boolean; }, { error: string; success: boolean; mergedCode: string; applied: boolean; }>; /** * Edit BubbleFlow Tool * Applies code edits using find-and-replace */ export declare class EditBubbleFlowTool extends ToolBubble { /** * REQUIRED STATIC METADATA */ static readonly type: "tool"; static readonly bubbleName = "code-edit-tool"; static readonly schema: z.ZodObject<{ initialCode: z.ZodString; old_string: z.ZodString; new_string: z.ZodString; replace_all: z.ZodOptional>; credentials: z.ZodOptional>; config: z.ZodOptional>; }, "strip", z.ZodTypeAny, { initialCode: string; old_string: string; new_string: string; credentials?: Record | undefined; config?: Record | undefined; replace_all?: boolean | undefined; }, { initialCode: string; old_string: string; new_string: string; credentials?: Record | undefined; config?: Record | undefined; replace_all?: boolean | undefined; }>; static readonly resultSchema: z.ZodObject<{ mergedCode: z.ZodString; applied: z.ZodBoolean; success: z.ZodBoolean; error: z.ZodString; }, "strip", z.ZodTypeAny, { error: string; success: boolean; mergedCode: string; applied: boolean; }, { error: string; success: boolean; mergedCode: string; applied: boolean; }>; static readonly shortDescription = "Applies code edits to BubbleFlow files using find-and-replace"; static readonly longDescription = "\n A tool for applying code edits to BubbleFlow TypeScript files using find-and-replace.\n\n What it does:\n - Finds exact text matches in code and replaces them\n - Validates uniqueness to prevent ambiguous edits\n - Supports replace-all mode for renaming variables/strings\n - No external API calls required\n\n How it works:\n - Takes the current code, old_string (text to find), and new_string (replacement)\n - Validates that old_string exists and is unique (unless replace_all is true)\n - Performs the replacement and returns the updated code\n\n Use cases:\n - When an AI agent needs to make edits to BubbleFlow code\n - When making targeted changes without rewriting entire files\n - When renaming variables or strings across a file\n\n Important:\n - old_string must be an exact match of text in the code\n - If old_string appears multiple times, provide more context or use replace_all\n - new_string must be different from old_string\n "; static readonly alias = "code-edit"; /** * Main action method - performs find-and-replace code editing */ performAction(): Promise; } export {}; //# sourceMappingURL=code-edit-tool.d.ts.map