@tangle-network/agent-knowledge 4.1.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,15 +1,16 @@
1
1
  import { S as SourceRecord, c as KnowledgeIndex, d as KnowledgeSearchResult, e as SourceRegistry, f as KnowledgeEvent, g as KnowledgeLintFinding, h as KnowledgeEventType, i as KnowledgePage, b as KnowledgeGraph, j as KnowledgeWriteBlock, k as KnowledgeClaim, l as KnowledgeRelease, m as KnowledgeWriteParseResult } from './types-6x0OpfW6.js';
2
2
  export { C as ClaimRef, n as KnowledgeBaseCandidate, K as KnowledgeGraphEdge, a as KnowledgeGraphNode, o as KnowledgeId, p as KnowledgePolicy, q as KnowledgeRelation, r as KnowledgeUnit, s as SourceAnchor } from './types-6x0OpfW6.js';
3
3
  import { KnowledgeRequirementCategory, KnowledgeAcquisitionMode, KnowledgeImportance, KnowledgeFreshness, KnowledgeSensitivity, KnowledgeRequirement, KnowledgeBundle, KnowledgeReadinessReport, UserQuestion, DataAcquisitionPlan, ControlRuntimeConfig, ControlEvalResult, RunRecord, AnalystSeverity, AnalystFinding, ReleaseTraceEvidence, GateDecision, DatasetScenario, ReleaseConfidenceScorecard } from '@tangle-network/agent-eval';
4
- import { AgentImprovementActivation, AgentImprovementActivationResult, AgentCandidateKnowledgeRef } from '@tangle-network/agent-interface';
4
+ import { AgentCandidateJsonValue, AgentImprovementActivation, AgentImprovementActivationResult, AgentCandidateKnowledgeRef } from '@tangle-network/agent-interface';
5
5
  import { z } from 'zod';
6
- import { JsonValue, Scenario, JudgeConfig } from '@tangle-network/agent-eval/campaign';
7
- import { R as RunRetrievalImprovementLoopResult, a as RunRetrievalImprovementLoopOptions } from './types-DP38encz.js';
8
- export { A as AgentMemoryAcquireRunLease, b as AgentMemoryAdapter, c as AgentMemoryBranchIsolation, d as AgentMemoryContext, e as AgentMemoryControllerMode, f as AgentMemoryHit, g as AgentMemoryKind, h as AgentMemoryRunLease, i as AgentMemoryScope, j as AgentMemorySearchOptions, k as AgentMemoryWriteInput, l as AgentMemoryWriteResult, B as BuildRetrievalBenchmarkCasesFromQrelsOptions, m as BuildRetrievalEvalDispatchOptions, n as BuildRetrievalParameterCandidatesOptions, K as KnowledgeAnswerBenchmarkCase, o as KnowledgeAnswerBenchmarkTaskKind, p as KnowledgeBenchmarkArtifact, q as KnowledgeBenchmarkCase, r as KnowledgeBenchmarkCaseBase, s as KnowledgeBenchmarkDistribution, t as KnowledgeBenchmarkEvaluation, u as KnowledgeBenchmarkFamily, v as KnowledgeBenchmarkReport, w as KnowledgeBenchmarkResponder, x as KnowledgeBenchmarkScenario, y as KnowledgeBenchmarkSliceSummary, z as KnowledgeBenchmarkSource, C as KnowledgeBenchmarkSpec, D as KnowledgeBenchmarkSplit, E as KnowledgeBenchmarkTaskKind, F as KnowledgeClaimMatcher, G as KnowledgeMemoryBenchmarkCase, H as KnowledgeMemoryBenchmarkTaskKind, I as KnowledgeMemoryEvent, J as KnowledgeMemoryFactMatcher, L as KnowledgeRetrievalBenchmarkCase, M as KnowledgeRetrievalBenchmarkQrel, N as KnowledgeRetrievalBenchmarkQuery, O as MemoryAdapterBenchmarkCandidate, P as MemoryAdapterBenchmarkRankingRow, Q as OwnedAgentMemoryRunLease, S as RetrievalConfig, T as RetrievalEvalArtifact, U as RetrievalEvalRetriever, V as RetrievalEvalRetrieverInput, W as RetrievalEvalRetrieverResult, X as RetrievalEvalScenario, Y as RetrievalGoldTarget, Z as RetrievalHoldoutBypassReason, _ as RetrievalHoldoutCallContext, $ as RetrievalHoldoutConfig, a0 as RetrievalHoldoutEligibleItem, a1 as RetrievalHoldoutEvent, a2 as RetrievalHoldoutResult, a3 as RetrievalHoldoutSessionState, a4 as RetrievalMetricSummary, a5 as RetrievalMetricWeights, a6 as RetrievalParameterSearchSpace, a7 as RetrievalParameterSweepProposerOptions, a8 as RetrievalRecallJudgeOptions, a9 as RetrievedKnowledgeHit, aa as RetrievedSourceSpan, ab as RunKnowledgeBenchmarkSuiteOptions, ac as RunKnowledgeBenchmarkSuiteResult, ad as RunMemoryAdapterBenchmarkOptions, ae as RunMemoryAdapterBenchmarkResult, af as acquireAgentMemoryRunLease, ag as buildRetrievalEvalDispatch, ah as buildRetrievalParameterCandidates, ai as retrievalConfigFromSurface, aj as retrievalConfigSurface, ak as retrievalParameterSweepProposer, al as retrievalRecallJudge, am as runRetrievalImprovementLoop, an as scoreRetrievalArtifact } from './types-DP38encz.js';
6
+ import { OptimizationMethod, DispatchContext, JudgeConfig, ComparisonCost, Scenario } from '@tangle-network/agent-eval/campaign';
7
+ import { R as RunSerializedKnowledgeOptimizationResult, a as RunSerializedKnowledgeOptimizationOptions } from './index-Cf7txrYP.js';
8
+ export { A as AgentMemoryActivation, b as AgentMemoryActivationDriver, c as AgentMemoryAttemptEvent, d as AgentMemoryBranch, e as AgentMemoryBranchLifetime, f as AgentMemoryBranchSnapshot, g as AgentMemoryDimensionComparison, h as AgentMemoryExecutionContext, i as AgentMemoryExecutionCostMeter, j as AgentMemoryExecutionCostReceipt, k as AgentMemoryExecutionPaidCallInput, l as AgentMemoryExecutionPaidCallResult, m as AgentMemoryExecutionStep, n as AgentMemoryExperimentCandidate, o as AgentMemoryExperimentRankingRow, p as AgentMemoryExperimentRunLease, q as AgentMemoryFinalEvaluation, r as AgentMemoryFinalPair, s as AgentMemoryHitSchema, t as AgentMemoryImprovementRunLease, u as AgentMemoryJournalEntry, v as AgentMemoryKindSchema, w as AgentMemoryLifecycleTimeoutError, x as AgentMemoryLifecycleUnsafeError, y as AgentMemoryPromotionDecision, z as AgentMemoryScopeSchema, B as AgentMemorySequence, C as AgentMemorySequenceArtifact, D as AgentMemorySequenceProbe, E as AgentMemorySequenceProbeResult, F as AgentMemorySequenceScenario, G as AgentMemorySequenceStep, H as AgentMemorySharingPolicy, I as AgentMemoryVisibility, J as AgentMemoryWriteInputSchema, K as BuildAgentMemorySequencesFromBenchmarkCasesOptions, L as CreateAgentMemoryBranchOptions, M as DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, N as ForkAgentMemoryBranchSnapshotOptions, O as GraphitiMcpClientLike, P as GraphitiMemoryAdapterOptions, Q as GraphitiToolNames, S as Mem0ClientLike, T as Mem0ClientMode, U as Mem0MemoryAdapterOptions, V as MemoryConfigScenario, W as Neo4jAgentMemoryAdapterOptions, X as RetrievalHoldoutOffPolicyOptions, Y as RetrievalHoldoutOffPolicyResult, Z as RetrievalHoldoutSessionSummary, _ as RunAgentMemoryExperimentOptions, $ as RunAgentMemoryExperimentResult, a0 as RunAgentMemoryImprovementOptions, a1 as RunAgentMemoryImprovementResult, a2 as SerializedCandidate, a3 as SerializedCandidateCodec, a4 as agentMemorySequenceJudge, a5 as applyRetrievalHoldout, a6 as applySessionStickyRetrievalHoldout, a7 as buildAgentMemorySequenceScenarios, a8 as buildAgentMemorySequencesFromBenchmarkCases, a9 as createAgentMemoryBranch, aa as createGraphitiMemoryAdapter, ab as createMem0MemoryAdapter, ac as createMemoryExecutionPool, ad as createNeo4jAgentMemoryAdapter, ae as defaultGetMemoryContext, af as deterministicRng, ag as emitRetrievalHoldoutBypass, ah as forkAgentMemoryBranchSnapshot, ai as graphitiMemoryAdapterIdentity, aj as jsonCandidateCodec, ak as jsonObjectCandidateCodec, al as mem0MemoryAdapterIdentity, am as memoryHitToSourceRecord, an as memoryRecoveryDelayMs, ao as memoryWriteResultToSourceRecord, ap as renderMemoryContext, aq as resetRetrievalHoldoutRegistry, ar as resolveMemoryCleanupTimeoutMs, as as retrievalHoldoutConfigHash, at as runAgentMemoryExperiment, au as runAgentMemoryImprovement, av as runBoundedMemoryLifecycle, aw as runSerializedKnowledgeOptimization, ax as scenarioContentFingerprint, ay as sleepForMemoryRecovery, az as toOffPolicyTrajectory } from './index-Cf7txrYP.js';
9
+ import { R as RetrievalConfig, a as RetrievalEvalScenario, b as RetrievalEvalArtifact, c as RetrievalEvalRetriever, d as RetrievalMetricWeights, e as RetrievedKnowledgeHit } from './types-BY-xLVw-.js';
10
+ export { A as AgentMemoryAcquireRunLease, f as AgentMemoryAdapter, g as AgentMemoryBranchIsolation, h as AgentMemoryContext, i as AgentMemoryControllerMode, j as AgentMemoryHit, k as AgentMemoryKind, l as AgentMemoryRunLease, m as AgentMemoryScope, n as AgentMemorySearchOptions, o as AgentMemoryWriteInput, p as AgentMemoryWriteResult, B as BuildRetrievalBenchmarkCasesFromQrelsOptions, q as BuildRetrievalEvalDispatchOptions, K as KnowledgeAnswerBenchmarkCase, r as KnowledgeAnswerBenchmarkTaskKind, s as KnowledgeBenchmarkArtifact, t as KnowledgeBenchmarkCase, u as KnowledgeBenchmarkCaseBase, v as KnowledgeBenchmarkDistribution, w as KnowledgeBenchmarkEvaluation, x as KnowledgeBenchmarkFamily, y as KnowledgeBenchmarkReport, z as KnowledgeBenchmarkResponder, C as KnowledgeBenchmarkScenario, D as KnowledgeBenchmarkSliceSummary, E as KnowledgeBenchmarkSource, F as KnowledgeBenchmarkSpec, G as KnowledgeBenchmarkSplit, H as KnowledgeBenchmarkTaskKind, I as KnowledgeClaimMatcher, J as KnowledgeMemoryBenchmarkCase, L as KnowledgeMemoryBenchmarkTaskKind, M as KnowledgeMemoryEvent, N as KnowledgeMemoryFactMatcher, O as KnowledgeRetrievalBenchmarkCase, P as KnowledgeRetrievalBenchmarkQrel, Q as KnowledgeRetrievalBenchmarkQuery, S as MemoryAdapterBenchmarkCandidate, T as MemoryAdapterBenchmarkRankingRow, U as OwnedAgentMemoryRunLease, V as PartitionRetrievalScenariosOptions, W as RetrievalEvalRetrieverInput, X as RetrievalEvalRetrieverResult, Y as RetrievalGoldTarget, Z as RetrievalHoldoutBypassReason, _ as RetrievalHoldoutCallContext, $ as RetrievalHoldoutConfig, a0 as RetrievalHoldoutEligibleItem, a1 as RetrievalHoldoutEvent, a2 as RetrievalHoldoutResult, a3 as RetrievalHoldoutSessionState, a4 as RetrievalMetricSummary, a5 as RetrievalRecallJudgeOptions, a6 as RetrievalScenarioPartitions, a7 as RetrievedSourceSpan, a8 as RunKnowledgeBenchmarkSuiteOptions, a9 as RunKnowledgeBenchmarkSuiteResult, aa as RunMemoryAdapterBenchmarkOptions, ab as RunMemoryAdapterBenchmarkResult, ac as acquireAgentMemoryRunLease, ad as buildRetrievalEvalDispatch, ae as partitionRetrievalScenarios, af as retrievalConfigFromSurface, ag as retrievalConfigSurface, ah as retrievalRecallJudge, ai as scoreRetrievalArtifact } from './types-BY-xLVw-.js';
9
11
  export { INDUSTRY_MEMORY_BENCHMARKS, INDUSTRY_RAG_BENCHMARKS, buildFirstPartyMemoryLifecycleBenchmarkCases, buildIndustryMemoryBenchmarkSmokeCases, buildIndustryRagBenchmarkSmokeCases, buildKnowledgeBenchmarkScenarios, buildRetrievalBenchmarkCasesFromQrels, createInMemoryBenchmarkAdapter, createNoopMemoryBenchmarkAdapter, isKnowledgeMemoryBenchmarkCase, knowledgeBenchmarkJudge, parseKnowledgeBenchmarkJsonl, parseKnowledgeBenchmarkQrels, renderKnowledgeBenchmarkReportMarkdown, respondToIndustryMemoryBenchmarkSmokeCase, respondToIndustryRagBenchmarkSmokeCase, runKnowledgeBenchmarkSuite, runMemoryAdapterBenchmark, scoreKnowledgeBenchmarkArtifact, scoreMemoryBenchmarkArtifact, summarizeKnowledgeBenchmarkCampaign } from './benchmarks/index.js';
