import type { Logger } from '@takeshape/logger';
import type { AgentAPIInput, AgentAPIMutationInput, AgentJSON, AgentStart, AgentState, HistoryStrategyMap, ObjectSchema, ProjectSchemaJSON, PropertySchema, QueryJSON, ShapeJSON, ToolJSON } from '../project-schema/index.ts';
import type { PropertyRefItem, RefItem } from '../refs.ts';
export interface GetShapeOptions {
    includeAllBuiltIns?: boolean;
}
export interface ProjectSchema {
    getShape(shapeRef: string, options?: GetShapeOptions): Shape | undefined;
    ensureShape(shapeRef: string, options?: GetShapeOptions): Shape;
    getQuery(queryRef: string): Query | undefined;
    ensureQuery(queryRef: string): Query;
    getLocalQueries(): Query[];
    getLocalMutations(): Query[];
    dereferenceSchema(propertySchema: PropertySchema): PropertySchema;
    dereferenceObjectSchema(propertySchema: PropertySchema): ObjectSchema;
    getAgent(name: string): Agent | undefined;
    ensureAgent(name: string): Agent;
    getAgents(): Agent[];
    getTool(name: string): Tool | undefined;
    ensureTool(name: string): Tool;
    getTools(): Tool[];
    getShapeContextVariables(shapeName: string): Record<string, string> | undefined;
    json: ProjectSchemaJSON;
}
export interface Shape {
    name: string;
    ref: string;
    refItem: RefItem;
    json: ShapeJSON;
    getObjectSchema(): ObjectSchema | undefined;
}
export interface Query {
    name: string;
    type: 'query' | 'mutation';
    ref: string;
    argsSchema: ObjectSchema | undefined;
    argsAreFromShape: boolean;
    json: QueryJSON;
    returnShape: Shape | undefined;
}
export interface Agent {
    name: string;
    json: AgentJSON;
    title: string | undefined;
    description: string | undefined;
    disabled: boolean | undefined;
    systemPrompt: string | undefined;
    sessionMemoryShape: Shape | undefined;
    historyStrategies: HistoryStrategyMap | undefined;
    isProtectionEnabled: boolean;
    apiInputs: AgentAPIInput[];
    startState: AgentStart;
    getState(stateId: string): AgentState | undefined;
    ensureState(stateId: string): AgentState;
    getQueries(): Query[];
    getMutations(): Query[];
    getInputConfig(inputName: string): AgentAPIMutationInput | undefined;
}
export type GetParametersSchemaOptions = {
    enableOpenAIFormat?: boolean;
    logger?: Logger;
};
export interface Tool {
    name: string;
    description?: string;
    ref: string;
    refItem: PropertyRefItem;
    json: ToolJSON;
    execution: ToolExecution;
    parametersSchema: ObjectSchema;
}
type QueryGeneratorParams = {
    query: Query;
    selectionSet?: string;
};
export type QueryGenerator = (schema: ProjectSchema, params: QueryGeneratorParams) => string;
export interface ToolExecutionGraphQL {
    type: 'graphql';
    path?: string;
    optimizeResponse?: {
        compactPagination?: boolean;
    };
    getGraphQLParams(queryGenerator: QueryGenerator): {
        source: string;
    };
    getQueryArgSchema(): {
        argsSchema: ObjectSchema;
        argsAreFromShape: boolean;
    } | undefined;
    getQueryDescription(): string | undefined;
}
export interface ToolExecutionRemote {
    type: 'remote';
    service: string;
    toolName: string;
}
export type ToolExecution = ToolExecutionGraphQL | ToolExecutionRemote;
export {};
