/**
 * Nexus Learning Network
 *
 * Turns run evidence into measured behavior change. Memory is the evidence
 * layer; learning is the promoted policy that changes the next run.
 */
export type LearningSignalSource = 'memory' | 'decision_spine' | 'llm_output' | 'user_feedback' | 'worker_output' | 'file_change' | 'verification' | 'pod_signal' | 'context_router';
export type LearningDomain = 'persona' | 'project' | 'stack' | 'coding_style' | 'quality_bar' | 'tooling' | 'routing' | 'verification';
export type LearningAction = 'promote' | 'test' | 'decay' | 'quarantine';
export declare const LEARNING_PACKET_FILE = "learning-packet.json";
export declare const LEARNING_SIGNALS_FILE = "learning-signals.jsonl";
export declare const LEARNING_POLICY_DELTAS_FILE = "learning-policy-deltas.json";
export declare const LEARNING_FEEDBACK_FILE = "learning-feedback.jsonl";
export interface LearningSignal {
    id: string;
    source: LearningSignalSource;
    domain: LearningDomain;
    summary: string;
    evidenceRefs: string[];
    confidence: number;
    accepted?: boolean;
    rejected?: boolean;
    runId?: string;
    filePaths?: string[];
    tags?: string[];
}
export interface LearningFeedback {
    id?: string;
    runId: string;
    packetId?: string;
    lessonId?: string;
    rating: 'accepted' | 'rejected' | 'useful' | 'ignore';
    note?: string;
    createdAt?: number;
}
export interface LearningPacket {
    id: string;
    runId: string;
    lesson: string;
    evidence: string[];
    evidenceRefs: string[];
    scope: LearningDomain;
    confidence: number;
    action: LearningAction;
    nextRunEffect: string;
    sourceSignals: string[];
    createdAt: number;
}
export interface LearningPolicyDelta {
    id: string;
    packetId: string;
    scope: LearningDomain;
    target: 'context_router' | 'worker_router' | 'model_router' | 'prompt' | 'verifier' | 'dashboard';
    rule: string;
    confidence: number;
    evidenceRefs: string[];
}
export interface LearningQualityMetrics {
    packetCount: number;
    promotedCount: number;
    testCount: number;
    quarantinedCount: number;
    verificationPassRate: number | null;
    acceptedFeedback: number;
    rejectedFeedback: number;
    changedFileCount: number;
    workerReuseSignals: number;
    modelRouteSignals: number;
}
export interface LearningRunEvidence {
    runId: string;
    goal?: string;
    state?: string;
    source?: string;
    createdAt?: number;
    artifactsPath?: string | null;
    requestBrief?: any;
    selectionPlan?: any;
    contextLog?: any[];
    decisionLog?: any[];
    workerResults?: any[];
    verificationResults?: any[];
    memoryChecks?: any[];
    backendEvidence?: any;
    tokenTelemetry?: any;
    userWorkflowTrace?: any;
    userFeedback?: LearningFeedback[];
}
export interface LearningGraphNode {
    id: string;
    label: string;
    type: 'run' | 'packet' | 'evidence' | 'policy' | 'feedback';
    scope?: LearningDomain;
    confidence?: number;
}
export interface LearningGraphEdge {
    source: string;
    target: string;
    type: 'generated' | 'supported-by' | 'changes' | 'feedback';
}
export interface LearningNetworkEnvelope {
    runId: string;
    generatedAt: number;
    promptVersion: string;
    axiom: string;
    packets: LearningPacket[];
    signals: LearningSignal[];
    policyDeltas: LearningPolicyDelta[];
    quality: LearningQualityMetrics;
    graph: {
        nodes: LearningGraphNode[];
        edges: LearningGraphEdge[];
    };
}
export interface LearningNetworkPromptInput {
    projectName?: string;
    persona?: string;
    stack?: string[];
    codingStyle?: string[];
    currentGoal?: string;
    evidenceRefs?: string[];
}
export interface LearningNetworkBlueprint {
    axiom: string;
    podModule: {
        name: string;
        expansion: string;
        purpose: string;
        members: string[];
        outputContract: string[];
    };
    signalSources: LearningSignalSource[];
    domains: LearningDomain[];
    loop: string[];
    qualityMetrics: string[];
    routingOutputs: string[];
    guardrails: string[];
}
export declare const LEARNING_NETWORK_BLUEPRINT: LearningNetworkBlueprint;
export declare const LEARNING_NETWORK_PROMPT = "You are Nexus Prime Learning Network, the system that turns evidence into better future work.\n\nCore axiom: memory is stored evidence; learning is a verified behavior change that improves the next run.\n\nBuild a Learning POD: Proof, Outcome, Decision.\nThe POD reads memories, decision-spine events, LLM outputs, worker outputs, file changes, verification results, context-router choices, and user accept/reject feedback. It does not hoard facts. It compiles lessons.\n\nFor every run:\n1. Observe the evidence trail: task goal, selected context, model route, hired workers, decisions made, files changed, commands run, tests passed or failed, user feedback, and memories created.\n2. Extract candidate lessons across persona, project, stack, coding style, quality bar, tooling, routing, and verification.\n3. Score each lesson by evidence strength, recency, repetition, acceptance, contradiction risk, and blast radius.\n4. Promote only the lessons that can change future behavior: retrieval rules, worker instructions, model-routing policy, file-prior hints, verification gates, coding-style constraints, and user-preference deltas.\n5. Quarantine weak, conflicting, stale, secret-bearing, or one-off observations.\n6. On the next task, route the active learning packet into context selection, worker hiring, model choice, prompts, tests, and dashboard explanation.\n7. Measure whether output quality actually improved: fewer repeated fixes, fewer user rejections, faster verified diffs, better context recall, higher worker reuse, and clearer model-route decisions.\n\nOutput a compact learning packet with:\n- lesson: the behavior change\n- evidence: memory IDs, run IDs, file paths, decision IDs, or feedback events\n- scope: persona, project, stack, coding style, routing, or verification\n- confidence: 0 to 1\n- action: promote, test, decay, or quarantine\n- next_run_effect: exactly what workers, context router, model router, or verifier should do differently\n\nDo not summarize memory as learning. Do not claim improvement without proof. Make the next run visibly smarter.";
export declare function buildLearningNetworkPrompt(input?: LearningNetworkPromptInput): string;
export declare function scoreLearningSignal(signal: Pick<LearningSignal, 'confidence' | 'accepted' | 'rejected' | 'evidenceRefs'>): number;
export declare function buildLearningPodTags(signal: Pick<LearningSignal, 'source' | 'domain' | 'runId' | 'filePaths' | 'tags'>): string[];
export declare function deriveLearningSignals(evidence: LearningRunEvidence): LearningSignal[];
export declare function buildLearningPackets(signals: LearningSignal[], createdAt?: number): LearningPacket[];
export declare function buildLearningPolicyDeltas(packets: LearningPacket[]): LearningPolicyDelta[];
export declare function buildLearningQuality(evidence: LearningRunEvidence, packets: LearningPacket[]): LearningQualityMetrics;
export declare function buildLearningGraph(envelopes: LearningNetworkEnvelope[]): LearningNetworkEnvelope['graph'];
export declare function buildLearningNetworkEnvelope(evidence: LearningRunEvidence): LearningNetworkEnvelope;
export declare function learningSignalsToJsonl(signals: LearningSignal[]): string;