10
12
  import { KnowledgeFragment } from './sources/index.js';
11
13
  export { CornellLiiSelector, CornellLiiSourceOptions, FetchOpts, FragmentProvenance, IRS_DIMENSION_HINTS, IrsPublicationsSourceOptions, KnowledgeSource, MAX_RESPONSE_BYTES, MIN_REQUEST_GAP_MS, POLITE_USER_AGENT, PoliteFetchOptions, PoliteFetchResult, StateSosEntity, StateSosSourceConfig, __resetHttpThrottle, createCornellLiiSource, createIrsPublicationsSource, createStateSosSource, extractLinks, firstMatch, htmlToText, innerHtmlById, looksLikeBlockPage, politeFetch } from './sources/index.js';
12
- export { AgentMemoryActivation, AgentMemoryActivationDriver, AgentMemoryAttemptEvent, AgentMemoryBranch, AgentMemoryBranchLifetime, AgentMemoryBranchSnapshot, AgentMemoryDimensionComparison, AgentMemoryExperimentCandidate, AgentMemoryExperimentRankingRow, AgentMemoryExperimentRunLease, AgentMemoryGovernor, AgentMemoryHitSchema, AgentMemoryImprovementRunLease, AgentMemoryImprovementSeed, AgentMemoryJournalEntry, AgentMemoryKindSchema, AgentMemoryLifecycleTimeoutError, AgentMemoryLifecycleUnsafeError, AgentMemoryPromotionDecision, AgentMemoryScopeSchema, AgentMemorySequence, AgentMemorySequenceArtifact, AgentMemorySequenceProbe, AgentMemorySequenceProbeResult, AgentMemorySequenceScenario, AgentMemorySequenceStep, AgentMemorySharingPolicy, AgentMemoryVisibility, AgentMemoryWriteInputSchema, BuildAgentMemorySequencesFromBenchmarkCasesOptions, CreateAgentMemoryBranchOptions, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, ForkAgentMemoryBranchSnapshotOptions, GraphitiMcpClientLike, GraphitiMemoryAdapterOptions, GraphitiToolNames, Mem0ClientLike, Mem0ClientMode, Mem0MemoryAdapterOptions, Neo4jAgentMemoryAdapterOptions, RetrievalHoldoutOffPolicyOptions, RetrievalHoldoutOffPolicyResult, RetrievalHoldoutSessionSummary, RunAgentMemoryExperimentOptions, RunAgentMemoryExperimentResult, RunAgentMemoryImprovementOptions, RunAgentMemoryImprovementResult, agentMemorySequenceJudge, applyRetrievalHoldout, applySessionStickyRetrievalHoldout, buildAgentMemorySequenceScenarios, buildAgentMemorySequencesFromBenchmarkCases, createAgentMemoryBranch, createGraphitiMemoryAdapter, createMem0MemoryAdapter, createMemoryExecutionPool, createNeo4jAgentMemoryAdapter, defaultGetMemoryContext, deterministicRng, emitRetrievalHoldoutBypass, forkAgentMemoryBranchSnapshot, graphitiMemoryAdapterIdentity, mem0MemoryAdapterIdentity, memoryHitToSourceRecord, memoryRecoveryDelayMs, memoryWriteResultToSourceRecord, renderMemoryContext, resetRetrievalHoldoutRegistry, resolveMemoryCleanupTimeoutMs, retrievalHoldoutConfigHash, runAgentMemoryExperiment, runAgentMemoryImprovement, runBoundedMemoryLifecycle, sleepForMemoryRecovery, toOffPolicyTrajectory } from './memory/index.js';
13
14
  import '@tangle-network/agent-eval/rl';
