/** * Template Interpolation Utilities * * Provides utilities for interpolating template strings with context values. * Used by the Intent Router to fill in command templates with widget context. * * @since 0.18.0 */ /** * Interpolates a template string with values from a context object. * Supports dot notation for nested paths (e.g., {{context.currentJob.jobId}}). * * @param template - The template string containing {{path}} placeholders * @param context - The context object to pull values from * @returns The interpolated string * * @example * ```typescript * const template = 'Opening job: {{context.currentJob.name}}'; * const context = { context: { currentJob: { name: 'My Job' } } }; * interpolateString(template, context); // 'Opening job: My Job' * ``` */ declare function interpolateString(template: string, context: Record): string; /** * Interpolates all string values in an object recursively. * Non-string values are passed through unchanged. * * @param obj - The object containing template strings * @param context - The context object to pull values from * @returns A new object with all string values interpolated * * @example * ```typescript * const command = { * type: 'renderTag', * tagId: 'rcs.job', * data: { * jobId: '{{context.currentJob.jobId}}', * tab: 'overview' * } * }; * const context = { context: { currentJob: { jobId: '123' } } }; * interpolateObject(command, context); * // { type: 'renderTag', tagId: 'rcs.job', data: { jobId: '123', tab: 'overview' } } * ``` */ declare function interpolateObject(obj: T, context: Record): T; /** * Gets a value from an object using dot notation path. * * @param obj - The object to get the value from * @param path - The dot notation path (e.g., "context.currentJob.jobId") * @returns The value at the path, or undefined if not found * * @example * ```typescript * const obj = { context: { currentJob: { jobId: '123' } } }; * getValueAtPath(obj, 'context.currentJob.jobId'); // '123' * getValueAtPath(obj, 'context.missing.path'); // undefined * ``` */ declare function getValueAtPath(obj: Record, path: string): unknown; /** * Checks if all required context paths exist in the context object. * Used to determine if a command's requiresContext conditions are met. * * @param context - The context object to check * @param requiredPaths - Array of dot notation paths that must exist * @returns true if all paths exist and have non-null/undefined values * * @example * ```typescript * const context = { currentJob: { jobId: '123', name: 'Test' } }; * hasRequiredContext(context, ['currentJob.jobId']); // true * hasRequiredContext(context, ['currentJob.missing']); // false * ``` */ declare function hasRequiredContext(context: Record, requiredPaths: string[]): boolean; /** * Converts LLM context items to a flat context object for template interpolation. * Groups context by source and extracts data. * * @param llmContextItems - Array of LLM context items from the request * @returns A flat context object suitable for template interpolation * * @example * ```typescript * const items = [ * { id: 'job-context', context: { currentJob: { jobId: '123' } } } * ]; * convertLlmContextToFlatContext(items); * // { currentJob: { jobId: '123' } } * ``` */ declare function convertLlmContextToFlatContext(llmContextItems: Array<{ id: string; context: unknown; }>): Record; export { convertLlmContextToFlatContext, getValueAtPath, hasRequiredContext, interpolateObject, interpolateString };