import { KnowledgeReadinessSpec, BuildEvalKnowledgeBundleOptions, KnowledgeBaseQualityOptions, KnowledgeImprovementResult, KnowledgeImprovementOptions } from '@tangle-network/agent-knowledge';
import { E as ExecutorConfig } from './coordination-rRj5hjJK.js';
import { a as SuperviseOptions, S as SupervisorProfile } from './supervise-DPmYPk0j.js';
import { B as Budget, b as SupervisedResult } from './types-eMNgWgFi.js';
import { D as DeliverableSpec } from './completion-gate-DkAnUmpb.js';
import '@tangle-network/agent-interface';
import './substrate-DO2GHNg2.js';
import './types-SyuwunY_.js';
import '@tangle-network/agent-eval';
import '@tangle-network/sandbox';
import './router-client-DJImUDlm.js';
import './local-harness-dcD5WTTr.js';
import 'node:child_process';
import './environment-provider.js';
import '@tangle-network/agent-interface/environment-provider';

/** Standing prompt for a supervisor that grows a shared knowledge base through spawned researchers. */
declare const RESEARCH_SUPERVISOR_SYSTEM_PROMPT: string;
interface KnowledgeReadinessCheckInput {
    root: string;
    goal: string;
    readinessSpecs?: readonly unknown[];
    readinessTaskId?: string;
    readiness?: unknown;
}
type KnowledgeReadinessCheckResult = boolean | {
    ready: boolean;
    summary?: string;
    metadata?: Record<string, unknown>;
};
type KnowledgeReadinessCheck = (input: KnowledgeReadinessCheckInput) => Promise<KnowledgeReadinessCheckResult> | KnowledgeReadinessCheckResult;
interface SupervisedKnowledgeUpdateInput {
    goal?: string;
    root?: string;
    candidateRoot?: string;
    findings?: readonly unknown[];
    metadata?: Record<string, unknown>;
}
interface SupervisedKnowledgeUpdateResult {
    applied: boolean;
    summary: string;
    supervised: SupervisedResult<unknown>;
    metadata: Record<string, unknown>;
}
interface SupervisedKnowledgeUpdateOptions {
    root: string;
    goal: string;
    readiness: KnowledgeReadinessCheck;
    readinessSpecs?: readonly unknown[];
    readinessTaskId?: string;
    readinessOptions?: unknown;
    findings?: readonly unknown[];
    metadata?: Record<string, unknown>;
    budget: Budget;
    backend?: ExecutorConfig;
    makeWorkerAgent?: SuperviseOptions['makeWorkerAgent'];
    harness?: string;
    supervisorModel?: string;
    supervisorSystemPrompt?: string;
    superviseOptions?: Partial<Omit<SuperviseOptions, 'budget' | 'backend' | 'deliverable' | 'makeWorkerAgent' | 'allowedModels'>>;
    allowedModels?: readonly string[];
    runSupervised?: (profile: SupervisorProfile, task: unknown, opts: SuperviseOptions) => Promise<SupervisedResult<unknown>>;
}
type SupervisedKnowledgeUpdater = (input: SupervisedKnowledgeUpdateInput) => Promise<SupervisedKnowledgeUpdateResult>;
/** Build the completion check a supervised KB update uses to stop only when the KB is ready. */
declare function knowledgeReadinessDeliverable(options: Pick<SupervisedKnowledgeUpdateOptions, 'root' | 'goal' | 'readiness' | 'readinessSpecs' | 'readinessTaskId' | 'readinessOptions'>): DeliverableSpec<unknown>;
/** Create an `improveKnowledgeBase` update callback backed by runtime supervision. */
declare function createSupervisedKnowledgeUpdater(options: SupervisedKnowledgeUpdateOptions): SupervisedKnowledgeUpdater;
/** Run a runtime supervisor that updates one candidate knowledge base and stops on readiness. */
declare function runSupervisedKnowledgeUpdate(options: SupervisedKnowledgeUpdateOptions): Promise<SupervisedKnowledgeUpdateResult>;
/** Format the supervisor task with the KB root, readiness requirements, current findings, and metadata. */
declare function formatSupervisedKnowledgeTask(options: Pick<SupervisedKnowledgeUpdateOptions, 'root' | 'goal' | 'readinessSpecs' | 'readinessTaskId' | 'findings' | 'metadata'>): string;

interface RunKnowledgeImprovementJobOptions extends Omit<KnowledgeImprovementOptions, 'updateKnowledge'> {
    budget: Budget;
    readinessCheck?: KnowledgeReadinessCheck;
    backend?: ExecutorConfig;
    makeWorkerAgent?: SuperviseOptions['makeWorkerAgent'];
    harness?: string;
    supervisorModel?: string;
    supervisorSystemPrompt?: string;
    superviseOptions?: Partial<Omit<SuperviseOptions, 'budget' | 'backend' | 'deliverable' | 'makeWorkerAgent' | 'allowedModels'>>;
    allowedModels?: readonly string[];
    runSupervised?: (profile: SupervisorProfile, task: unknown, opts: SuperviseOptions) => Promise<SupervisedResult<unknown>>;
    onMeasurement?: (measurement: KnowledgeImprovementJobMeasurement) => Promise<void> | void;
}
interface KnowledgeImprovementJobMeasurement {
    startedAt: string;
    finishedAt: string;
    durationMs: number;
    updateCalls: number;
    updateDurationMs: number;
    supervisedSpent: {
        iterations: number;
        inputTokens: number;
        outputTokens: number;
        usd: number;
        ms: number;
    };
}
interface KnowledgeImprovementJobResult {
    improvement: KnowledgeImprovementResult;
    measurement: KnowledgeImprovementJobMeasurement;
    promoted: boolean;
    blocked: boolean;
}
interface AgentKnowledgeReadinessCheckOptions {
    goal: string;
    readinessSpecs?: readonly KnowledgeReadinessSpec[];
    readinessTaskId?: string;
    readiness?: Omit<BuildEvalKnowledgeBundleOptions, 'taskId' | 'index' | 'specs'>;
    strict?: boolean;
    kbQuality?: KnowledgeBaseQualityOptions;
}
/** Build the default readiness check backed by `@tangle-network/agent-knowledge` validation and scoring. */
declare function createAgentKnowledgeReadinessCheck(options: AgentKnowledgeReadinessCheckOptions): KnowledgeReadinessCheck;
/** Run the full KB improvement job: candidate workspace, runtime supervisor update, readiness check, and promotion. */
declare function runKnowledgeImprovementJob(options: RunKnowledgeImprovementJobOptions): Promise<KnowledgeImprovementJobResult>;

export { type AgentKnowledgeReadinessCheckOptions, type KnowledgeImprovementJobMeasurement, type KnowledgeImprovementJobResult, type KnowledgeReadinessCheck, type KnowledgeReadinessCheckInput, type KnowledgeReadinessCheckResult, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, type RunKnowledgeImprovementJobOptions, type SupervisedKnowledgeUpdateInput, type SupervisedKnowledgeUpdateOptions, type SupervisedKnowledgeUpdateResult, type SupervisedKnowledgeUpdater, createAgentKnowledgeReadinessCheck, createSupervisedKnowledgeUpdater, formatSupervisedKnowledgeTask, knowledgeReadinessDeliverable, runKnowledgeImprovementJob, runSupervisedKnowledgeUpdate };