14
15
 
15
16
  interface SourceAdapterInput {
@@ -633,6 +634,33 @@ interface AdaptiveResearchDriver {
633
634
  */
634
635
  declare function createAdaptiveResearchDriver(options?: AdaptiveDriverOptions): AdaptiveResearchDriver;
635
636
 
637
+ type RagOptimizationConfig = Record<string, AgentCandidateJsonValue>;
638
+ type RagOptimizationBaseOptions = Omit<RunSerializedKnowledgeOptimizationOptions<RagOptimizationConfig, RagAnswerEvalScenario, RagAnswerEvalArtifact>, 'baseline' | 'method' | 'trainScenarios' | 'selectionScenarios' | 'finalScenarios' | 'dispatchCandidate' | 'judges' | 'codec' | 'scenarioFingerprint'>;
639
+ interface RunRagOptimizationOptions extends RagOptimizationBaseOptions {
640
+ baseline: RagOptimizationConfig;
641
+ method: OptimizationMethod<RagAnswerEvalScenario, RagAnswerEvalArtifact>;
642
+ trainScenarios: readonly RagAnswerEvalScenario[];
643
+ selectionScenarios: readonly RagAnswerEvalScenario[];
644
+ finalScenarios: readonly RagAnswerEvalScenario[];
645
+ run(input: {
646
+ config: RagOptimizationConfig;
647
+ configSurface: string;
648
+ configSurfaceHash: string;
649
+ scenario: RagAnswerEvalScenario;
650
+ context: DispatchContext;
651
+ }): Promise<RagAnswerEvalArtifact>;
652
+ judges?: readonly JudgeConfig<RagAnswerEvalArtifact, RagAnswerEvalScenario>[];
653
+ }
654
+ interface RunRagOptimizationResult extends RunSerializedKnowledgeOptimizationResult<RagOptimizationConfig> {
655
+ baselineConfig: RagOptimizationConfig;
656
+ winnerConfig: RagOptimizationConfig;
657
+ trainScenarios: readonly RagAnswerEvalScenario[];
658
+ selectionScenarios: readonly RagAnswerEvalScenario[];
659
+ finalScenarios: readonly RagAnswerEvalScenario[];
660
+ }
661
+ /** Optimizes retrieval and answer behavior together as one serialized RAG configuration. */
662
+ declare function runRagOptimization(options: RunRagOptimizationOptions): Promise<RunRagOptimizationResult>;
663
+
636
664
  interface ApplyWriteBlocksResult {
637
665
  written: string[];
638
666
  warnings: string[];
@@ -746,7 +774,29 @@ type KnowledgeControlLoopAdapter = Pick<ControlRuntimeConfig<KnowledgeControlLoo
746
774
  declare function createKnowledgeControlLoopAdapter(options: KnowledgeControlLoopAdapterOptions): KnowledgeControlLoopAdapter;
747
775
  declare function runKnowledgeResearchLoop(options: RunKnowledgeResearchLoopOptions): Promise<KnowledgeResearchLoopResult>;
748
776
 
749
- type RagKnowledgeImprovementPhase = 'retrieval-tuning' | 'gap-diagnosis' | 'knowledge-acquisition' | 'knowledge-update' | 'answer-quality' | 'promotion';
777
+ type RetrievalOptimizationBaseOptions = Omit<RunSerializedKnowledgeOptimizationOptions<RetrievalConfig, RetrievalEvalScenario, RetrievalEvalArtifact>, 'baseline' | 'method' | 'trainScenarios' | 'selectionScenarios' | 'finalScenarios' | 'dispatchCandidate' | 'judges' | 'codec' | 'scenarioFingerprint'>;
778
+ interface RunRetrievalImprovementLoopOptions extends RetrievalOptimizationBaseOptions {
779
+ baseline: RetrievalConfig;
780
+ trainScenarios: readonly RetrievalEvalScenario[];
781
+ selectionScenarios: readonly RetrievalEvalScenario[];
782
+ finalScenarios: readonly RetrievalEvalScenario[];
783
+ method: OptimizationMethod<RetrievalEvalScenario, RetrievalEvalArtifact>;
784
+ index?: KnowledgeIndex;
785
+ defaultK?: number;
786
+ retrieve?: RetrievalEvalRetriever;
787
+ judges?: readonly JudgeConfig<RetrievalEvalArtifact, RetrievalEvalScenario>[];
788
+ metricWeights?: RetrievalMetricWeights;
789
+ }
790
+ interface RunRetrievalImprovementLoopResult extends RunSerializedKnowledgeOptimizationResult<RetrievalConfig> {
791
+ baselineConfig: RetrievalConfig;
792
+ winnerConfig: RetrievalConfig;
793
+ trainScenarios: readonly RetrievalEvalScenario[];
794
+ selectionScenarios: readonly RetrievalEvalScenario[];
795
+ finalScenarios: readonly RetrievalEvalScenario[];
796
+ }
797
+ declare function runRetrievalImprovementLoop(options: RunRetrievalImprovementLoopOptions): Promise<RunRetrievalImprovementLoopResult>;
798
+
799
+ type RagKnowledgeImprovementPhase = 'rag-optimization' | 'retrieval-tuning' | 'gap-diagnosis' | 'knowledge-acquisition' | 'knowledge-update' | 'answer-quality' | 'promotion';
750
800
  type RagKnowledgeImprovementPhaseStatus = 'completed' | 'skipped' | 'failed';
751
801
  type RagGapKind = 'missing-source' | 'stale-source' | 'retrieval-miss' | 'retrieval-noise' | 'chunking-mismatch' | 'missing-multihop-evidence' | 'generator-unsupported-claim' | 'citation-mismatch' | 'incorrect-abstention' | 'unknown';
752
802
  type RagGapSeverity = 'info' | 'warning' | 'error' | 'critical';
@@ -756,7 +806,7 @@ interface RagGapFinding {
756
806
  severity: RagGapSeverity;
757
807
  message: string;
758
808
  scenarioId?: string;
759
- evidence?: Record<string, JsonValue>;
809
+ evidence?: Record<string, AgentCandidateJsonValue>;
760
810
  }
761
811
  interface RagKnowledgeImprovementPhaseResult {
762
812
  phase: RagKnowledgeImprovementPhase;
@@ -764,22 +814,26 @@ interface RagKnowledgeImprovementPhaseResult {
764
814
  summary: string;
765
815
  startedAt: string;
766
816
  finishedAt: string;
767
- metadata?: Record<string, JsonValue>;
817
+ metadata?: Record<string, AgentCandidateJsonValue>;
768
818
  }
819
+ type RagOptimizationSelection = Pick<RunRagOptimizationResult, 'methodName' | 'baseline' | 'winner' | 'baselineConfig' | 'winnerConfig'>;
820
+ type RetrievalOptimizationSelection = Pick<RunRetrievalImprovementLoopResult, 'methodName' | 'baseline' | 'winner' | 'baselineConfig' | 'winnerConfig'>;
769
821
  interface RagPhaseInputBase {
770
822
  goal: string;
771
823
  phases: readonly RagKnowledgeImprovementPhaseResult[];
824
+ /** Selected candidate only. Adaptive update callbacks run before final scoring starts. */
825
+ optimization?: RagOptimizationSelection;
772
826
  signal?: AbortSignal;
773
827
  }
774
828
  interface RagDiagnosisInput extends RagPhaseInputBase {
775
- retrieval?: RunRetrievalImprovementLoopResult;
829
+ retrieval?: RetrievalOptimizationSelection;
776
830
  }
777
831
  interface RagKnowledgeAcquisitionInput extends RagPhaseInputBase {
778
- retrieval?: RunRetrievalImprovementLoopResult;
832
+ retrieval?: RetrievalOptimizationSelection;
779
833
  findings: readonly RagGapFinding[];
780
834
  }
781
835
  interface RagKnowledgeUpdateInput extends RagPhaseInputBase {
782
- retrieval?: RunRetrievalImprovementLoopResult;
836
+ retrieval?: RetrievalOptimizationSelection;
783
837
  findings: readonly RagGapFinding[];
784
838
  acquisition?: KnowledgeResearchLoopDecision;
785
839
  }
@@ -787,10 +841,10 @@ interface RagKnowledgeUpdateResult {
787
841
  applied: boolean;
788
842
  summary: string;
789
843
  research?: KnowledgeResearchLoopResult;
790
- metadata?: Record<string, JsonValue>;
844
+ metadata?: Record<string, AgentCandidateJsonValue>;
791
845
  }
792
846
  interface RagAnswerQualityInput extends RagPhaseInputBase {
793
- retrieval?: RunRetrievalImprovementLoopResult;
847
+ retrieval?: RetrievalOptimizationSelection;
794
848
  findings: readonly RagGapFinding[];
795
849
  acquisition?: KnowledgeResearchLoopDecision;
796
850
  knowledgeUpdate?: RagKnowledgeUpdateResult;
@@ -798,11 +852,19 @@ interface RagAnswerQualityInput extends RagPhaseInputBase {
798
852
  interface RagAnswerQualityResult {
799
853
  passed: boolean;
800
854
  metrics: Record<string, number>;
855
+ finalScenarioIds: readonly string[];
856
+ datasetRef: string;
857
+ evaluatorRef: string;
858
+ cost: ComparisonCost;
801
859
  findings?: readonly RagGapFinding[];
802
- metadata?: Record<string, JsonValue>;
860
+ metadata?: Record<string, AgentCandidateJsonValue>;
803
861
  }
804
862
  interface RagPromotionInput extends RagPhaseInputBase {
805
- retrieval?: RunRetrievalImprovementLoopResult;
863
+ retrieval?: RetrievalOptimizationSelection;
864
+ /** Full final-case result available only to the terminal promotion decision. */
865
+ optimizationComparison?: RunRagOptimizationResult['comparison'];
866
+ /** Full final-case result available only to the terminal promotion decision. */
867
+ retrievalComparison?: RunRetrievalImprovementLoopResult['comparison'];
806
868
  findings: readonly RagGapFinding[];
807
869
  acquisition?: KnowledgeResearchLoopDecision;
808
870
  knowledgeUpdate?: RagKnowledgeUpdateResult;
@@ -811,7 +873,7 @@ interface RagPromotionInput extends RagPhaseInputBase {
811
873
  interface RagPromotionResult {
812
874
  promoted: boolean;
813
875
  reason: string;
814
- metadata?: Record<string, JsonValue>;
876
+ metadata?: Record<string, AgentCandidateJsonValue>;
815
877
  }
816
878
  interface RagKnowledgeResearchOptions extends Omit<RunKnowledgeResearchLoopOptions, 'goal' | 'signal' | 'step'> {
817
879
  goal?: string;
@@ -819,13 +881,20 @@ interface RagKnowledgeResearchOptions extends Omit<RunKnowledgeResearchLoopOptio
819
881
  }
820
882
  interface RunRagKnowledgeImprovementLoopOptions {
821
883
  goal: string;
884
+ optimization?: RunRagOptimizationOptions;
822
885
  retrieval?: RunRetrievalImprovementLoopOptions;
823
886
  diagnose?: (input: RagDiagnosisInput) => MaybePromise$1<readonly RagGapFinding[]>;
824
887
  acquireKnowledge?: (input: RagKnowledgeAcquisitionInput) => MaybePromise$1<KnowledgeResearchLoopDecision>;
825
888
  knowledgeResearch?: RagKnowledgeResearchOptions;
826
889
  updateKnowledge?: (input: RagKnowledgeUpdateInput) => MaybePromise$1<RagKnowledgeUpdateResult>;
827
890
  evaluateAnswers?: (input: RagAnswerQualityInput) => MaybePromise$1<RagAnswerQualityResult>;
828
- promote?: (input: RagPromotionInput) => MaybePromise$1<RagPromotionResult>;
891
+ /** Maximum total answer-evaluation spend accepted for promotion. */
892
+ answerQualityCostCeiling?: number;
893
+ /**
894
+ * Makes a side-effect-free promotion decision after the library has rejected
895
+ * missing, regressing, unaccounted, or over-budget final evidence.
896
+ */
897
+ decidePromotion?: (input: RagPromotionInput) => MaybePromise$1<RagPromotionResult>;
829
898
  enabledPhases?: readonly RagKnowledgeImprovementPhase[];
830
899
  requiredPhases?: readonly RagKnowledgeImprovementPhase[];
831
900
  signal?: AbortSignal;
@@ -834,6 +903,7 @@ interface RunRagKnowledgeImprovementLoopOptions {
834
903
  interface RunRagKnowledgeImprovementLoopResult {
835
904
  goal: string;
836
905
  phases: readonly RagKnowledgeImprovementPhaseResult[];
906
+ optimization?: RunRagOptimizationResult;
837
907
  retrieval?: RunRetrievalImprovementLoopResult;
838
908
  findings: readonly RagGapFinding[];
839
909
  acquisition?: KnowledgeResearchLoopDecision;
@@ -855,7 +925,7 @@ interface RagEvalContext {
855
925
  sourceId?: string;
856
926
  anchorId?: string;
857
927
  stale?: boolean;
858
- metadata?: Record<string, JsonValue>;
928
+ metadata?: Record<string, AgentCandidateJsonValue>;
859
929
  }
860
930
  interface RagEvalCitation {
861
931
  id: string;
@@ -865,13 +935,13 @@ interface RagEvalCitation {
865
935
  sourceId?: string;
866
936
  anchorId?: string;
867
937
  quote?: string;
868
- metadata?: Record<string, JsonValue>;
938
+ metadata?: Record<string, AgentCandidateJsonValue>;
869
939
  }
870
940
  interface RagEvalClaim {
871
941
  id: string;
872
942
  text: string;
873
943
  citationIds?: readonly string[];
874
- metadata?: Record<string, JsonValue>;
944
+ metadata?: Record<string, AgentCandidateJsonValue>;
875
945
  }
876
946
  interface RagRequiredContext {
877
947
  id?: string;
@@ -896,7 +966,7 @@ interface ExternalRagEvalScore {
896
966
  provider: RagEvalProvider | string;
897
967
  scores: Record<string, number>;
898
968
  reasons?: Record<string, string>;
899
- metadata?: Record<string, JsonValue>;
969
+ metadata?: Record<string, AgentCandidateJsonValue>;
900
970
  }
901
971
  interface RagAnswerEvalArtifact {
902
972
  query: string;
@@ -908,7 +978,7 @@ interface RagAnswerEvalArtifact {
908
978
  durationMs?: number;
909
979
  costUsd?: number;
910
980
  externalScores?: readonly ExternalRagEvalScore[];
911
- metadata?: Record<string, JsonValue>;
981
+ metadata?: Record<string, AgentCandidateJsonValue>;
912
982
  }
913
983
  interface RagAnswerMetricSummary {
914
984
  metrics: Record<RagEvalMetricKey, number>;
@@ -936,6 +1006,10 @@ interface RagAnswerEvalCase {
936
1006
  }
937
1007
  interface RagAnswerQualityHookOptions {
938
1008
  scenarios: readonly RagAnswerEvalScenario[];
1009
+ /** Immutable identity of generation, scoring, models, and external evaluator behavior. */
1010
+ evaluatorRef: string;
1011
+ /** Return observed spend after all generation and evaluation calls finish. */
1012
+ cost: ComparisonCost | (() => MaybePromise<ComparisonCost>);
939
1013
  run: (scenario: RagAnswerEvalScenario) => MaybePromise<RagAnswerEvalArtifact>;
940
1014
  externalEvaluator?: (item: RagAnswerEvalCase) => MaybePromise<ExternalRagEvalScore | readonly ExternalRagEvalScore[] | undefined>;
941
1015
  thresholds?: Partial<Record<RagEvalMetricKey, number>>;
@@ -1067,6 +1141,8 @@ interface KnowledgeImprovementCandidateRecord {
1067
1141
  candidateHash?: string;
1068
1142
  evidenceHash?: string;
1069
1143
  promotionPlanHash?: string;
1144
+ /** Durable one-way boundary preventing final-case reuse after interruption. */
1145
+ finalEvaluationStartedAt?: string;
1070
1146
  status: KnowledgeImprovementStatus;
1071
1147
  createdAt: string;
1072
1148
  updatedAt: string;
@@ -1075,6 +1151,7 @@ interface KnowledgeImprovementRunState {
1075
1151
  runId: string;
1076
1152
  root: string;
1077
1153
  goal: string;
1154
+ implementationRef: string;
1078
1155
  status: KnowledgeImprovementStatus;
1079
1156
  baseHash: string;
1080
1157
  createdAt: string;
@@ -1118,6 +1195,7 @@ declare const KnowledgeImprovementRunStateSchema: z.ZodObject<{
1118
1195
  runId: z.ZodString;
1119
1196
  root: z.ZodString;
1120
1197
  goal: z.ZodString;
1198
+ implementationRef: z.ZodString;
1121
1199
  status: z.ZodEnum<{
1122
1200
  rejected: "rejected";
1123
1201
  promoted: "promoted";
@@ -1136,6 +1214,7 @@ declare const KnowledgeImprovementRunStateSchema: z.ZodObject<{
1136
1214
  candidateHash: z.ZodOptional<z.ZodString>;
1137
1215
  evidenceHash: z.ZodOptional<z.ZodString>;
1138
1216
  promotionPlanHash: z.ZodOptional<z.ZodString>;
1217
+ finalEvaluationStartedAt: z.ZodOptional<z.ZodISODateTime>;
1139
1218
  status: z.ZodEnum<{
1140
1219
  rejected: "rejected";
1141
1220
  promoted: "promoted";
@@ -1155,6 +1234,7 @@ declare const KnowledgeImprovementEvidenceSchema: z.ZodObject<{
1155
1234
  candidateId: z.ZodString;
1156
1235
  iteration: z.ZodNumber;
1157
1236
  goalHash: z.ZodString;
1237
+ implementationRef: z.ZodString;
1158
1238
  baseHash: z.ZodString;
1159
1239
  candidateHash: z.ZodString;
1160
1240
  promotionPlanHash: z.ZodString;
@@ -1241,6 +1321,20 @@ interface ResolvedKnowledgeImprovementCandidate {
1241
1321
  interface KnowledgeImprovementRetrievalOptions extends Omit<RunRetrievalImprovementLoopOptions, 'index' | 'runDir'> {
1242
1322
  runDir?: RunRetrievalImprovementLoopOptions['runDir'];
1243
1323
  }
1324
+ type KnowledgeImprovementRagOptimizationRunInput = Parameters<RunRagOptimizationOptions['run']>[0] & {
1325
+ runId: string;
1326
+ iteration: number;
1327
+ candidateId: string;
1328
+ root: string;
1329
+ baselineRoot: string;
1330
+ candidateRoot: string;
1331
+ candidateIndex: KnowledgeIndex;
1332
+ baseHash: string;
1333
+ };
1334
+ interface KnowledgeImprovementRagOptimizationOptions extends Omit<RunRagOptimizationOptions, 'run' | 'runDir'> {
1335
+ runDir?: RunRagOptimizationOptions['runDir'];
1336
+ run(input: KnowledgeImprovementRagOptimizationRunInput): Promise<RagAnswerEvalArtifact>;
1337
+ }
1244
1338
  interface KnowledgeImprovementUpdateInput extends RagKnowledgeUpdateInput {
1245
1339
  runId: string;
1246
1340
  iteration: number;
@@ -1254,6 +1348,11 @@ type KnowledgeImprovementUpdate = (input: KnowledgeImprovementUpdateInput) => Pr
1254
1348
  interface KnowledgeImprovementOptions {
1255
1349
  root: string;
1256
1350
  goal: string;
1351
+ /**
1352
+ * Immutable identity covering callbacks, evaluation policy, models, indexes,
1353
+ * external services, and all other behavior that can affect this run.
1354
+ */
1355
+ implementationRef: string;
1257
1356
  runId?: string;
1258
1357
  ownerId?: string;
1259
1358
  leaseTtlMs?: number;
@@ -1267,14 +1366,19 @@ interface KnowledgeImprovementOptions {
1267
1366
  kbQuality?: KnowledgeBaseQualityOptions;
1268
1367
  step?: RunKnowledgeResearchLoopOptions['step'];
1269
1368
  knowledgeResearch?: Omit<RagKnowledgeResearchOptions, 'root'>;
1369
+ ragOptimization?: KnowledgeImprovementRagOptimizationOptions;
1270
1370
  retrieval?: KnowledgeImprovementRetrievalOptions;
1271
1371
  diagnose?: NonNullable<RunRagKnowledgeImprovementLoopOptions['diagnose']>;
1272
1372
  acquireKnowledge?: NonNullable<RunRagKnowledgeImprovementLoopOptions['acquireKnowledge']>;
1273
1373
  updateKnowledge?: KnowledgeImprovementUpdate;
1274
1374
  evaluateAnswers?: NonNullable<RunRagKnowledgeImprovementLoopOptions['evaluateAnswers']>;
1275
- decidePromotion?: NonNullable<RunRagKnowledgeImprovementLoopOptions['promote']>;
1375
+ answerQualityCostCeiling?: RunRagKnowledgeImprovementLoopOptions['answerQualityCostCeiling'];
1376
+ decidePromotion?: NonNullable<RunRagKnowledgeImprovementLoopOptions['decidePromotion']>;
1276
1377
  enabledPhases?: readonly RagKnowledgeImprovementPhase[];
1277
1378
  requiredPhases?: readonly RagKnowledgeImprovementPhase[];
1379
+ /** Repeatable candidate screening that must not use final cases. */
1380
+ evaluateDevelopment?: KnowledgeImprovementEvaluator;
1381
+ /** Single-use final evaluator. A failure ends the run. */
1278
1382
  evaluate?: KnowledgeImprovementEvaluator;
1279
1383
  signal?: AbortSignal;
1280
1384
  now?: () => Date;
@@ -1284,6 +1388,49 @@ interface KnowledgeImprovementOptions {
1284
1388
  /** Load the durable result for one exact activation without changing knowledge or run state. */
1285
1389
  declare function loadKnowledgeImprovementActivationResult(options: LoadKnowledgeImprovementActivationResultOptions): Promise<AgentImprovementActivationResult | null>;
1286
1390
 
1391
+ type PolicyCandidateOptions = Omit<KnowledgeImprovementOptions, 'root' | 'goal' | 'implementationRef' | 'runId' | 'maxCandidates' | 'step' | 'knowledgeResearch' | 'updateKnowledge'>;
1392
+ type PolicyOptimizationBaseOptions<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact> = Omit<RunSerializedKnowledgeOptimizationOptions<TPolicy, TScenario, TArtifact>, 'baseline' | 'method' | 'trainScenarios' | 'selectionScenarios' | 'finalScenarios' | 'executionRef'>;
1393
+ interface OptimizeKnowledgeBasePolicyOptions<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact> extends PolicyOptimizationBaseOptions<TPolicy, TScenario, TArtifact> {
1394
+ root: string;
1395
+ goal: string;
1396
+ baselinePolicy: TPolicy;
1397
+ method: OptimizationMethod<TScenario, TArtifact>;
1398
+ trainScenarios: readonly TScenario[];
1399
+ selectionScenarios: readonly TScenario[];
1400
+ finalScenarios: readonly TScenario[];
1401
+ /** Commit or content identity for evaluation, applyPolicy, and external dependencies. */
1402
+ policyApplicationRef: string;
1403
+ /** Optional namespace for parallel materialization of the same measured policy. */
1404
+ candidateRunLabel?: string;
1405
+ candidate?: PolicyCandidateOptions;
1406
+ applyPolicy(input: KnowledgeImprovementUpdateInput & {
1407
+ policy: TPolicy;
1408
+ policySurface: string;
1409
+ policySurfaceHash: string;
1410
+ optimizationMethod: string;
1411
+ }): Promise<{
1412
+ applied: boolean;
1413
+ summary: string;
1414
+ metadata?: Record<string, AgentCandidateJsonValue>;
1415
+ }>;
1416
+ }
1417
+ interface OptimizeKnowledgeBasePolicyResult<TPolicy extends AgentCandidateJsonValue> {
1418
+ optimization: RunSerializedKnowledgeOptimizationResult<TPolicy>;
1419
+ improvement: KnowledgeImprovementResult;
1420
+ }
1421
+ /**
1422
+ * Optimizes a serialized KB-maintenance policy, then materializes the selected
1423
+ * policy in one isolated knowledge candidate. Activation remains explicit.
1424
+ */
1425
+ declare function optimizeKnowledgeBasePolicy<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact>(options: OptimizeKnowledgeBasePolicyOptions<TPolicy, TScenario, TArtifact>): Promise<OptimizeKnowledgeBasePolicyResult<TPolicy>>;
1426
+ type KnowledgePolicyDispatch<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact> = (input: {
1427
+ candidate: TPolicy;
1428
+ candidateSurface: string;
1429
+ candidateSurfaceHash: string;
1430
+ scenario: TScenario;
1431
+ context: DispatchContext;
1432
+ }) => Promise<TArtifact>;
1433
+
1287
1434
  declare function improveKnowledgeBase(options: KnowledgeImprovementOptions): Promise<KnowledgeImprovementResult>;
1288
1435
 
1289
1436
  declare function knowledgeImprovementRunId(root: string, goal: string): string;
@@ -1668,6 +1815,43 @@ declare function createKnowledgeEvent(input: {
1668
1815
  now?: () => Date;
1669
1816
  }): KnowledgeEvent;
1670
1817
 
1818
+ interface FileSystemSearchProviderOptions {
1819
+ /** Knowledge-base root containing `knowledge/` and `.agent-knowledge/`. */
1820
+ root: string;
1821
+ /** Optional warm index, useful when the caller already built one. */
1822
+ index?: KnowledgeIndex;
1823
+ /** Default result count for `search()`. Defaults to 10. */
1824
+ defaultLimit?: number;
1825
+ /**
1826
+ * `manual` caches the index until `refresh: true` or `invalidate()`.
1827
+ * `always` rebuilds from disk on every search.
1828
+ */
1829
+ refresh?: 'manual' | 'always';
1830
+ }
1831
+ interface FileSystemSearchOptions {
1832
+ limit?: number;
1833
+ refresh?: boolean;
1834
+ }
1835
+ /**
1836
+ * File-first retrieval over an `agent-knowledge` KB.
1837
+ *
1838
+ * This is the simple backend for products that want deterministic search over
1839
+ * markdown knowledge files before adding embeddings, rerankers, or a vector DB.
1840
+ */
1841
+ declare class FileSystemSearchProvider {
1842
+ readonly root: string;
1843
+ private index;
1844
+ private readonly defaultLimit;
1845
+ private readonly refreshMode;
1846
+ constructor(options: FileSystemSearchProviderOptions);
1847
+ getIndex(options?: FileSystemSearchOptions): Promise<KnowledgeIndex>;
1848
+ search(query: string, options?: FileSystemSearchOptions): Promise<KnowledgeSearchResult[]>;
1849
+ retrieve(query: string, options?: FileSystemSearchOptions): Promise<RetrievedKnowledgeHit[]>;
1850
+ asRetrievalEvalRetriever(): RetrievalEvalRetriever;
1851
+ invalidate(): void;
1852
+ }
1853
+ declare function createFileSystemSearchProvider(options: FileSystemSearchProviderOptions): FileSystemSearchProvider;
1854
+
1671
1855
  /**
1672
1856
  * Knowledge freshness store: tracks when each `(workspaceId, sourceId)` pair
1673
1857
  * was last successfully refreshed, and reports staleness against a TTL.
@@ -2705,4 +2889,4 @@ declare function normalizeLinkTarget(target: string): string;
2705
2889
  declare function isSafeKnowledgePath(path: string, allowedPrefixes?: string[]): boolean;
2706
2890
  declare function parseKnowledgeWriteBlocks(text: string, allowedPrefixes?: string[]): KnowledgeWriteParseResult;
2707
2891
 
2708
- export { type AdaptiveDecision, type AdaptiveDriverOptions, type AdaptiveResearchDriver, type AdaptiveStats, type AddSourceOptions, type AddSourceTextInput, type ApplyWriteBlocksResult, type BuildEvalKnowledgeBundleOptions, type ChunkingOptions, type ClaimGroundingDriverOptions, type CompanyEvalCase, type D1Adapter, type DedupReason, type DeepQuestion, type DeepQuestionKind, type DefineReadinessSpecInput, type DetectChangesOptions, type DetectChangesResult, type DiscoveryLoopResult, type DiscoveryLoopRound, type DiscoveryLoopStopReason, type DiscoveryResult, type DiscoveryTask, type DriverResearchContext, type EvalKnowledgeBundleBuildResult, type EvaluateKnowledgeBaseReadinessOptions, type ExpectedGroup, type ExternalRagEvalScore, type FactResult, type FileSystemFreshnessStoreOptions, FileSystemKbStore, type FreshnessKey, type FreshnessMark, type FreshnessRecord, type FreshnessTtl, type GroundClaimOptions, type GroundingResult, type KbStore, KnowledgeBaseCandidateSchema, type KnowledgeBaseQualityOptions, type KnowledgeBaseQualityReport, type KnowledgeBaseReadinessEvaluation, type KnowledgeChange, type KnowledgeChangeKind, type KnowledgeChunk, KnowledgeClaim, type KnowledgeControlLoopAction, type KnowledgeControlLoopActionResult, type KnowledgeControlLoopAdapter, type KnowledgeControlLoopAdapterOptions, type KnowledgeControlLoopState, type KnowledgeDiscoveryDispatcher, type KnowledgeDiscoveryWorker, KnowledgeEvent, type KnowledgeEventQuery, KnowledgeEventSchema, KnowledgeEventType, type KnowledgeExplanation, KnowledgeFragment, type KnowledgeFreshnessStore, type KnowledgeGap, KnowledgeGraph, KnowledgeGraphEdgeSchema, KnowledgeGraphNodeSchema, type KnowledgeImprovementActivationPersistence, type KnowledgeImprovementCandidateRecord, type KnowledgeImprovementCandidateRef, KnowledgeImprovementCandidateRefSchema, type KnowledgeImprovementEvaluationInput, type KnowledgeImprovementEvaluator, type KnowledgeImprovementEvent, type KnowledgeImprovementEvidence, KnowledgeImprovementEvidenceSchema, type KnowledgeImprovementMetric, type KnowledgeImprovementMetricProvenance, type KnowledgeImprovementMutationReceipt, type KnowledgeImprovementMutationResult, type KnowledgeImprovementOptions, type KnowledgeImprovementResult, type KnowledgeImprovementRetrievalOptions, type KnowledgeImprovementRunState, KnowledgeImprovementRunStateSchema, type KnowledgeImprovementStatus, type KnowledgeImprovementTarget, type KnowledgeImprovementUpdate, type KnowledgeImprovementUpdateInput, KnowledgeIndex, KnowledgeIndexSchema, type KnowledgeInspection, type KnowledgeLayout, KnowledgeLintFinding, KnowledgePage, KnowledgePageSchema, type KnowledgeProposal, KnowledgeProposalParseError, type KnowledgeReadinessSpec, KnowledgeRelease, type KnowledgeReleaseInput, type KnowledgeReleaseReport, type KnowledgeResearchLoopContext, type KnowledgeResearchLoopDecision, type KnowledgeResearchLoopResult, type KnowledgeResearchLoopStep, KnowledgeSearchResult, KnowledgeWriteBlock, KnowledgeWriteParseResult, type LoadKnowledgeImprovementActivationResultOptions, type MaterialFact, type MaterialFactLens, type MaterialFactsResult, MemoryKbStore, type ParsedFrontmatter, type PendingKnowledgeMutation, type PromoteKnowledgeCandidateOptions, type ProposeFromFindingsResult, READINESS_SPEC_DEFAULTS, type RagAnswerEvalArtifact, type RagAnswerEvalCase, type RagAnswerEvalScenario, type RagAnswerMetricSummary, type RagAnswerQualityHookOptions, type RagAnswerQualityInput, type RagAnswerQualityJudgeOptions, type RagAnswerQualityResult, type RagCalibrationOptions, type RagCalibrationResult, type RagDiagnosisInput, type RagEvalCitation, type RagEvalClaim, type RagEvalContext, type RagEvalMetricKey, type RagEvalProvider, type RagEvalSlice, type RagGapFinding, type RagGapKind, type RagGapSeverity, type RagKnowledgeAcquisitionInput, type RagKnowledgeImprovementPhase, type RagKnowledgeImprovementPhaseResult, type RagKnowledgeImprovementPhaseStatus, type RagKnowledgeResearchOptions, type RagKnowledgeUpdateInput, type RagKnowledgeUpdateResult, type RagPhaseInputBase, type RagPromotionInput, type RagPromotionResult, type RagRequiredContext, type RecoverPendingKnowledgeMutationOptions, type RejectedSource, type ResearchContribution, type ResearchDriver, type ResearchDrivingDriver, type ResearchDrivingDriverOptions, type ResearchDrivingState, type ResearchDrivingSteer, type ResearchSourceProposal, type ResearchWorker, type ResolvedKnowledgeImprovementCandidate, type ResolvedKnowledgeImprovementComparison, type ResolvedKnowledgeImprovementComparisonSnapshot, type RestoreKnowledgeCandidateBaselineOptions, type RouterClient, RouterError, type RouterUsage, type RunDiscoveryLoopOptions, type RunKnowledgeResearchLoopOptions, type RunRagKnowledgeImprovementLoopOptions, type RunRagKnowledgeImprovementLoopResult, RunRetrievalImprovementLoopOptions, RunRetrievalImprovementLoopResult, SCAFFOLD_PAGE_BASENAMES, type SourceAdapter, type SourceAdapterInput, type SourceAdapterOutput, SourceAnchorSchema, type SourceFreshnessInspection, SourceRecord, SourceRecordSchema, SourceRegistry, type SourceVerdict, type SourceVerificationContext, type TangleRouterOptions, type ThesisRunOptions, type ThesisRunResult, type ThesisTaskInput, type TrackedClaim, type TriageClass, type TwoAgentResearchLoopOptions, type TwoAgentResearchLoopResult, type TwoAgentResearchRound, type UseKnowledgeImprovementCandidateOptions, type ValidateKnowledgeOptions, type ValidateKnowledgeResult, type VerifiedResearchLoopOptions, type VerifiedResearchLoopResult, type VerifiedResearchRound, type VerifyingDriverOptions, WIKILINK_REGEX, type WebResearchWorkerOptions, type WebSearchHit, type WorkerClaimDecorationOptions, type WorkerResearchContext, addSourcePath, addSourceText, applyKnowledgeWriteBlocks, applyKnowledgeWriteBlocksFile, buildEvalKnowledgeBundle, buildKnowledgeGraph, buildKnowledgeIndex, calibrateRagAnswerJudge, canonicalizeUrl, chunkMarkdown, citedClaimKey, citedClaimOf, contentKey, createAdaptiveResearchDriver, createClaimDecorator, createClaimGroundingVerifier, createCollectionResearchDriver, createD1FreshnessStoreStub, createFileSystemFreshnessStore, createKnowledgeControlLoopAdapter, createKnowledgeEvent, createLocalDiscoveryDispatcher, createRagAnswerQualityHook, createResearchDrivingDriver, createTangleRouterClient, createVerifyingResearchDriver, createWebResearchWorker, defineReadinessSpec, detectChanges, diagnoseRagAnswerFailure, evaluateKnowledgeBaseReadiness, explainKnowledgeTarget, extractWikilinks, formatFrontmatter, fromAgentCandidateKnowledgeRef, gradeCompanyAgainstText, gradeFactAgainstText, groundClaimInText, hashKnowledgeBase, improveKnowledgeBase, initKnowledgeBase, inspectKnowledgeIndex, inspectPendingKnowledgeMutation, investmentThesisSet, isSafeKnowledgePath, isScaffoldPath, kbIndexToText, knowledgeImprovementCandidateRef, knowledgeImprovementRunDir, knowledgeImprovementRunId, knowledgeReleaseReport, layoutFor, lensDistribution, lintKnowledgeIndex, loadKnowledgeImprovementActivationResult, loadKnowledgeImprovementEvents, loadKnowledgeImprovementState, loadKnowledgePages, loadSourceRegistry, materialFactsSurfaced, materialFactsSurfacedInText, mediaTypeFor, normalizeExternalRagScores, normalizeLinkTarget, parseFrontmatter, parseKnowledgeWriteBlocks, promoteKnowledgeCandidate, proposeFromFinding, proposeFromFindings, ragAnswerQualityJudge, reciprocalRankFusion, recoverPendingKnowledgeMutation, restoreKnowledgeCandidateBaseline, runDiscoveryLoop, runInvestmentThesisTask, runKnowledgeResearchLoop, runRagKnowledgeImprovementLoop, runTwoAgentResearchLoop, runVerifiedResearchLoop, scoreKnowledgeBaseIndex, scoreRagAnswerArtifact, searchKnowledge, sha256, slugify, sourceMatchesGaps, sourceRegistryPath, stableId, stripFrontmatter, textSourceAdapter, thesisReadinessSpecs, toAgentCandidateKnowledgeRef, toDeepEvalTestCases, toRagCheckerRecords, toRagasEvaluationRows, toTruLensRecords, tokenizeQuery, totalMaterialFacts, triageSource, validateKnowledgeIndex, withCitedClaim, withKnowledgeImprovementCandidate, withKnowledgeImprovementComparison, writeJson, writeKnowledgeIndex, writeSourceRegistry };
2892
+ export { type AdaptiveDecision, type AdaptiveDriverOptions, type AdaptiveResearchDriver, type AdaptiveStats, type AddSourceOptions, type AddSourceTextInput, type ApplyWriteBlocksResult, type BuildEvalKnowledgeBundleOptions, type ChunkingOptions, type ClaimGroundingDriverOptions, type CompanyEvalCase, type D1Adapter, type DedupReason, type DeepQuestion, type DeepQuestionKind, type DefineReadinessSpecInput, type DetectChangesOptions, type DetectChangesResult, type DiscoveryLoopResult, type DiscoveryLoopRound, type DiscoveryLoopStopReason, type DiscoveryResult, type DiscoveryTask, type DriverResearchContext, type EvalKnowledgeBundleBuildResult, type EvaluateKnowledgeBaseReadinessOptions, type ExpectedGroup, type ExternalRagEvalScore, type FactResult, type FileSystemFreshnessStoreOptions, FileSystemKbStore, type FileSystemSearchOptions, FileSystemSearchProvider, type FileSystemSearchProviderOptions, type FreshnessKey, type FreshnessMark, type FreshnessRecord, type FreshnessTtl, type GroundClaimOptions, type GroundingResult, type KbStore, KnowledgeBaseCandidateSchema, type KnowledgeBaseQualityOptions, type KnowledgeBaseQualityReport, type KnowledgeBaseReadinessEvaluation, type KnowledgeChange, type KnowledgeChangeKind, type KnowledgeChunk, KnowledgeClaim, type KnowledgeControlLoopAction, type KnowledgeControlLoopActionResult, type KnowledgeControlLoopAdapter, type KnowledgeControlLoopAdapterOptions, type KnowledgeControlLoopState, type KnowledgeDiscoveryDispatcher, type KnowledgeDiscoveryWorker, KnowledgeEvent, type KnowledgeEventQuery, KnowledgeEventSchema, KnowledgeEventType, type KnowledgeExplanation, KnowledgeFragment, type KnowledgeFreshnessStore, type KnowledgeGap, KnowledgeGraph, KnowledgeGraphEdgeSchema, KnowledgeGraphNodeSchema, type KnowledgeImprovementActivationPersistence, type KnowledgeImprovementCandidateRecord, type KnowledgeImprovementCandidateRef, KnowledgeImprovementCandidateRefSchema, type KnowledgeImprovementEvaluationInput, type KnowledgeImprovementEvaluator, type KnowledgeImprovementEvent, type KnowledgeImprovementEvidence, KnowledgeImprovementEvidenceSchema, type KnowledgeImprovementMetric, type KnowledgeImprovementMetricProvenance, type KnowledgeImprovementMutationReceipt, type KnowledgeImprovementMutationResult, type KnowledgeImprovementOptions, type KnowledgeImprovementRagOptimizationOptions, type KnowledgeImprovementRagOptimizationRunInput, type KnowledgeImprovementResult, type KnowledgeImprovementRetrievalOptions, type KnowledgeImprovementRunState, KnowledgeImprovementRunStateSchema, type KnowledgeImprovementStatus, type KnowledgeImprovementTarget, type KnowledgeImprovementUpdate, type KnowledgeImprovementUpdateInput, KnowledgeIndex, KnowledgeIndexSchema, type KnowledgeInspection, type KnowledgeLayout, KnowledgeLintFinding, KnowledgePage, KnowledgePageSchema, type KnowledgePolicyDispatch, type KnowledgeProposal, KnowledgeProposalParseError, type KnowledgeReadinessSpec, KnowledgeRelease, type KnowledgeReleaseInput, type KnowledgeReleaseReport, type KnowledgeResearchLoopContext, type KnowledgeResearchLoopDecision, type KnowledgeResearchLoopResult, type KnowledgeResearchLoopStep, KnowledgeSearchResult, KnowledgeWriteBlock, KnowledgeWriteParseResult, type LoadKnowledgeImprovementActivationResultOptions, type MaterialFact, type MaterialFactLens, type MaterialFactsResult, MemoryKbStore, type OptimizeKnowledgeBasePolicyOptions, type OptimizeKnowledgeBasePolicyResult, type ParsedFrontmatter, type PendingKnowledgeMutation, type PromoteKnowledgeCandidateOptions, type ProposeFromFindingsResult, READINESS_SPEC_DEFAULTS, type RagAnswerEvalArtifact, type RagAnswerEvalCase, type RagAnswerEvalScenario, type RagAnswerMetricSummary, type RagAnswerQualityHookOptions, type RagAnswerQualityInput, type RagAnswerQualityJudgeOptions, type RagAnswerQualityResult, type RagCalibrationOptions, type RagCalibrationResult, type RagDiagnosisInput, type RagEvalCitation, type RagEvalClaim, type RagEvalContext, type RagEvalMetricKey, type RagEvalProvider, type RagEvalSlice, type RagGapFinding, type RagGapKind, type RagGapSeverity, type RagKnowledgeAcquisitionInput, type RagKnowledgeImprovementPhase, type RagKnowledgeImprovementPhaseResult, type RagKnowledgeImprovementPhaseStatus, type RagKnowledgeResearchOptions, type RagKnowledgeUpdateInput, type RagKnowledgeUpdateResult, type RagOptimizationConfig, type RagOptimizationSelection, type RagPhaseInputBase, type RagPromotionInput, type RagPromotionResult, type RagRequiredContext, type RecoverPendingKnowledgeMutationOptions, type RejectedSource, type ResearchContribution, type ResearchDriver, type ResearchDrivingDriver, type ResearchDrivingDriverOptions, type ResearchDrivingState, type ResearchDrivingSteer, type ResearchSourceProposal, type ResearchWorker, type ResolvedKnowledgeImprovementCandidate, type ResolvedKnowledgeImprovementComparison, type ResolvedKnowledgeImprovementComparisonSnapshot, type RestoreKnowledgeCandidateBaselineOptions, RetrievalConfig, RetrievalEvalArtifact, RetrievalEvalRetriever, RetrievalEvalScenario, RetrievalMetricWeights, type RetrievalOptimizationSelection, RetrievedKnowledgeHit, type RouterClient, RouterError, type RouterUsage, type RunDiscoveryLoopOptions, type RunKnowledgeResearchLoopOptions, type RunRagKnowledgeImprovementLoopOptions, type RunRagKnowledgeImprovementLoopResult, type RunRagOptimizationOptions, type RunRagOptimizationResult, type RunRetrievalImprovementLoopOptions, type RunRetrievalImprovementLoopResult, RunSerializedKnowledgeOptimizationOptions, RunSerializedKnowledgeOptimizationResult, SCAFFOLD_PAGE_BASENAMES, type SourceAdapter, type SourceAdapterInput, type SourceAdapterOutput, SourceAnchorSchema, type SourceFreshnessInspection, SourceRecord, SourceRecordSchema, SourceRegistry, type SourceVerdict, type SourceVerificationContext, type TangleRouterOptions, type ThesisRunOptions, type ThesisRunResult, type ThesisTaskInput, type TrackedClaim, type TriageClass, type TwoAgentResearchLoopOptions, type TwoAgentResearchLoopResult, type TwoAgentResearchRound, type UseKnowledgeImprovementCandidateOptions, type ValidateKnowledgeOptions, type ValidateKnowledgeResult, type VerifiedResearchLoopOptions, type VerifiedResearchLoopResult, type VerifiedResearchRound, type VerifyingDriverOptions, WIKILINK_REGEX, type WebResearchWorkerOptions, type WebSearchHit, type WorkerClaimDecorationOptions, type WorkerResearchContext, addSourcePath, addSourceText, applyKnowledgeWriteBlocks, applyKnowledgeWriteBlocksFile, buildEvalKnowledgeBundle, buildKnowledgeGraph, buildKnowledgeIndex, calibrateRagAnswerJudge, canonicalizeUrl, chunkMarkdown, citedClaimKey, citedClaimOf, contentKey, createAdaptiveResearchDriver, createClaimDecorator, createClaimGroundingVerifier, createCollectionResearchDriver, createD1FreshnessStoreStub, createFileSystemFreshnessStore, createFileSystemSearchProvider, createKnowledgeControlLoopAdapter, createKnowledgeEvent, createLocalDiscoveryDispatcher, createRagAnswerQualityHook, createResearchDrivingDriver, createTangleRouterClient, createVerifyingResearchDriver, createWebResearchWorker, defineReadinessSpec, detectChanges, diagnoseRagAnswerFailure, evaluateKnowledgeBaseReadiness, explainKnowledgeTarget, extractWikilinks, formatFrontmatter, fromAgentCandidateKnowledgeRef, gradeCompanyAgainstText, gradeFactAgainstText, groundClaimInText, hashKnowledgeBase, improveKnowledgeBase, initKnowledgeBase, inspectKnowledgeIndex, inspectPendingKnowledgeMutation, investmentThesisSet, isSafeKnowledgePath, isScaffoldPath, kbIndexToText, knowledgeImprovementCandidateRef, knowledgeImprovementRunDir, knowledgeImprovementRunId, knowledgeReleaseReport, layoutFor, lensDistribution, lintKnowledgeIndex, loadKnowledgeImprovementActivationResult, loadKnowledgeImprovementEvents, loadKnowledgeImprovementState, loadKnowledgePages, loadSourceRegistry, materialFactsSurfaced, materialFactsSurfacedInText, mediaTypeFor, normalizeExternalRagScores, normalizeLinkTarget, optimizeKnowledgeBasePolicy, parseFrontmatter, parseKnowledgeWriteBlocks, promoteKnowledgeCandidate, proposeFromFinding, proposeFromFindings, ragAnswerQualityJudge, reciprocalRankFusion, recoverPendingKnowledgeMutation, restoreKnowledgeCandidateBaseline, runDiscoveryLoop, runInvestmentThesisTask, runKnowledgeResearchLoop, runRagKnowledgeImprovementLoop, runRagOptimization, runRetrievalImprovementLoop, runTwoAgentResearchLoop, runVerifiedResearchLoop, scoreKnowledgeBaseIndex, scoreRagAnswerArtifact, searchKnowledge, sha256, slugify, sourceMatchesGaps, sourceRegistryPath, stableId, stripFrontmatter, textSourceAdapter, thesisReadinessSpecs, toAgentCandidateKnowledgeRef, toDeepEvalTestCases, toRagCheckerRecords, toRagasEvaluationRows, toTruLensRecords, tokenizeQuery, totalMaterialFacts, triageSource, validateKnowledgeIndex, withCitedClaim, withKnowledgeImprovementCandidate, withKnowledgeImprovementComparison, writeJson, writeKnowledgeIndex, writeSourceRegistry };