@tangle-network/agent-knowledge 19.1.2 → 20.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +32 -2
  2. package/README.md +17 -91
  3. package/dist/benchmarks/index.d.ts +2 -2
  4. package/dist/benchmarks/index.js +2 -2
  5. package/dist/benchmarks-jir3ZP-M.js +162 -0
  6. package/dist/benchmarks-jir3ZP-M.js.map +1 -0
  7. package/dist/cli.js +2 -3
  8. package/dist/cli.js.map +1 -1
  9. package/dist/index-BhvSH4E4.d.ts +512 -0
  10. package/dist/index-BhvSH4E4.d.ts.map +1 -0
  11. package/dist/index-OAxtm6is.d.ts +9 -0
  12. package/dist/index-OAxtm6is.d.ts.map +1 -0
  13. package/dist/index.d.ts +197 -1332
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +561 -3653
  16. package/dist/index.js.map +1 -1
  17. package/dist/{inspect-C6c4zuKp.js → inspect-CMigdsD5.js} +282 -24
  18. package/dist/inspect-CMigdsD5.js.map +1 -0
  19. package/dist/memory/index.d.ts +3 -3
  20. package/dist/memory/index.js +3 -3
  21. package/dist/memory-BH6oT1Qe.js +2728 -0
  22. package/dist/memory-BH6oT1Qe.js.map +1 -0
  23. package/dist/source-record-CdWvzvO6.js +39 -0
  24. package/dist/source-record-CdWvzvO6.js.map +1 -0
  25. package/dist/types-BWV_Fvp7.d.ts +224 -0
  26. package/dist/types-BWV_Fvp7.d.ts.map +1 -0
  27. package/dist/{types-m2QB86fF.d.ts → types-BekdNwGD.d.ts} +4 -19
  28. package/dist/types-BekdNwGD.d.ts.map +1 -0
  29. package/dist/viz/index.d.ts +1 -1
  30. package/docs/architecture.md +2 -30
  31. package/docs/eval/investment-material-facts.md +2 -0
  32. package/docs/results/research-driving.md +8 -8
  33. package/docs/verified-research-ab.md +12 -10
  34. package/package.json +6 -12
  35. package/skills/build-with-agent-knowledge/SKILL.md +2 -15
  36. package/dist/benchmarks-BjXxjAke.js +0 -2824
  37. package/dist/benchmarks-BjXxjAke.js.map +0 -1
  38. package/dist/index-Bh9wLd0_.d.ts +0 -1097
  39. package/dist/index-Bh9wLd0_.d.ts.map +0 -1
  40. package/dist/index-DZeFm-BP.d.ts +0 -680
  41. package/dist/index-DZeFm-BP.d.ts.map +0 -1
  42. package/dist/inspect-C6c4zuKp.js.map +0 -1
  43. package/dist/memory-CUk1mgPY.js +0 -5778
  44. package/dist/memory-CUk1mgPY.js.map +0 -1
  45. package/dist/search-BBr5eUyT.js +0 -275
  46. package/dist/search-BBr5eUyT.js.map +0 -1
  47. package/dist/sources/index.d.ts +0 -376
  48. package/dist/sources/index.d.ts.map +0 -1
  49. package/dist/sources/index.js +0 -615
  50. package/dist/sources/index.js.map +0 -1
  51. package/dist/types-m2QB86fF.d.ts.map +0 -1
  52. package/docs/eval/rag-eval-roadmap.md +0 -123
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { A as SourceAnchor, C as KnowledgeUnit, D as ResearchClaimLedger, E as ResearchClaimEvidence, M as SourceRegistry, N as TrackedClaim, O as ResearchClaimRecord, S as KnowledgeSearchResult, T as KnowledgeWriteParseResult, _ as KnowledgePolicy, a as KnowledgeBaseCandidate, b as KnowledgeRelationNode, c as KnowledgeEventType, d as KnowledgeGraphNode, f as KnowledgeId, g as KnowledgePageInvalidation, h as KnowledgePage, i as KNOWLEDGE_EVENT_TYPES, j as SourceRecord, k as ResearchSourceVersion, l as KnowledgeGraph, m as KnowledgeLintFinding, n as DeepQuestion, o as KnowledgeClaim, p as KnowledgeIndex, r as DeepQuestionKind, s as KnowledgeEvent, t as ClaimRef, u as KnowledgeGraphEdge, v as KnowledgeRelation, w as KnowledgeWriteBlock, x as KnowledgeRelease, y as KnowledgeRelationGraph } from "./types-m2QB86fF.js";
2
- import { $ as RetrievalConfig, A as KnowledgeBenchmarkResponder, At as AgentMemoryScope, B as KnowledgeMemoryEvent, Bt as RetrievalHoldoutSessionState, C as KnowledgeBenchmarkArtifact, Ct as createInMemoryBenchmarkAdapter, D as KnowledgeBenchmarkEvaluation, Dt as AgentMemoryContext, E as KnowledgeBenchmarkDistribution, Et as AgentMemoryBranchIsolation, F as KnowledgeBenchmarkSplit, Ft as RetrievalHoldoutCallContext, G as MemoryAdapterBenchmarkCandidate, H as KnowledgeRetrievalBenchmarkCase, I as KnowledgeBenchmarkTaskKind, It as RetrievalHoldoutConfig, J as RunKnowledgeBenchmarkSuiteResult, K as MemoryAdapterBenchmarkRankingRow, L as KnowledgeClaimMatcher, Lt as RetrievalHoldoutEligibleItem, M as KnowledgeBenchmarkSliceSummary, Mt as AgentMemoryWriteInput, N as KnowledgeBenchmarkSource, Nt as AgentMemoryWriteResult, O as KnowledgeBenchmarkFamily, Ot as AgentMemoryHit, P as KnowledgeBenchmarkSpec, Pt as RetrievalHoldoutBypassReason, Q as PartitionRetrievalScenariosOptions, R as KnowledgeMemoryBenchmarkCase, Rt as RetrievalHoldoutEvent, S as KnowledgeAnswerBenchmarkTaskKind, St as acquireAgentMemoryRunLease, T as KnowledgeBenchmarkCaseBase, Tt as AgentMemoryAdapter, U as KnowledgeRetrievalBenchmarkQrel, V as KnowledgeMemoryFactMatcher, W as KnowledgeRetrievalBenchmarkQuery, X as RunMemoryAdapterBenchmarkResult, Y as RunMemoryAdapterBenchmarkOptions, Z as BuildRetrievalEvalDispatchOptions, _ as buildIndustryRagBenchmarkSmokeCases, _t as scoreRetrievalArtifact, a as runKnowledgeBenchmarkSuite, at as RetrievalGoldTarget, b as BuildRetrievalBenchmarkCasesFromQrelsOptions, bt as AgentMemoryRunLease, c as buildRetrievalBenchmarkCasesFromQrels, ct as RetrievalRecallJudgeOptions, d as summarizeKnowledgeBenchmarkCampaign, dt as RetrievedSourceSpan, et as RetrievalEvalArtifact, f as runMemoryAdapterBenchmark, ft as buildRetrievalEvalDispatch, g as buildIndustryMemoryBenchmarkSmokeCases, gt as retrievalRecallJudge, h as buildFirstPartyMemoryLifecycleBenchmarkCases, ht as retrievalConfigSurface, i as renderKnowledgeBenchmarkReportMarkdown, it as RetrievalEvalScenario, j as KnowledgeBenchmarkScenario, jt as AgentMemorySearchOptions, k as KnowledgeBenchmarkReport, kt as AgentMemoryKind, l as parseKnowledgeBenchmarkJsonl, lt as RetrievalScenarioPartitions, m as INDUSTRY_RAG_BENCHMARKS, mt as retrievalConfigFromSurface, n as buildKnowledgeBenchmarkScenarios, nt as RetrievalEvalRetrieverInput, o as scoreKnowledgeBenchmarkArtifact, ot as RetrievalMetricSummary, p as INDUSTRY_MEMORY_BENCHMARKS, pt as partitionRetrievalScenarios, q as RunKnowledgeBenchmarkSuiteOptions, r as knowledgeBenchmarkJudge, rt as RetrievalEvalRetrieverResult, s as scoreMemoryBenchmarkArtifact, st as RetrievalMetricWeights, t as isKnowledgeMemoryBenchmarkCase, tt as RetrievalEvalRetriever, u as parseKnowledgeBenchmarkQrels, ut as RetrievedKnowledgeHit, v as respondToIndustryMemoryBenchmarkSmokeCase, vt as AgentMemoryAcquireRunLease, w as KnowledgeBenchmarkCase, wt as createNoopMemoryBenchmarkAdapter, x as KnowledgeAnswerBenchmarkCase, xt as OwnedAgentMemoryRunLease, y as respondToIndustryRagBenchmarkSmokeCase, yt as AgentMemoryControllerMode, z as KnowledgeMemoryBenchmarkTaskKind, zt as RetrievalHoldoutResult } from "./index-DZeFm-BP.js";
3
- import { $ as hindsightMemoryBankId, $t as forkAgentMemoryBranchSnapshot, A as AgentMemoryActivationDriver, At as AgentMemorySequence, B as RetrievalHoldoutOffPolicyResult, Bt as RunAgentMemoryExperimentOptions, C as createMemoryExecutionPool, Ct as AgentMemoryExperimentRunLease, D as sleepForMemoryRecovery, Dt as AgentMemoryLearningCellComparison, E as runBoundedMemoryLifecycle, Et as AgentMemoryLearningCandidateSummary, F as AgentMemoryPromotionDecision, Ft as AgentMemorySequenceStep, G as emitRetrievalHoldoutBypass, Gt as AgentMemoryBranchLifetime, H as applyRetrievalHoldout, Ht as RunAgentMemoryLearningExperimentOptions, I as MemoryConfigScenario, It as AgentMemoryTransferCellComparison, J as toOffPolicyTrajectory, Jt as AgentMemorySharingPolicy, K as resetRetrievalHoldoutRegistry, Kt as AgentMemoryBranchSnapshot, L as RunAgentMemoryImprovementOptions, Lt as AgentMemoryTransferStepSummary, M as AgentMemoryFinalEvaluation, Mt as AgentMemorySequenceProbe, N as AgentMemoryFinalPair, Nt as AgentMemorySequenceProbeResult, O as runAgentMemoryImprovement, Ot as AgentMemoryLearningComparison, P as AgentMemoryImprovementRunLease, Pt as AgentMemorySequenceScenario, Q as createHindsightMemoryAdapter, Qt as createAgentMemoryBranch, R as RunAgentMemoryImprovementResult, Rt as BuildAgentMemorySequencesFromBenchmarkCasesOptions, S as DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, St as AgentMemoryExperimentRankingRow, T as resolveMemoryCleanupTimeoutMs, Tt as AgentMemoryLearningArmOrder, U as applySessionStickyRetrievalHoldout, Ut as RunAgentMemoryLearningExperimentResult, V as RetrievalHoldoutSessionSummary, Vt as RunAgentMemoryExperimentResult, W as deterministicRng, Wt as AgentMemoryBranch, X as HindsightMemoryAdapterOptions, Xt as CreateAgentMemoryBranchOptions, Y as HindsightClientLike, Yt as AgentMemoryVisibility, Z as HindsightOperationUnknownError, Zt as ForkAgentMemoryBranchSnapshotOptions, _ as Mem0OssMemoryAdapterOptions, _t as AgentMemoryExecutionPaidCallResult, a as memoryWriteResultToSourceRecord, an as SerializedCandidateCodec, at as runAgentMemoryExperiment, b as AgentMemoryLifecycleTimeoutError, bt as AgentMemoryExperimentCandidateRef, c as AgentMemoryScopeSchema, cn as runSerializedKnowledgeOptimization, ct as agentMemorySequenceJudge, d as createNeo4jAgentMemoryAdapter, dt as AgentMemoryAttemptEvent, en as defaultGetMemoryContext, et as GraphitiMcpClientLike, f as Mem0ClientMode, ft as AgentMemoryEvidenceRef, g as Mem0OssClient, gt as AgentMemoryExecutionPaidCallInput, h as Mem0MemoryAdapterOptions, ht as AgentMemoryExecutionCostReceipt, i as memoryHitToSourceRecord, in as SerializedCandidate, it as graphitiMemoryAdapterIdentity, j as AgentMemoryDimensionComparison, jt as AgentMemorySequenceArtifact, k as AgentMemoryActivation, kt as AgentMemoryMode, l as AgentMemoryWriteInputSchema, ln as scenarioContentFingerprint, lt as buildAgentMemorySequenceScenarios, m as Mem0HostedMemoryAdapterOptions, mt as AgentMemoryExecutionCostMeter, n as PlayMemoryRetrievalReceipt, nn as RunSerializedKnowledgeOptimizationOptions, nt as GraphitiToolNames, o as AgentMemoryHitSchema, on as jsonCandidateCodec, ot as compareAgentMemoryLearning, p as Mem0HostedClient, pt as AgentMemoryExecutionContext, q as retrievalHoldoutConfigHash, qt as AgentMemoryJournalEntry, r as createPlayMemoryTools, rn as RunSerializedKnowledgeOptimizationResult, rt as createGraphitiMemoryAdapter, s as AgentMemoryKindSchema, sn as jsonObjectCandidateCodec, st as runAgentMemoryLearningExperiment, t as CreatePlayMemoryToolsOptions, tn as renderMemoryContext, tt as GraphitiMemoryAdapterOptions, u as Neo4jAgentMemoryAdapterOptions, ut as buildAgentMemorySequencesFromBenchmarkCases, v as createMem0MemoryAdapter, vt as AgentMemoryExecutionStep, w as memoryRecoveryDelayMs, wt as AgentMemoryForgettingComparison, x as AgentMemoryLifecycleUnsafeError, xt as AgentMemoryExperimentComparisonRef, y as mem0MemoryAdapterIdentity, yt as AgentMemoryExperimentCandidate, z as RetrievalHoldoutOffPolicyOptions, zt as CompareAgentMemoryLearningOptions } from "./index-Bh9wLd0_.js";
4
- import { CornellLiiSelector, CornellLiiSourceOptions, FetchOpts, FragmentProvenance, IRS_DIMENSION_HINTS, IrsPublicationsSourceOptions, KnowledgeFragment, 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";
1
+ import { A as SourceRegistry, C as KnowledgeWriteParseResult, D as ResearchSourceVersion, E as ResearchClaimRecord, O as SourceAnchor, S as KnowledgeWriteBlock, T as ResearchClaimLedger, _ as KnowledgePolicy, a as KnowledgeBaseCandidate, b as KnowledgeSearchResult, c as KnowledgeEventType, d as KnowledgeGraphNode, f as KnowledgeId, g as KnowledgePageInvalidation, h as KnowledgePage, i as KNOWLEDGE_EVENT_TYPES, j as TrackedClaim, k as SourceRecord, l as KnowledgeGraph, m as KnowledgeLintFinding, n as DeepQuestion, o as KnowledgeClaim, p as KnowledgeIndex, r as DeepQuestionKind, s as KnowledgeEvent, t as ClaimRef, u as KnowledgeGraphEdge, v as KnowledgeRelation, w as ResearchClaimEvidence, x as KnowledgeUnit, y as KnowledgeRelease } from "./types-BekdNwGD.js";
2
+ import { a as AgentMemoryKind, c as AgentMemoryWriteInput, d as RetrievalHoldoutCallContext, f as RetrievalHoldoutConfig, g as RetrievalHoldoutSessionState, h as RetrievalHoldoutResult, i as AgentMemoryHit, l as AgentMemoryWriteResult, m as RetrievalHoldoutEvent, n as AgentMemoryBranchIsolation, o as AgentMemoryScope, p as RetrievalHoldoutEligibleItem, r as AgentMemoryContext, s as AgentMemorySearchOptions, t as AgentMemoryAdapter, u as RetrievalHoldoutBypassReason } from "./types-BWV_Fvp7.js";
3
+ import { n as createNoopMemoryBenchmarkAdapter, t as createInMemoryBenchmarkAdapter } from "./index-OAxtm6is.js";
4
+ import { $ as AgentMemoryVisibility, A as RetrievalHoldoutSessionSummary, B as HindsightOperationUnknownError, C as createMemoryExecutionPool, D as sleepForMemoryRecovery, E as runBoundedMemoryLifecycle, F as resetRetrievalHoldoutRegistry, G as GraphitiToolNames, H as hindsightMemoryBankId, I as retrievalHoldoutConfigHash, J as AgentMemoryBranch, K as createGraphitiMemoryAdapter, L as toOffPolicyTrajectory, M as applySessionStickyRetrievalHoldout, N as deterministicRng, O as RetrievalHoldoutOffPolicyOptions, P as emitRetrievalHoldoutBypass, Q as AgentMemorySharingPolicy, R as HindsightClientLike, S as DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, T as resolveMemoryCleanupTimeoutMs, U as GraphitiMcpClientLike, V as createHindsightMemoryAdapter, W as GraphitiMemoryAdapterOptions, X as AgentMemoryBranchSnapshot, Y as AgentMemoryBranchLifetime, Z as AgentMemoryJournalEntry, _ as Mem0OssMemoryAdapterOptions, a as memoryWriteResultToSourceRecord, at as renderMemoryContext, b as AgentMemoryLifecycleTimeoutError, c as AgentMemoryScopeSchema, d as createNeo4jAgentMemoryAdapter, et as CreateAgentMemoryBranchOptions, f as Mem0ClientMode, g as Mem0OssClient, h as Mem0MemoryAdapterOptions, i as memoryHitToSourceRecord, it as defaultGetMemoryContext, j as applyRetrievalHoldout, k as RetrievalHoldoutOffPolicyResult, l as AgentMemoryWriteInputSchema, m as Mem0HostedMemoryAdapterOptions, n as PlayMemoryRetrievalReceipt, nt as createAgentMemoryBranch, o as AgentMemoryHitSchema, p as Mem0HostedClient, q as graphitiMemoryAdapterIdentity, r as createPlayMemoryTools, rt as forkAgentMemoryBranchSnapshot, s as AgentMemoryKindSchema, t as CreatePlayMemoryToolsOptions, tt as ForkAgentMemoryBranchSnapshotOptions, u as Neo4jAgentMemoryAdapterOptions, v as createMem0MemoryAdapter, w as memoryRecoveryDelayMs, x as AgentMemoryLifecycleUnsafeError, y as mem0MemoryAdapterIdentity, z as HindsightMemoryAdapterOptions } from "./index-BhvSH4E4.js";
5
5
  import { AgentCandidateJsonValue, AgentCandidateKnowledgeRef, AgentImprovementActivation, AgentImprovementActivationResult, Sha256Digest, ToolDefinition } from "@tangle-network/agent-interface";
6
6
  import { AnalystFinding, AnalystSeverity, ControlEvalResult, ControlRuntimeConfig, DataAcquisitionPlan, DatasetScenario, HeldOutGateDecision, KnowledgeAcquisitionMode, KnowledgeBundle, KnowledgeFreshness, KnowledgeImportance, KnowledgeReadinessReport, KnowledgeRequirement, KnowledgeRequirementCategory, KnowledgeSensitivity, ReleaseConfidenceScorecard, ReleaseTraceEvidence, RunRecord, UserQuestion } from "@tangle-network/agent-eval";
7
7
  import { z } from "zod";
8
- import { ComparisonCost, DispatchContext, JudgeConfig, OptimizationMethod, Scenario } from "@tangle-network/agent-eval/campaign";
8
+ import { CompareOptimizationMethodsOptions, ComparisonCost, DispatchContext, JudgeConfig, MutableSurface, OptimizationMethod, OptimizationMethodComparison, OptimizationMethodRunOptions, Scenario } from "@tangle-network/agent-eval/campaign";
9
9
  import { EvidenceRef } from "@tangle-network/agent-eval/analyst";
10
10
  import { LockOptions } from "proper-lockfile";
11
11
  //#region src/adapters.d.ts
@@ -121,450 +121,6 @@ export interface EvalKnowledgeBundleBuildResult {
121
121
  }
122
122
  export declare function buildEvalKnowledgeBundle(options: BuildEvalKnowledgeBundleOptions): EvalKnowledgeBundleBuildResult;
123
123
  //#endregion
124
- //#region src/sources.d.ts
125
- export interface AddSourceOptions {
126
- copyIntoRaw?: boolean;
127
- adapters?: SourceAdapter[];
128
- now?: () => Date;
129
- }
130
- export interface AddSourceTextInput {
131
- uri: string;
132
- text: string;
133
- title?: string;
134
- mediaType?: string;
135
- validUntil?: string;
136
- lastVerifiedAt?: string;
137
- metadata?: Record<string, unknown>;
138
- }
139
- /** Copy and freeze an untrusted source proposal before any asynchronous work. */
140
- export declare function snapshotSourceTextInput(input: AddSourceTextInput): AddSourceTextInput;
141
- export declare function loadSourceRegistry(root: string): Promise<SourceRegistry>;
142
- export declare function writeSourceRegistry(root: string, registry: SourceRegistry): Promise<void>;
143
- export declare function addSourcePath(root: string, sourcePath: string, options?: AddSourceOptions): Promise<SourceRecord[]>;
144
- export declare function addSourceText(root: string, input: AddSourceTextInput, options?: Pick<AddSourceOptions, 'adapters' | 'now'>): Promise<SourceRecord>;
145
- export declare function sourceRegistryPath(root: string): string;
146
- //#endregion
147
- //#region src/verified-research-loop.d.ts
148
- /**
149
- * A knowledge gap the loop surfaces from `scoreKnowledgeReadiness`. The worker
150
- * targets these; the driver folds the unfilled remainder into the worker's next
151
- * prompt and runs its own gap-fill pass over them.
152
- */
153
- export interface KnowledgeGap {
154
- /** Readiness-spec id this gap belongs to. */
155
- id: string;
156
- /** Human-readable description of what's missing. */
157
- description: string;
158
- /** The search query the readiness check ran for this requirement. */
159
- query: string;
160
- /** True when the gap blocks readiness (vs. a soft, non-blocking gap). */
161
- blocking: boolean;
162
- }
163
- /** A new source the worker (or driver) discovered and wants to add to the KB. */
164
- export type ResearchSourceProposal = AddSourceTextInput;
165
- /**
166
- * What a research agent contributes in one round. Both the worker and (when
167
- * `driverResearches` is on) the driver produce this shape — the worker ADDS
168
- * primary findings, the driver gap-FILLS the ones the worker missed.
169
- *
170
- * `proposalText` is the safe write-protocol text (`---FILE: knowledge/...---`
171
- * blocks). The loop only applies it AFTER the driver has verified the round's
172
- * sources, so a rejected source never reaches the curated pages.
173
- */
174
- export interface ResearchContribution {
175
- /** Immutable sources to register (the raw evidence). */
176
- sources?: ResearchSourceProposal[];
177
- /** Safe write-protocol text producing curated `knowledge/*.md` pages. */
178
- proposalText?: string;
179
- /**
180
- * Build the page write-protocol text FROM the sources the driver accepted —
181
- * the curated, citing pages the readiness gate searches. Receives the
182
- * registered `SourceRecord`s (with their assigned ids, so a page's frontmatter
183
- * `sources:` can cite them). Returns `---FILE: knowledge/...---` block text or
184
- * `undefined`. Runs after verification, so a page never cites a rejected
185
- * source. Concatenated after any static `proposalText`.
186
- */
187
- buildPages?: (acceptedSources: SourceRecord[]) => string | undefined;
188
- /** Free-form research transcript — products can persist this. */
189
- notes?: string;
190
- metadata?: Record<string, unknown>;
191
- }
192
- /** Context handed to the worker each round. */
193
- export interface WorkerResearchContext {
194
- root: string;
195
- goal: string;
196
- round: number;
197
- index: KnowledgeIndex;
198
- /** Gaps the readiness gate currently reports — what the worker should close. */
199
- gaps: KnowledgeGap[];
200
- /** Steer text the driver folded in from the previous round's remaining gaps. */
201
- steer?: string;
202
- readiness: EvalKnowledgeBundleBuildResult;
203
- signal?: AbortSignal;
204
- }
205
- /** Context handed to the driver's verifier for one candidate source. */
206
- export interface SourceVerificationContext {
207
- root: string;
208
- goal: string;
209
- round: number;
210
- index: KnowledgeIndex;
211
- gaps: KnowledgeGap[];
212
- /** Sources already accepted earlier THIS round (in-round dedup). */
213
- acceptedThisRound: ResearchSourceProposal[];
214
- signal?: AbortSignal;
215
- }
216
- /** A single rejected source plus the reason the driver gave. */
217
- export interface RejectedSource {
218
- source: ResearchSourceProposal;
219
- reason: string;
220
- }
221
- /** Context handed to the driver's gap-fill pass (only when `driverResearches`). */
222
- export interface DriverResearchContext {
223
- root: string;
224
- goal: string;
225
- round: number;
226
- index: KnowledgeIndex;
227
- /** Gaps STILL open after the worker's accepted contribution applied. */
228
- remainingGaps: KnowledgeGap[];
229
- readiness: EvalKnowledgeBundleBuildResult;
230
- signal?: AbortSignal;
231
- }
232
- /**
233
- * The differentiated driver role.
234
- *
235
- * - `verifySource` — the gate the worker's additions pass before they commit.
236
- * Return `{ accept: true }` to keep a source or `{ accept: false, reason }`
237
- * to reject it (not real / not relevant / duplicate). The loop dedups exact
238
- * duplicates (same `uri` already in the KB or accepted this round) BEFORE
239
- * calling this, so the verifier only sees genuinely-new candidates.
240
- * - `research` — the driver's OWN gap-fill pass over the gaps the worker left
241
- * open. Only invoked when `driverResearches` is true.
242
- * - `foldGaps` — turn the remaining gaps into a steer string for the worker's
243
- * next prompt. Defaults to a compact bulleted list when omitted.
244
- * - `isComplete` — require the driver's research objectives as well as storage readiness.
245
- * - `checkpoint` — write whatever state the driver accumulated to durable
246
- * storage. Called at the end of every round, after `foldGaps`, so state that
247
- * a synchronous hook produced is on disk before the next round can crash.
248
- * - `prepareFold` — durably announce the next synchronous fold before it runs,
249
- * so a crash between question generation and `checkpoint` can be recovered.
250
- * - `commitSources` — confirm exact source records are durable after verification;
251
- * drivers with pending evidence must not count it before this callback.
252
- */
253
- export interface ResearchDriver {
254
- verifySource(source: ResearchSourceProposal, ctx: SourceVerificationContext): Promise<SourceVerdict> | SourceVerdict;
255
- research?(ctx: DriverResearchContext): Promise<ResearchContribution> | ResearchContribution;
256
- foldGaps?(gaps: KnowledgeGap[]): string;
257
- isComplete?(): boolean;
258
- prepareFold?(): Promise<void> | void;
259
- commitSources?(sources: readonly SourceRecord[]): Promise<void> | void;
260
- checkpoint?(): Promise<void> | void;
261
- }
262
- export type SourceVerdict = {
263
- accept: true;
264
- } | {
265
- accept: false;
266
- reason: string;
267
- };
268
- /** The worker: primary research targeting the round's gaps. */
269
- export type ResearchWorker = (ctx: WorkerResearchContext) => Promise<ResearchContribution> | ResearchContribution;
270
- export interface VerifiedResearchLoopOptions {
271
- root: string;
272
- goal: string;
273
- worker: ResearchWorker;
274
- driver: ResearchDriver;
275
- /**
276
- * When false (default), the driver ONLY verifies + gates — a pure coordinator
277
- * that contributes no research of its own (the "doesn't participate in the
278
- * work" mode). When true, the driver also runs its `research` gap-fill pass
279
- * each round over the gaps the worker left open.
280
- */
281
- driverResearches?: boolean;
282
- maxRounds?: number;
283
- actor?: string;
284
- /** Readiness specs define the gate; an empty list means the loop never gates. */
285
- readinessSpecs?: KnowledgeReadinessSpec[];
286
- readinessTaskId?: string;
287
- readiness?: Omit<BuildEvalKnowledgeBundleOptions, 'taskId' | 'index' | 'specs'>;
288
- sourceOptions?: Pick<AddSourceOptions, 'adapters' | 'now'>;
289
- signal?: AbortSignal;
290
- onRound?: (round: VerifiedResearchRound) => Promise<void> | void;
291
- }
292
- export interface VerifiedResearchRound {
293
- round: number;
294
- /** Gaps reported at the START of the round (what the worker targeted). */
295
- gaps: KnowledgeGap[];
296
- /** Worker sources accepted by the driver and written to the KB. */
297
- acceptedWorkerSources: SourceRecord[];
298
- /** Worker sources the driver rejected (with reasons) — never written. */
299
- rejectedWorkerSources: RejectedSource[];
300
- /** Sources the driver itself added in its gap-fill pass. */
301
- driverSources: SourceRecord[];
302
- /** Curated pages written this round (worker proposal + driver proposal). */
303
- writtenPages: string[];
304
- readiness?: EvalKnowledgeBundleBuildResult;
305
- /** True once readiness passes and the driver reports completion, when configured. */
306
- ready: boolean;
307
- event: KnowledgeEvent;
308
- notes: {
309
- worker?: string;
310
- driver?: string;
311
- };
312
- }
313
- export interface VerifiedResearchLoopResult {
314
- root: string;
315
- goal: string;
316
- rounds: number;
317
- ready: boolean;
318
- index: KnowledgeIndex;
319
- readiness?: EvalKnowledgeBundleBuildResult;
320
- steps: VerifiedResearchRound[];
321
- }
322
- /**
323
- * Two-agent (driver + worker) sibling of `runKnowledgeResearchLoop`.
324
- *
325
- * Both agents research to grow ONE knowledge base. The roles are differentiated:
326
- *
327
- * - **WORKER** = primary research. Each round it reads the open gaps, discovers
328
- * new sources, and proposes additions (`sources` + `proposalText`). It ADDS.
329
- * - **DRIVER** = the verifier / gap-filler / gate. It (1) VERIFIES the worker's
330
- * sources before they commit — dedup against the KB, then `verifySource`
331
- * rejects ones that aren't real/relevant; (2) GAP-FILLS the gaps the worker
332
- * missed with its own research pass (when `driverResearches`); (3) folds the
333
- * remaining gaps into the worker's next prompt; and (4) GATES on
334
- * `scoreKnowledgeReadiness` and optional `isComplete` — the loop stops when
335
- * readiness passes and the driver has no unfinished research.
336
- *
337
- * Set `driverResearches: false` (default) for the pure-coordinator mode: the
338
- * driver only verifies + gates and contributes no research itself.
339
- *
340
- * Composes existing atoms — `initKnowledgeBase`, `addSourceText`,
341
- * `applyKnowledgeWriteBlocks`, `buildEvalKnowledgeBundle` (the readiness gate),
342
- * and `searchKnowledge` — and reinvents none of them.
343
- */
344
- export declare function runVerifiedResearchLoop(options: VerifiedResearchLoopOptions): Promise<VerifiedResearchLoopResult>;
345
- /**
346
- * Helper for verifiers: does the candidate source's text/title overlap any page
347
- * the readiness search returns for a gap query? A cheap relevance heuristic the
348
- * driver can compose into `verifySource` (real verifiers can do more).
349
- */
350
- export declare function sourceMatchesGaps(source: ResearchSourceProposal, index: KnowledgeIndex, gaps: KnowledgeGap[]): KnowledgeSearchResult[];
351
- //#endregion
352
- //#region src/web-research-worker.d.ts
353
- /** One live web result, as the router's `/v1/search` returns it. */
354
- export interface WebSearchHit {
355
- title: string;
356
- url: string;
357
- snippet?: string;
358
- }
359
- /**
360
- * The two router capabilities the worker/driver need. Injectable so tests can
361
- * supply a client; the default uses the published TCloud SDK.
362
- */
363
- export interface RouterClient {
364
- /** Live web search — returns title/url/snippet hits. */
365
- search(query: string, opts?: {
366
- maxResults?: number;
367
- }): Promise<WebSearchHit[]>;
368
- /** Chat completion — returns the assistant message's visible text. */
369
- chat(messages: {
370
- role: 'system' | 'user';
371
- content: string;
372
- }[], maxTokens?: number): Promise<string>;
373
- /** Cumulative cost (chat + search) since this client was created. */
374
- usage(): RouterUsage;
375
- }
376
- /**
377
- * Cumulative router cost — the per-arm signal the A/B reports ALONGSIDE quality,
378
- * so "2.3 fewer sources" can be read against the token/$/latency it cost. A
379
- * two-agent round is one worker pass plus N `verifySource` LLM calls; counting
380
- * each call here is what surfaces that the two-agent loop spends more inference
381
- * than its "equal passes" budget implies.
382
- */
383
- export interface RouterUsage {
384
- chatCalls: number;
385
- searchCalls: number;
386
- promptTokens: number;
387
- completionTokens: number;
388
- /** Reported cost only. NaN once a successful response omits its cost receipt. */
389
- usd: number;
390
- wallMs: number;
391
- }
392
- export interface TangleRouterOptions {
393
- /** Router base URL. Defaults to `https://router.tangle.tools/v1`. */
394
- baseUrl?: string;
395
- /** Bearer key. Defaults to `process.env.TANGLE_API_KEY`. */
396
- apiKey?: string;
397
- /** Chat model id. Defaults to `glm-5.2`. */
398
- model?: string;
399
- /** Optional preferred search provider (exa | you | perplexity | …). */
400
- searchProvider?: string;
401
- /** SDK retries for 429/502/503/504. Default 4. Kept for API compatibility. */
402
- maxRetries?: number;
403
- /** Initial SDK retry backoff in ms. Default 1500. */
404
- retryBaseMs?: number;
405
- signal?: AbortSignal;
406
- }
407
- /** Compatibility error facade. HTTP execution and classification belong to TCloud. */
408
- export declare class RouterError extends Error {
409
- readonly status: number;
410
- constructor(status: number, message: string);
411
- }
412
- /** Adapt Knowledge's public contract to the published SDK, without a second transport. */
413
- export declare function createTangleRouterClient(options?: TangleRouterOptions): RouterClient;
414
- export interface WebResearchWorkerOptions {
415
- /** Router client. Defaults to a live Tangle router client from env creds. */
416
- router?: RouterClient;
417
- router_options?: TangleRouterOptions;
418
- /** Max search queries the LLM may form per gap. Default 2. */
419
- queriesPerGap?: number;
420
- /** Max web results fetched per query. Default 3. */
421
- resultsPerQuery?: number;
422
- /** Hard cap on sources proposed per round (across all gaps). Default 6. */
423
- maxSourcesPerRound?: number;
424
- /** Disk cache dir for `politeFetch`. Optional; speeds repeat runs. */
425
- cacheDir?: string;
426
- /** Minimum readable text length to keep a fetched page. Default 200. */
427
- minTextChars?: number;
428
- /** Max chars of page text stored per source (keeps pages bounded). Default 4000. */
429
- maxTextChars?: number;
430
- }
431
- /**
432
- * The real web-research worker. Conforms to the loop's `ResearchWorker`
433
- * contract: given the open gaps, it returns the sources it found plus a
434
- * `buildPages` that emits citing pages from the sources the driver accepted.
435
- */
436
- export declare function createWebResearchWorker(options?: WebResearchWorkerOptions): ResearchWorker;
437
- export interface VerifyingDriverOptions {
438
- router?: RouterClient;
439
- router_options?: TangleRouterOptions;
440
- /**
441
- * When the LLM verdict can't be parsed, default to REJECT (fail-closed) so a
442
- * model hiccup never poisons the KB with an unverified source. Set `true` to
443
- * accept-on-parse-failure only if you have a reason to. Default false.
444
- */
445
- acceptOnParseFailure?: boolean;
446
- }
447
- /**
448
- * The verifying driver: a real LLM pass that judges each candidate source's
449
- * on-topic relevance to the goal + open gaps and whether it duplicates material
450
- * already accepted this round. This is the differentiated coordinator role — it
451
- * GATES the worker's additions; it adds nothing itself.
452
- *
453
- * The loop already dedups exact-uri duplicates and only calls this on genuinely
454
- * new candidates, so the verifier focuses on relevance + near-duplicate
455
- * judgement, not bookkeeping.
456
- */
457
- export declare function createVerifyingResearchDriver(options?: VerifyingDriverOptions): ResearchDriver;
458
- //#endregion
459
- //#region src/adaptive-driver.d.ts
460
- /**
461
- * Canonicalize a URL for duplicate detection: lowercase host, strip a leading
462
- * `www.`, drop the scheme, the fragment, a trailing slash, and tracking query
463
- * params (`utm_*`, `ref`, `fbclid`, `gclid`, …). Two URLs that differ only by
464
- * those decorations canonicalize to the same key, so the dedup stage treats them
465
- * as the same source. Falls back to the lowercased raw string when the input is
466
- * not a parseable absolute URL (so non-http identifiers still dedup by equality).
467
- */
468
- export declare function canonicalizeUrl(uri: string): string;
469
- /**
470
- * A stable content key for a fetched page: the sha256 of its normalized text
471
- * (lowercased, punctuation/whitespace collapsed). Two pages whose readable body
472
- * is the same modulo formatting collide here, so the dedup stage rejects a
473
- * mirror/syndication of an already-accepted source even when the URL differs.
474
- */
475
- export declare function contentKey(text: string): string;
476
- /** Why the deterministic dedup stage rejected a candidate (for audit/notes). */
477
- export type DedupReason = 'duplicate-url' | 'duplicate-content';
478
- /** The cheap-triage classification of a unique survivor. */
479
- export type TriageClass = 'keep' | 'drop' | 'ambiguous';
480
- /** One source's adaptive routing decision, for instrumentation and the doc. */
481
- export interface AdaptiveDecision {
482
- uri: string;
483
- /** The stage that decided this source: dedup | heuristic | llm. */
484
- stage: 'dedup' | 'heuristic' | 'llm';
485
- accepted: boolean;
486
- /** The triage class assigned (set once past dedup). */
487
- triage?: TriageClass;
488
- reason?: string;
489
- }
490
- /** Running tally of where the adaptive driver spent its decisions. */
491
- export interface AdaptiveStats {
492
- total: number;
493
- /** Rejected by deterministic dedup (URL or content). $0. */
494
- dedupRejected: number;
495
- /** Kept by the cheap heuristic without an LLM call. $0. */
496
- heuristicKept: number;
497
- /** Dropped by the cheap heuristic without an LLM call. $0. */
498
- heuristicDropped: number;
499
- /** Escalated to the LLM relevance verifier ($ — the only paid stage). */
500
- llmCalls: number;
501
- /** Of the escalations, how many the LLM accepted. */
502
- llmAccepted: number;
503
- decisions: AdaptiveDecision[];
504
- }
505
- export interface AdaptiveDriverOptions {
506
- /** Router client for the LLM escalation. Defaults to a live client from env. */
507
- router?: RouterClient;
508
- router_options?: TangleRouterOptions;
509
- /** Passed through to the escalation relevance verifier. */
510
- verifying?: Pick<VerifyingDriverOptions, 'acceptOnParseFailure'>;
511
- /**
512
- * Hosts an authoritative source lives on. A unique survivor on one of these,
513
- * with a substantial body, is KEPT deterministically (no LLM). Suffix-matched
514
- * against the canonical host, so `arxiv.org` matches `export.arxiv.org`. The
515
- * defaults cover papers, official docs, and standards bodies.
516
- */
517
- authoritativeHosts?: string[];
518
- /**
519
- * Title/snippet patterns that mark obvious spam / listicle / marketing — a
520
- * unique survivor matching one is DROPPED deterministically (no LLM).
521
- */
522
- spamPatterns?: RegExp[];
523
- /**
524
- * Below this many readable chars a survivor is too thin to be a real reference
525
- * and is dropped deterministically. Default 400.
526
- */
527
- minBodyChars?: number;
528
- /**
529
- * A survivor whose body is at or above this many chars AND on an authoritative
530
- * host is kept without an LLM call. Default 600.
531
- */
532
- substantialBodyChars?: number;
533
- /** Receives each routing decision as it is made (for live instrumentation). */
534
- onDecision?: (decision: AdaptiveDecision) => void;
535
- }
536
- /**
537
- * Classify a UNIQUE survivor (already past dedup) with cheap host/title/length
538
- * signals only — no LLM. Returns `keep`, `drop`, or `ambiguous`. `ambiguous` is
539
- * the residue the LLM is reserved for: on-topic-looking pages on unknown hosts
540
- * with a plausible body, which a host/title rule cannot adjudicate.
541
- */
542
- export declare function triageSource(source: ResearchSourceProposal, options: {
543
- authoritativeHosts: string[];
544
- spamPatterns: RegExp[];
545
- minBodyChars: number;
546
- substantialBodyChars: number;
547
- }): {
548
- triage: TriageClass;
549
- reason: string;
550
- };
551
- export interface AdaptiveResearchDriver {
552
- verifySource(source: ResearchSourceProposal, ctx: SourceVerificationContext): Promise<SourceVerdict>;
553
- /** Live tally of where decisions were spent — the cost/quality instrumentation. */
554
- stats(): AdaptiveStats;
555
- }
556
- /**
557
- * Build the adaptive verifier. The deterministic stages (dedup + heuristic
558
- * triage) cost $0; only AMBIGUOUS survivors escalate to the LLM relevance
559
- * verifier. `stats()` exposes where every decision was spent so the A/B can read
560
- * the LLM $/calls the adaptive driver saved against the cleanliness it kept.
561
- *
562
- * Dedup state is kept on the driver instance: it tracks the canonical URLs and
563
- * content hashes it has ACCEPTED, plus those it sees in the verification
564
- * context's `acceptedThisRound` and the KB index. Use one driver per loop run.
565
- */
566
- export declare function createAdaptiveResearchDriver(options?: AdaptiveDriverOptions): AdaptiveResearchDriver;
567
- //#endregion
568
124
  //#region src/knowledge-state-scope.d.ts
569
125
  /** Authoritative local state included in a KB improvement candidate. */
570
126
  interface KnowledgeStateScope {
@@ -578,6 +134,52 @@ export declare function normalizeKnowledgeStateScope(scope?: KnowledgeStateScope
578
134
  researchState: boolean;
579
135
  };
580
136
  //#endregion
137
+ //#region src/optimization.d.ts
138
+ export interface SerializedCandidateCodec<TCandidate extends AgentCandidateJsonValue> {
139
+ serialize(candidate: TCandidate): string;
140
+ parse(surface: string): TCandidate;
141
+ }
142
+ export interface SerializedCandidate<TCandidate extends AgentCandidateJsonValue> {
143
+ value: TCandidate;
144
+ surface: string;
145
+ surfaceHash: string;
146
+ }
147
+ type ComparisonOptions<TScenario extends Scenario, TArtifact> = Omit<CompareOptimizationMethodsOptions<TScenario, TArtifact>, 'methods' | 'baselineSurface' | 'trainScenarios' | 'selectionScenarios' | 'testScenarios' | 'dispatchWithSurface' | 'dispatchRef' | 'optimizationRunOptions'>;
148
+ export interface RunSerializedKnowledgeOptimizationOptions<TCandidate extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact> extends ComparisonOptions<TScenario, TArtifact> {
149
+ /** Immutable identity for candidate execution, judges, models, indexes, and external settings. */
150
+ executionRef: string;
151
+ baseline: TCandidate;
152
+ method: OptimizationMethod<TScenario, TArtifact>;
153
+ trainScenarios: readonly TScenario[];
154
+ selectionScenarios: readonly TScenario[];
155
+ finalScenarios: readonly TScenario[];
156
+ dispatchCandidate(input: {
157
+ candidate: TCandidate;
158
+ candidateSurface: string;
159
+ candidateSurfaceHash: string;
160
+ scenario: TScenario;
161
+ context: DispatchContext;
162
+ }): Promise<TArtifact>;
163
+ codec?: SerializedCandidateCodec<TCandidate>;
164
+ /** Detects duplicated cases whose IDs differ within or across data partitions. */
165
+ scenarioFingerprint?: (scenario: TScenario) => string;
166
+ optimizationRunOptions?: Omit<OptimizationMethodRunOptions<TScenario, TArtifact>, 'dispatchRef'>;
167
+ }
168
+ export interface RunSerializedKnowledgeOptimizationResult<TCandidate extends AgentCandidateJsonValue> {
169
+ methodName: string;
170
+ baseline: SerializedCandidate<TCandidate>;
171
+ winner: SerializedCandidate<TCandidate>;
172
+ comparison: OptimizationMethodComparison;
173
+ }
174
+ /**
175
+ * Runs one complete agent-eval method over a serialized knowledge candidate.
176
+ * The method receives train and selection data; agent-eval owns final scoring.
177
+ */
178
+ export declare function runSerializedKnowledgeOptimization<TCandidate extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact>(options: RunSerializedKnowledgeOptimizationOptions<TCandidate, TScenario, TArtifact>): Promise<RunSerializedKnowledgeOptimizationResult<TCandidate>>;
179
+ export declare function jsonCandidateCodec<TCandidate extends AgentCandidateJsonValue>(): SerializedCandidateCodec<TCandidate>;
180
+ export declare function jsonObjectCandidateCodec<TCandidate extends Record<string, AgentCandidateJsonValue>>(): SerializedCandidateCodec<TCandidate>;
181
+ export declare function scenarioContentFingerprint(scenario: Scenario): string;
182
+ //#endregion
581
183
  //#region src/rag-optimization.d.ts
582
184
  export type RagOptimizationConfig = Record<string, AgentCandidateJsonValue>;
583
185
  type RagOptimizationBaseOptions = Omit<RunSerializedKnowledgeOptimizationOptions<RagOptimizationConfig, RagAnswerEvalScenario, RagAnswerEvalArtifact>, 'baseline' | 'method' | 'trainScenarios' | 'selectionScenarios' | 'finalScenarios' | 'dispatchCandidate' | 'judges' | 'codec' | 'scenarioFingerprint'>;
@@ -976,6 +578,29 @@ export interface ApplyKnowledgeWriteBlocksOptions extends KnowledgePagesOptions
976
578
  export declare function applyKnowledgeWriteBlocks(root: string, proposalText: string, options?: ApplyKnowledgeWriteBlocksOptions): Promise<ApplyWriteBlocksResult>;
977
579
  export declare function applyKnowledgeWriteBlocksFile(root: string, proposalPath: string, options?: ApplyKnowledgeWriteBlocksOptions): Promise<ApplyWriteBlocksResult>;
978
580
  //#endregion
581
+ //#region src/sources.d.ts
582
+ export interface AddSourceOptions {
583
+ copyIntoRaw?: boolean;
584
+ adapters?: SourceAdapter[];
585
+ now?: () => Date;
586
+ }
587
+ export interface AddSourceTextInput {
588
+ uri: string;
589
+ text: string;
590
+ title?: string;
591
+ mediaType?: string;
592
+ validUntil?: string;
593
+ lastVerifiedAt?: string;
594
+ metadata?: Record<string, unknown>;
595
+ }
596
+ /** Copy and freeze an untrusted source proposal before any asynchronous work. */
597
+ export declare function snapshotSourceTextInput(input: AddSourceTextInput): AddSourceTextInput;
598
+ export declare function loadSourceRegistry(root: string): Promise<SourceRegistry>;
599
+ export declare function writeSourceRegistry(root: string, registry: SourceRegistry): Promise<void>;
600
+ export declare function addSourcePath(root: string, sourcePath: string, options?: AddSourceOptions): Promise<SourceRecord[]>;
601
+ export declare function addSourceText(root: string, input: AddSourceTextInput, options?: Pick<AddSourceOptions, 'adapters' | 'now'>): Promise<SourceRecord>;
602
+ export declare function sourceRegistryPath(root: string): string;
603
+ //#endregion
979
604
  //#region src/validate.d.ts
980
605
  export interface ValidateKnowledgeOptions {
981
606
  strict?: boolean;
@@ -1086,6 +711,119 @@ export type KnowledgeControlLoopAdapter = Pick<ControlRuntimeConfig<KnowledgeCon
1086
711
  export declare function createKnowledgeControlLoopAdapter(options: KnowledgeControlLoopAdapterOptions): KnowledgeControlLoopAdapter;
1087
712
  export declare function runKnowledgeResearchLoop(options: RunKnowledgeResearchLoopOptions): Promise<KnowledgeResearchLoopResult>;
1088
713
  //#endregion
714
+ //#region src/retrieval-eval.d.ts
715
+ export type RetrievalConfig = Record<string, AgentCandidateJsonValue>;
716
+ export type RetrievalGoldTarget = {
717
+ kind: 'page';
718
+ pageId: string;
719
+ } | {
720
+ kind: 'page-path';
721
+ path: string;
722
+ } | {
723
+ kind: 'source';
724
+ sourceId: string;
725
+ } | {
726
+ kind: 'source-anchor';
727
+ sourceId: string;
728
+ anchorId: string;
729
+ } | {
730
+ kind: 'source-span';
731
+ sourceId: string;
732
+ charStart: number;
733
+ charEnd: number;
734
+ };
735
+ export interface RetrievalEvalScenario extends Scenario {
736
+ kind: 'retrieval-eval';
737
+ query: string;
738
+ expected: RetrievalGoldTarget | readonly RetrievalGoldTarget[];
739
+ k?: number;
740
+ }
741
+ export interface RetrievedSourceSpan {
742
+ sourceId: string;
743
+ anchorId?: string;
744
+ charStart?: number;
745
+ charEnd?: number;
746
+ }
747
+ export interface RetrievedKnowledgeHit {
748
+ pageId: string;
749
+ path: string;
750
+ title?: string;
751
+ rank: number;
752
+ score?: number;
753
+ normalizedScore?: number;
754
+ sourceIds?: readonly string[];
755
+ sourceSpans?: readonly RetrievedSourceSpan[];
756
+ snippet?: string;
757
+ metadata?: Record<string, AgentCandidateJsonValue>;
758
+ }
759
+ export interface RetrievalEvalArtifact {
760
+ config: RetrievalConfig;
761
+ query: string;
762
+ requestedK: number;
763
+ hits: readonly RetrievedKnowledgeHit[];
764
+ durationMs: number;
765
+ /** Informational copy. Billable retrievers account through context.cost.runPaidCall. */
766
+ costUsd?: number;
767
+ metadata?: Record<string, AgentCandidateJsonValue>;
768
+ }
769
+ export interface RetrievalMetricSummary {
770
+ recall: number;
771
+ mrr: number;
772
+ ndcg: number;
773
+ precisionAtK: number;
774
+ expectedCount: number;
775
+ matchedCount: number;
776
+ relevantHitCount: number;
777
+ firstHitRank: number | null;
778
+ matchedTargetIds: readonly string[];
779
+ }
780
+ export interface RetrievalEvalRetrieverInput {
781
+ index?: KnowledgeIndex;
782
+ config: RetrievalConfig;
783
+ scenario: RetrievalEvalScenario;
784
+ k: number;
785
+ signal: AbortSignal;
786
+ context: DispatchContext;
787
+ }
788
+ export interface RetrievalEvalRetrieverResult {
789
+ hits: readonly RetrievedKnowledgeHit[];
790
+ /** Informational copy. Billable retrievers account through context.cost.runPaidCall. */
791
+ costUsd?: number;
792
+ metadata?: Record<string, AgentCandidateJsonValue>;
793
+ }
794
+ export type RetrievalEvalRetriever = (input: RetrievalEvalRetrieverInput) => Promise<readonly RetrievedKnowledgeHit[] | RetrievalEvalRetrieverResult>;
795
+ export interface BuildRetrievalEvalDispatchOptions {
796
+ index?: KnowledgeIndex;
797
+ defaultK?: number;
798
+ retrieve?: RetrievalEvalRetriever;
799
+ }
800
+ export interface RetrievalMetricWeights {
801
+ recall?: number;
802
+ mrr?: number;
803
+ ndcg?: number;
804
+ precisionAtK?: number;
805
+ }
806
+ export interface RetrievalRecallJudgeOptions {
807
+ name?: string;
808
+ weights?: RetrievalMetricWeights;
809
+ }
810
+ export interface PartitionRetrievalScenariosOptions {
811
+ selectionFraction?: number;
812
+ finalFraction?: number;
813
+ seed?: number;
814
+ }
815
+ export interface RetrievalScenarioPartitions {
816
+ trainScenarios: RetrievalEvalScenario[];
817
+ selectionScenarios: RetrievalEvalScenario[];
818
+ finalScenarios: RetrievalEvalScenario[];
819
+ }
820
+ export declare function retrievalConfigSurface(config: RetrievalConfig): string;
821
+ export declare function retrievalConfigFromSurface(surface: MutableSurface): RetrievalConfig;
822
+ export declare function buildRetrievalEvalDispatch(options: BuildRetrievalEvalDispatchOptions): (surface: MutableSurface, scenario: RetrievalEvalScenario, context: DispatchContext) => Promise<RetrievalEvalArtifact>;
823
+ export declare function retrievalRecallJudge(options?: RetrievalRecallJudgeOptions): JudgeConfig<RetrievalEvalArtifact, RetrievalEvalScenario>;
824
+ export declare function scoreRetrievalArtifact(artifact: RetrievalEvalArtifact, scenario: RetrievalEvalScenario): RetrievalMetricSummary;
825
+ export declare function partitionRetrievalScenarios(scenarios: readonly RetrievalEvalScenario[], options?: PartitionRetrievalScenariosOptions): RetrievalScenarioPartitions;
826
+ //#endregion
1089
827
  //#region src/retrieval-optimization.d.ts
1090
828
  type RetrievalOptimizationBaseOptions = Omit<RunSerializedKnowledgeOptimizationOptions<RetrievalConfig, RetrievalEvalScenario, RetrievalEvalArtifact>, 'baseline' | 'method' | 'trainScenarios' | 'selectionScenarios' | 'finalScenarios' | 'dispatchCandidate' | 'judges' | 'codec' | 'scenarioFingerprint'>;
1091
829
  export interface RunRetrievalImprovementLoopOptions extends RetrievalOptimizationBaseOptions {
@@ -1377,10 +1115,6 @@ interface KnowledgeBaseQualityReport {
1377
1115
  }
1378
1116
  type MaybePromise<T> = T | Promise<T>;
1379
1117
  //#endregion
1380
- //#region src/rag-eval/calibration.d.ts
1381
- export declare function createRagAnswerQualityHook(options: RagAnswerQualityHookOptions): () => Promise<RagAnswerQualityResult>;
1382
- export declare function calibrateRagAnswerJudge(options: RagCalibrationOptions): Promise<RagCalibrationResult>;
1383
- //#endregion
1384
1118
  //#region src/rag-eval/knowledge-base.d.ts
1385
1119
  export declare function scoreKnowledgeBaseIndex(index: KnowledgeIndex, options?: KnowledgeBaseQualityOptions): KnowledgeBaseQualityReport;
1386
1120
  //#endregion
@@ -1728,119 +1462,9 @@ interface KnowledgeImprovementOptions {
1728
1462
  /** Load the durable result for one exact activation without changing knowledge or run state. */
1729
1463
  export declare function loadKnowledgeImprovementActivationResult(options: LoadKnowledgeImprovementActivationResultOptions): Promise<AgentImprovementActivationResult | null>;
1730
1464
  //#endregion
1731
- //#region src/kb-improvement/optimization.d.ts
1732
- type PolicyCandidateOptions = Omit<KnowledgeImprovementOptions, 'root' | 'goal' | 'implementationRef' | 'runId' | 'maxCandidates' | 'step' | 'knowledgeResearch' | 'updateKnowledge'>;
1733
- type PolicyOptimizationBaseOptions<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact> = Omit<RunSerializedKnowledgeOptimizationOptions<TPolicy, TScenario, TArtifact>, 'baseline' | 'method' | 'trainScenarios' | 'selectionScenarios' | 'finalScenarios' | 'executionRef'>;
1734
- interface OptimizeKnowledgeBasePolicyOptions<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact> extends PolicyOptimizationBaseOptions<TPolicy, TScenario, TArtifact> {
1735
- root: string;
1736
- goal: string;
1737
- baselinePolicy: TPolicy;
1738
- method: OptimizationMethod<TScenario, TArtifact>;
1739
- trainScenarios: readonly TScenario[];
1740
- selectionScenarios: readonly TScenario[];
1741
- finalScenarios: readonly TScenario[];
1742
- /** Commit or content identity for evaluation, applyPolicy, and external dependencies. */
1743
- policyApplicationRef: string;
1744
- /** Optional namespace for parallel materialization of the same measured policy. */
1745
- candidateRunLabel?: string;
1746
- candidate?: PolicyCandidateOptions;
1747
- applyPolicy(input: KnowledgeImprovementUpdateInput & {
1748
- policy: TPolicy;
1749
- policySurface: string;
1750
- policySurfaceHash: string;
1751
- optimizationMethod: string;
1752
- }): Promise<{
1753
- applied: boolean;
1754
- summary: string;
1755
- metadata?: Record<string, AgentCandidateJsonValue>;
1756
- }>;
1757
- }
1758
- interface OptimizeKnowledgeBasePolicyResult<TPolicy extends AgentCandidateJsonValue> {
1759
- optimization: RunSerializedKnowledgeOptimizationResult<TPolicy>;
1760
- improvement: KnowledgeImprovementResult;
1761
- }
1762
- /**
1763
- * Optimizes a serialized KB-maintenance policy, then materializes the selected
1764
- * policy in one isolated knowledge candidate. Activation remains explicit.
1765
- */
1766
- export declare function optimizeKnowledgeBasePolicy<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact>(options: OptimizeKnowledgeBasePolicyOptions<TPolicy, TScenario, TArtifact>): Promise<OptimizeKnowledgeBasePolicyResult<TPolicy>>;
1767
- type KnowledgePolicyDispatch<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact> = (input: {
1768
- candidate: TPolicy;
1769
- candidateSurface: string;
1770
- candidateSurfaceHash: string;
1771
- scenario: TScenario;
1772
- context: DispatchContext;
1773
- }) => Promise<TArtifact>;
1774
- //#endregion
1775
1465
  //#region src/kb-improvement/run.d.ts
1776
1466
  export declare function improveKnowledgeBase(options: KnowledgeImprovementOptions): Promise<KnowledgeImprovementResult>;
1777
1467
  //#endregion
1778
- //#region src/kb-improvement/selected-candidate.d.ts
1779
- declare const measuredSelectionReceiptSchema: z.ZodObject<{
1780
- kind: z.ZodLiteral<"measured-knowledge-change-selection-receipt">;
1781
- version: z.ZodLiteral<1>;
1782
- receiptHash: z.ZodString;
1783
- selectionDigest: z.ZodString;
1784
- sourceCandidate: z.ZodObject<{
1785
- kind: z.ZodLiteral<"knowledge-improvement-candidate">;
1786
- runId: z.ZodString;
1787
- candidateId: z.ZodString;
1788
- goalHash: z.ZodString;
1789
- baseHash: z.ZodString;
1790
- candidateHash: z.ZodString;
1791
- evidenceHash: z.ZodString;
1792
- promotionPlanHash: z.ZodString;
1793
- }, z.core.$strict>;
1794
- sourcePlanHash: z.ZodString;
1795
- selectedPaths: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1796
- derivedImplementationRef: z.ZodString;
1797
- runId: z.ZodString;
1798
- derivedCandidateId: z.ZodString;
1799
- derivedCandidateStatus: z.ZodString;
1800
- selectedCandidateHash: z.ZodString;
1801
- selectedPlanHash: z.ZodString;
1802
- selectedEvidenceHash: z.ZodString;
1803
- rationale: z.ZodOptional<z.ZodString>;
1804
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
1805
- }, z.core.$strict>;
1806
- type KnowledgeEvaluationPhase = Exclude<RagKnowledgeImprovementPhase, 'knowledge-acquisition' | 'knowledge-update'>;
1807
- interface ImproveSelectedKnowledgeCandidateOptions extends Omit<KnowledgeImprovementOptions, 'root' | 'goal' | 'implementationRef' | 'runId' | 'step' | 'knowledgeResearch' | 'acquireKnowledge' | 'updateKnowledge' | 'enabledPhases' | 'requiredPhases'> {
1808
- root: string;
1809
- goal: string;
1810
- /** Identity of the helper, policy, or human procedure choosing the subset. */
1811
- implementationRef: string;
1812
- /** Previously measured whole candidate from which the subset is derived. */
1813
- sourceCandidate: KnowledgeImprovementCandidateRef;
1814
- /** Exact changed file paths to carry into the derived candidate. */
1815
- selectedPaths: readonly string[];
1816
- /** Optional explicit run identity. The default includes the selection digest. */
1817
- runId?: string;
1818
- /** Human-readable reason for selecting this subset. */
1819
- rationale?: string;
1820
- /** JSON-safe policy output retained in the selection receipt. */
1821
- selectionMetadata?: Record<string, AgentCandidateJsonValue>;
1822
- /** Diagnosis and evaluation phases. `knowledge-update` is inserted by this helper. */
1823
- enabledEvaluationPhases?: readonly KnowledgeEvaluationPhase[];
1824
- /** Diagnosis and evaluation phases that must complete. `knowledge-update` is always required. */
1825
- requiredEvaluationPhases?: readonly KnowledgeEvaluationPhase[];
1826
- }
1827
- type MeasuredKnowledgeSelectionReceipt = z.infer<typeof measuredSelectionReceiptSchema>;
1828
- interface ImproveSelectedKnowledgeCandidateResult extends KnowledgeImprovementResult {
1829
- selection: MeasuredKnowledgeSelectionReceipt;
1830
- }
1831
- /**
1832
- * Derive a subset from an already measured candidate, then measure the subset as
1833
- * a new candidate before it can be promoted.
1834
- *
1835
- * Directly filtering an activation plan is unsafe: a whole candidate can pass
1836
- * while one page subset breaks links, removes supporting sources, or changes a
1837
- * readiness score. This helper instead applies the chosen changed paths to an
1838
- * isolated baseline, recomputes the index, runs the ordinary improvement
1839
- * evaluator, and returns the ordinary candidate reference. Promotion therefore
1840
- * remains one path and can never admit an unmeasured hybrid.
1841
- */
1842
- export declare function improveSelectedKnowledgeCandidate(options: ImproveSelectedKnowledgeCandidateOptions): Promise<ImproveSelectedKnowledgeCandidateResult>;
1843
- //#endregion
1844
1468
  //#region src/kb-improvement/state.d.ts
1845
1469
  export declare function knowledgeImprovementRunId(root: string, goal: string): string;
1846
1470
  export declare function knowledgeImprovementRunDir(root: string, runId: string): string;
@@ -1895,91 +1519,6 @@ export declare function toAgentCandidateKnowledgeRef(candidate: KnowledgeImprove
1895
1519
  /** Recover agent-knowledge's candidate identity from the shared contract. */
1896
1520
  export declare function fromAgentCandidateKnowledgeRef(candidate: AgentCandidateKnowledgeRef): KnowledgeImprovementCandidateRef;
1897
1521
  //#endregion
1898
- //#region src/changes.d.ts
1899
- /**
1900
- * Change detection across snapshots of one source's fragments.
1901
- *
1902
- * The output drives the continuous-ingestion loop: each `KnowledgeChange`
1903
- * carries the eval dimensions affected (`affectedDimensions`), which an
1904
- * agent-eval campaign scheduler consumes to decide which campaigns to
1905
- * re-run. Three change kinds:
1906
- *
1907
- * - `added` — fragment id appears in `next` but not `prev`.
1908
- * - `removed` — fragment id appears in `prev` but not `next`. Typical
1909
- * trigger: an authority retires a Wex slug, or a state SOS reorganises
1910
- * its forms catalogue.
1911
- * - `modified` — fragment id appears in both, body hash differs. This
1912
- * is the dominant change kind in practice — the Ryan-LLC v. FTC
1913
- * vacatur case manifests as a `modified` on the Wex non-compete
1914
- * fragment, NOT as a removed one.
1915
- *
1916
- * Unverifiable fragments are filtered out before diffing — comparing a
1917
- * captcha-blocked snapshot against a real one would falsely fire every
1918
- * fragment as removed. The caller can inspect the raw lists if they want
1919
- * to surface block-page failures.
1920
- *
1921
- * Within-snapshot duplicate ids are an upstream bug; this function picks
1922
- * the LAST one and emits a diagnostic via the `warnings` field.
1923
- *
1924
- * @stable
1925
- */
1926
- export type KnowledgeChangeKind = 'added' | 'removed' | 'modified';
1927
- export interface KnowledgeChange {
1928
- /** Source-scoped id (matches `KnowledgeFragment.id`). */
1929
- fragmentId: string;
1930
- kind: KnowledgeChangeKind;
1931
- /**
1932
- * For `added`: full body of the new fragment.
1933
- * For `removed`: full body of the prior fragment.
1934
- * For `modified`: unified-diff-style payload `{ before, after }` body strings.
1935
- */
1936
- diff?: {
1937
- before?: string;
1938
- after?: string;
1939
- };
1940
- /**
1941
- * Eval dimensions to re-score. Computed as the union of both fragments'
1942
- * `dimensionHints`. The eval cron treats this as a set of campaign tags.
1943
- */
1944
- affectedDimensions: string[];
1945
- /** URL of the affected authority page (from whichever side has it). */
1946
- url?: string;
1947
- /**
1948
- * Source-attested change time. For `modified`, takes the NEXT fragment's
1949
- * `sourceUpdatedAt`. For `removed`, takes the PRIOR fragment's
1950
- * `sourceUpdatedAt`. For `added`, takes the NEXT fragment's
1951
- * `sourceUpdatedAt`. Consumers index changes by this date.
1952
- */
1953
- detectedAt: string;
1954
- }
1955
- export interface DetectChangesResult {
1956
- changes: KnowledgeChange[];
1957
- /** Counts by kind — handy for dashboards. */
1958
- summary: {
1959
- added: number;
1960
- removed: number;
1961
- modified: number;
1962
- };
1963
- /** Non-fatal diagnostics (duplicate ids, dropped unverifiable fragments). */
1964
- warnings: string[];
1965
- }
1966
- export interface DetectChangesOptions {
1967
- /**
1968
- * When true (default), unverifiable fragments are dropped from both
1969
- * sides before comparison. Set false ONLY when debugging block-page
1970
- * issues — comparing against unverifiable content emits false
1971
- * `removed`/`modified` changes.
1972
- */
1973
- skipUnverifiable?: boolean;
1974
- /**
1975
- * When provided, only changes whose `affectedDimensions` intersect this
1976
- * set are returned. Useful for cron loops that schedule per-dimension
1977
- * eval campaigns and only care about a subset.
1978
- */
1979
- filterDimensions?: string[];
1980
- }
1981
- export declare function detectChanges(prev: KnowledgeFragment[], next: KnowledgeFragment[], options?: DetectChangesOptions): DetectChangesResult;
1982
- //#endregion
1983
1522
  //#region src/chunking.d.ts
1984
1523
  export interface ChunkingOptions {
1985
1524
  targetChars: number;
@@ -2001,12 +1540,6 @@ export declare function stripFrontmatter(content: string): {
2001
1540
  bodyOffset: number;
2002
1541
  };
2003
1542
  //#endregion
2004
- //#region src/citation-lint.d.ts
2005
- /** Convert a chain-aware citation audit into the package lint vocabulary. */
2006
- export declare function knowledgeCitationAuditFindings(report: KnowledgeCitationAuditReport): KnowledgeLintFinding[];
2007
- /** Lint only current-run pages against their complete declared visibility chain. */
2008
- export declare function lintCurrentRunCitations(stores: RunScopedStores, runId: string): Promise<KnowledgeLintFinding[]>;
2009
- //#endregion
2010
1543
  //#region src/claim-evidence.d.ts
2011
1544
  /**
2012
1545
  * The evidence contract for claims that machines, not authors, get to grade.
@@ -2229,15 +1762,11 @@ export declare function verifyGradeableEvidence(evidence: ClaimEvidence, options
2229
1762
  //#endregion
2230
1763
  //#region src/claim-grounding.d.ts
2231
1764
  /**
2232
- * Metadata key under which a proposal carries the specific claim it is cited
2233
- * for. The worker sets `metadata[citedClaimKey] = '<the claim>'`; the
2234
- * claim-grounding driver reads it and checks it against the fetched page text.
1765
+ * Deterministic claim grounding: is a claim present in a text?
1766
+ *
1767
+ * The check is text presence, not a model call. RAG answer scoring uses it to
1768
+ * test whether a generated claim is supported by the retrieved context.
2235
1769
  */
2236
- export declare const citedClaimKey = "citedClaim";
2237
- /** Read the cited claim a proposal carries, if any. */
2238
- export declare function citedClaimOf(source: ResearchSourceProposal): string | undefined;
2239
- /** Attach a cited claim to a proposal (immutably returns a new proposal). */
2240
- export declare function withCitedClaim(source: ResearchSourceProposal, claim: string): ResearchSourceProposal;
2241
1770
  export interface GroundingResult {
2242
1771
  /** True when the claim is sufficiently present in the page text. */
2243
1772
  grounded: boolean;
@@ -2266,8 +1795,7 @@ export interface GroundClaimOptions {
2266
1795
  minWordLength?: number;
2267
1796
  }
2268
1797
  /**
2269
- * THE ORACLE. Is `claim` grounded in `pageText` (the `htmlToText` output of the
2270
- * page the worker fetched)? Deterministic, no model call:
1798
+ * Is `claim` grounded in `pageText`? Deterministic, no model call:
2271
1799
  *
2272
1800
  * 1. verbatim — the claim string appears as-is (case-insensitive).
2273
1801
  * 2. normalized — the claim appears after collapsing punctuation/whitespace
@@ -2276,58 +1804,10 @@ export interface GroundClaimOptions {
2276
1804
  * substantive content words appear in the page text. A misattributed page
2277
1805
  * fails here because the SPECIFIC words the claim asserts are absent.
2278
1806
  *
2279
- * Returns the match mode, the measured overlap, and the missing content words —
2280
- * enough for the driver to give a precise rejection reason and for a test/doc to
2281
- * audit WHY a claim grounded or didn't.
1807
+ * Returns the match mode, the measured overlap, and the missing content words,
1808
+ * so a caller can state why a claim grounded or did not.
2282
1809
  */
2283
1810
  export declare function groundClaimInText(claim: string, pageText: string, options?: GroundClaimOptions): GroundingResult;
2284
- export interface ClaimGroundingDriverOptions extends GroundClaimOptions {
2285
- /**
2286
- * Optional second verifier to compose AFTER grounding passes. When set, a
2287
- * source must BOTH ground its claim AND pass this verifier (e.g. the LLM
2288
- * relevance driver's `verifySource`). Lets the loop reject off-topic AND
2289
- * misattributed sources in one driver. Omit for the pure, zero-inference
2290
- * grounding gate.
2291
- */
2292
- relevanceVerifier?: (source: ResearchSourceProposal, ctx: SourceVerificationContext) => Promise<SourceVerdict> | SourceVerdict;
2293
- /**
2294
- * What to do when a proposal carries NO cited claim. `'reject'` (default) is
2295
- * fail-closed: in claim-grounding mode every source must declare what it is
2296
- * cited for, so an un-annotated source is treated as ungrounded. `'accept'`
2297
- * lets unannotated sources through to the relevance verifier, if present.
2298
- */
2299
- onMissingClaim?: 'reject' | 'accept';
2300
- }
2301
- /**
2302
- * A `ResearchDriver`-shaped verifier (just the `verifySource` arm) that gates on
2303
- * CLAIM GROUNDING: it rejects a source whose cited claim is not present in its
2304
- * fetched page text — a misattributed / fabricated citation — and (optionally)
2305
- * composes a relevance verifier after grounding passes.
2306
- *
2307
- * The returned function matches `ResearchDriver['verifySource']`, so it drops
2308
- * straight into `runVerifiedResearchLoop` as `{ verifySource: createClaimGroundingVerifier(...) }`.
2309
- */
2310
- export declare function createClaimGroundingVerifier(options?: ClaimGroundingDriverOptions): (source: ResearchSourceProposal, ctx: SourceVerificationContext) => Promise<SourceVerdict>;
2311
- export interface WorkerClaimDecorationOptions {
2312
- router?: RouterClient;
2313
- router_options?: TangleRouterOptions;
2314
- /** Max output tokens for the claim-extraction call. Default 1200 (glm floor). */
2315
- maxTokens?: number;
2316
- }
2317
- /**
2318
- * Ask an LLM to state, for one source, the single specific factual claim a
2319
- * researcher would cite THIS page for toward the goal. Used to DECORATE the
2320
- * sources a relevance-only worker produced with the claim a citation would make,
2321
- * so the claim-grounding verifier has something executable to check. The model
2322
- * is told to ground the claim in the provided excerpt; the verifier then checks
2323
- * it against the FULL page text independently — the model does not get to mark
2324
- * its own homework.
2325
- *
2326
- * Returns the proposal annotated via `withCitedClaim`, or the original proposal
2327
- * unchanged if the model returns nothing parseable (the verifier's
2328
- * `onMissingClaim` policy then decides).
2329
- */
2330
- export declare function createClaimDecorator(options?: WorkerClaimDecorationOptions): (source: ResearchSourceProposal, goal: string) => Promise<ResearchSourceProposal>;
2331
1811
  //#endregion
2332
1812
  //#region src/claim-ledger.d.ts
2333
1813
  /**
@@ -2418,9 +1898,8 @@ export declare function mergeClaimLedgers(base: ResearchClaimLedger, incoming: R
2418
1898
  * of it: the worker that found the refuting source records "X contradicts Y" and
2419
1899
  * knows nothing about Y's record. Left one-sided, Y reads as an uncontested
2420
1900
  * claim, and the completion oracle would settle a question two sources disagree
2421
- * about. `createResearchDrivingDriver` does this pairwise as it records; this is
2422
- * the same rule stated over a whole ledger, for writers that assemble one from
2423
- * events rather than from a live loop.
1901
+ * about. This rule applies over a whole ledger, for writers that assemble one
1902
+ * from events.
2424
1903
  *
2425
1904
  * One-sided observations stay in `claimEvidence` until both claims are backed
2426
1905
  * by registered source versions. The materialized claim projection contains
@@ -2429,14 +1908,6 @@ export declare function mergeClaimLedgers(base: ResearchClaimLedger, incoming: R
2429
1908
  */
2430
1909
  export declare function linkClaimContradictions(ledger: ResearchClaimLedger): ResearchClaimLedger;
2431
1910
  //#endregion
2432
- //#region src/collection-research-driver.d.ts
2433
- /**
2434
- * Build the single-agent collection driver. Accepts every source; never gates,
2435
- * never researches, never steers beyond the loop's default open-gap list. The
2436
- * worker is the only agent that thinks.
2437
- */
2438
- export declare function createCollectionResearchDriver(): ResearchDriver;
2439
- //#endregion
2440
1911
  //#region src/discovery.d.ts
2441
1912
  export interface DiscoveryTask {
2442
1913
  id: string;
@@ -2634,108 +2105,6 @@ export declare class FileSystemSearchProvider {
2634
2105
  }
2635
2106
  export declare function createFileSystemSearchProvider(options: FileSystemSearchProviderOptions): FileSystemSearchProvider;
2636
2107
  //#endregion
2637
- //#region src/freshness.d.ts
2638
- /**
2639
- * Knowledge freshness store: tracks when each `(workspaceId, sourceId)` pair
2640
- * was last successfully refreshed, and reports staleness against a TTL.
2641
- *
2642
- * The contract is intentionally minimal and supports scheduled refresh loops:
2643
- *
2644
- * ```ts
2645
- * const store = createFileSystemFreshnessStore({ root: '.agent-knowledge' })
2646
- * for (const source of sources) {
2647
- * if (await store.stale({ workspaceId, sourceId: source.id, ttlMs: DAY })) {
2648
- * const fragments = await source.fetch({ cacheDir })
2649
- * await persistFragments(fragments)
2650
- * await store.mark({ workspaceId, sourceId: source.id, when: new Date() })
2651
- * }
2652
- * }
2653
- * ```
2654
- *
2655
- * Per-tenant isolation is enforced by `workspaceId` keying. There is no
2656
- * global mutable state across workspaces.
2657
- *
2658
- * Two adapters ship in-package:
2659
- *
2660
- * - `createFileSystemFreshnessStore`: JSON file under the knowledge root,
2661
- * mirrors the layout convention already used by `sources.json`.
2662
- * - `createD1FreshnessStoreStub`: complete bridge from the `D1Adapter` port
2663
- * to this package's freshness interface. The port can be backed by D1,
2664
- * PostgreSQL, SQLite, or another application-owned store.
2665
- */
2666
- /** Identity for one freshness record. */
2667
- export interface FreshnessKey {
2668
- workspaceId: string;
2669
- sourceId: string;
2670
- }
2671
- /** TTL bound for staleness checks. */
2672
- export interface FreshnessTtl extends FreshnessKey {
2673
- /** Milliseconds; the record is stale when `Date.now() - last() > ttlMs`. */
2674
- ttlMs: number;
2675
- /** Injected clock for deterministic tests; defaults to system time. */
2676
- now?: Date;
2677
- }
2678
- /** Mark argument. */
2679
- export interface FreshnessMark extends FreshnessKey {
2680
- when: Date;
2681
- /** Optional content hash captured at refresh time; aids debugging. */
2682
- contentHash?: string;
2683
- }
2684
- export interface KnowledgeFreshnessStore {
2685
- /** Last refresh time, or null if never refreshed. */
2686
- last(key: FreshnessKey): Promise<Date | null>;
2687
- /** Record a successful refresh. */
2688
- mark(input: FreshnessMark): Promise<void>;
2689
- /** True iff `last(key)` is null or older than `ttlMs`. */
2690
- stale(input: FreshnessTtl): Promise<boolean>;
2691
- /** All records for a workspace. */
2692
- list(workspaceId: string): Promise<FreshnessRecord[]>;
2693
- }
2694
- export interface FreshnessRecord {
2695
- workspaceId: string;
2696
- sourceId: string;
2697
- lastRefreshedAt: string;
2698
- contentHash?: string;
2699
- }
2700
- export interface FileSystemFreshnessStoreOptions {
2701
- /**
2702
- * Knowledge root. The store writes to `<root>/.agent-knowledge/freshness.json`,
2703
- * mirroring the convention used by `sources.json`.
2704
- */
2705
- root: string;
2706
- }
2707
- /**
2708
- * Filesystem-backed implementation. Single JSON file per knowledge root,
2709
- * indexed by `${workspaceId}::${sourceId}`. Reads parse on every call;
2710
- * cron tick rate is well below the cost of one JSON parse.
2711
- *
2712
- * Writes share the package-wide filesystem lock, so multiple workers cannot
2713
- * overwrite one another or run through an interrupted knowledge promotion.
2714
- */
2715
- export declare function createFileSystemFreshnessStore(options: FileSystemFreshnessStoreOptions): KnowledgeFreshnessStore;
2716
- /**
2717
- * Bridge an application-owned database adapter to `KnowledgeFreshnessStore`.
2718
- * The adapter may use D1, PostgreSQL, SQLite, or another durable store.
2719
- *
2720
- * The expected schema:
2721
- *
2722
- * ```sql
2723
- * CREATE TABLE knowledge_freshness (
2724
- * workspace_id TEXT NOT NULL,
2725
- * source_id TEXT NOT NULL,
2726
- * last_refreshed_at TEXT NOT NULL,
2727
- * content_hash TEXT,
2728
- * PRIMARY KEY (workspace_id, source_id)
2729
- * );
2730
- * ```
2731
- */
2732
- export interface D1Adapter {
2733
- get(workspaceId: string, sourceId: string): Promise<FreshnessRecord | null>;
2734
- upsert(record: FreshnessRecord): Promise<void>;
2735
- listByWorkspace(workspaceId: string): Promise<FreshnessRecord[]>;
2736
- }
2737
- export declare function createD1FreshnessStoreStub(adapter: D1Adapter): KnowledgeFreshnessStore;
2738
- //#endregion
2739
2108
  //#region src/frontmatter.d.ts
2740
2109
  export interface ParsedFrontmatter {
2741
2110
  frontmatter: Record<string, unknown>;
@@ -2838,250 +2207,6 @@ export interface KnowledgeExplanation {
2838
2207
  }
2839
2208
  export declare function explainKnowledgeTarget(index: KnowledgeIndex, target: string): KnowledgeExplanation;
2840
2209
  //#endregion
2841
- //#region src/invalidation-propagation.d.ts
2842
- /** Frontmatter field naming the cited pages whose evidence refuted them. */
2843
- export declare const CITES_INVALIDATED_FIELD = "citesInvalidated";
2844
- export interface KnowledgeInvalidationStamp {
2845
- readonly page: KnowledgePage;
2846
- /** The value the field must hold, sorted and deduplicated. Empty removes the field. */
2847
- readonly citesInvalidated: readonly KnowledgeId[];
2848
- /** The value the page holds now, in the order it is stored. */
2849
- readonly current: readonly KnowledgeId[];
2850
- }
2851
- export interface KnowledgeInvalidationPlan {
2852
- /** Every visible page carrying an invalidation, sorted by id. */
2853
- readonly invalidatedPageIds: readonly KnowledgeId[];
2854
- /** Only the pages whose stamp differs from what they hold, in path order. */
2855
- readonly stamps: readonly KnowledgeInvalidationStamp[];
2856
- }
2857
- /**
2858
- * Plan the `citesInvalidated` stamp for every page authored in the target
2859
- * store.
2860
- *
2861
- * Citations resolve over the whole chain, so a page here may be stamped for
2862
- * citing a refuted inherited or shared page. Only `here` pages are stamped: a
2863
- * run does not write the stores it inherits or shares.
2864
- */
2865
- export declare function planInvalidationPropagation(visiblePages: readonly OriginatedPage[]): KnowledgeInvalidationPlan;
2866
- /**
2867
- * Render one plan as a write-block proposal for `applyKnowledgeWriteBlocks`.
2868
- *
2869
- * Only the stamped field changes. The page is rendered through
2870
- * `formatFrontmatter`, so its frontmatter is written in that writer's
2871
- * normalized form.
2872
- */
2873
- export declare function formatKnowledgeInvalidationProposal(plan: KnowledgeInvalidationPlan): string;
2874
- //#endregion
2875
- //#region src/investment-thesis-set.d.ts
2876
- /**
2877
- * HELD-OUT INVESTMENT-RESEARCH EVAL SET.
2878
- *
2879
- * The point of this file is the same FIREWALL the deep-question exam uses
2880
- * (`tests/loops/held-out-exam.ts`): the material facts and their checkable
2881
- * fragments are NEVER shown to a research loop. A loop is told only the company
2882
- * + ticker + a research-as-of CUTOFF date, and asked to write an investment
2883
- * thesis. AFTER it finishes, we grade the thesis it produced against THESE
2884
- * facts — facts it never saw — so a high score is thesis QUALITY (it surfaced
2885
- * the buried, material, non-obvious drivers) and not teaching-to-the-test.
2886
- *
2887
- * Each fact is a DEPTH fact by construction: a single ticker / company-name web
2888
- * search does NOT surface it. They are the things buried in the filings or
2889
- * knowable from then-available primary sources that a thorough analyst flags and
2890
- * a one-shot search misses — customer/revenue/deposit concentration, a debt
2891
- * maturity wall, a margin-trend reversal, a governance / related-party item, a
2892
- * specific competitive or regulatory risk, an off-balance-sheet loss.
2893
- *
2894
- * THREE HARD RULES, enforced by how the data was gathered (see
2895
- * docs/eval/investment-material-facts.md for the per-item provenance + the
2896
- * curation-bias disclosure):
2897
- *
2898
- * 1. SPECIFIC + CHECKABLE. Each fact carries `expected` keyword groups — the
2899
- * specific number / name / phrase — so a deterministic, model-free
2900
- * substring grader (`gradeFactAgainstText`) can score "did the thesis
2901
- * surface it". $0, reproducible, and it cannot leak the answer key into a
2902
- * model the loop could observe.
2903
- *
2904
- * 2. DERIVED FROM REAL FETCHED EVIDENCE. Every fact records the primary source
2905
- * it came from (`sourceUrl`, an SEC EDGAR 10-K) and the literal `evidence`
2906
- * value read out of that document. Nothing here is invented; an item that
2907
- * could not be independently sourced was DROPPED, not guessed (the drop log
2908
- * is in the doc).
2909
- *
2910
- * 3. KNOWABLE AT THE CUTOFF. Every fact was disclosed in, or computable from, a
2911
- * document available on or before the company's `cutoff` date. Post-cutoff
2912
- * hindsight (the eventual bankruptcy / collapse) is NOT a checklist item —
2913
- * it is recorded separately as `knownOutcome`, purely for the reader, and is
2914
- * never graded.
2915
- *
2916
- * Grading mirrors the deep-question exam exactly: a fact is SURFACED when the
2917
- * thesis text contains at least `minGroups` of its expected groups; a group is
2918
- * satisfied when ANY of its `anyOf` fragments appears (case-insensitive
2919
- * substring), so a faithful thesis phrased in its own words still grades as a
2920
- * hit. `anyOf` groups model synonyms; the load-bearing tokens are the specific
2921
- * numbers / names.
2922
- */
2923
- /** A required answer component: satisfied when any synonym fragment is present. */
2924
- export interface ExpectedGroup {
2925
- /** Human label for the component (for the doc / audit). */
2926
- label: string;
2927
- /** Case-insensitive substring fragments; any one present satisfies the group. */
2928
- anyOf: string[];
2929
- }
2930
- /** Lens the fact belongs to — so a set can be checked for category coverage. */
2931
- export type MaterialFactLens = 'concentration' | 'leverage' | 'margin-trend' | 'liquidity' | 'capital-return' | 'governance' | 'off-balance-sheet' | 'regulatory';
2932
- /** One held-out material fact with a checkable expected answer + its provenance. */
2933
- export interface MaterialFact {
2934
- /** Stable id, `ticker/fN`. */
2935
- id: string;
2936
- /** Which analyst lens this fact exercises. For coverage + the doc. */
2937
- lens: MaterialFactLens;
2938
- /**
2939
- * The material fact, in plain words — for the doc/audit. NEVER shown to a loop.
2940
- * This is the thing a thorough analyst would flag and a ticker search misses.
2941
- */
2942
- fact: string;
2943
- /**
2944
- * The checkable answer as required keyword GROUPS. The thesis text must contain
2945
- * at least `minGroups` of these groups (default: all). A group is satisfied
2946
- * when ANY of its `anyOf` fragments appears (case-insensitive substring).
2947
- */
2948
- expected: ExpectedGroup[];
2949
- /**
2950
- * Minimum number of `expected` groups the thesis must contain to count the
2951
- * fact SURFACED. Default = all groups (the strict bar). Lowered (and documented
2952
- * inline) only when the fact is genuinely satisfiable by a subset.
2953
- */
2954
- minGroups?: number;
2955
- /**
2956
- * PROVENANCE. The primary source URL this fact was read from — an SEC EDGAR
2957
- * 10-K primary document, fetched live during curation.
2958
- */
2959
- sourceUrl: string;
2960
- /**
2961
- * The literal value / phrase read out of `sourceUrl` that grounds the fact.
2962
- * This is the "cite the actual filing + the value" requirement — verbatim or
2963
- * near-verbatim from the filing, with the figure.
2964
- */
2965
- evidence: string;
2966
- }
2967
- /** A company + the cutoff a loop researches as-of + its held-out material facts. */
2968
- export interface CompanyEvalCase {
2969
- /** Ticker as of the cutoff. */
2970
- ticker: string;
2971
- /** Legal name as of the cutoff (what the loop is told to research). */
2972
- company: string;
2973
- /** SEC Central Index Key (CIK), zero-stripped — the EDGAR filer id. */
2974
- cik: string;
2975
- /**
2976
- * Research-as-of date (ISO). The loop must reason as if it is this date; every
2977
- * `evidence` value was knowable on or before it. >= 18 months before this set
2978
- * was curated, so the outcome is known but is NOT a checklist item.
2979
- */
2980
- cutoff: string;
2981
- /** Sector, for coverage / the curation-bias disclosure. */
2982
- sector: string;
2983
- /**
2984
- * The known POST-cutoff outcome — recorded for the reader ONLY, never graded.
2985
- * Keeping it out of `facts` is what makes the set hindsight-free.
2986
- */
2987
- knownOutcome: string;
2988
- /** The held-out material facts for this company. */
2989
- facts: MaterialFact[];
2990
- }
2991
- /**
2992
- * The eval set. 5 public companies, 5-8 held-out material facts each, every fact
2993
- * grounded in a primary SEC EDGAR 10-K filed on or before the cutoff.
2994
- *
2995
- * CURATION-BIAS DISCLOSURE (full version in the doc): all five are companies
2996
- * whose buried risks later materialized, because that is where the material-vs-
2997
- * surface distinction is sharpest AND where the figures are easy to verify after
2998
- * the fact. This biases the set toward downside risks (two of the eight lenses,
2999
- * concentration + leverage, dominate) and toward distressed names. A production
3000
- * eval would balance these with companies whose buried facts were POSITIVE
3001
- * drivers and with survivors. This set is honest about that and reports the lens
3002
- * distribution so the bias is measurable, not hidden.
3003
- */
3004
- export declare const investmentThesisSet: CompanyEvalCase[];
3005
- /**
3006
- * Grade ONE material fact against an investment thesis's full text. Returns
3007
- * whether the thesis SURFACED it plus which expected groups were found. The
3008
- * check is a deterministic case-insensitive substring scan — $0, model-free,
3009
- * reproducible — so the eval never leaks into a model the loop could observe.
3010
- */
3011
- export declare function gradeFactAgainstText(fact: MaterialFact, thesisText: string): {
3012
- surfaced: boolean;
3013
- groupsFound: number;
3014
- groupsTotal: number;
3015
- foundLabels: string[];
3016
- };
3017
- /** Grade a whole company's thesis text: how many of its held-out facts it surfaces. */
3018
- export declare function gradeCompanyAgainstText(company: CompanyEvalCase, thesisText: string): {
3019
- surfaced: number;
3020
- total: number;
3021
- perFact: ReturnType<typeof gradeFactAgainstText>[];
3022
- };
3023
- /** Total held-out facts across the set (the denominator the doc reports). */
3024
- export declare function totalMaterialFacts(set?: CompanyEvalCase[]): number;
3025
- /** Count facts per lens across the set — used to report (and bound) curation bias. */
3026
- export declare function lensDistribution(set?: CompanyEvalCase[]): Record<MaterialFactLens, number>;
3027
- //#endregion
3028
- //#region src/investment-thesis-task.d.ts
3029
- /** The minimal brief a thesis run is given — the firewall boundary. */
3030
- export interface ThesisTaskInput {
3031
- /** Legal name as of the cutoff — what the loop researches. */
3032
- company: string;
3033
- /** Ticker as of the cutoff. */
3034
- ticker: string;
3035
- /** SEC Central Index Key (CIK), zero-stripped — the EDGAR filer id. */
3036
- cik: string;
3037
- /** Research-as-of date (ISO). The loop must reason as if it is this date. */
3038
- cutoff: string;
3039
- /** Sector, for the readiness query context (NOT a checklist hint). */
3040
- sector?: string;
3041
- }
3042
- /**
3043
- * The generic analyst-lens readiness specs every company gets. They are the ONLY
3044
- * thing the loop is told about WHAT to look for, and they name the LENSES a
3045
- * thorough analyst checks (balance-sheet risk, concentration, leverage, margins,
3046
- * liquidity, governance, regulatory) and where they live (the latest SEC 10-K) —
3047
- * NOT the answers. They steer the worker's web/EDGAR search toward the filing,
3048
- * not toward the held-out facts (which the loop never sees).
3049
- *
3050
- * `minSources` is set above 1 so the readiness gate stays UNMET after a single
3051
- * fetch and the loop runs multiple rounds — the depth-driving driver needs >1
3052
- * round to steer, exactly as the ML-exam multi-round probe established.
3053
- */
3054
- export declare function thesisReadinessSpecs(input: ThesisTaskInput): KnowledgeReadinessSpec[];
3055
- export interface ThesisRunOptions {
3056
- /** The KB root the loop writes into. */
3057
- root: string;
3058
- /** Shared router client (web search + chat). Defaults to env creds. */
3059
- router: RouterClient;
3060
- /** The driver — verify/dedup or research-driving. The loop's coordinator. */
3061
- driver: ResearchDriver;
3062
- /** Round budget. Default 3 (the depth-driving driver needs >1). */
3063
- maxRounds?: number;
3064
- /** Worker tuning forwarded to `createWebResearchWorker`. */
3065
- workerOptions?: Omit<WebResearchWorkerOptions, 'router'>;
3066
- /** Max tokens for the synthesis pass. Default 1600 (above glm-5.2's reasoning floor). */
3067
- synthesisMaxTokens?: number;
3068
- signal?: AbortSignal;
3069
- }
3070
- export interface ThesisRunResult {
3071
- loop: VerifiedResearchLoopResult;
3072
- /** The synthesized thesis text. */
3073
- thesis: string;
3074
- /** Path of the thesis page written into the KB. */
3075
- thesisPath: string;
3076
- }
3077
- /**
3078
- * Run the full thesis task: drive the two-agent loop to research the company AS
3079
- * OF the cutoff, then synthesize + write the thesis page. Returns the loop result
3080
- * + the thesis text + the page path. The caller grades the KB with
3081
- * `materialFactsSurfaced(root, checklist)` — the checklist is never passed here.
3082
- */
3083
- export declare function runInvestmentThesisTask(input: ThesisTaskInput, options: ThesisRunOptions): Promise<ThesisRunResult>;
3084
- //#endregion
3085
2210
  //#region src/kb-store.d.ts
3086
2211
  /**
3087
2212
  * Where a filesystem knowledge base keeps its machine-written records, relative
@@ -3670,56 +2795,6 @@ export declare function createKnowledgeTools(options: CreateKnowledgeToolsOption
3670
2795
  //#region src/lint.d.ts
3671
2796
  export declare function lintKnowledgeIndex(index: KnowledgeIndex): KnowledgeLintFinding[];
3672
2797
  //#endregion
3673
- //#region src/material-facts-metric.d.ts
3674
- /** Per-fact grade plus the fact's id/lens, for the audit trail. */
3675
- export interface FactResult {
3676
- id: string;
3677
- lens: CompanyEvalCase['facts'][number]['lens'];
3678
- surfaced: boolean;
3679
- groupsFound: number;
3680
- groupsTotal: number;
3681
- foundLabels: string[];
3682
- }
3683
- /** The metric's result for one company: the surfaced fraction + the per-fact trail. */
3684
- export interface MaterialFactsResult {
3685
- ticker: string;
3686
- company: string;
3687
- /** Held-out facts the KB surfaced + grounded. */
3688
- surfaced: number;
3689
- /** Total held-out facts for this company (the denominator). */
3690
- total: number;
3691
- /** `surfaced / total` in [0, 1]. */
3692
- fraction: number;
3693
- /** Per-fact grade, in checklist order, for the doc / audit. */
3694
- perFact: FactResult[];
3695
- }
3696
- /**
3697
- * Join a KB index into the single text blob the grader scans: every curated PAGE
3698
- * (title + body) followed by every raw SOURCE (title + fetched text). This is the
3699
- * text read AFTER the loop finished — it is never handed to the loop. Identical
3700
- * in spirit to `kbText` in the research-quality A/B so both metrics read a KB the
3701
- * same way.
3702
- */
3703
- export declare function kbIndexToText(index: KnowledgeIndex): string;
3704
- /**
3705
- * Grade one company's KB against its held-out material-fact checklist, given the
3706
- * KB's already-joined text. The pure core — no I/O — so calibration can score a
3707
- * hand-written shallow/deep thesis string directly and the live path can score a
3708
- * real KB. Returns the surfaced FRACTION plus the per-fact audit trail.
3709
- */
3710
- export declare function materialFactsSurfacedInText(company: CompanyEvalCase, kbText: string): MaterialFactsResult;
3711
- /**
3712
- * `materialFactsSurfaced(kb, checklist)` — the metric in its KB-reading form.
3713
- *
3714
- * `kb` is EITHER a knowledge-base root directory (the loop wrote pages there) or
3715
- * an already-built `KnowledgeIndex`. `checklist` is the company's held-out
3716
- * `CompanyEvalCase`. Returns the surfaced fraction + per-fact trail.
3717
- *
3718
- * The checklist is HELD OUT by construction: it lives in the test eval set, is
3719
- * never passed to the loop, and is read only here, after the loop finished.
3720
- */
3721
- export declare function materialFactsSurfaced(kb: string | KnowledgeIndex, checklist: CompanyEvalCase): Promise<MaterialFactsResult>;
3722
- //#endregion
3723
2798
  //#region src/mutation-lock.d.ts
3724
2799
  interface KnowledgeMutationLock {
3725
2800
  readonly transactionRoot: string;
@@ -4045,71 +3120,6 @@ export interface KnowledgeBaseReadinessEvaluation {
4045
3120
  }
4046
3121
  export declare function evaluateKnowledgeBaseReadiness(options: EvaluateKnowledgeBaseReadinessOptions): Promise<KnowledgeBaseReadinessEvaluation>;
4047
3122
  //#endregion
4048
- //#region src/relation-graph.d.ts
4049
- export type KnowledgeRelationGraphErrorCode = 'invalid-node' | 'duplicate-node' | 'invalid-relation' | 'duplicate-relation' | 'undeclared-endpoint' | 'unknown-node' | 'invalid-query';
4050
- /** A relation graph input or query that cannot be honored exactly. */
4051
- export declare class KnowledgeRelationGraphError extends Error {
4052
- readonly code: KnowledgeRelationGraphErrorCode;
4053
- constructor(code: KnowledgeRelationGraphErrorCode, message: string);
4054
- }
4055
- export interface BuildKnowledgeRelationGraphInput {
4056
- /**
4057
- * Declared node inventory. When present, every relation endpoint must name
4058
- * one declared node; an undeclared endpoint is refused rather than added.
4059
- * When absent, the graph carries edges only and `nodes` is empty.
4060
- */
4061
- nodes?: readonly KnowledgeRelationNode[];
4062
- relations: readonly KnowledgeRelation[];
4063
- }
4064
- /**
4065
- * `out` follows `sourceId -> targetId`, `in` follows `targetId -> sourceId`,
4066
- * `both` follows a relation from either end.
4067
- */
4068
- export type KnowledgeRelationDirection = 'out' | 'in' | 'both';
4069
- export interface KnowledgeRelationQuery {
4070
- /** Restrict to relations with this predicate. Every predicate when absent. */
4071
- predicate?: string;
4072
- direction: KnowledgeRelationDirection;
4073
- }
4074
- export interface KnowledgeRelationWalkOptions extends KnowledgeRelationQuery {
4075
- /** Most relations between the start node and a reported node. Unbounded when absent. */
4076
- maxDepth?: number;
4077
- }
4078
- export interface KnowledgeRelationNeighbor {
4079
- nodeId: KnowledgeId;
4080
- relation: KnowledgeRelation;
4081
- }
4082
- export interface KnowledgeRelationWalkStep {
4083
- nodeId: KnowledgeId;
4084
- /** Number of relations between the start node and this node. */
4085
- depth: number;
4086
- /** The node the search came from when it first reached this node. */
4087
- from: KnowledgeId;
4088
- relation: KnowledgeRelation;
4089
- }
4090
- /**
4091
- * Build a labeled multi-edge graph from caller relations.
4092
- *
4093
- * The graph keeps one edge per `(sourceId, targetId, predicate)`, in first-seen
4094
- * order. A repeated triple is accepted only when its weight and metadata are
4095
- * identical in canonical JSON; any other repeat is a conflict and is refused.
4096
- * Node and relation metadata must be finite, acyclic JSON so the graph
4097
- * round-trips through `KnowledgeRelationGraphSchema` unchanged.
4098
- */
4099
- export declare function buildKnowledgeRelationGraph(input: BuildKnowledgeRelationGraphInput): KnowledgeRelationGraph;
4100
- /** Relations touching `id`, each with the node at the other end, in graph order. */
4101
- export declare function neighbors(graph: KnowledgeRelationGraph, id: KnowledgeId, query: KnowledgeRelationQuery): KnowledgeRelationNeighbor[];
4102
- /**
4103
- * Breadth-first traversal from `id` over matching relations. Each reachable
4104
- * node is reported once, at the depth where the search first reached it; the
4105
- * start node is never reported, so a cycle back to it adds no step.
4106
- */
4107
- export declare function walk(graph: KnowledgeRelationGraph, id: KnowledgeId, options: KnowledgeRelationWalkOptions): KnowledgeRelationWalkStep[];
4108
- /**
4109
- * Whether `to` is `from` or lies on a path of matching relations out of `from`.
4110
- */
4111
- export declare function isReachable(graph: KnowledgeRelationGraph, from: KnowledgeId, to: KnowledgeId, query: KnowledgeRelationQuery): boolean;
4112
- //#endregion
4113
3123
  //#region src/release.d.ts
4114
3124
  export interface KnowledgeReleaseReport {
4115
3125
  release: KnowledgeRelease;
@@ -4142,130 +3152,6 @@ export interface KnowledgeReleaseInput {
4142
3152
  }
4143
3153
  export declare function knowledgeReleaseReport(input: KnowledgeReleaseInput): KnowledgeReleaseReport;
4144
3154
  //#endregion
4145
- //#region src/research-driving-driver.d.ts
4146
- /** The driver's accumulated research state — the completion oracle reads this. */
4147
- export interface ResearchDrivingState {
4148
- /** Every extracted claim backed by a registered source, by id. */
4149
- claims: TrackedClaim[];
4150
- /** Every deep sub-question raised, by id. */
4151
- questions: DeepQuestion[];
4152
- /** Claims with exactly one independent source AND not contested. */
4153
- weaklySupported: TrackedClaim[];
4154
- /** Claims supported by >= 2 independent sources. */
4155
- corroborated: TrackedClaim[];
4156
- /** Claims marked contested (a surfaced, unresolved contradiction). */
4157
- contested: TrackedClaim[];
4158
- /** Deep questions still unaddressed. */
4159
- openQuestions: DeepQuestion[];
4160
- /** How many rounds the driver has folded steer for. */
4161
- rounds: number;
4162
- }
4163
- export interface ResearchDrivingDriverOptions {
4164
- /** Router client for claim extraction + deep-question generation. */
4165
- router?: RouterClient;
4166
- router_options?: TangleRouterOptions;
4167
- /**
4168
- * A claim is CORROBORATED at this many INDEPENDENT supporting sources (distinct
4169
- * canonical hosts). Default 2 — the task's ">= 2 independent sources" bar.
4170
- */
4171
- minIndependentSources?: number;
4172
- /** Max deep sub-questions to fold into one round's steer. Default 6. */
4173
- maxQuestionsPerRound?: number;
4174
- /** Max claims to extract from a single source. Default 3. */
4175
- maxClaimsPerSource?: number;
4176
- /**
4177
- * When the extractor LLM is unavailable, fall back to a deterministic claim
4178
- * pull (the source's leading sentences) so the driver still drives. Default
4179
- * true. Set false to require the model (claims will be empty without it).
4180
- */
4181
- deterministicFallback?: boolean;
4182
- /** Observe each round's generated steer (for instrumentation / the script). */
4183
- onSteer?: (steer: ResearchDrivingSteer) => void;
4184
- }
4185
- /**
4186
- * Options for the durable driver: the same driver plus a store to keep its
4187
- * belief state in.
4188
- */
4189
- export interface PersistentResearchDrivingDriverOptions extends ResearchDrivingDriverOptions {
4190
- /** Where the claim ledger is read from and written to. */
4191
- store: ClaimLedgerStore;
4192
- /**
4193
- * Names this run's ledger. Stable across resumes (that is what makes a resume
4194
- * a resume) and distinct per run against one knowledge base. Must be a single
4195
- * safe path segment — see `assertClaimLedgerId`.
4196
- */
4197
- ledgerId: string;
4198
- }
4199
- /** What the driver folded into one round's worker prompt, surfaced for audit. */
4200
- export interface ResearchDrivingSteer {
4201
- round: number;
4202
- deepQuestions: DeepQuestion[];
4203
- /** Claims it demanded corroborating/refuting evidence for this round. */
4204
- invalidationTargets: TrackedClaim[];
4205
- /** The readiness gaps it interleaved (passed through from the loop). */
4206
- gaps: KnowledgeGap[];
4207
- /** The full steer text handed to the worker. */
4208
- text: string;
4209
- }
4210
- /**
4211
- * The research-driving driver. It is a `ResearchDriver` (drops straight into
4212
- * `runVerifiedResearchLoop`) PLUS a completion oracle and live state, mirroring
4213
- * how `createAdaptiveResearchDriver` exposes `stats()`.
4214
- */
4215
- export interface ResearchDrivingDriver extends ResearchDriver {
4216
- /** Live snapshot of the claim ledger + deep questions. */
4217
- researchState(): ResearchDrivingState;
4218
- /**
4219
- * The completion oracle — gate `done` on THIS, not on source count. True when
4220
- * every deep sub-question is addressed AND every claim is corroborated
4221
- * (>= `minIndependentSources` independent sources) or explicitly contested.
4222
- * False while any claim is weakly-supported or any deep question is open.
4223
- * Returns false before any claim has been seen (nothing researched yet).
4224
- */
4225
- isComplete(): boolean;
4226
- /**
4227
- * The last round's generated steer, or undefined before the first fold. Useful
4228
- * to assert the driver produced deeper questions / invalidation challenges.
4229
- */
4230
- lastSteer(): ResearchDrivingSteer | undefined;
4231
- /**
4232
- * Write the current belief state to the store. `verifySource` already persists
4233
- * each pending observation; this exists for the state `foldGaps` produces —
4234
- * the deep questions — which is raised by a synchronous hook and would
4235
- * otherwise be lost if the process died before the next source arrived.
4236
- *
4237
- * `runVerifiedResearchLoop` calls this at the end of every round. A driver
4238
- * built without a store has nothing to write and resolves immediately.
4239
- */
4240
- checkpoint(): Promise<void>;
4241
- /** Durably announce the next synchronous fold before it begins. */
4242
- prepareFold(): Promise<void>;
4243
- /**
4244
- * Confirm exact registered source records.
4245
- * URI equality alone is insufficient: pending evidence is authorized only
4246
- * when its expected content hash matches the registered record.
4247
- */
4248
- commitSources(sources: readonly SourceRecord[]): Promise<void>;
4249
- /** The ledger record as it would be written right now. */
4250
- toLedger(): ResearchClaimLedger;
4251
- }
4252
- /**
4253
- * The in-memory driver. Its belief state lives for exactly as long as the
4254
- * process does — use `createPersistentResearchDrivingDriver` when the run must
4255
- * survive a crash or resume.
4256
- */
4257
- export declare function createResearchDrivingDriver(options?: ResearchDrivingDriverOptions): ResearchDrivingDriver;
4258
- /**
4259
- * The durable driver: same behaviour, plus its claim ledger is read from the
4260
- * store at construction and written back after every claim and every round.
4261
- *
4262
- * Construction is asynchronous because loading is I/O, and loading has to happen
4263
- * before the caller can read `researchState()` or `isComplete()` — a driver that
4264
- * loaded lazily would answer "nothing researched, not complete" for a run that
4265
- * had already corroborated everything.
4266
- */
4267
- export declare function createPersistentResearchDrivingDriver(options: PersistentResearchDrivingDriverOptions): Promise<ResearchDrivingDriver>;
4268
- //#endregion
4269
3155
  //#region src/schemas.d.ts
4270
3156
  export declare const SourceAnchorSchema: z.ZodObject<{
4271
3157
  id: z.ZodString;
@@ -4353,27 +3239,6 @@ export declare const KnowledgeRelationSchema: z.ZodObject<{
4353
3239
  weight: z.ZodOptional<z.ZodNumber>;
4354
3240
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4355
3241
  }, z.core.$strip>;
4356
- export declare const KnowledgeRelationNodeSchema: z.ZodObject<{
4357
- id: z.ZodString;
4358
- kind: z.ZodString;
4359
- label: z.ZodOptional<z.ZodString>;
4360
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4361
- }, z.core.$strip>;
4362
- export declare const KnowledgeRelationGraphSchema: z.ZodObject<{
4363
- nodes: z.ZodArray<z.ZodObject<{
4364
- id: z.ZodString;
4365
- kind: z.ZodString;
4366
- label: z.ZodOptional<z.ZodString>;
4367
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4368
- }, z.core.$strip>>;
4369
- edges: z.ZodArray<z.ZodObject<{
4370
- sourceId: z.ZodString;
4371
- targetId: z.ZodString;
4372
- predicate: z.ZodString;
4373
- weight: z.ZodOptional<z.ZodNumber>;
4374
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4375
- }, z.core.$strip>>;
4376
- }, z.core.$strip>;
4377
3242
  export declare const KnowledgeIndexSchema: z.ZodObject<{
4378
3243
  root: z.ZodString;
4379
3244
  generatedAt: z.ZodString;
@@ -4589,5 +3454,5 @@ export declare function normalizeLinkTarget(target: string): string;
4589
3454
  export declare function isSafeKnowledgePath(path: string, allowedPrefixes?: string[]): boolean;
4590
3455
  export declare function parseKnowledgeWriteBlocks(text: string, allowedPrefixes?: string[]): KnowledgeWriteParseResult;
4591
3456
  //#endregion
4592
- export { AgentMemoryAcquireRunLease, type AgentMemoryActivation, type AgentMemoryActivationDriver, AgentMemoryAdapter, type AgentMemoryAttemptEvent, AgentMemoryBranch, AgentMemoryBranchIsolation, AgentMemoryBranchLifetime, AgentMemoryBranchSnapshot, AgentMemoryContext, AgentMemoryControllerMode, type AgentMemoryDimensionComparison, type AgentMemoryEvidenceRef, type AgentMemoryExecutionContext, type AgentMemoryExecutionCostMeter, type AgentMemoryExecutionCostReceipt, type AgentMemoryExecutionPaidCallInput, type AgentMemoryExecutionPaidCallResult, type AgentMemoryExecutionStep, type AgentMemoryExperimentCandidate, type AgentMemoryExperimentCandidateRef, type AgentMemoryExperimentComparisonRef, type AgentMemoryExperimentRankingRow, type AgentMemoryExperimentRunLease, type AgentMemoryFinalEvaluation, type AgentMemoryFinalPair, type AgentMemoryForgettingComparison, AgentMemoryHit, AgentMemoryHitSchema, type AgentMemoryImprovementRunLease, AgentMemoryJournalEntry, AgentMemoryKind, AgentMemoryKindSchema, type AgentMemoryLearningArmOrder, type AgentMemoryLearningCandidateSummary, type AgentMemoryLearningCellComparison, type AgentMemoryLearningComparison, AgentMemoryLifecycleTimeoutError, AgentMemoryLifecycleUnsafeError, type AgentMemoryMode, type AgentMemoryPromotionDecision, AgentMemoryRunLease, AgentMemoryScope, AgentMemoryScopeSchema, AgentMemorySearchOptions, type AgentMemorySequence, type AgentMemorySequenceArtifact, type AgentMemorySequenceProbe, type AgentMemorySequenceProbeResult, type AgentMemorySequenceScenario, type AgentMemorySequenceStep, AgentMemorySharingPolicy, type AgentMemoryTransferCellComparison, type AgentMemoryTransferStepSummary, AgentMemoryVisibility, AgentMemoryWriteInput, AgentMemoryWriteInputSchema, AgentMemoryWriteResult, type BuildAgentMemorySequencesFromBenchmarkCasesOptions, type BuildRetrievalBenchmarkCasesFromQrelsOptions, BuildRetrievalEvalDispatchOptions, ClaimRef, type CompareAgentMemoryLearningOptions, CornellLiiSelector, CornellLiiSourceOptions, CreateAgentMemoryBranchOptions, CreatePlayMemoryToolsOptions, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, DeepQuestion, DeepQuestionKind, type ExternalRagEvalScore, FetchOpts, ForkAgentMemoryBranchSnapshotOptions, FragmentProvenance, GraphitiMcpClientLike, GraphitiMemoryAdapterOptions, GraphitiToolNames, HindsightClientLike, HindsightMemoryAdapterOptions, HindsightOperationUnknownError, INDUSTRY_MEMORY_BENCHMARKS, INDUSTRY_RAG_BENCHMARKS, IRS_DIMENSION_HINTS, type ImproveSelectedKnowledgeCandidateOptions, type ImproveSelectedKnowledgeCandidateResult, IrsPublicationsSourceOptions, KNOWLEDGE_EVENT_TYPES, type KnowledgeAnswerBenchmarkCase, type KnowledgeAnswerBenchmarkTaskKind, KnowledgeBaseCandidate, type KnowledgeBaseQualityOptions, type KnowledgeBaseQualityReport, type KnowledgeBenchmarkArtifact, type KnowledgeBenchmarkCase, type KnowledgeBenchmarkCaseBase, type KnowledgeBenchmarkDistribution, type KnowledgeBenchmarkEvaluation, type KnowledgeBenchmarkFamily, type KnowledgeBenchmarkReport, type KnowledgeBenchmarkResponder, type KnowledgeBenchmarkScenario, type KnowledgeBenchmarkSliceSummary, type KnowledgeBenchmarkSource, type KnowledgeBenchmarkSpec, type KnowledgeBenchmarkSplit, type KnowledgeBenchmarkTaskKind, type KnowledgeBrief, type KnowledgeBriefOptions, KnowledgeClaim, type KnowledgeClaimMatcher, type KnowledgeEvaluationPhase, KnowledgeEvent, KnowledgeEventType, KnowledgeFragment, KnowledgeGraph, KnowledgeGraphEdge, KnowledgeGraphNode, KnowledgeId, type KnowledgeImprovementActivationPersistence, type KnowledgeImprovementCandidateRecord, type KnowledgeImprovementCandidateRef, type KnowledgeImprovementEvaluationInput, type KnowledgeImprovementEvaluator, type KnowledgeImprovementEvent, type KnowledgeImprovementEvidence, type KnowledgeImprovementMetric, type KnowledgeImprovementMetricProvenance, type KnowledgeImprovementMutationReceipt, type KnowledgeImprovementMutationResult, type KnowledgeImprovementOptions, type KnowledgeImprovementRagOptimizationOptions, type KnowledgeImprovementRagOptimizationRunInput, type KnowledgeImprovementResult, type KnowledgeImprovementRetrievalOptions, type KnowledgeImprovementRunState, type KnowledgeImprovementStatus, type KnowledgeImprovementTarget, type KnowledgeImprovementUpdate, type KnowledgeImprovementUpdateInput, KnowledgeIndex, KnowledgeLintFinding, type KnowledgeMemoryBenchmarkCase, type KnowledgeMemoryBenchmarkTaskKind, type KnowledgeMemoryEvent, type KnowledgeMemoryFactMatcher, type KnowledgeMutationHold, type KnowledgeMutationLock, type KnowledgeMutationOptions, KnowledgePage, KnowledgePageInvalidation, KnowledgePolicy, type KnowledgePolicyDispatch, type KnowledgeReadOptions, KnowledgeRelation, KnowledgeRelationGraph, KnowledgeRelationNode, KnowledgeRelease, type KnowledgeRetrievalBenchmarkCase, type KnowledgeRetrievalBenchmarkQrel, type KnowledgeRetrievalBenchmarkQuery, KnowledgeSearchResult, KnowledgeSource, type KnowledgeStateScope, KnowledgeUnit, KnowledgeWriteBlock, KnowledgeWriteParseResult, type LoadKnowledgeImprovementActivationResultOptions, MAX_RESPONSE_BYTES, MIN_REQUEST_GAP_MS, type MeasuredKnowledgeSelectionReceipt, Mem0ClientMode, Mem0HostedClient, Mem0HostedMemoryAdapterOptions, Mem0MemoryAdapterOptions, Mem0OssClient, Mem0OssMemoryAdapterOptions, type MemoryAdapterBenchmarkCandidate, type MemoryAdapterBenchmarkRankingRow, type MemoryConfigScenario, type NearDuplicateDetectionOptions, type NearDuplicatePair, type NearDuplicateReport, Neo4jAgentMemoryAdapterOptions, type OptimizeKnowledgeBasePolicyOptions, type OptimizeKnowledgeBasePolicyResult, type OriginatedPage, OwnedAgentMemoryRunLease, POLITE_USER_AGENT, type PageOrigin, PartitionRetrievalScenariosOptions, type PendingKnowledgeMutation, PlayMemoryRetrievalReceipt, PoliteFetchOptions, PoliteFetchResult, type PromoteKnowledgeCandidateOptions, type RagAnswerEvalArtifact, type RagAnswerEvalCase, type RagAnswerEvalScenario, type RagAnswerMetricSummary, type RagAnswerQualityHookOptions, type RagAnswerQualityJudgeOptions, type RagCalibrationOptions, type RagCalibrationResult, type RagEvalCitation, type RagEvalClaim, type RagEvalContext, type RagEvalMetricKey, type RagEvalProvider, type RagEvalSlice, type RagRequiredContext, type RecoverPendingKnowledgeMutationOptions, type RegularFileSnapshot, ResearchClaimEvidence, ResearchClaimLedger, ResearchClaimRecord, ResearchSourceVersion, type ResolvedKnowledgeImprovementCandidate, type ResolvedKnowledgeImprovementComparison, type ResolvedKnowledgeImprovementComparisonSnapshot, type RestoreKnowledgeCandidateBaselineOptions, RetrievalConfig, RetrievalEvalArtifact, RetrievalEvalRetriever, RetrievalEvalRetrieverInput, RetrievalEvalRetrieverResult, RetrievalEvalScenario, RetrievalGoldTarget, RetrievalHoldoutBypassReason, RetrievalHoldoutCallContext, RetrievalHoldoutConfig, RetrievalHoldoutEligibleItem, RetrievalHoldoutEvent, RetrievalHoldoutOffPolicyOptions, RetrievalHoldoutOffPolicyResult, RetrievalHoldoutResult, RetrievalHoldoutSessionState, RetrievalHoldoutSessionSummary, RetrievalMetricSummary, RetrievalMetricWeights, RetrievalRecallJudgeOptions, RetrievalScenarioPartitions, RetrievedKnowledgeHit, RetrievedSourceSpan, type RunAgentMemoryExperimentOptions, type RunAgentMemoryExperimentResult, type RunAgentMemoryImprovementOptions, type RunAgentMemoryImprovementResult, type RunAgentMemoryLearningExperimentOptions, type RunAgentMemoryLearningExperimentResult, type RunKnowledgeBenchmarkSuiteOptions, type RunKnowledgeBenchmarkSuiteResult, type RunLineageAuthority, type RunLineageRecord, type RunMemoryAdapterBenchmarkOptions, type RunMemoryAdapterBenchmarkResult, type RunScopedStores, type RunScopedStoresOptions, RunSerializedKnowledgeOptimizationOptions, RunSerializedKnowledgeOptimizationResult, SerializedCandidate, SerializedCandidateCodec, SourceAnchor, SourceRecord, SourceRegistry, StateSosEntity, StateSosSourceConfig, TrackedClaim, type UseKnowledgeImprovementCandidateOptions, __resetHttpThrottle, acquireAgentMemoryRunLease, agentMemorySequenceJudge, applyRetrievalHoldout, applySessionStickyRetrievalHoldout, buildAgentMemorySequenceScenarios, buildAgentMemorySequencesFromBenchmarkCases, buildFirstPartyMemoryLifecycleBenchmarkCases, buildIndustryMemoryBenchmarkSmokeCases, buildIndustryRagBenchmarkSmokeCases, buildKnowledgeBenchmarkScenarios, buildRetrievalBenchmarkCasesFromQrels, buildRetrievalEvalDispatch, compareAgentMemoryLearning, createAgentMemoryBranch, createCornellLiiSource, createGraphitiMemoryAdapter, createHindsightMemoryAdapter, createInMemoryBenchmarkAdapter, createIrsPublicationsSource, createMem0MemoryAdapter, createMemoryExecutionPool, createNeo4jAgentMemoryAdapter, createNoopMemoryBenchmarkAdapter, createPlayMemoryTools, createStateSosSource, defaultGetMemoryContext, deterministicRng, emitRetrievalHoldoutBypass, extractLinks, firstMatch, forkAgentMemoryBranchSnapshot, graphitiMemoryAdapterIdentity, hindsightMemoryBankId, htmlToText, innerHtmlById, isKnowledgeMemoryBenchmarkCase, jsonCandidateCodec, jsonObjectCandidateCodec, knowledgeBenchmarkJudge, looksLikeBlockPage, mem0MemoryAdapterIdentity, memoryHitToSourceRecord, memoryRecoveryDelayMs, memoryWriteResultToSourceRecord, parseKnowledgeBenchmarkJsonl, parseKnowledgeBenchmarkQrels, partitionRetrievalScenarios, politeFetch, renderKnowledgeBenchmarkReportMarkdown, renderMemoryContext, resetRetrievalHoldoutRegistry, resolveMemoryCleanupTimeoutMs, respondToIndustryMemoryBenchmarkSmokeCase, respondToIndustryRagBenchmarkSmokeCase, retrievalConfigFromSurface, retrievalConfigSurface, retrievalHoldoutConfigHash, retrievalRecallJudge, runAgentMemoryExperiment, runAgentMemoryImprovement, runAgentMemoryLearningExperiment, runBoundedMemoryLifecycle, runKnowledgeBenchmarkSuite, runMemoryAdapterBenchmark, runSerializedKnowledgeOptimization, scenarioContentFingerprint, scoreKnowledgeBenchmarkArtifact, scoreMemoryBenchmarkArtifact, scoreRetrievalArtifact, sleepForMemoryRecovery, summarizeKnowledgeBenchmarkCampaign, toOffPolicyTrajectory };
3457
+ export { AgentMemoryAdapter, AgentMemoryBranch, AgentMemoryBranchIsolation, AgentMemoryBranchLifetime, AgentMemoryBranchSnapshot, AgentMemoryContext, AgentMemoryHit, AgentMemoryHitSchema, AgentMemoryJournalEntry, AgentMemoryKind, AgentMemoryKindSchema, AgentMemoryLifecycleTimeoutError, AgentMemoryLifecycleUnsafeError, AgentMemoryScope, AgentMemoryScopeSchema, AgentMemorySearchOptions, AgentMemorySharingPolicy, AgentMemoryVisibility, AgentMemoryWriteInput, AgentMemoryWriteInputSchema, AgentMemoryWriteResult, ClaimRef, CreateAgentMemoryBranchOptions, CreatePlayMemoryToolsOptions, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, DeepQuestion, DeepQuestionKind, type ExternalRagEvalScore, ForkAgentMemoryBranchSnapshotOptions, GraphitiMcpClientLike, GraphitiMemoryAdapterOptions, GraphitiToolNames, HindsightClientLike, HindsightMemoryAdapterOptions, HindsightOperationUnknownError, KNOWLEDGE_EVENT_TYPES, KnowledgeBaseCandidate, type KnowledgeBaseQualityOptions, type KnowledgeBaseQualityReport, type KnowledgeBrief, type KnowledgeBriefOptions, KnowledgeClaim, KnowledgeEvent, KnowledgeEventType, KnowledgeGraph, KnowledgeGraphEdge, KnowledgeGraphNode, KnowledgeId, type KnowledgeImprovementActivationPersistence, type KnowledgeImprovementCandidateRecord, type KnowledgeImprovementCandidateRef, type KnowledgeImprovementEvaluationInput, type KnowledgeImprovementEvaluator, type KnowledgeImprovementEvent, type KnowledgeImprovementEvidence, type KnowledgeImprovementMetric, type KnowledgeImprovementMetricProvenance, type KnowledgeImprovementMutationReceipt, type KnowledgeImprovementMutationResult, type KnowledgeImprovementOptions, type KnowledgeImprovementRagOptimizationOptions, type KnowledgeImprovementRagOptimizationRunInput, type KnowledgeImprovementResult, type KnowledgeImprovementRetrievalOptions, type KnowledgeImprovementRunState, type KnowledgeImprovementStatus, type KnowledgeImprovementTarget, type KnowledgeImprovementUpdate, type KnowledgeImprovementUpdateInput, KnowledgeIndex, KnowledgeLintFinding, type KnowledgeMutationHold, type KnowledgeMutationLock, type KnowledgeMutationOptions, KnowledgePage, KnowledgePageInvalidation, KnowledgePolicy, type KnowledgeReadOptions, KnowledgeRelation, KnowledgeRelease, KnowledgeSearchResult, type KnowledgeStateScope, KnowledgeUnit, KnowledgeWriteBlock, KnowledgeWriteParseResult, type LoadKnowledgeImprovementActivationResultOptions, Mem0ClientMode, Mem0HostedClient, Mem0HostedMemoryAdapterOptions, Mem0MemoryAdapterOptions, Mem0OssClient, Mem0OssMemoryAdapterOptions, type NearDuplicateDetectionOptions, type NearDuplicatePair, type NearDuplicateReport, Neo4jAgentMemoryAdapterOptions, type OriginatedPage, type PageOrigin, type PendingKnowledgeMutation, PlayMemoryRetrievalReceipt, type PromoteKnowledgeCandidateOptions, type RagAnswerEvalArtifact, type RagAnswerEvalCase, type RagAnswerEvalScenario, type RagAnswerMetricSummary, type RagAnswerQualityHookOptions, type RagAnswerQualityJudgeOptions, type RagCalibrationOptions, type RagCalibrationResult, type RagEvalCitation, type RagEvalClaim, type RagEvalContext, type RagEvalMetricKey, type RagEvalProvider, type RagEvalSlice, type RagRequiredContext, type RecoverPendingKnowledgeMutationOptions, type RegularFileSnapshot, ResearchClaimEvidence, ResearchClaimLedger, ResearchClaimRecord, ResearchSourceVersion, type ResolvedKnowledgeImprovementCandidate, type ResolvedKnowledgeImprovementComparison, type ResolvedKnowledgeImprovementComparisonSnapshot, type RestoreKnowledgeCandidateBaselineOptions, RetrievalHoldoutBypassReason, RetrievalHoldoutCallContext, RetrievalHoldoutConfig, RetrievalHoldoutEligibleItem, RetrievalHoldoutEvent, RetrievalHoldoutOffPolicyOptions, RetrievalHoldoutOffPolicyResult, RetrievalHoldoutResult, RetrievalHoldoutSessionState, RetrievalHoldoutSessionSummary, type RunLineageAuthority, type RunLineageRecord, type RunScopedStores, type RunScopedStoresOptions, SourceAnchor, SourceRecord, SourceRegistry, TrackedClaim, type UseKnowledgeImprovementCandidateOptions, applyRetrievalHoldout, applySessionStickyRetrievalHoldout, createAgentMemoryBranch, createGraphitiMemoryAdapter, createHindsightMemoryAdapter, createInMemoryBenchmarkAdapter, createMem0MemoryAdapter, createMemoryExecutionPool, createNeo4jAgentMemoryAdapter, createNoopMemoryBenchmarkAdapter, createPlayMemoryTools, defaultGetMemoryContext, deterministicRng, emitRetrievalHoldoutBypass, forkAgentMemoryBranchSnapshot, graphitiMemoryAdapterIdentity, hindsightMemoryBankId, mem0MemoryAdapterIdentity, memoryHitToSourceRecord, memoryRecoveryDelayMs, memoryWriteResultToSourceRecord, renderMemoryContext, resetRetrievalHoldoutRegistry, resolveMemoryCleanupTimeoutMs, retrievalHoldoutConfigHash, runBoundedMemoryLifecycle, sleepForMemoryRecovery, toOffPolicyTrajectory };
4593
3458
  //# sourceMappingURL=index.d.ts.map