@vfarcic/dot-ai
Version:
AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance
140 lines • 4 kB
TypeScript
/**
* Resource Tools for AI-Powered Cluster Intelligence
*
* Shared tool definitions and executor for resource vector DB operations.
* Used by query and other cluster intelligence workflows.
*
* PRD #291: Cluster Query Tool - Natural Language Cluster Intelligence
*/
import { AITool } from './ai-provider.interface';
import { ResourceVectorService } from './resource-vector-service';
/**
* Tool: search_resources
* Semantic search for cluster resources by name, kind, labels, and annotations
*/
export declare const SEARCH_RESOURCES_TOOL: AITool;
/**
* Tool: query_resources
* Filter-based query for resources using Qdrant filter syntax
*/
export declare const QUERY_RESOURCES_TOOL: AITool;
/**
* All resource tools for cluster intelligence
* Convenient array for passing to toolLoop()
*/
export declare const RESOURCE_TOOLS: AITool[];
/**
* Get or create the resource vector service
* Uses lazy initialization to avoid startup errors when Qdrant isn't ready
* Respects QDRANT_RESOURCES_COLLECTION env var for collection name
*/
export declare function getResourceService(): Promise<ResourceVectorService>;
/**
* Input for search_resources tool
*/
export interface SearchResourcesInput {
query: string;
namespace?: string;
kind?: string;
apiVersion?: string;
limit?: number;
}
/**
* Input for query_resources tool
*/
export interface QueryResourcesInput {
filter: Record<string, unknown>;
limit?: number;
}
/**
* Result from resource tool execution
*/
interface ResourceToolResult {
success: boolean;
data?: unknown[];
count?: number;
message: string;
error?: string;
}
/**
* Tool executor for resource-based tools
* Handles execution and error handling for all resource tool calls
*
* @param toolName - Name of the tool to execute
* @param input - Tool input parameters
* @returns Tool execution result
*/
export declare function executeResourceTools(toolName: string, input: SearchResourcesInput | QueryResourcesInput): Promise<ResourceToolResult>;
/**
* Reset the resource service (useful for testing)
*/
export declare function resetResourceService(): void;
/**
* Resource kind information with count
*/
export interface ResourceKindInfo {
kind: string;
apiGroup: string;
apiVersion: string;
count: number;
}
/**
* Options for listing resources
* PRD #343: Status fetching moved to REST API layer via plugin
*/
export interface ListResourcesOptions {
kind: string;
apiGroup?: string;
apiVersion?: string;
namespace?: string;
limit?: number;
offset?: number;
}
/**
* Resource item for list response
*/
export interface ResourceListItem {
name: string;
namespace: string;
kind: string;
apiGroup: string;
apiVersion: string;
labels: Record<string, string>;
createdAt: string;
updatedAt: string;
status?: object;
}
/**
* Result of listing resources with pagination info
*/
export interface ListResourcesResult {
resources: ResourceListItem[];
total: number;
limit: number;
offset: number;
}
/**
* Get all unique resource kinds with counts
* Groups resources by kind+apiGroup+apiVersion and counts each group
*
* @param namespace - Optional namespace to filter by
* @returns Array of resource kinds sorted by count descending
*/
export declare function getResourceKinds(namespace?: string): Promise<ResourceKindInfo[]>;
/**
* List resources with filtering and pagination
* PRD #343: Status fetching moved to REST API layer via plugin
*
* @param options - Filter and pagination options
* @returns Paginated list of resources
*/
export declare function listResources(options: ListResourcesOptions): Promise<ListResourcesResult>;
/**
* Get all unique namespaces from resources
* Filters out '_cluster' marker for cluster-scoped resources
*
* @returns Sorted array of namespace names
*/
export declare function getNamespaces(): Promise<string[]>;
export {};
//# sourceMappingURL=resource-tools.d.ts.map