@tangle-network/agent-knowledge 17.1.10 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -9,29 +9,29 @@ import { ComparisonCost, DispatchContext, JudgeConfig, OptimizationMethod, Scena
9
9
  import { EvidenceRef } from "@tangle-network/agent-eval/analyst";
10
10
  import { LockOptions } from "proper-lockfile";
11
11
  //#region src/adapters.d.ts
12
- interface SourceAdapterInput {
12
+ export interface SourceAdapterInput {
13
13
  uri: string;
14
14
  bytes?: Uint8Array;
15
15
  text?: string;
16
16
  metadata?: Record<string, unknown>;
17
17
  }
18
- interface SourceAdapterOutput {
18
+ export interface SourceAdapterOutput {
19
19
  title?: string;
20
20
  mediaType?: string;
21
21
  text?: string;
22
22
  anchors?: SourceRecord['anchors'];
23
23
  metadata?: Record<string, unknown>;
24
24
  }
25
- interface SourceAdapter {
25
+ export interface SourceAdapter {
26
26
  id: string;
27
27
  canLoad(input: SourceAdapterInput): boolean;
28
28
  load(input: SourceAdapterInput): Promise<SourceAdapterOutput> | SourceAdapterOutput;
29
29
  }
30
- declare const textSourceAdapter: SourceAdapter;
31
- declare function mediaTypeFor(uri: string): string;
30
+ export declare const textSourceAdapter: SourceAdapter;
31
+ export declare function mediaTypeFor(uri: string): string;
32
32
  //#endregion
33
33
  //#region src/eval-readiness.d.ts
34
- interface KnowledgeReadinessSpec {
34
+ export interface KnowledgeReadinessSpec {
35
35
  id: string;
36
36
  description: string;
37
37
  query: string;
@@ -55,7 +55,7 @@ interface KnowledgeReadinessSpec {
55
55
  * source. Override any field to specialise (e.g. `freshness: 'daily'` for a
56
56
  * topic that must reflect today's regulatory state).
57
57
  */
58
- declare const READINESS_SPEC_DEFAULTS: {
58
+ export declare const READINESS_SPEC_DEFAULTS: {
59
59
  readonly category: 'domain_specific';
60
60
  readonly acquisitionMode: 'search_web';
61
61
  readonly importance: 'high';
@@ -70,7 +70,7 @@ declare const READINESS_SPEC_DEFAULTS: {
70
70
  * sanely default (id, description, query, requiredFor) are required; everything
71
71
  * else is optional and pulls from `READINESS_SPEC_DEFAULTS`.
72
72
  */
73
- type DefineReadinessSpecInput = Pick<KnowledgeReadinessSpec, 'id' | 'description' | 'query' | 'requiredFor'> & Partial<Omit<KnowledgeReadinessSpec, 'id' | 'description' | 'query' | 'requiredFor'>>;
73
+ export type DefineReadinessSpecInput = Pick<KnowledgeReadinessSpec, 'id' | 'description' | 'query' | 'requiredFor'> & Partial<Omit<KnowledgeReadinessSpec, 'id' | 'description' | 'query' | 'requiredFor'>>;
74
74
  /**
75
75
  * Builder that returns a fully-typed `KnowledgeReadinessSpec` from a slim input.
76
76
  *
@@ -101,8 +101,8 @@ type DefineReadinessSpecInput = Pick<KnowledgeReadinessSpec, 'id' | 'description
101
101
  * minSources: 3,
102
102
  * })
103
103
  */
104
- declare function defineReadinessSpec(input: DefineReadinessSpecInput): KnowledgeReadinessSpec;
105
- interface BuildEvalKnowledgeBundleOptions {
104
+ export declare function defineReadinessSpec(input: DefineReadinessSpecInput): KnowledgeReadinessSpec;
105
+ export interface BuildEvalKnowledgeBundleOptions {
106
106
  taskId: string;
107
107
  index: KnowledgeIndex;
108
108
  specs: KnowledgeReadinessSpec[];
@@ -111,7 +111,7 @@ interface BuildEvalKnowledgeBundleOptions {
111
111
  metadata?: Record<string, unknown>;
112
112
  now?: Date;
113
113
  }
114
- interface EvalKnowledgeBundleBuildResult {
114
+ export interface EvalKnowledgeBundleBuildResult {
115
115
  bundle: KnowledgeBundle;
116
116
  report: KnowledgeReadinessReport;
117
117
  requirements: KnowledgeRequirement[];
@@ -119,15 +119,15 @@ interface EvalKnowledgeBundleBuildResult {
119
119
  questions: UserQuestion[];
120
120
  acquisitionPlans: DataAcquisitionPlan[];
121
121
  }
122
- declare function buildEvalKnowledgeBundle(options: BuildEvalKnowledgeBundleOptions): EvalKnowledgeBundleBuildResult;
122
+ export declare function buildEvalKnowledgeBundle(options: BuildEvalKnowledgeBundleOptions): EvalKnowledgeBundleBuildResult;
123
123
  //#endregion
124
124
  //#region src/sources.d.ts
125
- interface AddSourceOptions {
125
+ export interface AddSourceOptions {
126
126
  copyIntoRaw?: boolean;
127
127
  adapters?: SourceAdapter[];
128
128
  now?: () => Date;
129
129
  }
130
- interface AddSourceTextInput {
130
+ export interface AddSourceTextInput {
131
131
  uri: string;
132
132
  text: string;
133
133
  title?: string;
@@ -137,12 +137,12 @@ interface AddSourceTextInput {
137
137
  metadata?: Record<string, unknown>;
138
138
  }
139
139
  /** Copy and freeze an untrusted source proposal before any asynchronous work. */
140
- declare function snapshotSourceTextInput(input: AddSourceTextInput): AddSourceTextInput;
141
- declare function loadSourceRegistry(root: string): Promise<SourceRegistry>;
142
- declare function writeSourceRegistry(root: string, registry: SourceRegistry): Promise<void>;
143
- declare function addSourcePath(root: string, sourcePath: string, options?: AddSourceOptions): Promise<SourceRecord[]>;
144
- declare function addSourceText(root: string, input: AddSourceTextInput, options?: Pick<AddSourceOptions, 'adapters' | 'now'>): Promise<SourceRecord>;
145
- declare function sourceRegistryPath(root: string): string;
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
146
  //#endregion
147
147
  //#region src/verified-research-loop.d.ts
148
148
  /**
@@ -150,7 +150,7 @@ declare function sourceRegistryPath(root: string): string;
150
150
  * targets these; the driver folds the unfilled remainder into the worker's next
151
151
  * prompt and runs its own gap-fill pass over them.
152
152
  */
153
- interface KnowledgeGap {
153
+ export interface KnowledgeGap {
154
154
  /** Readiness-spec id this gap belongs to. */
155
155
  id: string;
156
156
  /** Human-readable description of what's missing. */
@@ -161,7 +161,7 @@ interface KnowledgeGap {
161
161
  blocking: boolean;
162
162
  }
163
163
  /** A new source the worker (or driver) discovered and wants to add to the KB. */
164
- type ResearchSourceProposal = AddSourceTextInput;
164
+ export type ResearchSourceProposal = AddSourceTextInput;
165
165
  /**
166
166
  * What a research agent contributes in one round. Both the worker and (when
167
167
  * `driverResearches` is on) the driver produce this shape — the worker ADDS
@@ -171,7 +171,7 @@ type ResearchSourceProposal = AddSourceTextInput;
171
171
  * blocks). The loop only applies it AFTER the driver has verified the round's
172
172
  * sources, so a rejected source never reaches the curated pages.
173
173
  */
174
- interface ResearchContribution {
174
+ export interface ResearchContribution {
175
175
  /** Immutable sources to register (the raw evidence). */
176
176
  sources?: ResearchSourceProposal[];
177
177
  /** Safe write-protocol text producing curated `knowledge/*.md` pages. */
@@ -190,7 +190,7 @@ interface ResearchContribution {
190
190
  metadata?: Record<string, unknown>;
191
191
  }
192
192
  /** Context handed to the worker each round. */
193
- interface WorkerResearchContext {
193
+ export interface WorkerResearchContext {
194
194
  root: string;
195
195
  goal: string;
196
196
  round: number;
@@ -203,7 +203,7 @@ interface WorkerResearchContext {
203
203
  signal?: AbortSignal;
204
204
  }
205
205
  /** Context handed to the driver's verifier for one candidate source. */
206
- interface SourceVerificationContext {
206
+ export interface SourceVerificationContext {
207
207
  root: string;
208
208
  goal: string;
209
209
  round: number;
@@ -214,12 +214,12 @@ interface SourceVerificationContext {
214
214
  signal?: AbortSignal;
215
215
  }
216
216
  /** A single rejected source plus the reason the driver gave. */
217
- interface RejectedSource {
217
+ export interface RejectedSource {
218
218
  source: ResearchSourceProposal;
219
219
  reason: string;
220
220
  }
221
221
  /** Context handed to the driver's gap-fill pass (only when `driverResearches`). */
222
- interface DriverResearchContext {
222
+ export interface DriverResearchContext {
223
223
  root: string;
224
224
  goal: string;
225
225
  round: number;
@@ -250,7 +250,7 @@ interface DriverResearchContext {
250
250
  * - `commitSources` — confirm exact source records are durable after verification;
251
251
  * drivers with pending evidence must not count it before this callback.
252
252
  */
253
- interface ResearchDriver {
253
+ export interface ResearchDriver {
254
254
  verifySource(source: ResearchSourceProposal, ctx: SourceVerificationContext): Promise<SourceVerdict> | SourceVerdict;
255
255
  research?(ctx: DriverResearchContext): Promise<ResearchContribution> | ResearchContribution;
256
256
  foldGaps?(gaps: KnowledgeGap[]): string;
@@ -259,15 +259,15 @@ interface ResearchDriver {
259
259
  commitSources?(sources: readonly SourceRecord[]): Promise<void> | void;
260
260
  checkpoint?(): Promise<void> | void;
261
261
  }
262
- type SourceVerdict = {
262
+ export type SourceVerdict = {
263
263
  accept: true;
264
264
  } | {
265
265
  accept: false;
266
266
  reason: string;
267
267
  };
268
268
  /** The worker: primary research targeting the round's gaps. */
269
- type ResearchWorker = (ctx: WorkerResearchContext) => Promise<ResearchContribution> | ResearchContribution;
270
- interface VerifiedResearchLoopOptions {
269
+ export type ResearchWorker = (ctx: WorkerResearchContext) => Promise<ResearchContribution> | ResearchContribution;
270
+ export interface VerifiedResearchLoopOptions {
271
271
  root: string;
272
272
  goal: string;
273
273
  worker: ResearchWorker;
@@ -289,7 +289,7 @@ interface VerifiedResearchLoopOptions {
289
289
  signal?: AbortSignal;
290
290
  onRound?: (round: VerifiedResearchRound) => Promise<void> | void;
291
291
  }
292
- interface VerifiedResearchRound {
292
+ export interface VerifiedResearchRound {
293
293
  round: number;
294
294
  /** Gaps reported at the START of the round (what the worker targeted). */
295
295
  gaps: KnowledgeGap[];
@@ -310,7 +310,7 @@ interface VerifiedResearchRound {
310
310
  driver?: string;
311
311
  };
312
312
  }
313
- interface VerifiedResearchLoopResult {
313
+ export interface VerifiedResearchLoopResult {
314
314
  root: string;
315
315
  goal: string;
316
316
  rounds: number;
@@ -341,26 +341,26 @@ interface VerifiedResearchLoopResult {
341
341
  * `applyKnowledgeWriteBlocks`, `buildEvalKnowledgeBundle` (the readiness gate),
342
342
  * and `searchKnowledge` — and reinvents none of them.
343
343
  */
344
- declare function runVerifiedResearchLoop(options: VerifiedResearchLoopOptions): Promise<VerifiedResearchLoopResult>;
344
+ export declare function runVerifiedResearchLoop(options: VerifiedResearchLoopOptions): Promise<VerifiedResearchLoopResult>;
345
345
  /**
346
346
  * Helper for verifiers: does the candidate source's text/title overlap any page
347
347
  * the readiness search returns for a gap query? A cheap relevance heuristic the
348
348
  * driver can compose into `verifySource` (real verifiers can do more).
349
349
  */
350
- declare function sourceMatchesGaps(source: ResearchSourceProposal, index: KnowledgeIndex, gaps: KnowledgeGap[]): KnowledgeSearchResult[];
350
+ export declare function sourceMatchesGaps(source: ResearchSourceProposal, index: KnowledgeIndex, gaps: KnowledgeGap[]): KnowledgeSearchResult[];
351
351
  //#endregion
352
352
  //#region src/web-research-worker.d.ts
353
353
  /** One live web result, as the router's `/v1/search` returns it. */
354
- interface WebSearchHit {
354
+ export interface WebSearchHit {
355
355
  title: string;
356
356
  url: string;
357
357
  snippet?: string;
358
358
  }
359
359
  /**
360
360
  * The two router capabilities the worker/driver need. Injectable so tests can
361
- * stub the network; the default talks to the live Tangle router over `fetch`.
361
+ * supply a client; the default uses the published TCloud SDK.
362
362
  */
363
- interface RouterClient {
363
+ export interface RouterClient {
364
364
  /** Live web search — returns title/url/snippet hits. */
365
365
  search(query: string, opts?: {
366
366
  maxResults?: number;
@@ -380,15 +380,16 @@ interface RouterClient {
380
380
  * each call here is what surfaces that the two-agent loop spends more inference
381
381
  * than its "equal passes" budget implies.
382
382
  */
383
- interface RouterUsage {
383
+ export interface RouterUsage {
384
384
  chatCalls: number;
385
385
  searchCalls: number;
386
386
  promptTokens: number;
387
387
  completionTokens: number;
388
+ /** Reported cost only. NaN once a successful response omits its cost receipt. */
388
389
  usd: number;
389
390
  wallMs: number;
390
391
  }
391
- interface TangleRouterOptions {
392
+ export interface TangleRouterOptions {
392
393
  /** Router base URL. Defaults to `https://router.tangle.tools/v1`. */
393
394
  baseUrl?: string;
394
395
  /** Bearer key. Defaults to `process.env.TANGLE_API_KEY`. */
@@ -397,30 +398,20 @@ interface TangleRouterOptions {
397
398
  model?: string;
398
399
  /** Optional preferred search provider (exa | you | perplexity | …). */
399
400
  searchProvider?: string;
400
- /**
401
- * Retries on a TRANSIENT upstream status (502/503/504/429) with exponential
402
- * backoff. Default 4. A 4xx that isn't 429, and a 401, are NOT retried — those
403
- * are not transient. After the budget is exhausted the call still fails loud
404
- * with the original `RouterError`, so the fail-closed contract holds; this only
405
- * stops a single upstream-capacity blip from voiding a whole multi-topic run.
406
- */
401
+ /** SDK retries for 429/502/503/504. Default 4. Kept for API compatibility. */
407
402
  maxRetries?: number;
408
- /** Base backoff in ms (doubled each retry, ±25% jitter). Default 1500. */
403
+ /** Initial SDK retry backoff in ms. Default 1500. */
409
404
  retryBaseMs?: number;
410
405
  signal?: AbortSignal;
411
406
  }
412
- /** A small error so a failed router call fails loud rather than returning junk. */
413
- declare class RouterError extends Error {
407
+ /** Compatibility error facade. HTTP execution and classification belong to TCloud. */
408
+ export declare class RouterError extends Error {
414
409
  readonly status: number;
415
410
  constructor(status: number, message: string);
416
411
  }
417
- /**
418
- * Build a dependency-free Tangle router client over `fetch`. This is the same
419
- * wire surface the `tcloud` SDK + `tcloud mcp` use (`/v1/search` for web search,
420
- * `/v1/chat/completions` for chat) so it needs no CLI installed.
421
- */
422
- declare function createTangleRouterClient(options?: TangleRouterOptions): RouterClient;
423
- interface WebResearchWorkerOptions {
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 {
424
415
  /** Router client. Defaults to a live Tangle router client from env creds. */
425
416
  router?: RouterClient;
426
417
  router_options?: TangleRouterOptions;
@@ -442,8 +433,8 @@ interface WebResearchWorkerOptions {
442
433
  * contract: given the open gaps, it returns the sources it found plus a
443
434
  * `buildPages` that emits citing pages from the sources the driver accepted.
444
435
  */
445
- declare function createWebResearchWorker(options?: WebResearchWorkerOptions): ResearchWorker;
446
- interface VerifyingDriverOptions {
436
+ export declare function createWebResearchWorker(options?: WebResearchWorkerOptions): ResearchWorker;
437
+ export interface VerifyingDriverOptions {
447
438
  router?: RouterClient;
448
439
  router_options?: TangleRouterOptions;
449
440
  /**
@@ -463,7 +454,7 @@ interface VerifyingDriverOptions {
463
454
  * new candidates, so the verifier focuses on relevance + near-duplicate
464
455
  * judgement, not bookkeeping.
465
456
  */
466
- declare function createVerifyingResearchDriver(options?: VerifyingDriverOptions): ResearchDriver;
457
+ export declare function createVerifyingResearchDriver(options?: VerifyingDriverOptions): ResearchDriver;
467
458
  //#endregion
468
459
  //#region src/adaptive-driver.d.ts
469
460
  /**
@@ -474,20 +465,20 @@ declare function createVerifyingResearchDriver(options?: VerifyingDriverOptions)
474
465
  * as the same source. Falls back to the lowercased raw string when the input is
475
466
  * not a parseable absolute URL (so non-http identifiers still dedup by equality).
476
467
  */
477
- declare function canonicalizeUrl(uri: string): string;
468
+ export declare function canonicalizeUrl(uri: string): string;
478
469
  /**
479
470
  * A stable content key for a fetched page: the sha256 of its normalized text
480
471
  * (lowercased, punctuation/whitespace collapsed). Two pages whose readable body
481
472
  * is the same modulo formatting collide here, so the dedup stage rejects a
482
473
  * mirror/syndication of an already-accepted source even when the URL differs.
483
474
  */
484
- declare function contentKey(text: string): string;
475
+ export declare function contentKey(text: string): string;
485
476
  /** Why the deterministic dedup stage rejected a candidate (for audit/notes). */
486
- type DedupReason = 'duplicate-url' | 'duplicate-content';
477
+ export type DedupReason = 'duplicate-url' | 'duplicate-content';
487
478
  /** The cheap-triage classification of a unique survivor. */
488
- type TriageClass = 'keep' | 'drop' | 'ambiguous';
479
+ export type TriageClass = 'keep' | 'drop' | 'ambiguous';
489
480
  /** One source's adaptive routing decision, for instrumentation and the doc. */
490
- interface AdaptiveDecision {
481
+ export interface AdaptiveDecision {
491
482
  uri: string;
492
483
  /** The stage that decided this source: dedup | heuristic | llm. */
493
484
  stage: 'dedup' | 'heuristic' | 'llm';
@@ -497,7 +488,7 @@ interface AdaptiveDecision {
497
488
  reason?: string;
498
489
  }
499
490
  /** Running tally of where the adaptive driver spent its decisions. */
500
- interface AdaptiveStats {
491
+ export interface AdaptiveStats {
501
492
  total: number;
502
493
  /** Rejected by deterministic dedup (URL or content). $0. */
503
494
  dedupRejected: number;
@@ -511,7 +502,7 @@ interface AdaptiveStats {
511
502
  llmAccepted: number;
512
503
  decisions: AdaptiveDecision[];
513
504
  }
514
- interface AdaptiveDriverOptions {
505
+ export interface AdaptiveDriverOptions {
515
506
  /** Router client for the LLM escalation. Defaults to a live client from env. */
516
507
  router?: RouterClient;
517
508
  router_options?: TangleRouterOptions;
@@ -548,7 +539,7 @@ interface AdaptiveDriverOptions {
548
539
  * the residue the LLM is reserved for: on-topic-looking pages on unknown hosts
549
540
  * with a plausible body, which a host/title rule cannot adjudicate.
550
541
  */
551
- declare function triageSource(source: ResearchSourceProposal, options: {
542
+ export declare function triageSource(source: ResearchSourceProposal, options: {
552
543
  authoritativeHosts: string[];
553
544
  spamPatterns: RegExp[];
554
545
  minBodyChars: number;
@@ -557,7 +548,7 @@ declare function triageSource(source: ResearchSourceProposal, options: {
557
548
  triage: TriageClass;
558
549
  reason: string;
559
550
  };
560
- interface AdaptiveResearchDriver {
551
+ export interface AdaptiveResearchDriver {
561
552
  verifySource(source: ResearchSourceProposal, ctx: SourceVerificationContext): Promise<SourceVerdict>;
562
553
  /** Live tally of where decisions were spent — the cost/quality instrumentation. */
563
554
  stats(): AdaptiveStats;
@@ -572,7 +563,7 @@ interface AdaptiveResearchDriver {
572
563
  * content hashes it has ACCEPTED, plus those it sees in the verification
573
564
  * context's `acceptedThisRound` and the KB index. Use one driver per loop run.
574
565
  */
575
- declare function createAdaptiveResearchDriver(options?: AdaptiveDriverOptions): AdaptiveResearchDriver;
566
+ export declare function createAdaptiveResearchDriver(options?: AdaptiveDriverOptions): AdaptiveResearchDriver;
576
567
  //#endregion
577
568
  //#region src/knowledge-state-scope.d.ts
578
569
  /** Authoritative local state included in a KB improvement candidate. */
@@ -582,15 +573,15 @@ interface KnowledgeStateScope {
582
573
  /** Include claim ledgers and research events. Excludes indexes, locks, and receipt artifacts. */
583
574
  researchState?: boolean;
584
575
  }
585
- declare function normalizeKnowledgeStateScope(scope?: KnowledgeStateScope): {
576
+ export declare function normalizeKnowledgeStateScope(scope?: KnowledgeStateScope): {
586
577
  pagesDirectory: string;
587
578
  researchState: boolean;
588
579
  };
589
580
  //#endregion
590
581
  //#region src/rag-optimization.d.ts
591
- type RagOptimizationConfig = Record<string, AgentCandidateJsonValue>;
582
+ export type RagOptimizationConfig = Record<string, AgentCandidateJsonValue>;
592
583
  type RagOptimizationBaseOptions = Omit<RunSerializedKnowledgeOptimizationOptions<RagOptimizationConfig, RagAnswerEvalScenario, RagAnswerEvalArtifact>, 'baseline' | 'method' | 'trainScenarios' | 'selectionScenarios' | 'finalScenarios' | 'dispatchCandidate' | 'judges' | 'codec' | 'scenarioFingerprint'>;
593
- interface RunRagOptimizationOptions extends RagOptimizationBaseOptions {
584
+ export interface RunRagOptimizationOptions extends RagOptimizationBaseOptions {
594
585
  baseline: RagOptimizationConfig;
595
586
  method: OptimizationMethod<RagAnswerEvalScenario, RagAnswerEvalArtifact>;
596
587
  trainScenarios: readonly RagAnswerEvalScenario[];
@@ -605,7 +596,7 @@ interface RunRagOptimizationOptions extends RagOptimizationBaseOptions {
605
596
  }): Promise<RagAnswerEvalArtifact>;
606
597
  judges?: readonly JudgeConfig<RagAnswerEvalArtifact, RagAnswerEvalScenario>[];
607
598
  }
608
- interface RunRagOptimizationResult extends RunSerializedKnowledgeOptimizationResult<RagOptimizationConfig> {
599
+ export interface RunRagOptimizationResult extends RunSerializedKnowledgeOptimizationResult<RagOptimizationConfig> {
609
600
  baselineConfig: RagOptimizationConfig;
610
601
  winnerConfig: RagOptimizationConfig;
611
602
  trainScenarios: readonly RagAnswerEvalScenario[];
@@ -613,11 +604,11 @@ interface RunRagOptimizationResult extends RunSerializedKnowledgeOptimizationRes
613
604
  finalScenarios: readonly RagAnswerEvalScenario[];
614
605
  }
615
606
  /** Optimizes retrieval and answer behavior together as one serialized RAG configuration. */
616
- declare function runRagOptimization(options: RunRagOptimizationOptions): Promise<RunRagOptimizationResult>;
607
+ export declare function runRagOptimization(options: RunRagOptimizationOptions): Promise<RunRagOptimizationResult>;
617
608
  //#endregion
618
609
  //#region src/pages-directory.d.ts
619
610
  /** Root-relative directory that holds Markdown pages when a caller names none. */
620
- declare const DEFAULT_PAGES_DIRECTORY = "knowledge";
611
+ export declare const DEFAULT_PAGES_DIRECTORY = "knowledge";
621
612
  /**
622
613
  * Selects the root-relative directory that holds Markdown pages.
623
614
  *
@@ -625,7 +616,7 @@ declare const DEFAULT_PAGES_DIRECTORY = "knowledge";
625
616
  * run-scoped chain, and the write protocol, so a store laid out as
626
617
  * `kb/pages/<line>/` is read and written through one value.
627
618
  */
628
- interface KnowledgePagesOptions {
619
+ export interface KnowledgePagesOptions {
629
620
  /** Root-relative directory that holds Markdown pages. Defaults to `knowledge`. */
630
621
  pagesDirectory?: string;
631
622
  }
@@ -637,10 +628,10 @@ interface KnowledgePagesOptions {
637
628
  * paths, drive letters, `..` or `.` segments, empty segments, control
638
629
  * characters, and the package-owned `.agent-knowledge` and `raw` trees.
639
630
  */
640
- declare function normalizePagesDirectory(value?: string): string;
631
+ export declare function normalizePagesDirectory(value?: string): string;
641
632
  //#endregion
642
633
  //#region src/store.d.ts
643
- interface KnowledgeLayout {
634
+ export interface KnowledgeLayout {
644
635
  root: string;
645
636
  knowledgeDir: string;
646
637
  rawSourcesDir: string;
@@ -649,7 +640,7 @@ interface KnowledgeLayout {
649
640
  logPath: string;
650
641
  cacheDir: string;
651
642
  }
652
- declare function layoutFor(root: string): KnowledgeLayout;
643
+ export declare function layoutFor(root: string): KnowledgeLayout;
653
644
  /**
654
645
  * Filenames that `initKnowledgeBase` writes as human-navigation scaffolding.
655
646
  * These are excluded from the page index — they exist on disk so authors can
@@ -658,7 +649,7 @@ declare function layoutFor(root: string): KnowledgeLayout;
658
649
  * Add new scaffold filenames here (and only here) to keep lint, validate, viz,
659
650
  * and the indexer consistent.
660
651
  */
661
- declare const SCAFFOLD_PAGE_BASENAMES: readonly string[];
652
+ export declare const SCAFFOLD_PAGE_BASENAMES: readonly string[];
662
653
  /**
663
654
  * True when a knowledge-relative path points at a scaffold file rather than
664
655
  * authored content. Accepts both repo-relative paths (`knowledge/index.md`)
@@ -666,24 +657,24 @@ declare const SCAFFOLD_PAGE_BASENAMES: readonly string[];
666
657
  * `knowledge/concepts/index.md`) so subdirectory README-style scaffolds are
667
658
  * also excluded.
668
659
  */
669
- declare function isScaffoldPath(path: string): boolean;
670
- declare function initKnowledgeBase(root: string): Promise<KnowledgeLayout>;
671
- declare function loadKnowledgePages(root: string, options?: KnowledgePagesOptions): Promise<KnowledgePage[]>;
660
+ export declare function isScaffoldPath(path: string): boolean;
661
+ export declare function initKnowledgeBase(root: string): Promise<KnowledgeLayout>;
662
+ export declare function loadKnowledgePages(root: string, options?: KnowledgePagesOptions): Promise<KnowledgePage[]>;
672
663
  /** True when a root-relative path names authored Markdown rather than scaffolding. */
673
- declare function isKnowledgePagePath(path: string): boolean;
664
+ export declare function isKnowledgePagePath(path: string): boolean;
674
665
  /**
675
666
  * Build a page from the bytes of one Markdown file.
676
667
  *
677
668
  * The reader and every gate that inspects a page before it is written share
678
669
  * this constructor, so what a gate judges is exactly what the store loads back.
679
670
  */
680
- declare function knowledgePageFromMarkdown(path: string, content: string, pagesDirectory?: string): KnowledgePage;
681
- declare function writeJson(path: string, value: unknown): Promise<void>;
671
+ export declare function knowledgePageFromMarkdown(path: string, content: string, pagesDirectory?: string): KnowledgePage;
672
+ export declare function writeJson(path: string, value: unknown): Promise<void>;
682
673
  //#endregion
683
674
  //#region src/run-scoped.d.ts
684
675
  /** Where a page in a chained read came from. */
685
- type PageOrigin = 'here' | `inherited:${string}` | 'shared';
686
- interface OriginatedPage {
676
+ export type PageOrigin = 'here' | `inherited:${string}` | 'shared';
677
+ export interface OriginatedPage {
687
678
  page: KnowledgePage;
688
679
  origin: PageOrigin;
689
680
  }
@@ -695,8 +686,8 @@ interface OriginatedPage {
695
686
  * invalidation propagation — take one page shape whether or not the caller
696
687
  * runs run-scoped stores.
697
688
  */
698
- declare function originatedPages(pages: readonly KnowledgePage[], origin?: PageOrigin): OriginatedPage[];
699
- interface RunLineageRecord {
689
+ export declare function originatedPages(pages: readonly KnowledgePage[], origin?: PageOrigin): OriginatedPage[];
690
+ export interface RunLineageRecord {
700
691
  runId: string;
701
692
  parentRunId: string | null;
702
693
  createdAt: string;
@@ -709,12 +700,12 @@ interface RunLineageRecord {
709
700
  * that case `init` verifies that the existing authority agrees with the parent
710
701
  * requested by the caller before creating any store files.
711
702
  */
712
- interface RunLineageAuthority {
703
+ export interface RunLineageAuthority {
713
704
  parentOf(runId: string): Promise<string | null>;
714
705
  record?(record: RunLineageRecord): Promise<void>;
715
706
  }
716
- declare const RUN_LINEAGE_BASENAME = "lineage.json";
717
- interface RunScopedStoresOptions extends KnowledgePagesOptions {
707
+ export declare const RUN_LINEAGE_BASENAME = "lineage.json";
708
+ export interface RunScopedStoresOptions extends KnowledgePagesOptions {
718
709
  /** The root under which per-run stores live. */
719
710
  root: string;
720
711
  /** Store path for a run; defaults to `<root>/<runId>/knowledge-base`. */
@@ -730,7 +721,7 @@ interface RunScopedStoresOptions extends KnowledgePagesOptions {
730
721
  * Cycles and invalid identities are always refused; long valid history is not corruption. */
731
722
  maxAncestors?: number;
732
723
  }
733
- interface RunScopedStores {
724
+ export interface RunScopedStores {
734
725
  /** Create or open a run store and bind it to one exact parent identity. */
735
726
  init(runId: string, options?: {
736
727
  parentRunId?: string | null;
@@ -750,9 +741,9 @@ interface RunScopedStores {
750
741
  */
751
742
  loadChain(runId: string): Promise<OriginatedPage[]>;
752
743
  }
753
- declare function createRunScopedStores(options: RunScopedStoresOptions): RunScopedStores;
744
+ export declare function createRunScopedStores(options: RunScopedStoresOptions): RunScopedStores;
754
745
  /** File-backed authority used when the product has no separate run manifest. */
755
- declare function createFileRunLineageAuthority(runStorePath: (runId: string) => string): RunLineageAuthority;
746
+ export declare function createFileRunLineageAuthority(runStorePath: (runId: string) => string): RunLineageAuthority;
756
747
  //#endregion
757
748
  //#region src/citation-resolution.d.ts
758
749
  /**
@@ -762,24 +753,24 @@ declare function createFileRunLineageAuthority(runStorePath: (runId: string) =>
762
753
  * the requested id. Callers can qualify a reference by origin when a current,
763
754
  * inherited, or shared page intentionally reuses the same stable id.
764
755
  */
765
- interface KnowledgeCitationReference {
756
+ export interface KnowledgeCitationReference {
766
757
  readonly pageId: KnowledgeId;
767
758
  readonly origin?: PageOrigin;
768
759
  }
769
- interface KnowledgeCitationCandidate {
760
+ export interface KnowledgeCitationCandidate {
770
761
  readonly pageId: KnowledgeId;
771
762
  readonly origin: PageOrigin;
772
763
  readonly page: KnowledgePage;
773
764
  }
774
- type KnowledgeCitationResolutionStatus = 'resolved' | 'missing' | 'ambiguous';
775
- interface KnowledgeCitationResolution {
765
+ export type KnowledgeCitationResolutionStatus = 'resolved' | 'missing' | 'ambiguous';
766
+ export interface KnowledgeCitationResolution {
776
767
  readonly reference: KnowledgeCitationReference;
777
768
  readonly status: KnowledgeCitationResolutionStatus;
778
769
  readonly candidates: readonly KnowledgeCitationCandidate[];
779
770
  readonly resolved?: KnowledgeCitationCandidate;
780
771
  }
781
- type KnowledgeCitationAuditIssueKind = 'self' | 'missing' | 'ambiguous';
782
- interface KnowledgeCitationAuditIssue {
772
+ export type KnowledgeCitationAuditIssueKind = 'self' | 'missing' | 'ambiguous';
773
+ export interface KnowledgeCitationAuditIssue {
783
774
  readonly kind: KnowledgeCitationAuditIssueKind;
784
775
  readonly sourcePageId: KnowledgeId;
785
776
  readonly sourcePath: string;
@@ -788,23 +779,23 @@ interface KnowledgeCitationAuditIssue {
788
779
  readonly reference: KnowledgeCitationReference;
789
780
  readonly candidates: readonly KnowledgeCitationCandidate[];
790
781
  }
791
- interface KnowledgeCitationAuditReport {
782
+ export interface KnowledgeCitationAuditReport {
792
783
  readonly ok: boolean;
793
784
  readonly checkedPages: number;
794
785
  readonly checkedCitations: number;
795
786
  readonly issues: readonly KnowledgeCitationAuditIssue[];
796
787
  }
797
- interface AuditKnowledgeCitationsOptions {
788
+ export interface AuditKnowledgeCitationsOptions {
798
789
  /** Limit audited source pages to these origins. All visible origins are checked by default. */
799
790
  readonly sourceOrigins?: readonly PageOrigin[];
800
791
  }
801
792
  /** A batch contains at least one citation that is missing or ambiguous. */
802
- declare class KnowledgeCitationResolutionError extends Error {
793
+ export declare class KnowledgeCitationResolutionError extends Error {
803
794
  readonly resolutions: readonly KnowledgeCitationResolution[];
804
795
  constructor(resolutions: readonly KnowledgeCitationResolution[]);
805
796
  }
806
797
  /** A persisted page contains a self, missing, or ambiguous citation. */
807
- declare class KnowledgeCitationAuditError extends Error {
798
+ export declare class KnowledgeCitationAuditError extends Error {
808
799
  readonly report: KnowledgeCitationAuditReport;
809
800
  constructor(report: KnowledgeCitationAuditReport);
810
801
  }
@@ -817,32 +808,32 @@ declare class KnowledgeCitationAuditError extends Error {
817
808
  * tuple (null origin means unqualified). Always use the formatter to mint handles.
818
809
  * Legacy percent sequences are literal; old records are not silently reinterpreted.
819
810
  */
820
- declare function parseKnowledgeCitationReference(value: string): KnowledgeCitationReference;
811
+ export declare function parseKnowledgeCitationReference(value: string): KnowledgeCitationReference;
821
812
  /** Serialize one reference into the canonical frontmatter representation. */
822
- declare function formatKnowledgeCitationReference(reference: KnowledgeCitationReference): string;
813
+ export declare function formatKnowledgeCitationReference(reference: KnowledgeCitationReference): string;
823
814
  /** Resolve one reference against an already materialized visibility chain. */
824
- declare function resolveKnowledgeCitation(visiblePages: readonly OriginatedPage[], reference: KnowledgeCitationReference): KnowledgeCitationResolution;
815
+ export declare function resolveKnowledgeCitation(visiblePages: readonly OriginatedPage[], reference: KnowledgeCitationReference): KnowledgeCitationResolution;
825
816
  /** Resolve a batch without discarding missing or ambiguous rows. */
826
- declare function resolveKnowledgeCitations(visiblePages: readonly OriginatedPage[], references: readonly KnowledgeCitationReference[]): readonly KnowledgeCitationResolution[];
817
+ export declare function resolveKnowledgeCitations(visiblePages: readonly OriginatedPage[], references: readonly KnowledgeCitationReference[]): readonly KnowledgeCitationResolution[];
827
818
  /**
828
819
  * Resolve a batch and fail closed unless every reference names exactly one
829
820
  * visible page. Returned candidates preserve the caller's reference order.
830
821
  */
831
- declare function assertKnowledgeCitationsResolved(visiblePages: readonly OriginatedPage[], references: readonly KnowledgeCitationReference[]): readonly KnowledgeCitationCandidate[];
822
+ export declare function assertKnowledgeCitationsResolved(visiblePages: readonly OriginatedPage[], references: readonly KnowledgeCitationReference[]): readonly KnowledgeCitationCandidate[];
832
823
  /** Audit persisted `cites` relations against one immutable visibility snapshot. */
833
- declare function auditKnowledgeCitations(visiblePages: readonly OriginatedPage[], options?: AuditKnowledgeCitationsOptions): KnowledgeCitationAuditReport;
824
+ export declare function auditKnowledgeCitations(visiblePages: readonly OriginatedPage[], options?: AuditKnowledgeCitationsOptions): KnowledgeCitationAuditReport;
834
825
  /** Audit and fail closed when any persisted citation is unresolved. */
835
- declare function assertKnowledgeCitationAudit(report: KnowledgeCitationAuditReport): void;
826
+ export declare function assertKnowledgeCitationAudit(report: KnowledgeCitationAuditReport): void;
836
827
  /** Resolve one citation using a run-scoped store's declared visibility chain. */
837
- declare function resolveRunScopedCitation(stores: RunScopedStores, runId: string, reference: KnowledgeCitationReference): Promise<KnowledgeCitationResolution>;
828
+ export declare function resolveRunScopedCitation(stores: RunScopedStores, runId: string, reference: KnowledgeCitationReference): Promise<KnowledgeCitationResolution>;
838
829
  /** Resolve citations using one chain read so every row sees the same snapshot. */
839
- declare function resolveRunScopedCitations(stores: RunScopedStores, runId: string, references: readonly KnowledgeCitationReference[]): Promise<readonly KnowledgeCitationResolution[]>;
830
+ export declare function resolveRunScopedCitations(stores: RunScopedStores, runId: string, references: readonly KnowledgeCitationReference[]): Promise<readonly KnowledgeCitationResolution[]>;
840
831
  /** Resolve a run-scoped batch and fail closed on any missing or ambiguous id. */
841
- declare function assertRunScopedCitationsResolved(stores: RunScopedStores, runId: string, references: readonly KnowledgeCitationReference[]): Promise<readonly KnowledgeCitationCandidate[]>;
832
+ export declare function assertRunScopedCitationsResolved(stores: RunScopedStores, runId: string, references: readonly KnowledgeCitationReference[]): Promise<readonly KnowledgeCitationCandidate[]>;
842
833
  /** Audit only pages authored in the current run against the full visible chain. */
843
- declare function auditCurrentRunCitations(stores: RunScopedStores, runId: string): Promise<KnowledgeCitationAuditReport>;
834
+ export declare function auditCurrentRunCitations(stores: RunScopedStores, runId: string): Promise<KnowledgeCitationAuditReport>;
844
835
  /** Audit current-run citations and fail closed on every unresolved relation. */
845
- declare function assertCurrentRunCitationsResolved(stores: RunScopedStores, runId: string): Promise<KnowledgeCitationAuditReport>;
836
+ export declare function assertCurrentRunCitationsResolved(stores: RunScopedStores, runId: string): Promise<KnowledgeCitationAuditReport>;
846
837
  //#endregion
847
838
  //#region src/rag-eval/near-duplicates.d.ts
848
839
  interface NearDuplicateDetectionOptions {
@@ -895,12 +886,12 @@ interface NearDuplicateReport {
895
886
  * common. Every limit and sort order is explicit so the same corpus produces
896
887
  * the same report on every run.
897
888
  */
898
- declare function detectNearDuplicatePages(pages: readonly KnowledgePage[], options?: NearDuplicateDetectionOptions): NearDuplicateReport;
899
- declare function normalizePageText(value: string): string;
889
+ export declare function detectNearDuplicatePages(pages: readonly KnowledgePage[], options?: NearDuplicateDetectionOptions): NearDuplicateReport;
890
+ export declare function normalizePageText(value: string): string;
900
891
  //#endregion
901
892
  //#region src/write-intake.d.ts
902
893
  /** One candidate that duplicates visible knowledge without relating itself to it. */
903
- interface KnowledgeDuplicateIntakePair {
894
+ export interface KnowledgeDuplicateIntakePair {
904
895
  readonly candidatePageId: KnowledgeId;
905
896
  readonly candidatePath: string;
906
897
  readonly matchedPageId: KnowledgeId;
@@ -915,12 +906,12 @@ interface KnowledgeDuplicateIntakePair {
915
906
  * name it in `contradicts`, or give the candidate the matched page's id so the
916
907
  * write is an update of it.
917
908
  */
918
- declare class KnowledgeDuplicateIntakeError extends Error {
909
+ export declare class KnowledgeDuplicateIntakeError extends Error {
919
910
  readonly pairs: readonly KnowledgeDuplicateIntakePair[];
920
911
  readonly threshold: number;
921
912
  constructor(pairs: readonly KnowledgeDuplicateIntakePair[], threshold: number);
922
913
  }
923
- interface KnowledgeWriteIntakeOptions {
914
+ export interface KnowledgeWriteIntakeOptions {
924
915
  /**
925
916
  * The chain the write lands in, as `loadChain` reports it. Candidates replace
926
917
  * the `here` entries at the same paths; an inherited or shared page at one of
@@ -944,15 +935,15 @@ interface KnowledgeWriteIntakeOptions {
944
935
  * Returns the resolved citation candidates in the order the candidates declare
945
936
  * them.
946
937
  */
947
- declare function assertKnowledgeWriteIntake(candidates: readonly KnowledgePage[], options: KnowledgeWriteIntakeOptions): readonly KnowledgeCitationCandidate[];
938
+ export declare function assertKnowledgeWriteIntake(candidates: readonly KnowledgePage[], options: KnowledgeWriteIntakeOptions): readonly KnowledgeCitationCandidate[];
948
939
  //#endregion
949
940
  //#region src/proposals.d.ts
950
- interface ApplyWriteBlocksResult {
941
+ export interface ApplyWriteBlocksResult {
951
942
  written: string[];
952
943
  warnings: string[];
953
944
  }
954
945
  /** Intake settings for a write, minus the pages the target root supplies itself. */
955
- type KnowledgeWriteIntakeRequest = Omit<KnowledgeWriteIntakeOptions, 'visiblePages'> & {
946
+ export type KnowledgeWriteIntakeRequest = Omit<KnowledgeWriteIntakeOptions, 'visiblePages'> & {
956
947
  /**
957
948
  * Pages visible to the write beyond the target root, such as the inherited
958
949
  * and shared entries of a run-scoped chain. The target root's own pages are
@@ -960,7 +951,12 @@ type KnowledgeWriteIntakeRequest = Omit<KnowledgeWriteIntakeOptions, 'visiblePag
960
951
  */
961
952
  readonly inheritedPages?: readonly OriginatedPage[];
962
953
  };
963
- interface ApplyKnowledgeWriteBlocksOptions extends KnowledgePagesOptions {
954
+ export interface ApplyKnowledgeWriteBlocksOptions extends KnowledgePagesOptions {
955
+ /** Host-provided identity, never inferred from authored page content. */
956
+ readonly actorId?: string;
957
+ readonly runId?: string;
958
+ /** Expected page identities by proposal path; null requires a new page. */
959
+ readonly expectedPageDigests?: Readonly<Record<string, Sha256Digest | null>>;
964
960
  /** Preserve terminal transactions under .agent-knowledge/history; no automatic deletion. */
965
961
  readonly retainHistory?: boolean;
966
962
  /**
@@ -977,21 +973,21 @@ interface ApplyKnowledgeWriteBlocksOptions extends KnowledgePagesOptions {
977
973
  * and again by the file transaction, so one option value bounds the whole
978
974
  * write.
979
975
  */
980
- declare function applyKnowledgeWriteBlocks(root: string, proposalText: string, options?: ApplyKnowledgeWriteBlocksOptions): Promise<ApplyWriteBlocksResult>;
981
- declare function applyKnowledgeWriteBlocksFile(root: string, proposalPath: string, options?: ApplyKnowledgeWriteBlocksOptions): Promise<ApplyWriteBlocksResult>;
976
+ export declare function applyKnowledgeWriteBlocks(root: string, proposalText: string, options?: ApplyKnowledgeWriteBlocksOptions): Promise<ApplyWriteBlocksResult>;
977
+ export declare function applyKnowledgeWriteBlocksFile(root: string, proposalPath: string, options?: ApplyKnowledgeWriteBlocksOptions): Promise<ApplyWriteBlocksResult>;
982
978
  //#endregion
983
979
  //#region src/validate.d.ts
984
- interface ValidateKnowledgeOptions {
980
+ export interface ValidateKnowledgeOptions {
985
981
  strict?: boolean;
986
982
  }
987
- interface ValidateKnowledgeResult {
983
+ export interface ValidateKnowledgeResult {
988
984
  ok: boolean;
989
985
  findings: KnowledgeLintFinding[];
990
986
  }
991
- declare function validateKnowledgeIndex(index: KnowledgeIndex, options?: ValidateKnowledgeOptions): ValidateKnowledgeResult;
987
+ export declare function validateKnowledgeIndex(index: KnowledgeIndex, options?: ValidateKnowledgeOptions): ValidateKnowledgeResult;
992
988
  //#endregion
993
989
  //#region src/research-loop.d.ts
994
- interface KnowledgeResearchLoopContext {
990
+ export interface KnowledgeResearchLoopContext {
995
991
  root: string;
996
992
  goal: string;
997
993
  iteration: number;
@@ -1002,7 +998,7 @@ interface KnowledgeResearchLoopContext {
1002
998
  previousSteps: KnowledgeResearchLoopStep[];
1003
999
  signal?: AbortSignal;
1004
1000
  }
1005
- interface KnowledgeResearchLoopDecision {
1001
+ export interface KnowledgeResearchLoopDecision {
1006
1002
  /**
1007
1003
  * Free-form notes from the researcher. Keep this human-readable; products can
1008
1004
  * store it as the research transcript.
@@ -1029,7 +1025,7 @@ interface KnowledgeResearchLoopDecision {
1029
1025
  done?: boolean;
1030
1026
  metadata?: Record<string, unknown>;
1031
1027
  }
1032
- interface KnowledgeResearchLoopStep {
1028
+ export interface KnowledgeResearchLoopStep {
1033
1029
  iteration: number;
1034
1030
  notes?: string;
1035
1031
  addedSources: SourceRecord[];
@@ -1041,7 +1037,7 @@ interface KnowledgeResearchLoopStep {
1041
1037
  done: boolean;
1042
1038
  metadata?: Record<string, unknown>;
1043
1039
  }
1044
- interface RunKnowledgeResearchLoopOptions {
1040
+ export interface RunKnowledgeResearchLoopOptions {
1045
1041
  pagesDirectory?: string;
1046
1042
  root: string;
1047
1043
  goal: string;
@@ -1056,7 +1052,7 @@ interface RunKnowledgeResearchLoopOptions {
1056
1052
  step(context: KnowledgeResearchLoopContext): Promise<KnowledgeResearchLoopDecision> | KnowledgeResearchLoopDecision;
1057
1053
  onStep?: (step: KnowledgeResearchLoopStep) => Promise<void> | void;
1058
1054
  }
1059
- interface KnowledgeResearchLoopResult {
1055
+ export interface KnowledgeResearchLoopResult {
1060
1056
  root: string;
1061
1057
  goal: string;
1062
1058
  iterations: number;
@@ -1067,10 +1063,10 @@ interface KnowledgeResearchLoopResult {
1067
1063
  readiness?: EvalKnowledgeBundleBuildResult;
1068
1064
  steps: KnowledgeResearchLoopStep[];
1069
1065
  }
1070
- type KnowledgeControlLoopState = KnowledgeResearchLoopContext;
1071
- type KnowledgeControlLoopAction = KnowledgeResearchLoopDecision;
1072
- type KnowledgeControlLoopActionResult = KnowledgeResearchLoopStep;
1073
- interface KnowledgeControlLoopAdapterOptions {
1066
+ export type KnowledgeControlLoopState = KnowledgeResearchLoopContext;
1067
+ export type KnowledgeControlLoopAction = KnowledgeResearchLoopDecision;
1068
+ export type KnowledgeControlLoopActionResult = KnowledgeResearchLoopStep;
1069
+ export interface KnowledgeControlLoopAdapterOptions {
1074
1070
  pagesDirectory?: string;
1075
1071
  root: string;
1076
1072
  goal: string;
@@ -1081,18 +1077,18 @@ interface KnowledgeControlLoopAdapterOptions {
1081
1077
  readiness?: Omit<BuildEvalKnowledgeBundleOptions, 'taskId' | 'index' | 'specs'>;
1082
1078
  sourceOptions?: Pick<AddSourceOptions, 'adapters' | 'now'>;
1083
1079
  }
1084
- type KnowledgeControlLoopAdapter = Pick<ControlRuntimeConfig<KnowledgeControlLoopState, KnowledgeControlLoopAction, KnowledgeControlLoopActionResult, ControlEvalResult>, 'intent' | 'observe' | 'validate' | 'act' | 'shouldStop' | 'stopPolicies'>;
1080
+ export type KnowledgeControlLoopAdapter = Pick<ControlRuntimeConfig<KnowledgeControlLoopState, KnowledgeControlLoopAction, KnowledgeControlLoopActionResult, ControlEvalResult>, 'intent' | 'observe' | 'validate' | 'act' | 'shouldStop' | 'stopPolicies'>;
1085
1081
  /**
1086
1082
  * Adapter for running knowledge growth through `agent-eval`'s generic control
1087
1083
  * runtime. The caller still owns `decide`: that can be a proposer agent,
1088
1084
  * reviewer agent, deterministic policy, or a composition of all three.
1089
1085
  */
1090
- declare function createKnowledgeControlLoopAdapter(options: KnowledgeControlLoopAdapterOptions): KnowledgeControlLoopAdapter;
1091
- declare function runKnowledgeResearchLoop(options: RunKnowledgeResearchLoopOptions): Promise<KnowledgeResearchLoopResult>;
1086
+ export declare function createKnowledgeControlLoopAdapter(options: KnowledgeControlLoopAdapterOptions): KnowledgeControlLoopAdapter;
1087
+ export declare function runKnowledgeResearchLoop(options: RunKnowledgeResearchLoopOptions): Promise<KnowledgeResearchLoopResult>;
1092
1088
  //#endregion
1093
1089
  //#region src/retrieval-optimization.d.ts
1094
1090
  type RetrievalOptimizationBaseOptions = Omit<RunSerializedKnowledgeOptimizationOptions<RetrievalConfig, RetrievalEvalScenario, RetrievalEvalArtifact>, 'baseline' | 'method' | 'trainScenarios' | 'selectionScenarios' | 'finalScenarios' | 'dispatchCandidate' | 'judges' | 'codec' | 'scenarioFingerprint'>;
1095
- interface RunRetrievalImprovementLoopOptions extends RetrievalOptimizationBaseOptions {
1091
+ export interface RunRetrievalImprovementLoopOptions extends RetrievalOptimizationBaseOptions {
1096
1092
  baseline: RetrievalConfig;
1097
1093
  trainScenarios: readonly RetrievalEvalScenario[];
1098
1094
  selectionScenarios: readonly RetrievalEvalScenario[];
@@ -1104,21 +1100,21 @@ interface RunRetrievalImprovementLoopOptions extends RetrievalOptimizationBaseOp
1104
1100
  judges?: readonly JudgeConfig<RetrievalEvalArtifact, RetrievalEvalScenario>[];
1105
1101
  metricWeights?: RetrievalMetricWeights;
1106
1102
  }
1107
- interface RunRetrievalImprovementLoopResult extends RunSerializedKnowledgeOptimizationResult<RetrievalConfig> {
1103
+ export interface RunRetrievalImprovementLoopResult extends RunSerializedKnowledgeOptimizationResult<RetrievalConfig> {
1108
1104
  baselineConfig: RetrievalConfig;
1109
1105
  winnerConfig: RetrievalConfig;
1110
1106
  trainScenarios: readonly RetrievalEvalScenario[];
1111
1107
  selectionScenarios: readonly RetrievalEvalScenario[];
1112
1108
  finalScenarios: readonly RetrievalEvalScenario[];
1113
1109
  }
1114
- declare function runRetrievalImprovementLoop(options: RunRetrievalImprovementLoopOptions): Promise<RunRetrievalImprovementLoopResult>;
1110
+ export declare function runRetrievalImprovementLoop(options: RunRetrievalImprovementLoopOptions): Promise<RunRetrievalImprovementLoopResult>;
1115
1111
  //#endregion
1116
1112
  //#region src/rag-improvement-loop.d.ts
1117
- type RagKnowledgeImprovementPhase = 'rag-optimization' | 'retrieval-tuning' | 'gap-diagnosis' | 'knowledge-acquisition' | 'knowledge-update' | 'answer-quality' | 'promotion';
1118
- type RagKnowledgeImprovementPhaseStatus = 'completed' | 'skipped' | 'failed';
1119
- type RagGapKind = 'missing-source' | 'stale-source' | 'retrieval-miss' | 'retrieval-noise' | 'chunking-mismatch' | 'missing-multihop-evidence' | 'generator-unsupported-claim' | 'citation-mismatch' | 'incorrect-abstention' | 'unknown';
1120
- type RagGapSeverity = 'info' | 'warning' | 'error' | 'critical';
1121
- interface RagGapFinding {
1113
+ export type RagKnowledgeImprovementPhase = 'rag-optimization' | 'retrieval-tuning' | 'gap-diagnosis' | 'knowledge-acquisition' | 'knowledge-update' | 'answer-quality' | 'promotion';
1114
+ export type RagKnowledgeImprovementPhaseStatus = 'completed' | 'skipped' | 'failed';
1115
+ export type RagGapKind = 'missing-source' | 'stale-source' | 'retrieval-miss' | 'retrieval-noise' | 'chunking-mismatch' | 'missing-multihop-evidence' | 'generator-unsupported-claim' | 'citation-mismatch' | 'incorrect-abstention' | 'unknown';
1116
+ export type RagGapSeverity = 'info' | 'warning' | 'error' | 'critical';
1117
+ export interface RagGapFinding {
1122
1118
  id: string;
1123
1119
  kind: RagGapKind;
1124
1120
  severity: RagGapSeverity;
@@ -1126,7 +1122,7 @@ interface RagGapFinding {
1126
1122
  scenarioId?: string;
1127
1123
  evidence?: Record<string, AgentCandidateJsonValue>;
1128
1124
  }
1129
- interface RagKnowledgeImprovementPhaseResult {
1125
+ export interface RagKnowledgeImprovementPhaseResult {
1130
1126
  phase: RagKnowledgeImprovementPhase;
1131
1127
  status: RagKnowledgeImprovementPhaseStatus;
1132
1128
  summary: string;
@@ -1134,40 +1130,40 @@ interface RagKnowledgeImprovementPhaseResult {
1134
1130
  finishedAt: string;
1135
1131
  metadata?: Record<string, AgentCandidateJsonValue>;
1136
1132
  }
1137
- type RagOptimizationSelection = Pick<RunRagOptimizationResult, 'methodName' | 'baseline' | 'winner' | 'baselineConfig' | 'winnerConfig'>;
1138
- type RetrievalOptimizationSelection = Pick<RunRetrievalImprovementLoopResult, 'methodName' | 'baseline' | 'winner' | 'baselineConfig' | 'winnerConfig'>;
1139
- interface RagPhaseInputBase {
1133
+ export type RagOptimizationSelection = Pick<RunRagOptimizationResult, 'methodName' | 'baseline' | 'winner' | 'baselineConfig' | 'winnerConfig'>;
1134
+ export type RetrievalOptimizationSelection = Pick<RunRetrievalImprovementLoopResult, 'methodName' | 'baseline' | 'winner' | 'baselineConfig' | 'winnerConfig'>;
1135
+ export interface RagPhaseInputBase {
1140
1136
  goal: string;
1141
1137
  phases: readonly RagKnowledgeImprovementPhaseResult[];
1142
1138
  /** Selected candidate only. Adaptive update callbacks run before final scoring starts. */
1143
1139
  optimization?: RagOptimizationSelection;
1144
1140
  signal?: AbortSignal;
1145
1141
  }
1146
- interface RagDiagnosisInput extends RagPhaseInputBase {
1142
+ export interface RagDiagnosisInput extends RagPhaseInputBase {
1147
1143
  retrieval?: RetrievalOptimizationSelection;
1148
1144
  }
1149
- interface RagKnowledgeAcquisitionInput extends RagPhaseInputBase {
1145
+ export interface RagKnowledgeAcquisitionInput extends RagPhaseInputBase {
1150
1146
  retrieval?: RetrievalOptimizationSelection;
1151
1147
  findings: readonly RagGapFinding[];
1152
1148
  }
1153
- interface RagKnowledgeUpdateInput extends RagPhaseInputBase {
1149
+ export interface RagKnowledgeUpdateInput extends RagPhaseInputBase {
1154
1150
  retrieval?: RetrievalOptimizationSelection;
1155
1151
  findings: readonly RagGapFinding[];
1156
1152
  acquisition?: KnowledgeResearchLoopDecision;
1157
1153
  }
1158
- interface RagKnowledgeUpdateResult {
1154
+ export interface RagKnowledgeUpdateResult {
1159
1155
  applied: boolean;
1160
1156
  summary: string;
1161
1157
  research?: KnowledgeResearchLoopResult;
1162
1158
  metadata?: Record<string, AgentCandidateJsonValue>;
1163
1159
  }
1164
- interface RagAnswerQualityInput extends RagPhaseInputBase {
1160
+ export interface RagAnswerQualityInput extends RagPhaseInputBase {
1165
1161
  retrieval?: RetrievalOptimizationSelection;
1166
1162
  findings: readonly RagGapFinding[];
1167
1163
  acquisition?: KnowledgeResearchLoopDecision;
1168
1164
  knowledgeUpdate?: RagKnowledgeUpdateResult;
1169
1165
  }
1170
- interface RagAnswerQualityResult {
1166
+ export interface RagAnswerQualityResult {
1171
1167
  passed: boolean;
1172
1168
  metrics: Record<string, number>;
1173
1169
  finalScenarioIds: readonly string[];
@@ -1177,7 +1173,7 @@ interface RagAnswerQualityResult {
1177
1173
  findings?: readonly RagGapFinding[];
1178
1174
  metadata?: Record<string, AgentCandidateJsonValue>;
1179
1175
  }
1180
- interface RagPromotionInput extends RagPhaseInputBase {
1176
+ export interface RagPromotionInput extends RagPhaseInputBase {
1181
1177
  retrieval?: RetrievalOptimizationSelection;
1182
1178
  /** Full final-case result available only to the terminal promotion decision. */
1183
1179
  optimizationComparison?: RunRagOptimizationResult['comparison'];
@@ -1188,16 +1184,16 @@ interface RagPromotionInput extends RagPhaseInputBase {
1188
1184
  knowledgeUpdate?: RagKnowledgeUpdateResult;
1189
1185
  answerQuality?: RagAnswerQualityResult;
1190
1186
  }
1191
- interface RagPromotionResult {
1187
+ export interface RagPromotionResult {
1192
1188
  promoted: boolean;
1193
1189
  reason: string;
1194
1190
  metadata?: Record<string, AgentCandidateJsonValue>;
1195
1191
  }
1196
- interface RagKnowledgeResearchOptions extends Omit<RunKnowledgeResearchLoopOptions, 'goal' | 'signal' | 'step'> {
1192
+ export interface RagKnowledgeResearchOptions extends Omit<RunKnowledgeResearchLoopOptions, 'goal' | 'signal' | 'step'> {
1197
1193
  goal?: string;
1198
1194
  step?: RunKnowledgeResearchLoopOptions['step'];
1199
1195
  }
1200
- interface RunRagKnowledgeImprovementLoopOptions {
1196
+ export interface RunRagKnowledgeImprovementLoopOptions {
1201
1197
  goal: string;
1202
1198
  optimization?: RunRagOptimizationOptions;
1203
1199
  retrieval?: RunRetrievalImprovementLoopOptions;
@@ -1218,7 +1214,7 @@ interface RunRagKnowledgeImprovementLoopOptions {
1218
1214
  signal?: AbortSignal;
1219
1215
  now?: () => Date;
1220
1216
  }
1221
- interface RunRagKnowledgeImprovementLoopResult {
1217
+ export interface RunRagKnowledgeImprovementLoopResult {
1222
1218
  goal: string;
1223
1219
  phases: readonly RagKnowledgeImprovementPhaseResult[];
1224
1220
  optimization?: RunRagOptimizationResult;
@@ -1230,7 +1226,7 @@ interface RunRagKnowledgeImprovementLoopResult {
1230
1226
  promotion?: RagPromotionResult;
1231
1227
  }
1232
1228
  type MaybePromise$1<T> = T | Promise<T>;
1233
- declare function runRagKnowledgeImprovementLoop(options: RunRagKnowledgeImprovementLoopOptions): Promise<RunRagKnowledgeImprovementLoopResult>;
1229
+ export declare function runRagKnowledgeImprovementLoop(options: RunRagKnowledgeImprovementLoopOptions): Promise<RunRagKnowledgeImprovementLoopResult>;
1234
1230
  //#endregion
1235
1231
  //#region src/rag-eval/contracts.d.ts
1236
1232
  type RagEvalProvider = 'agent-knowledge' | 'ragas' | 'deepeval' | 'trulens' | 'ragchecker' | 'custom';
@@ -1382,34 +1378,34 @@ interface KnowledgeBaseQualityReport {
1382
1378
  type MaybePromise<T> = T | Promise<T>;
1383
1379
  //#endregion
1384
1380
  //#region src/rag-eval/calibration.d.ts
1385
- declare function createRagAnswerQualityHook(options: RagAnswerQualityHookOptions): () => Promise<RagAnswerQualityResult>;
1386
- declare function calibrateRagAnswerJudge(options: RagCalibrationOptions): Promise<RagCalibrationResult>;
1381
+ export declare function createRagAnswerQualityHook(options: RagAnswerQualityHookOptions): () => Promise<RagAnswerQualityResult>;
1382
+ export declare function calibrateRagAnswerJudge(options: RagCalibrationOptions): Promise<RagCalibrationResult>;
1387
1383
  //#endregion
1388
1384
  //#region src/rag-eval/knowledge-base.d.ts
1389
- declare function scoreKnowledgeBaseIndex(index: KnowledgeIndex, options?: KnowledgeBaseQualityOptions): KnowledgeBaseQualityReport;
1385
+ export declare function scoreKnowledgeBaseIndex(index: KnowledgeIndex, options?: KnowledgeBaseQualityOptions): KnowledgeBaseQualityReport;
1390
1386
  //#endregion
1391
1387
  //#region src/rag-eval/providers.d.ts
1392
- declare function normalizeExternalRagScores(scores: readonly ExternalRagEvalScore[]): Record<string, Record<RagEvalMetricKey, number>>;
1393
- declare function toRagasEvaluationRows(cases: readonly RagAnswerEvalCase[]): {
1388
+ export declare function normalizeExternalRagScores(scores: readonly ExternalRagEvalScore[]): Record<string, Record<RagEvalMetricKey, number>>;
1389
+ export declare function toRagasEvaluationRows(cases: readonly RagAnswerEvalCase[]): {
1394
1390
  user_input: string;
1395
1391
  response: string;
1396
1392
  retrieved_contexts: string[];
1397
1393
  reference: string | undefined;
1398
1394
  reference_contexts: string[];
1399
1395
  }[];
1400
- declare function toDeepEvalTestCases(cases: readonly RagAnswerEvalCase[]): {
1396
+ export declare function toDeepEvalTestCases(cases: readonly RagAnswerEvalCase[]): {
1401
1397
  input: string;
1402
1398
  actual_output: string;
1403
1399
  expected_output: string | undefined;
1404
1400
  retrieval_context: string[];
1405
1401
  context: string[];
1406
1402
  }[];
1407
- declare function toTruLensRecords(cases: readonly RagAnswerEvalCase[]): {
1403
+ export declare function toTruLensRecords(cases: readonly RagAnswerEvalCase[]): {
1408
1404
  input: string;
1409
1405
  output: string;
1410
1406
  context: string;
1411
1407
  }[];
1412
- declare function toRagCheckerRecords(cases: readonly RagAnswerEvalCase[]): {
1408
+ export declare function toRagCheckerRecords(cases: readonly RagAnswerEvalCase[]): {
1413
1409
  query_id: string;
1414
1410
  query: string;
1415
1411
  gt_answer: string | undefined;
@@ -1422,9 +1418,9 @@ declare function toRagCheckerRecords(cases: readonly RagAnswerEvalCase[]): {
1422
1418
  }[];
1423
1419
  //#endregion
1424
1420
  //#region src/rag-eval/scoring.d.ts
1425
- declare function ragAnswerQualityJudge(options?: RagAnswerQualityJudgeOptions): JudgeConfig<RagAnswerEvalArtifact, RagAnswerEvalScenario>;
1426
- declare function scoreRagAnswerArtifact(artifact: RagAnswerEvalArtifact, scenario: RagAnswerEvalScenario, options?: RagAnswerQualityJudgeOptions): RagAnswerMetricSummary;
1427
- declare function diagnoseRagAnswerFailure(metrics: Record<RagEvalMetricKey, number>, scenario: RagAnswerEvalScenario, thresholds?: Partial<Record<RagEvalMetricKey, number>>): RagGapFinding[];
1421
+ export declare function ragAnswerQualityJudge(options?: RagAnswerQualityJudgeOptions): JudgeConfig<RagAnswerEvalArtifact, RagAnswerEvalScenario>;
1422
+ export declare function scoreRagAnswerArtifact(artifact: RagAnswerEvalArtifact, scenario: RagAnswerEvalScenario, options?: RagAnswerQualityJudgeOptions): RagAnswerMetricSummary;
1423
+ export declare function diagnoseRagAnswerFailure(metrics: Record<RagEvalMetricKey, number>, scenario: RagAnswerEvalScenario, thresholds?: Partial<Record<RagEvalMetricKey, number>>): RagGapFinding[];
1428
1424
  //#endregion
1429
1425
  //#region src/kb-improvement/contracts.d.ts
1430
1426
  type KnowledgeImprovementStatus = 'running' | 'candidate-ready' | 'promoted' | 'rejected' | 'blocked';
@@ -1526,7 +1522,7 @@ interface KnowledgeImprovementActivationPersistence {
1526
1522
  /** May run again after interruption; keep this deterministic and free of external side effects. */
1527
1523
  createResult(mutation: KnowledgeImprovementMutationReceipt): Promise<AgentImprovementActivationResult> | AgentImprovementActivationResult;
1528
1524
  }
1529
- declare const KnowledgeImprovementRunStateSchema: z.ZodObject<{
1525
+ export declare const KnowledgeImprovementRunStateSchema: z.ZodObject<{
1530
1526
  stateScope: z.ZodOptional<z.ZodObject<{
1531
1527
  pagesDirectory: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
1532
1528
  researchState: z.ZodOptional<z.ZodBoolean>;
@@ -1567,7 +1563,7 @@ declare const KnowledgeImprovementRunStateSchema: z.ZodObject<{
1567
1563
  promotedCandidateId: z.ZodOptional<z.ZodString>;
1568
1564
  blockedReason: z.ZodOptional<z.ZodString>;
1569
1565
  }, z.core.$strict>;
1570
- declare const KnowledgeImprovementEvidenceSchema: z.ZodObject<{
1566
+ export declare const KnowledgeImprovementEvidenceSchema: z.ZodObject<{
1571
1567
  kind: z.ZodLiteral<"knowledge-improvement-evidence">;
1572
1568
  runId: z.ZodString;
1573
1569
  candidateId: z.ZodString;
@@ -1611,7 +1607,7 @@ declare const KnowledgeImprovementEvidenceSchema: z.ZodObject<{
1611
1607
  }, z.core.$strict>;
1612
1608
  type KnowledgeImprovementEvidence = z.infer<typeof KnowledgeImprovementEvidenceSchema>;
1613
1609
  /** Portable identity of one measured candidate. Paths and mutable run state are deliberately excluded. */
1614
- declare const KnowledgeImprovementCandidateRefSchema: z.ZodObject<{
1610
+ export declare const KnowledgeImprovementCandidateRefSchema: z.ZodObject<{
1615
1611
  kind: z.ZodLiteral<"knowledge-improvement-candidate">;
1616
1612
  runId: z.ZodString;
1617
1613
  candidateId: z.ZodString;
@@ -1730,7 +1726,7 @@ interface KnowledgeImprovementOptions {
1730
1726
  //#endregion
1731
1727
  //#region src/kb-improvement/activation.d.ts
1732
1728
  /** Load the durable result for one exact activation without changing knowledge or run state. */
1733
- declare function loadKnowledgeImprovementActivationResult(options: LoadKnowledgeImprovementActivationResultOptions): Promise<AgentImprovementActivationResult | null>;
1729
+ export declare function loadKnowledgeImprovementActivationResult(options: LoadKnowledgeImprovementActivationResultOptions): Promise<AgentImprovementActivationResult | null>;
1734
1730
  //#endregion
1735
1731
  //#region src/kb-improvement/optimization.d.ts
1736
1732
  type PolicyCandidateOptions = Omit<KnowledgeImprovementOptions, 'root' | 'goal' | 'implementationRef' | 'runId' | 'maxCandidates' | 'step' | 'knowledgeResearch' | 'updateKnowledge'>;
@@ -1767,7 +1763,7 @@ interface OptimizeKnowledgeBasePolicyResult<TPolicy extends AgentCandidateJsonVa
1767
1763
  * Optimizes a serialized KB-maintenance policy, then materializes the selected
1768
1764
  * policy in one isolated knowledge candidate. Activation remains explicit.
1769
1765
  */
1770
- declare function optimizeKnowledgeBasePolicy<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact>(options: OptimizeKnowledgeBasePolicyOptions<TPolicy, TScenario, TArtifact>): Promise<OptimizeKnowledgeBasePolicyResult<TPolicy>>;
1766
+ export declare function optimizeKnowledgeBasePolicy<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact>(options: OptimizeKnowledgeBasePolicyOptions<TPolicy, TScenario, TArtifact>): Promise<OptimizeKnowledgeBasePolicyResult<TPolicy>>;
1771
1767
  type KnowledgePolicyDispatch<TPolicy extends AgentCandidateJsonValue, TScenario extends Scenario, TArtifact> = (input: {
1772
1768
  candidate: TPolicy;
1773
1769
  candidateSurface: string;
@@ -1777,7 +1773,7 @@ type KnowledgePolicyDispatch<TPolicy extends AgentCandidateJsonValue, TScenario
1777
1773
  }) => Promise<TArtifact>;
1778
1774
  //#endregion
1779
1775
  //#region src/kb-improvement/run.d.ts
1780
- declare function improveKnowledgeBase(options: KnowledgeImprovementOptions): Promise<KnowledgeImprovementResult>;
1776
+ export declare function improveKnowledgeBase(options: KnowledgeImprovementOptions): Promise<KnowledgeImprovementResult>;
1781
1777
  //#endregion
1782
1778
  //#region src/kb-improvement/selected-candidate.d.ts
1783
1779
  declare const measuredSelectionReceiptSchema: z.ZodObject<{
@@ -1843,17 +1839,17 @@ interface ImproveSelectedKnowledgeCandidateResult extends KnowledgeImprovementRe
1843
1839
  * evaluator, and returns the ordinary candidate reference. Promotion therefore
1844
1840
  * remains one path and can never admit an unmeasured hybrid.
1845
1841
  */
1846
- declare function improveSelectedKnowledgeCandidate(options: ImproveSelectedKnowledgeCandidateOptions): Promise<ImproveSelectedKnowledgeCandidateResult>;
1842
+ export declare function improveSelectedKnowledgeCandidate(options: ImproveSelectedKnowledgeCandidateOptions): Promise<ImproveSelectedKnowledgeCandidateResult>;
1847
1843
  //#endregion
1848
1844
  //#region src/kb-improvement/state.d.ts
1849
- declare function knowledgeImprovementRunId(root: string, goal: string): string;
1850
- declare function knowledgeImprovementRunDir(root: string, runId: string): string;
1851
- declare function loadKnowledgeImprovementState(root: string, runId: string): Promise<KnowledgeImprovementRunState | null>;
1845
+ export declare function knowledgeImprovementRunId(root: string, goal: string): string;
1846
+ export declare function knowledgeImprovementRunDir(root: string, runId: string): string;
1847
+ export declare function loadKnowledgeImprovementState(root: string, runId: string): Promise<KnowledgeImprovementRunState | null>;
1852
1848
  interface KnowledgeImprovementEvent extends Record<string, unknown> {
1853
1849
  at: string;
1854
1850
  type: string;
1855
1851
  }
1856
- declare function loadKnowledgeImprovementEvents(root: string, runId: string): Promise<KnowledgeImprovementEvent[]>;
1852
+ export declare function loadKnowledgeImprovementEvents(root: string, runId: string): Promise<KnowledgeImprovementEvent[]>;
1857
1853
  //#endregion
1858
1854
  //#region src/file-transaction.d.ts
1859
1855
  declare const transactionSchema: z.ZodObject<{
@@ -1861,6 +1857,8 @@ declare const transactionSchema: z.ZodObject<{
1861
1857
  transactionId: z.ZodString;
1862
1858
  purpose: z.ZodString;
1863
1859
  recoveryOwner: z.ZodOptional<z.ZodString>;
1860
+ actorId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1861
+ runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1864
1862
  pagesDirectory: z.ZodOptional<z.ZodString>;
1865
1863
  researchState: z.ZodOptional<z.ZodBoolean>;
1866
1864
  retainHistory: z.ZodOptional<z.ZodBoolean>;
@@ -1878,24 +1876,24 @@ type KnowledgeFileTransaction = z.infer<typeof transactionSchema>;
1878
1876
  //#endregion
1879
1877
  //#region src/kb-improvement/transition.d.ts
1880
1878
  /** Promote one previously measured candidate without rerunning research or evaluation. */
1881
- declare function promoteKnowledgeCandidate(options: PromoteKnowledgeCandidateOptions): Promise<KnowledgeImprovementMutationResult>;
1879
+ export declare function promoteKnowledgeCandidate(options: PromoteKnowledgeCandidateOptions): Promise<KnowledgeImprovementMutationResult>;
1882
1880
  /** Restore the frozen baseline paired with one previously measured candidate. */
1883
- declare function restoreKnowledgeCandidateBaseline(options: RestoreKnowledgeCandidateBaselineOptions): Promise<KnowledgeImprovementMutationResult>;
1881
+ export declare function restoreKnowledgeCandidateBaseline(options: RestoreKnowledgeCandidateBaselineOptions): Promise<KnowledgeImprovementMutationResult>;
1884
1882
  //#endregion
1885
1883
  //#region src/kb-improvement/workspace.d.ts
1886
1884
  /** Freeze the exact knowledge bytes and measured evidence a later approval may promote. */
1887
- declare function knowledgeImprovementCandidateRef(result: Pick<KnowledgeImprovementResult, 'runId' | 'state' | 'candidate'>): KnowledgeImprovementCandidateRef;
1885
+ export declare function knowledgeImprovementCandidateRef(result: Pick<KnowledgeImprovementResult, 'runId' | 'state' | 'candidate'>): KnowledgeImprovementCandidateRef;
1888
1886
  /** Use both frozen sides of one measured comparison in isolated, integrity-checked copies. */
1889
- declare function withKnowledgeImprovementComparison<T>(options: UseKnowledgeImprovementCandidateOptions, use: (comparison: ResolvedKnowledgeImprovementComparison) => Promise<T> | T): Promise<T>;
1887
+ export declare function withKnowledgeImprovementComparison<T>(options: UseKnowledgeImprovementCandidateOptions, use: (comparison: ResolvedKnowledgeImprovementComparison) => Promise<T> | T): Promise<T>;
1890
1888
  /** Use the frozen candidate side of one measured comparison. */
1891
- declare function withKnowledgeImprovementCandidate<T>(options: UseKnowledgeImprovementCandidateOptions, use: (candidate: ResolvedKnowledgeImprovementCandidate) => Promise<T> | T): Promise<T>;
1892
- declare function hashKnowledgeBase(root: string, scope?: KnowledgeStateScope): Promise<string>;
1889
+ export declare function withKnowledgeImprovementCandidate<T>(options: UseKnowledgeImprovementCandidateOptions, use: (candidate: ResolvedKnowledgeImprovementCandidate) => Promise<T> | T): Promise<T>;
1890
+ export declare function hashKnowledgeBase(root: string, scope?: KnowledgeStateScope): Promise<string>;
1893
1891
  //#endregion
1894
1892
  //#region src/agent-candidate.d.ts
1895
1893
  /** Convert a measured knowledge candidate into the shared review and execution identity. */
1896
- declare function toAgentCandidateKnowledgeRef(candidate: KnowledgeImprovementCandidateRef): AgentCandidateKnowledgeRef;
1894
+ export declare function toAgentCandidateKnowledgeRef(candidate: KnowledgeImprovementCandidateRef): AgentCandidateKnowledgeRef;
1897
1895
  /** Recover agent-knowledge's candidate identity from the shared contract. */
1898
- declare function fromAgentCandidateKnowledgeRef(candidate: AgentCandidateKnowledgeRef): KnowledgeImprovementCandidateRef;
1896
+ export declare function fromAgentCandidateKnowledgeRef(candidate: AgentCandidateKnowledgeRef): KnowledgeImprovementCandidateRef;
1899
1897
  //#endregion
1900
1898
  //#region src/changes.d.ts
1901
1899
  /**
@@ -1925,8 +1923,8 @@ declare function fromAgentCandidateKnowledgeRef(candidate: AgentCandidateKnowled
1925
1923
  *
1926
1924
  * @stable
1927
1925
  */
1928
- type KnowledgeChangeKind = 'added' | 'removed' | 'modified';
1929
- interface KnowledgeChange {
1926
+ export type KnowledgeChangeKind = 'added' | 'removed' | 'modified';
1927
+ export interface KnowledgeChange {
1930
1928
  /** Source-scoped id (matches `KnowledgeFragment.id`). */
1931
1929
  fragmentId: string;
1932
1930
  kind: KnowledgeChangeKind;
@@ -1954,7 +1952,7 @@ interface KnowledgeChange {
1954
1952
  */
1955
1953
  detectedAt: string;
1956
1954
  }
1957
- interface DetectChangesResult {
1955
+ export interface DetectChangesResult {
1958
1956
  changes: KnowledgeChange[];
1959
1957
  /** Counts by kind — handy for dashboards. */
1960
1958
  summary: {
@@ -1965,7 +1963,7 @@ interface DetectChangesResult {
1965
1963
  /** Non-fatal diagnostics (duplicate ids, dropped unverifiable fragments). */
1966
1964
  warnings: string[];
1967
1965
  }
1968
- interface DetectChangesOptions {
1966
+ export interface DetectChangesOptions {
1969
1967
  /**
1970
1968
  * When true (default), unverifiable fragments are dropped from both
1971
1969
  * sides before comparison. Set false ONLY when debugging block-page
@@ -1980,16 +1978,16 @@ interface DetectChangesOptions {
1980
1978
  */
1981
1979
  filterDimensions?: string[];
1982
1980
  }
1983
- declare function detectChanges(prev: KnowledgeFragment[], next: KnowledgeFragment[], options?: DetectChangesOptions): DetectChangesResult;
1981
+ export declare function detectChanges(prev: KnowledgeFragment[], next: KnowledgeFragment[], options?: DetectChangesOptions): DetectChangesResult;
1984
1982
  //#endregion
1985
1983
  //#region src/chunking.d.ts
1986
- interface ChunkingOptions {
1984
+ export interface ChunkingOptions {
1987
1985
  targetChars: number;
1988
1986
  maxChars: number;
1989
1987
  minChars: number;
1990
1988
  overlapChars: number;
1991
1989
  }
1992
- interface KnowledgeChunk {
1990
+ export interface KnowledgeChunk {
1993
1991
  index: number;
1994
1992
  text: string;
1995
1993
  headingPath: string;
@@ -1997,17 +1995,17 @@ interface KnowledgeChunk {
1997
1995
  charEnd: number;
1998
1996
  oversized: boolean;
1999
1997
  }
2000
- declare function chunkMarkdown(content: string, options?: Partial<ChunkingOptions>): KnowledgeChunk[];
2001
- declare function stripFrontmatter(content: string): {
1998
+ export declare function chunkMarkdown(content: string, options?: Partial<ChunkingOptions>): KnowledgeChunk[];
1999
+ export declare function stripFrontmatter(content: string): {
2002
2000
  body: string;
2003
2001
  bodyOffset: number;
2004
2002
  };
2005
2003
  //#endregion
2006
2004
  //#region src/citation-lint.d.ts
2007
2005
  /** Convert a chain-aware citation audit into the package lint vocabulary. */
2008
- declare function knowledgeCitationAuditFindings(report: KnowledgeCitationAuditReport): KnowledgeLintFinding[];
2006
+ export declare function knowledgeCitationAuditFindings(report: KnowledgeCitationAuditReport): KnowledgeLintFinding[];
2009
2007
  /** Lint only current-run pages against their complete declared visibility chain. */
2010
- declare function lintCurrentRunCitations(stores: RunScopedStores, runId: string): Promise<KnowledgeLintFinding[]>;
2008
+ export declare function lintCurrentRunCitations(stores: RunScopedStores, runId: string): Promise<KnowledgeLintFinding[]>;
2011
2009
  //#endregion
2012
2010
  //#region src/claim-evidence.d.ts
2013
2011
  /**
@@ -2035,10 +2033,10 @@ declare function lintCurrentRunCitations(stores: RunScopedStores, runId: string)
2035
2033
  * Reporting a low rung in the vocabulary of a high one is the most expensive error available to a
2036
2034
  * knowledge system: it is indistinguishable from success and propagates as settled provenance.
2037
2035
  */
2038
- type EvidenceRung = 1 | 2 | 3 | 4 | 5;
2036
+ export type EvidenceRung = 1 | 2 | 3 | 4 | 5;
2039
2037
  /** The rung at and above which a claim must be machine-checkable to be recorded at that rung. */
2040
- declare const CHECKABLE_RUNG_THRESHOLD = 4;
2041
- interface ClaimEvidence {
2038
+ export declare const CHECKABLE_RUNG_THRESHOLD = 4;
2039
+ export interface ClaimEvidence {
2042
2040
  rung: EvidenceRung;
2043
2041
  /**
2044
2042
  * A shell command that re-establishes the claim when run by a grader the author cannot edit,
@@ -2065,7 +2063,7 @@ interface ClaimEvidence {
2065
2063
  * all of them: `uncheckable`. `note` names which shape was refused and what to record instead, in
2066
2064
  * the same words the grader reports, so an author reads one message wherever the claim is stopped.
2067
2065
  */
2068
- declare class UncheckableClaimError extends Error {
2066
+ export declare class UncheckableClaimError extends Error {
2069
2067
  /** The rung whose evidence rule the recorded claim failed. */
2070
2068
  readonly rung: EvidenceRung;
2071
2069
  /** The refused shape and the fix for it, in the grader's vocabulary. */
@@ -2086,7 +2084,7 @@ declare class UncheckableClaimError extends Error {
2086
2084
  * were never executed before their authors disappeared. The dynamic half of that last rule is
2087
2085
  * `verifyGradeableEvidence` below.
2088
2086
  */
2089
- declare function assertGradeableEvidence(evidence: ClaimEvidence): ClaimEvidence;
2087
+ export declare function assertGradeableEvidence(evidence: ClaimEvidence): ClaimEvidence;
2090
2088
  /**
2091
2089
  * What a grader may conclude from re-executing a claim's check.
2092
2090
  *
@@ -2099,15 +2097,15 @@ declare function assertGradeableEvidence(evidence: ClaimEvidence): ClaimEvidence
2099
2097
  * deadline killed it — an environment verdict, never a claim verdict
2100
2098
  * uncheckable the recorded evidence cannot decide the claim at this rung
2101
2099
  */
2102
- type ClaimVerdict = 'verified' | 'silent-check' | 'contradicted' | 'unrunnable' | 'uncheckable';
2100
+ export type ClaimVerdict = 'verified' | 'silent-check' | 'contradicted' | 'unrunnable' | 'uncheckable';
2103
2101
  /**
2104
2102
  * The exit status a deadline kill reports: `timeout(1)`'s status, and the one a bounded process
2105
2103
  * runner forces so a killed child that closes with 0 cannot read as a pass. A grader that has
2106
2104
  * only an exit status reports this one; a grader that knows it killed the process sets
2107
2105
  * `CheckExecution.timedOut` instead, which is unambiguous.
2108
2106
  */
2109
- declare const DEADLINE_EXIT_CODE = 124;
2110
- interface CheckExecution {
2107
+ export declare const DEADLINE_EXIT_CODE = 124;
2108
+ export interface CheckExecution {
2111
2109
  exitCode: number;
2112
2110
  stdout: string;
2113
2111
  stderr: string;
@@ -2130,7 +2128,7 @@ interface CheckExecution {
2130
2128
  outputTruncated?: boolean;
2131
2129
  }
2132
2130
  /** A verdict with the reason a grader may report to the claim's author. */
2133
- interface ClaimGrade {
2131
+ export interface ClaimGrade {
2134
2132
  verdict: ClaimVerdict;
2135
2133
  /** Present when the verdict is a refusal the author can fix, absent otherwise. */
2136
2134
  note?: string;
@@ -2155,9 +2153,9 @@ interface ClaimGrade {
2155
2153
  * - a check whose output says it never reached its input is `unrunnable` whatever its exit
2156
2154
  * status, because a pipeline hides the failing stage's status behind its last stage.
2157
2155
  */
2158
- declare function gradeFor(evidence: Pick<ClaimEvidence, 'rung' | 'check' | 'expect'>, execution: CheckExecution | null): ClaimGrade;
2156
+ export declare function gradeFor(evidence: Pick<ClaimEvidence, 'rung' | 'check' | 'expect'>, execution: CheckExecution | null): ClaimGrade;
2159
2157
  /** A claim and the observation a grader made of it, as one grading pass sees them. */
2160
- interface GradeableClaim {
2158
+ export interface GradeableClaim {
2161
2159
  /** Stable identity a duplicate flag can point back to, such as the page or claim id. */
2162
2160
  id: string;
2163
2161
  /** The claim's own sentence. Two claims that share a check but say different things differ. */
@@ -2166,7 +2164,7 @@ interface GradeableClaim {
2166
2164
  execution: CheckExecution | null;
2167
2165
  }
2168
2166
  /** A grade with the claim it belongs to, in the order the claims were supplied. */
2169
- interface GradedClaim extends ClaimGrade {
2167
+ export interface GradedClaim extends ClaimGrade {
2170
2168
  id: string;
2171
2169
  }
2172
2170
  /**
@@ -2178,7 +2176,7 @@ interface GradedClaim extends ClaimGrade {
2178
2176
  * claim with `duplicateOf`, leaving the verdict and the count untouched: the flag is for a reader
2179
2177
  * deciding how much evidence a run really produced.
2180
2178
  */
2181
- declare function gradeClaims(claims: readonly GradeableClaim[]): GradedClaim[];
2179
+ export declare function gradeClaims(claims: readonly GradeableClaim[]): GradedClaim[];
2182
2180
  /**
2183
2181
  * The identity two claims must share to be one verification counted twice: the same command, the
2184
2182
  * same expectation, and the same sentence. A check shared across claims that say different things
@@ -2188,14 +2186,14 @@ declare function gradeClaims(claims: readonly GradeableClaim[]): GradedClaim[];
2188
2186
  * so an unkeyable claim is never flagged as a repeat of another unkeyable one. The key is JSON
2189
2187
  * rather than a joined string, so no separator can collide with text inside a check.
2190
2188
  */
2191
- declare function claimCheckKey(claim: {
2189
+ export declare function claimCheckKey(claim: {
2192
2190
  check?: string;
2193
2191
  expect?: string;
2194
2192
  title?: string;
2195
2193
  }): string | undefined;
2196
2194
  /** The verdict alone, for graders that report a lattice member and not a reason. */
2197
- declare function verdictFor(evidence: Pick<ClaimEvidence, 'rung' | 'check' | 'expect'>, execution: CheckExecution | null): ClaimVerdict;
2198
- interface VerifyGradeableEvidenceOptions {
2195
+ export declare function verdictFor(evidence: Pick<ClaimEvidence, 'rung' | 'check' | 'expect'>, execution: CheckExecution | null): ClaimVerdict;
2196
+ export interface VerifyGradeableEvidenceOptions {
2199
2197
  /** Directory in which the later grader will execute the command. Required to avoid ambient cwd. */
2200
2198
  cwd: string;
2201
2199
  /** Exact environment visible to the command. Omitted variables are genuinely absent. */
@@ -2208,7 +2206,7 @@ interface VerifyGradeableEvidenceOptions {
2208
2206
  maxBufferBytes?: number;
2209
2207
  signal?: AbortSignal;
2210
2208
  }
2211
- interface VerifiedGradeableEvidence {
2209
+ export interface VerifiedGradeableEvidence {
2212
2210
  evidence: ClaimEvidence;
2213
2211
  execution: CheckExecution;
2214
2212
  grade: ClaimGrade;
@@ -2227,7 +2225,7 @@ interface VerifiedGradeableEvidence {
2227
2225
  * it remain importable. Callers must apply their own sandbox and capability policy before passing
2228
2226
  * untrusted commands here.
2229
2227
  */
2230
- declare function verifyGradeableEvidence(evidence: ClaimEvidence, options: VerifyGradeableEvidenceOptions): Promise<VerifiedGradeableEvidence>;
2228
+ export declare function verifyGradeableEvidence(evidence: ClaimEvidence, options: VerifyGradeableEvidenceOptions): Promise<VerifiedGradeableEvidence>;
2231
2229
  //#endregion
2232
2230
  //#region src/claim-grounding.d.ts
2233
2231
  /**
@@ -2235,12 +2233,12 @@ declare function verifyGradeableEvidence(evidence: ClaimEvidence, options: Verif
2235
2233
  * for. The worker sets `metadata[citedClaimKey] = '<the claim>'`; the
2236
2234
  * claim-grounding driver reads it and checks it against the fetched page text.
2237
2235
  */
2238
- declare const citedClaimKey = "citedClaim";
2236
+ export declare const citedClaimKey = "citedClaim";
2239
2237
  /** Read the cited claim a proposal carries, if any. */
2240
- declare function citedClaimOf(source: ResearchSourceProposal): string | undefined;
2238
+ export declare function citedClaimOf(source: ResearchSourceProposal): string | undefined;
2241
2239
  /** Attach a cited claim to a proposal (immutably returns a new proposal). */
2242
- declare function withCitedClaim(source: ResearchSourceProposal, claim: string): ResearchSourceProposal;
2243
- interface GroundingResult {
2240
+ export declare function withCitedClaim(source: ResearchSourceProposal, claim: string): ResearchSourceProposal;
2241
+ export interface GroundingResult {
2244
2242
  /** True when the claim is sufficiently present in the page text. */
2245
2243
  grounded: boolean;
2246
2244
  /** How the claim matched (or why it didn't). For audit/notes. */
@@ -2253,7 +2251,7 @@ interface GroundingResult {
2253
2251
  /** Content words present in the claim but NOT in the page text. */
2254
2252
  missingWords: string[];
2255
2253
  }
2256
- interface GroundClaimOptions {
2254
+ export interface GroundClaimOptions {
2257
2255
  /**
2258
2256
  * Minimum fraction of the claim's content words that must appear in the page
2259
2257
  * text to count as a close paraphrase when there is no verbatim/normalized
@@ -2282,8 +2280,8 @@ interface GroundClaimOptions {
2282
2280
  * enough for the driver to give a precise rejection reason and for a test/doc to
2283
2281
  * audit WHY a claim grounded or didn't.
2284
2282
  */
2285
- declare function groundClaimInText(claim: string, pageText: string, options?: GroundClaimOptions): GroundingResult;
2286
- interface ClaimGroundingDriverOptions extends GroundClaimOptions {
2283
+ export declare function groundClaimInText(claim: string, pageText: string, options?: GroundClaimOptions): GroundingResult;
2284
+ export interface ClaimGroundingDriverOptions extends GroundClaimOptions {
2287
2285
  /**
2288
2286
  * Optional second verifier to compose AFTER grounding passes. When set, a
2289
2287
  * source must BOTH ground its claim AND pass this verifier (e.g. the LLM
@@ -2309,8 +2307,8 @@ interface ClaimGroundingDriverOptions extends GroundClaimOptions {
2309
2307
  * The returned function matches `ResearchDriver['verifySource']`, so it drops
2310
2308
  * straight into `runVerifiedResearchLoop` as `{ verifySource: createClaimGroundingVerifier(...) }`.
2311
2309
  */
2312
- declare function createClaimGroundingVerifier(options?: ClaimGroundingDriverOptions): (source: ResearchSourceProposal, ctx: SourceVerificationContext) => Promise<SourceVerdict>;
2313
- interface WorkerClaimDecorationOptions {
2310
+ export declare function createClaimGroundingVerifier(options?: ClaimGroundingDriverOptions): (source: ResearchSourceProposal, ctx: SourceVerificationContext) => Promise<SourceVerdict>;
2311
+ export interface WorkerClaimDecorationOptions {
2314
2312
  router?: RouterClient;
2315
2313
  router_options?: TangleRouterOptions;
2316
2314
  /** Max output tokens for the claim-extraction call. Default 1200 (glm floor). */
@@ -2329,7 +2327,7 @@ interface WorkerClaimDecorationOptions {
2329
2327
  * unchanged if the model returns nothing parseable (the verifier's
2330
2328
  * `onMissingClaim` policy then decides).
2331
2329
  */
2332
- declare function createClaimDecorator(options?: WorkerClaimDecorationOptions): (source: ResearchSourceProposal, goal: string) => Promise<ResearchSourceProposal>;
2330
+ export declare function createClaimDecorator(options?: WorkerClaimDecorationOptions): (source: ResearchSourceProposal, goal: string) => Promise<ResearchSourceProposal>;
2333
2331
  //#endregion
2334
2332
  //#region src/claim-ledger.d.ts
2335
2333
  /**
@@ -2338,13 +2336,13 @@ declare function createClaimDecorator(options?: WorkerClaimDecorationOptions): (
2338
2336
  * sources rather than two claims with one each — which is the difference
2339
2337
  * between corroborated and unsupported.
2340
2338
  */
2341
- declare function claimId(text: string): string;
2339
+ export declare function claimId(text: string): string;
2342
2340
  /** Stable identity for one extracted claim/source/contradiction observation. */
2343
- declare function claimEvidenceId(claim: Pick<ResearchClaimEvidence, 'claimId' | 'sourceId' | 'sourceUri' | 'sourceContentHash' | 'contradictsClaimId'>): string;
2341
+ export declare function claimEvidenceId(claim: Pick<ResearchClaimEvidence, 'claimId' | 'sourceId' | 'sourceUri' | 'sourceContentHash' | 'contradictsClaimId'>): string;
2344
2342
  /** Canonical key for one exact registry-id + original-URI + hash source version. */
2345
- declare function researchSourceVersionKey(source: Pick<ResearchSourceVersion, 'sourceId' | 'uri' | 'contentHash'>): string;
2343
+ export declare function researchSourceVersionKey(source: Pick<ResearchSourceVersion, 'sourceId' | 'uri' | 'contentHash'>): string;
2346
2344
  /** Case-, whitespace-, and stylistic-punctuation-insensitive claim identity form. */
2347
- declare function normalizeClaimText(text: string): string;
2345
+ export declare function normalizeClaimText(text: string): string;
2348
2346
  /**
2349
2347
  * The canonical host a source uri counts as, which is what makes two sources
2350
2348
  * INDEPENDENT: corroboration is "distinct hosts", so this function is the rule
@@ -2353,9 +2351,9 @@ declare function normalizeClaimText(text: string): string;
2353
2351
  * consumer that counted raw uris would report two pages of one site as
2354
2352
  * independent confirmation.
2355
2353
  */
2356
- declare function claimSourceHost(uri: string): string;
2354
+ export declare function claimSourceHost(uri: string): string;
2357
2355
  /** Stable identity for one deep question. */
2358
- declare function deepQuestionId(kind: DeepQuestion['kind'], text: string): string;
2356
+ export declare function deepQuestionId(kind: DeepQuestion['kind'], text: string): string;
2359
2357
  /**
2360
2358
  * Refuse a claim record whose identity or source count disagrees with its evidence.
2361
2359
  *
@@ -2364,15 +2362,15 @@ declare function deepQuestionId(kind: DeepQuestion['kind'], text: string): strin
2364
2362
  * manufacture corroboration. Canonical ordering also makes equal records have
2365
2363
  * equal bytes regardless of which process assembled them.
2366
2364
  */
2367
- declare function assertTrackedClaimIntegrity(claim: ResearchClaimRecord): void;
2365
+ export declare function assertTrackedClaimIntegrity(claim: ResearchClaimRecord): void;
2368
2366
  /** Refuse a deep question whose stable identity or set fields are malformed. */
2369
- declare function assertDeepQuestionIntegrity(question: DeepQuestion): void;
2367
+ export declare function assertDeepQuestionIntegrity(question: DeepQuestion): void;
2370
2368
  /** Refuse an extracted observation whose identity or content is malformed. */
2371
- declare function assertResearchClaimEvidenceIntegrity(evidence: ResearchClaimEvidence): void;
2369
+ export declare function assertResearchClaimEvidenceIntegrity(evidence: ResearchClaimEvidence): void;
2372
2370
  /** Refuse a ledger that is not one canonical, internally consistent record. */
2373
- declare function assertResearchClaimLedgerIntegrity(ledger: ResearchClaimLedger): void;
2371
+ export declare function assertResearchClaimLedgerIntegrity(ledger: ResearchClaimLedger): void;
2374
2372
  /** A ledger with nothing in it yet. */
2375
- declare function emptyClaimLedger(id: string, goal?: string): ResearchClaimLedger;
2373
+ export declare function emptyClaimLedger(id: string, goal?: string): ResearchClaimLedger;
2376
2374
  /**
2377
2375
  * Turn only evidence backed by a confirmed source registration into support.
2378
2376
  *
@@ -2380,14 +2378,14 @@ declare function emptyClaimLedger(id: string, goal?: string): ResearchClaimLedge
2380
2378
  * it twice is a no-op. Keeping it in the ledger algebra means a source-confirming
2381
2379
  * writer and an evidence-producing writer can arrive in either order.
2382
2380
  */
2383
- declare function materializeRegisteredClaimEvidence(ledger: ResearchClaimLedger): ResearchClaimLedger;
2381
+ export declare function materializeRegisteredClaimEvidence(ledger: ResearchClaimLedger): ResearchClaimLedger;
2384
2382
  /**
2385
2383
  * Raised when two ledgers that accumulated evidence for DIFFERENT goals are
2386
2384
  * combined. Merging them would pool two questions' evidence into one
2387
2385
  * corroboration count, which reports a claim as independently confirmed when
2388
2386
  * nobody confirmed it — strictly worse than losing the ledger, so this refuses.
2389
2387
  */
2390
- declare class ClaimLedgerGoalConflictError extends Error {
2388
+ export declare class ClaimLedgerGoalConflictError extends Error {
2391
2389
  readonly ledgerId: string;
2392
2390
  readonly existingGoal: string;
2393
2391
  readonly incomingGoal: string;
@@ -2402,7 +2400,7 @@ declare class ClaimLedgerGoalConflictError extends Error {
2402
2400
  * seeing a contradiction is enough for the claim to be contested, and no later
2403
2401
  * writer that simply did not see it may clear the flag.
2404
2402
  */
2405
- declare function mergeTrackedClaims(base: ResearchClaimRecord, incoming: ResearchClaimRecord): ResearchClaimRecord;
2403
+ export declare function mergeTrackedClaims(base: ResearchClaimRecord, incoming: ResearchClaimRecord): ResearchClaimRecord;
2406
2404
  /**
2407
2405
  * Combine two ledgers for the same run.
2408
2406
  *
@@ -2412,7 +2410,7 @@ declare function mergeTrackedClaims(base: ResearchClaimRecord, incoming: Researc
2412
2410
  * is associative and idempotent — merge order cannot change the result and a
2413
2411
  * replayed merge is a no-op.
2414
2412
  */
2415
- declare function mergeClaimLedgers(base: ResearchClaimLedger, incoming: ResearchClaimLedger): ResearchClaimLedger;
2413
+ export declare function mergeClaimLedgers(base: ResearchClaimLedger, incoming: ResearchClaimLedger): ResearchClaimLedger;
2416
2414
  /**
2417
2415
  * Make every contradiction edge symmetric and mark both ends contested.
2418
2416
  *
@@ -2429,7 +2427,7 @@ declare function mergeClaimLedgers(base: ResearchClaimLedger, incoming: Research
2429
2427
  * only closed pairs, so it cannot report a lone weak claim as settled merely
2430
2428
  * because its evidence named a claim that never arrived.
2431
2429
  */
2432
- declare function linkClaimContradictions(ledger: ResearchClaimLedger): ResearchClaimLedger;
2430
+ export declare function linkClaimContradictions(ledger: ResearchClaimLedger): ResearchClaimLedger;
2433
2431
  //#endregion
2434
2432
  //#region src/collection-research-driver.d.ts
2435
2433
  /**
@@ -2437,17 +2435,17 @@ declare function linkClaimContradictions(ledger: ResearchClaimLedger): ResearchC
2437
2435
  * never researches, never steers beyond the loop's default open-gap list. The
2438
2436
  * worker is the only agent that thinks.
2439
2437
  */
2440
- declare function createCollectionResearchDriver(): ResearchDriver;
2438
+ export declare function createCollectionResearchDriver(): ResearchDriver;
2441
2439
  //#endregion
2442
2440
  //#region src/discovery.d.ts
2443
- interface DiscoveryTask {
2441
+ export interface DiscoveryTask {
2444
2442
  id: string;
2445
2443
  goal: string;
2446
2444
  query?: string;
2447
2445
  sourceHints?: string[];
2448
2446
  metadata?: Record<string, unknown>;
2449
2447
  }
2450
- interface DiscoveryResult {
2448
+ export interface DiscoveryResult {
2451
2449
  taskId: string;
2452
2450
  summary: string;
2453
2451
  sourceUris?: string[];
@@ -2459,23 +2457,23 @@ interface DiscoveryResult {
2459
2457
  followUpTasks?: DiscoveryTask[];
2460
2458
  metadata?: Record<string, unknown>;
2461
2459
  }
2462
- interface KnowledgeDiscoveryWorker {
2460
+ export interface KnowledgeDiscoveryWorker {
2463
2461
  run(task: DiscoveryTask, signal?: AbortSignal): Promise<DiscoveryResult> | DiscoveryResult;
2464
2462
  }
2465
- interface KnowledgeDiscoveryDispatcher {
2463
+ export interface KnowledgeDiscoveryDispatcher {
2466
2464
  dispatch(tasks: DiscoveryTask[], options?: {
2467
2465
  concurrency?: number;
2468
2466
  signal?: AbortSignal;
2469
2467
  }): Promise<DiscoveryResult[]>;
2470
2468
  }
2471
- type DiscoveryLoopStopReason = 'complete' | 'max-rounds' | 'max-tasks' | 'aborted';
2472
- interface DiscoveryLoopRound {
2469
+ export type DiscoveryLoopStopReason = 'complete' | 'max-rounds' | 'max-tasks' | 'aborted';
2470
+ export interface DiscoveryLoopRound {
2473
2471
  round: number;
2474
2472
  tasks: DiscoveryTask[];
2475
2473
  results: DiscoveryResult[];
2476
2474
  queuedFollowUps: DiscoveryTask[];
2477
2475
  }
2478
- interface DiscoveryLoopResult {
2476
+ export interface DiscoveryLoopResult {
2479
2477
  stopReason: DiscoveryLoopStopReason;
2480
2478
  tasksDispatched: number;
2481
2479
  results: DiscoveryResult[];
@@ -2485,7 +2483,7 @@ interface DiscoveryLoopResult {
2485
2483
  /** Structurally identical task identities ignored to prevent cycles. */
2486
2484
  duplicateTaskIds: string[];
2487
2485
  }
2488
- interface RunDiscoveryLoopOptions {
2486
+ export interface RunDiscoveryLoopOptions {
2489
2487
  dispatcher: KnowledgeDiscoveryDispatcher;
2490
2488
  initialTasks: readonly DiscoveryTask[];
2491
2489
  /** Maximum follow-up depth including the initial dispatch. Default 3. */
@@ -2503,41 +2501,41 @@ interface RunDiscoveryLoopOptions {
2503
2501
  * The runner owns only bounded scheduling and accounting. Workers own search,
2504
2502
  * source verification, and domain-specific candidate shapes.
2505
2503
  */
2506
- declare function runDiscoveryLoop(options: RunDiscoveryLoopOptions): Promise<DiscoveryLoopResult>;
2507
- declare function createLocalDiscoveryDispatcher(worker: KnowledgeDiscoveryWorker): KnowledgeDiscoveryDispatcher;
2504
+ export declare function runDiscoveryLoop(options: RunDiscoveryLoopOptions): Promise<DiscoveryLoopResult>;
2505
+ export declare function createLocalDiscoveryDispatcher(worker: KnowledgeDiscoveryWorker): KnowledgeDiscoveryDispatcher;
2508
2506
  //#endregion
2509
2507
  //#region src/durable-fs.d.ts
2510
- interface RegularFileSnapshot {
2508
+ export interface RegularFileSnapshot {
2511
2509
  bytes: Buffer;
2512
2510
  mode: number;
2513
2511
  }
2514
- declare function writeFileDurable(path: string, data: string | Buffer, options?: {
2512
+ export declare function writeFileDurable(path: string, data: string | Buffer, options?: {
2515
2513
  encoding?: BufferEncoding;
2516
2514
  mode?: number;
2517
2515
  }): Promise<void>;
2518
- declare function writeJsonDurable(path: string, value: unknown): Promise<void>;
2519
- declare function writeFileDurableWithinRoot(root: string, relativePath: string, data: string | Buffer, options?: {
2516
+ export declare function writeJsonDurable(path: string, value: unknown): Promise<void>;
2517
+ export declare function writeFileDurableWithinRoot(root: string, relativePath: string, data: string | Buffer, options?: {
2520
2518
  encoding?: BufferEncoding;
2521
2519
  mode?: number;
2522
2520
  }): Promise<void>;
2523
- declare function writeJsonDurableWithinRoot(root: string, relativePath: string, value: unknown): Promise<void>;
2524
- declare function renameDurable(source: string, target: string): Promise<void>;
2525
- declare function removeDurable(path: string): Promise<void>;
2526
- declare function syncDirectory(path: string): Promise<void>;
2521
+ export declare function writeJsonDurableWithinRoot(root: string, relativePath: string, value: unknown): Promise<void>;
2522
+ export declare function renameDurable(source: string, target: string): Promise<void>;
2523
+ export declare function removeDurable(path: string): Promise<void>;
2524
+ export declare function syncDirectory(path: string): Promise<void>;
2527
2525
  /**
2528
2526
  * Keeps the target's parent directory open while the operation runs. On Linux,
2529
2527
  * `/proc/self/fd` anchors every lookup to that directory even if an ancestor is
2530
2528
  * renamed concurrently.
2531
2529
  */
2532
- declare function withSafeDescendant<T>(root: string, relativePath: string, use: (path: string) => Promise<T> | T): Promise<T>;
2533
- declare function withSafeDirectory<T>(root: string, relativePath: string, create: boolean, use: (path: string) => Promise<T> | T): Promise<T>;
2534
- declare function readRegularFileNoFollow(path: string): Promise<RegularFileSnapshot>;
2535
- declare function readRegularFileWithinRoot(root: string, relativePath: string): Promise<RegularFileSnapshot>;
2536
- declare function listRegularFilesWithinRoot(root: string, relativeDirectory: string): Promise<Array<RegularFileSnapshot & {
2530
+ export declare function withSafeDescendant<T>(root: string, relativePath: string, use: (path: string) => Promise<T> | T): Promise<T>;
2531
+ export declare function withSafeDirectory<T>(root: string, relativePath: string, create: boolean, use: (path: string) => Promise<T> | T): Promise<T>;
2532
+ export declare function readRegularFileNoFollow(path: string): Promise<RegularFileSnapshot>;
2533
+ export declare function readRegularFileWithinRoot(root: string, relativePath: string): Promise<RegularFileSnapshot>;
2534
+ export declare function listRegularFilesWithinRoot(root: string, relativeDirectory: string): Promise<Array<RegularFileSnapshot & {
2537
2535
  path: string;
2538
2536
  }>>;
2539
- declare function isMissingFile(error: unknown): boolean;
2540
- declare function isKernelAnchoredPath(path: string): boolean;
2537
+ export declare function isMissingFile(error: unknown): boolean;
2538
+ export declare function isKernelAnchoredPath(path: string): boolean;
2541
2539
  /**
2542
2540
  * The path from `root` down to `candidate`, or undefined when `candidate` is not
2543
2541
  * strictly inside `root`.
@@ -2550,7 +2548,7 @@ declare function isKernelAnchoredPath(path: string): boolean;
2550
2548
  * and a caller that treats it as a descendant would hand its own root to
2551
2549
  * machinery that may remove the directory it is given.
2552
2550
  */
2553
- declare function relativeWithinRoot(root: string, candidate: string): string | undefined;
2551
+ export declare function relativeWithinRoot(root: string, candidate: string): string | undefined;
2554
2552
  /**
2555
2553
  * The path from `root` down to `candidate`, with both sides canonicalized before
2556
2554
  * they are compared.
@@ -2570,7 +2568,7 @@ declare function relativeWithinRoot(root: string, candidate: string): string | u
2570
2568
  * canonicalized and the remaining segments are appended, so a directory that is
2571
2569
  * about to be created is measured against the same root as one that already is.
2572
2570
  */
2573
- declare function canonicalRelativeWithinRoot(root: string, candidate: string): Promise<string | undefined>;
2571
+ export declare function canonicalRelativeWithinRoot(root: string, candidate: string): Promise<string | undefined>;
2574
2572
  /**
2575
2573
  * Whether two paths name the same location, with both sides canonicalized first.
2576
2574
  *
@@ -2579,15 +2577,15 @@ declare function canonicalRelativeWithinRoot(root: string, candidate: string): P
2579
2577
  * spellings. Comparing the resolved strings reports a mismatch that does not
2580
2578
  * exist.
2581
2579
  */
2582
- declare function canonicalPathsEqual(left: string, right: string): Promise<boolean>;
2580
+ export declare function canonicalPathsEqual(left: string, right: string): Promise<boolean>;
2583
2581
  //#endregion
2584
2582
  //#region src/events.d.ts
2585
- interface KnowledgeEventQuery {
2583
+ export interface KnowledgeEventQuery {
2586
2584
  type?: KnowledgeEventType;
2587
2585
  target?: string;
2588
2586
  limit?: number;
2589
2587
  }
2590
- declare function createKnowledgeEvent(input: {
2588
+ export declare function createKnowledgeEvent(input: {
2591
2589
  type: KnowledgeEventType;
2592
2590
  actor?: string;
2593
2591
  target?: string;
@@ -2596,7 +2594,7 @@ declare function createKnowledgeEvent(input: {
2596
2594
  }): KnowledgeEvent;
2597
2595
  //#endregion
2598
2596
  //#region src/filesystem-search-provider.d.ts
2599
- interface FileSystemSearchProviderOptions extends KnowledgePagesOptions {
2597
+ export interface FileSystemSearchProviderOptions extends KnowledgePagesOptions {
2600
2598
  /** Knowledge-base root containing the pages directory and `.agent-knowledge/`. */
2601
2599
  root: string;
2602
2600
  /** Optional warm index, useful when the caller already built one. */
@@ -2609,7 +2607,7 @@ interface FileSystemSearchProviderOptions extends KnowledgePagesOptions {
2609
2607
  */
2610
2608
  refresh?: 'manual' | 'always';
2611
2609
  }
2612
- interface FileSystemSearchOptions {
2610
+ export interface FileSystemSearchOptions {
2613
2611
  limit?: number;
2614
2612
  refresh?: boolean;
2615
2613
  }
@@ -2619,7 +2617,7 @@ interface FileSystemSearchOptions {
2619
2617
  * This is the simple backend for products that want deterministic search over
2620
2618
  * markdown knowledge files before adding embeddings, rerankers, or a vector DB.
2621
2619
  */
2622
- declare class FileSystemSearchProvider {
2620
+ export declare class FileSystemSearchProvider {
2623
2621
  readonly root: string;
2624
2622
  /** Root-relative directory the provider indexes. */
2625
2623
  readonly pagesDirectory: string;
@@ -2634,7 +2632,7 @@ declare class FileSystemSearchProvider {
2634
2632
  asRetrievalEvalRetriever(): RetrievalEvalRetriever;
2635
2633
  invalidate(): void;
2636
2634
  }
2637
- declare function createFileSystemSearchProvider(options: FileSystemSearchProviderOptions): FileSystemSearchProvider;
2635
+ export declare function createFileSystemSearchProvider(options: FileSystemSearchProviderOptions): FileSystemSearchProvider;
2638
2636
  //#endregion
2639
2637
  //#region src/freshness.d.ts
2640
2638
  /**
@@ -2666,24 +2664,24 @@ declare function createFileSystemSearchProvider(options: FileSystemSearchProvide
2666
2664
  * PostgreSQL, SQLite, or another application-owned store.
2667
2665
  */
2668
2666
  /** Identity for one freshness record. */
2669
- interface FreshnessKey {
2667
+ export interface FreshnessKey {
2670
2668
  workspaceId: string;
2671
2669
  sourceId: string;
2672
2670
  }
2673
2671
  /** TTL bound for staleness checks. */
2674
- interface FreshnessTtl extends FreshnessKey {
2672
+ export interface FreshnessTtl extends FreshnessKey {
2675
2673
  /** Milliseconds; the record is stale when `Date.now() - last() > ttlMs`. */
2676
2674
  ttlMs: number;
2677
2675
  /** Injected clock for deterministic tests; defaults to system time. */
2678
2676
  now?: Date;
2679
2677
  }
2680
2678
  /** Mark argument. */
2681
- interface FreshnessMark extends FreshnessKey {
2679
+ export interface FreshnessMark extends FreshnessKey {
2682
2680
  when: Date;
2683
2681
  /** Optional content hash captured at refresh time; aids debugging. */
2684
2682
  contentHash?: string;
2685
2683
  }
2686
- interface KnowledgeFreshnessStore {
2684
+ export interface KnowledgeFreshnessStore {
2687
2685
  /** Last refresh time, or null if never refreshed. */
2688
2686
  last(key: FreshnessKey): Promise<Date | null>;
2689
2687
  /** Record a successful refresh. */
@@ -2693,13 +2691,13 @@ interface KnowledgeFreshnessStore {
2693
2691
  /** All records for a workspace. */
2694
2692
  list(workspaceId: string): Promise<FreshnessRecord[]>;
2695
2693
  }
2696
- interface FreshnessRecord {
2694
+ export interface FreshnessRecord {
2697
2695
  workspaceId: string;
2698
2696
  sourceId: string;
2699
2697
  lastRefreshedAt: string;
2700
2698
  contentHash?: string;
2701
2699
  }
2702
- interface FileSystemFreshnessStoreOptions {
2700
+ export interface FileSystemFreshnessStoreOptions {
2703
2701
  /**
2704
2702
  * Knowledge root. The store writes to `<root>/.agent-knowledge/freshness.json`,
2705
2703
  * mirroring the convention used by `sources.json`.
@@ -2714,7 +2712,7 @@ interface FileSystemFreshnessStoreOptions {
2714
2712
  * Writes share the package-wide filesystem lock, so multiple workers cannot
2715
2713
  * overwrite one another or run through an interrupted knowledge promotion.
2716
2714
  */
2717
- declare function createFileSystemFreshnessStore(options: FileSystemFreshnessStoreOptions): KnowledgeFreshnessStore;
2715
+ export declare function createFileSystemFreshnessStore(options: FileSystemFreshnessStoreOptions): KnowledgeFreshnessStore;
2718
2716
  /**
2719
2717
  * Bridge an application-owned database adapter to `KnowledgeFreshnessStore`.
2720
2718
  * The adapter may use D1, PostgreSQL, SQLite, or another durable store.
@@ -2731,25 +2729,25 @@ declare function createFileSystemFreshnessStore(options: FileSystemFreshnessStor
2731
2729
  * );
2732
2730
  * ```
2733
2731
  */
2734
- interface D1Adapter {
2732
+ export interface D1Adapter {
2735
2733
  get(workspaceId: string, sourceId: string): Promise<FreshnessRecord | null>;
2736
2734
  upsert(record: FreshnessRecord): Promise<void>;
2737
2735
  listByWorkspace(workspaceId: string): Promise<FreshnessRecord[]>;
2738
2736
  }
2739
- declare function createD1FreshnessStoreStub(adapter: D1Adapter): KnowledgeFreshnessStore;
2737
+ export declare function createD1FreshnessStoreStub(adapter: D1Adapter): KnowledgeFreshnessStore;
2740
2738
  //#endregion
2741
2739
  //#region src/frontmatter.d.ts
2742
- interface ParsedFrontmatter {
2740
+ export interface ParsedFrontmatter {
2743
2741
  frontmatter: Record<string, unknown>;
2744
2742
  body: string;
2745
2743
  }
2746
- declare function parseFrontmatter(content: string): ParsedFrontmatter;
2747
- declare function formatFrontmatter(frontmatter: Record<string, unknown>, body: string): string;
2744
+ export declare function parseFrontmatter(content: string): ParsedFrontmatter;
2745
+ export declare function formatFrontmatter(frontmatter: Record<string, unknown>, body: string): string;
2748
2746
  //#endregion
2749
2747
  //#region src/graph.d.ts
2750
- type KnowledgePageRelationPredicate = 'wikilink' | 'citation' | 'shared-source' | 'contradicts';
2748
+ export type KnowledgePageRelationPredicate = 'wikilink' | 'citation' | 'shared-source' | 'contradicts';
2751
2749
  /** One labeled relation between two pages; `weight` counts the occurrences that produced it. */
2752
- interface KnowledgePageRelation extends KnowledgeRelation {
2750
+ export interface KnowledgePageRelation extends KnowledgeRelation {
2753
2751
  predicate: KnowledgePageRelationPredicate;
2754
2752
  weight: number;
2755
2753
  }
@@ -2764,24 +2762,24 @@ interface KnowledgePageRelation extends KnowledgeRelation {
2764
2762
  * implicit, so it is listed after the authored relations and never counts
2765
2763
  * toward a page's degree in `buildKnowledgeGraph`.
2766
2764
  */
2767
- declare function knowledgePageRelations(pages: KnowledgePage[]): KnowledgePageRelation[];
2765
+ export declare function knowledgePageRelations(pages: KnowledgePage[]): KnowledgePageRelation[];
2768
2766
  /**
2769
2767
  * The weighted page graph: `knowledgePageRelations` collapsed to one edge per
2770
2768
  * ordered page pair, with the predicates merged into `reasons` and the weights
2771
2769
  * summed. `contradicts` stays out of this projection; read it from the relation
2772
2770
  * list. Node degrees count the authored `wikilink` and `citation` occurrences.
2773
2771
  */
2774
- declare function buildKnowledgeGraph(pages: KnowledgePage[]): KnowledgeGraph;
2772
+ export declare function buildKnowledgeGraph(pages: KnowledgePage[]): KnowledgeGraph;
2775
2773
  //#endregion
2776
2774
  //#region src/ids.d.ts
2777
- declare function sha256(text: string): string;
2778
- declare function slugify(input: string): string;
2779
- declare function stableId(prefix: string, content: string): string;
2775
+ export declare function sha256(text: string): string;
2776
+ export declare function slugify(input: string): string;
2777
+ export declare function stableId(prefix: string, content: string): string;
2780
2778
  /** Canonical registry id for exact text submitted at one original URI. */
2781
- declare function textSourceId(uri: string, contentHash: string): string;
2779
+ export declare function textSourceId(uri: string, contentHash: string): string;
2782
2780
  //#endregion
2783
2781
  //#region src/indexer.d.ts
2784
- declare function buildKnowledgeIndex(root: string, options?: KnowledgePagesOptions): Promise<KnowledgeIndex>;
2782
+ export declare function buildKnowledgeIndex(root: string, options?: KnowledgePagesOptions): Promise<KnowledgeIndex>;
2785
2783
  /**
2786
2784
  * Build the index from the knowledge tree and store it.
2787
2785
  *
@@ -2791,10 +2789,10 @@ declare function buildKnowledgeIndex(root: string, options?: KnowledgePagesOptio
2791
2789
  * a store-based reader saw none of the indexer's work. One writer now, and it
2792
2790
  * validates through `KnowledgeIndexSchema` on the way out.
2793
2791
  */
2794
- declare function writeKnowledgeIndex(root: string, options?: KnowledgePagesOptions): Promise<KnowledgeIndex>;
2792
+ export declare function writeKnowledgeIndex(root: string, options?: KnowledgePagesOptions): Promise<KnowledgeIndex>;
2795
2793
  //#endregion
2796
2794
  //#region src/inspect.d.ts
2797
- interface KnowledgeInspection {
2795
+ export interface KnowledgeInspection {
2798
2796
  pageCount: number;
2799
2797
  sourceCount: number;
2800
2798
  expiredSourceCount: number;
@@ -2811,7 +2809,7 @@ interface KnowledgeInspection {
2811
2809
  sourceFreshness: SourceFreshnessInspection[];
2812
2810
  findings: KnowledgeLintFinding[];
2813
2811
  }
2814
- interface SourceFreshnessInspection {
2812
+ export interface SourceFreshnessInspection {
2815
2813
  id: string;
2816
2814
  title?: string;
2817
2815
  uri: string;
@@ -2819,10 +2817,10 @@ interface SourceFreshnessInspection {
2819
2817
  validUntil?: string;
2820
2818
  lastVerifiedAt?: string;
2821
2819
  }
2822
- declare function inspectKnowledgeIndex(index: KnowledgeIndex, options?: {
2820
+ export declare function inspectKnowledgeIndex(index: KnowledgeIndex, options?: {
2823
2821
  now?: Date;
2824
2822
  }): KnowledgeInspection;
2825
- interface KnowledgeExplanation {
2823
+ export interface KnowledgeExplanation {
2826
2824
  target: string;
2827
2825
  page?: KnowledgePage;
2828
2826
  sources: Array<{
@@ -2838,19 +2836,19 @@ interface KnowledgeExplanation {
2838
2836
  score: number;
2839
2837
  }>;
2840
2838
  }
2841
- declare function explainKnowledgeTarget(index: KnowledgeIndex, target: string): KnowledgeExplanation;
2839
+ export declare function explainKnowledgeTarget(index: KnowledgeIndex, target: string): KnowledgeExplanation;
2842
2840
  //#endregion
2843
2841
  //#region src/invalidation-propagation.d.ts
2844
2842
  /** Frontmatter field naming the cited pages whose evidence refuted them. */
2845
- declare const CITES_INVALIDATED_FIELD = "citesInvalidated";
2846
- interface KnowledgeInvalidationStamp {
2843
+ export declare const CITES_INVALIDATED_FIELD = "citesInvalidated";
2844
+ export interface KnowledgeInvalidationStamp {
2847
2845
  readonly page: KnowledgePage;
2848
2846
  /** The value the field must hold, sorted and deduplicated. Empty removes the field. */
2849
2847
  readonly citesInvalidated: readonly KnowledgeId[];
2850
2848
  /** The value the page holds now, in the order it is stored. */
2851
2849
  readonly current: readonly KnowledgeId[];
2852
2850
  }
2853
- interface KnowledgeInvalidationPlan {
2851
+ export interface KnowledgeInvalidationPlan {
2854
2852
  /** Every visible page carrying an invalidation, sorted by id. */
2855
2853
  readonly invalidatedPageIds: readonly KnowledgeId[];
2856
2854
  /** Only the pages whose stamp differs from what they hold, in path order. */
@@ -2864,7 +2862,7 @@ interface KnowledgeInvalidationPlan {
2864
2862
  * citing a refuted inherited or shared page. Only `here` pages are stamped: a
2865
2863
  * run does not write the stores it inherits or shares.
2866
2864
  */
2867
- declare function planInvalidationPropagation(visiblePages: readonly OriginatedPage[]): KnowledgeInvalidationPlan;
2865
+ export declare function planInvalidationPropagation(visiblePages: readonly OriginatedPage[]): KnowledgeInvalidationPlan;
2868
2866
  /**
2869
2867
  * Render one plan as a write-block proposal for `applyKnowledgeWriteBlocks`.
2870
2868
  *
@@ -2872,7 +2870,7 @@ declare function planInvalidationPropagation(visiblePages: readonly OriginatedPa
2872
2870
  * `formatFrontmatter`, so its frontmatter is written in that writer's
2873
2871
  * normalized form.
2874
2872
  */
2875
- declare function formatKnowledgeInvalidationProposal(plan: KnowledgeInvalidationPlan): string;
2873
+ export declare function formatKnowledgeInvalidationProposal(plan: KnowledgeInvalidationPlan): string;
2876
2874
  //#endregion
2877
2875
  //#region src/investment-thesis-set.d.ts
2878
2876
  /**
@@ -2923,16 +2921,16 @@ declare function formatKnowledgeInvalidationProposal(plan: KnowledgeInvalidation
2923
2921
  * numbers / names.
2924
2922
  */
2925
2923
  /** A required answer component: satisfied when any synonym fragment is present. */
2926
- interface ExpectedGroup {
2924
+ export interface ExpectedGroup {
2927
2925
  /** Human label for the component (for the doc / audit). */
2928
2926
  label: string;
2929
2927
  /** Case-insensitive substring fragments; any one present satisfies the group. */
2930
2928
  anyOf: string[];
2931
2929
  }
2932
2930
  /** Lens the fact belongs to — so a set can be checked for category coverage. */
2933
- type MaterialFactLens = 'concentration' | 'leverage' | 'margin-trend' | 'liquidity' | 'capital-return' | 'governance' | 'off-balance-sheet' | 'regulatory';
2931
+ export type MaterialFactLens = 'concentration' | 'leverage' | 'margin-trend' | 'liquidity' | 'capital-return' | 'governance' | 'off-balance-sheet' | 'regulatory';
2934
2932
  /** One held-out material fact with a checkable expected answer + its provenance. */
2935
- interface MaterialFact {
2933
+ export interface MaterialFact {
2936
2934
  /** Stable id, `ticker/fN`. */
2937
2935
  id: string;
2938
2936
  /** Which analyst lens this fact exercises. For coverage + the doc. */
@@ -2967,7 +2965,7 @@ interface MaterialFact {
2967
2965
  evidence: string;
2968
2966
  }
2969
2967
  /** A company + the cutoff a loop researches as-of + its held-out material facts. */
2970
- interface CompanyEvalCase {
2968
+ export interface CompanyEvalCase {
2971
2969
  /** Ticker as of the cutoff. */
2972
2970
  ticker: string;
2973
2971
  /** Legal name as of the cutoff (what the loop is told to research). */
@@ -3003,33 +3001,33 @@ interface CompanyEvalCase {
3003
3001
  * drivers and with survivors. This set is honest about that and reports the lens
3004
3002
  * distribution so the bias is measurable, not hidden.
3005
3003
  */
3006
- declare const investmentThesisSet: CompanyEvalCase[];
3004
+ export declare const investmentThesisSet: CompanyEvalCase[];
3007
3005
  /**
3008
3006
  * Grade ONE material fact against an investment thesis's full text. Returns
3009
3007
  * whether the thesis SURFACED it plus which expected groups were found. The
3010
3008
  * check is a deterministic case-insensitive substring scan — $0, model-free,
3011
3009
  * reproducible — so the eval never leaks into a model the loop could observe.
3012
3010
  */
3013
- declare function gradeFactAgainstText(fact: MaterialFact, thesisText: string): {
3011
+ export declare function gradeFactAgainstText(fact: MaterialFact, thesisText: string): {
3014
3012
  surfaced: boolean;
3015
3013
  groupsFound: number;
3016
3014
  groupsTotal: number;
3017
3015
  foundLabels: string[];
3018
3016
  };
3019
3017
  /** Grade a whole company's thesis text: how many of its held-out facts it surfaces. */
3020
- declare function gradeCompanyAgainstText(company: CompanyEvalCase, thesisText: string): {
3018
+ export declare function gradeCompanyAgainstText(company: CompanyEvalCase, thesisText: string): {
3021
3019
  surfaced: number;
3022
3020
  total: number;
3023
3021
  perFact: ReturnType<typeof gradeFactAgainstText>[];
3024
3022
  };
3025
3023
  /** Total held-out facts across the set (the denominator the doc reports). */
3026
- declare function totalMaterialFacts(set?: CompanyEvalCase[]): number;
3024
+ export declare function totalMaterialFacts(set?: CompanyEvalCase[]): number;
3027
3025
  /** Count facts per lens across the set — used to report (and bound) curation bias. */
3028
- declare function lensDistribution(set?: CompanyEvalCase[]): Record<MaterialFactLens, number>;
3026
+ export declare function lensDistribution(set?: CompanyEvalCase[]): Record<MaterialFactLens, number>;
3029
3027
  //#endregion
3030
3028
  //#region src/investment-thesis-task.d.ts
3031
3029
  /** The minimal brief a thesis run is given — the firewall boundary. */
3032
- interface ThesisTaskInput {
3030
+ export interface ThesisTaskInput {
3033
3031
  /** Legal name as of the cutoff — what the loop researches. */
3034
3032
  company: string;
3035
3033
  /** Ticker as of the cutoff. */
@@ -3053,8 +3051,8 @@ interface ThesisTaskInput {
3053
3051
  * fetch and the loop runs multiple rounds — the depth-driving driver needs >1
3054
3052
  * round to steer, exactly as the ML-exam multi-round probe established.
3055
3053
  */
3056
- declare function thesisReadinessSpecs(input: ThesisTaskInput): KnowledgeReadinessSpec[];
3057
- interface ThesisRunOptions {
3054
+ export declare function thesisReadinessSpecs(input: ThesisTaskInput): KnowledgeReadinessSpec[];
3055
+ export interface ThesisRunOptions {
3058
3056
  /** The KB root the loop writes into. */
3059
3057
  root: string;
3060
3058
  /** Shared router client (web search + chat). Defaults to env creds. */
@@ -3069,7 +3067,7 @@ interface ThesisRunOptions {
3069
3067
  synthesisMaxTokens?: number;
3070
3068
  signal?: AbortSignal;
3071
3069
  }
3072
- interface ThesisRunResult {
3070
+ export interface ThesisRunResult {
3073
3071
  loop: VerifiedResearchLoopResult;
3074
3072
  /** The synthesized thesis text. */
3075
3073
  thesis: string;
@@ -3082,7 +3080,7 @@ interface ThesisRunResult {
3082
3080
  * + the thesis text + the page path. The caller grades the KB with
3083
3081
  * `materialFactsSurfaced(root, checklist)` — the checklist is never passed here.
3084
3082
  */
3085
- declare function runInvestmentThesisTask(input: ThesisTaskInput, options: ThesisRunOptions): Promise<ThesisRunResult>;
3083
+ export declare function runInvestmentThesisTask(input: ThesisTaskInput, options: ThesisRunOptions): Promise<ThesisRunResult>;
3086
3084
  //#endregion
3087
3085
  //#region src/kb-store.d.ts
3088
3086
  /**
@@ -3096,18 +3094,18 @@ declare function runInvestmentThesisTask(input: ThesisTaskInput, options: Thesis
3096
3094
  * `FileSystemKbStore`, anchored on the knowledge-base root, which is also the
3097
3095
  * directory `withKnowledgeMutation` locks: one file, one lock domain.
3098
3096
  */
3099
- declare const KB_STORE_DIR = ".agent-knowledge";
3100
- declare const KB_INDEX_PATH = ".agent-knowledge/index.json";
3101
- declare const KB_EVENTS_PATH = ".agent-knowledge/events.json";
3102
- declare const KB_CLAIM_LEDGER_DIR = ".agent-knowledge/claim-ledgers";
3103
- declare function assertClaimLedgerId(id: string): string;
3097
+ export declare const KB_STORE_DIR = ".agent-knowledge";
3098
+ export declare const KB_INDEX_PATH = ".agent-knowledge/index.json";
3099
+ export declare const KB_EVENTS_PATH = ".agent-knowledge/events.json";
3100
+ export declare const KB_CLAIM_LEDGER_DIR = ".agent-knowledge/claim-ledgers";
3101
+ export declare function assertClaimLedgerId(id: string): string;
3104
3102
  /** A URI-only ledger cannot be upgraded without re-verifying its source bytes. */
3105
- declare class ClaimLedgerMigrationRequiredError extends Error {
3103
+ export declare class ClaimLedgerMigrationRequiredError extends Error {
3106
3104
  readonly ledgerId: string;
3107
3105
  readonly foundSchemaVersion: number | 'unversioned';
3108
3106
  constructor(ledgerId: string, foundSchemaVersion: number | 'unversioned');
3109
3107
  }
3110
- interface KbStore {
3108
+ export interface KbStore {
3111
3109
  putSource(source: SourceRecord): Promise<void>;
3112
3110
  getSource(id: string): Promise<SourceRecord | null>;
3113
3111
  listSources(): Promise<SourceRecord[]>;
@@ -3120,7 +3118,7 @@ interface KbStore {
3120
3118
  listEvents(query?: KnowledgeEventQuery): Promise<KnowledgeEvent[]>;
3121
3119
  }
3122
3120
  /** Optional durable capability for stores that retain per-run research belief. */
3123
- interface ClaimLedgerStore {
3121
+ export interface ClaimLedgerStore {
3124
3122
  /**
3125
3123
  * Persist one research run's claim ledger — the corroboration counts,
3126
3124
  * contradiction edges, and open deep questions that make up its belief state.
@@ -3146,7 +3144,7 @@ interface ClaimLedgerStore {
3146
3144
  */
3147
3145
  mergeClaimLedger(id: string, merge: (current: ResearchClaimLedger | null) => ResearchClaimLedger): Promise<ResearchClaimLedger>;
3148
3146
  }
3149
- declare class MemoryKbStore implements KbStore, ClaimLedgerStore {
3147
+ export declare class MemoryKbStore implements KbStore, ClaimLedgerStore {
3150
3148
  private readonly sources;
3151
3149
  private readonly pages;
3152
3150
  private readonly events;
@@ -3175,11 +3173,11 @@ declare class MemoryKbStore implements KbStore, ClaimLedgerStore {
3175
3173
  * `writeKnowledgeIndex`. The string constructor preserves the published direct
3176
3174
  * record-directory layout (`<directory>/index.json`).
3177
3175
  */
3178
- interface FileSystemKbStoreOptions {
3176
+ export interface FileSystemKbStoreOptions {
3179
3177
  /** Knowledge-base root; records are stored under `<root>/.agent-knowledge/`. */
3180
3178
  root: string;
3181
3179
  }
3182
- declare class FileSystemKbStore implements KbStore, ClaimLedgerStore {
3180
+ export declare class FileSystemKbStore implements KbStore, ClaimLedgerStore {
3183
3181
  private readonly root;
3184
3182
  private readonly indexPath;
3185
3183
  private readonly eventsPath;
@@ -3212,29 +3210,29 @@ declare class FileSystemKbStore implements KbStore, ClaimLedgerStore {
3212
3210
  }
3213
3211
  //#endregion
3214
3212
  //#region src/knowledge-visibility.d.ts
3215
- declare const KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION: '2.0.0';
3216
- declare const KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM: 'rfc8785-sha256';
3213
+ export declare const KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION: '2.0.0';
3214
+ export declare const KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM: 'rfc8785-sha256';
3217
3215
  /** Stable content identity for one exact knowledge page. */
3218
- declare function knowledgePageDigest(page: KnowledgePage): Sha256Digest;
3216
+ export declare function knowledgePageDigest(page: KnowledgePage): Sha256Digest;
3219
3217
  /** Snapshot the exact ordered current/ancestor/shared page view. */
3220
- declare function createKnowledgeVisibilitySnapshot(visiblePages: readonly OriginatedPage[]): KnowledgeVisibilitySnapshot;
3218
+ export declare function createKnowledgeVisibilitySnapshot(visiblePages: readonly OriginatedPage[]): KnowledgeVisibilitySnapshot;
3221
3219
  /**
3222
3220
  * Verify a snapshot's schema and canonical digest. The check runs once per
3223
3221
  * snapshot object; later calls with the same object are free.
3224
3222
  */
3225
- declare function verifyKnowledgeVisibilitySnapshot(snapshot: KnowledgeVisibilitySnapshot): KnowledgeVisibilitySnapshot;
3223
+ export declare function verifyKnowledgeVisibilitySnapshot(snapshot: KnowledgeVisibilitySnapshot): KnowledgeVisibilitySnapshot;
3226
3224
  /** Canonical bytes of a verified snapshot, for durable storage. */
3227
- declare function encodeKnowledgeVisibilitySnapshot(snapshot: KnowledgeVisibilitySnapshot): Uint8Array;
3225
+ export declare function encodeKnowledgeVisibilitySnapshot(snapshot: KnowledgeVisibilitySnapshot): Uint8Array;
3228
3226
  /** Parse stored snapshot bytes and verify their schema and digest. */
3229
- declare function decodeKnowledgeVisibilitySnapshot(bytes: Uint8Array): KnowledgeVisibilitySnapshot;
3227
+ export declare function decodeKnowledgeVisibilitySnapshot(bytes: Uint8Array): KnowledgeVisibilitySnapshot;
3230
3228
  /** Locator for snapshot bytes stored at `uri`. */
3231
- declare function knowledgeVisibilityArtifactRef(input: {
3229
+ export declare function knowledgeVisibilityArtifactRef(input: {
3232
3230
  uri: string;
3233
3231
  bytes: Uint8Array;
3234
3232
  }): KnowledgeVisibilityArtifactRef;
3235
3233
  //#endregion
3236
3234
  //#region src/knowledge-use-receipts.d.ts
3237
- interface KnowledgeVisibilitySnapshotEntry {
3235
+ export interface KnowledgeVisibilitySnapshotEntry {
3238
3236
  readonly position: number;
3239
3237
  readonly pageId: string;
3240
3238
  readonly origin: PageOrigin;
@@ -3244,14 +3242,14 @@ interface KnowledgeVisibilitySnapshotEntry {
3244
3242
  readonly invalidated: boolean;
3245
3243
  }
3246
3244
  /** Exact ordered page visibility presented to one retrieval operation. */
3247
- interface KnowledgeVisibilitySnapshot {
3245
+ export interface KnowledgeVisibilitySnapshot {
3248
3246
  readonly schemaVersion: typeof KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION;
3249
3247
  readonly digestAlgorithm: typeof KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM;
3250
3248
  readonly snapshotDigest: Sha256Digest;
3251
3249
  readonly entries: readonly KnowledgeVisibilitySnapshotEntry[];
3252
3250
  }
3253
3251
  /** Content-addressed locator of the stored bytes of one visibility snapshot. */
3254
- interface KnowledgeVisibilityArtifactRef {
3252
+ export interface KnowledgeVisibilityArtifactRef {
3255
3253
  readonly uri: string;
3256
3254
  /** Digest of the stored bytes, as `knowledgeVisibilityArtifactRef` computes it. */
3257
3255
  readonly digest: Sha256Digest;
@@ -3262,12 +3260,12 @@ interface KnowledgeVisibilityArtifactRef {
3262
3260
  * the artifact the reference names, or in another durable record the caller
3263
3261
  * keeps; the receipt carries only this reference.
3264
3262
  */
3265
- interface KnowledgeVisibilityRef {
3263
+ export interface KnowledgeVisibilityRef {
3266
3264
  readonly snapshotDigest: Sha256Digest;
3267
3265
  readonly pageCount: number;
3268
3266
  readonly artifact?: KnowledgeVisibilityArtifactRef;
3269
3267
  }
3270
- interface KnowledgeRetrieverIdentity {
3268
+ export interface KnowledgeRetrieverIdentity {
3271
3269
  /** Stable implementation name, for example `token-overlap-v1`. */
3272
3270
  readonly id: string;
3273
3271
  /** Published or application-defined implementation version. */
@@ -3275,10 +3273,10 @@ interface KnowledgeRetrieverIdentity {
3275
3273
  /** Exact identity of every retrieval setting not represented elsewhere. */
3276
3274
  readonly configDigest: Sha256Digest;
3277
3275
  }
3278
- interface OriginatedKnowledgeSearchResult extends KnowledgeSearchResult {
3276
+ export interface OriginatedKnowledgeSearchResult extends KnowledgeSearchResult {
3279
3277
  readonly origin: PageOrigin;
3280
3278
  }
3281
- interface KnowledgeRetrievalResultReceipt {
3279
+ export interface KnowledgeRetrievalResultReceipt {
3282
3280
  readonly rank: number;
3283
3281
  readonly pageId: string;
3284
3282
  readonly origin: PageOrigin;
@@ -3289,12 +3287,12 @@ interface KnowledgeRetrievalResultReceipt {
3289
3287
  readonly snippet: string;
3290
3288
  readonly reasons: readonly string[];
3291
3289
  }
3292
- type KnowledgeReceiptAttributeValue = string | number | boolean | null;
3290
+ export type KnowledgeReceiptAttributeValue = string | number | boolean | null;
3293
3291
  /**
3294
3292
  * Immutable proof of what one actor could see and what its retriever returned.
3295
3293
  * Final prose is not evidence that retrieval happened; this receipt is.
3296
3294
  */
3297
- interface KnowledgeRetrievalReceipt {
3295
+ export interface KnowledgeRetrievalReceipt {
3298
3296
  readonly schemaVersion: typeof KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION;
3299
3297
  readonly kind: 'knowledge-retrieval';
3300
3298
  readonly digestAlgorithm: typeof KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM;
@@ -3311,7 +3309,7 @@ interface KnowledgeRetrievalReceipt {
3311
3309
  readonly evidenceRefs: readonly EvidenceRef[];
3312
3310
  readonly attributes: Readonly<Record<string, KnowledgeReceiptAttributeValue>>;
3313
3311
  }
3314
- interface CreateKnowledgeRetrievalReceiptInput {
3312
+ export interface CreateKnowledgeRetrievalReceiptInput {
3315
3313
  readonly runId: string;
3316
3314
  readonly actorId?: string;
3317
3315
  readonly profileDigest?: Sha256Digest;
@@ -3336,14 +3334,14 @@ interface CreateKnowledgeRetrievalReceiptInput {
3336
3334
  * Returns the stored bytes of the artifact, or `undefined` when nothing is
3337
3335
  * stored at its uri. A thrown error is reported as a load failure.
3338
3336
  */
3339
- type KnowledgeVisibilityArtifactLoader = (artifact: KnowledgeVisibilityArtifactRef) => Promise<Uint8Array | undefined> | Uint8Array | undefined;
3340
- type KnowledgeVisibilityUnavailableReason = 'no-artifact-reference' | 'missing' | 'load-failed';
3337
+ export type KnowledgeVisibilityArtifactLoader = (artifact: KnowledgeVisibilityArtifactRef) => Promise<Uint8Array | undefined> | Uint8Array | undefined;
3338
+ export type KnowledgeVisibilityUnavailableReason = 'no-artifact-reference' | 'missing' | 'load-failed';
3341
3339
  /**
3342
3340
  * The visibility snapshot a receipt references could not be obtained, so the
3343
3341
  * result-to-visibility join cannot be proven. This is distinct from a snapshot
3344
3342
  * that loads and fails to match.
3345
3343
  */
3346
- declare class KnowledgeVisibilityUnavailableError extends Error {
3344
+ export declare class KnowledgeVisibilityUnavailableError extends Error {
3347
3345
  readonly reason: KnowledgeVisibilityUnavailableReason;
3348
3346
  readonly snapshotDigest: Sha256Digest;
3349
3347
  readonly uri?: string;
@@ -3354,14 +3352,14 @@ declare class KnowledgeVisibilityUnavailableError extends Error {
3354
3352
  cause?: unknown;
3355
3353
  });
3356
3354
  }
3357
- type KnowledgeUseRelation = 'supports' | 'contradicts' | 'extends' | 'rederives' | 'background';
3358
- type KnowledgeConsumerKind = 'decision' | 'artifact' | 'experiment' | 'candidate' | 'message' | 'other';
3359
- interface KnowledgeConsumerRef {
3355
+ export type KnowledgeUseRelation = 'supports' | 'contradicts' | 'extends' | 'rederives' | 'background';
3356
+ export type KnowledgeConsumerKind = 'decision' | 'artifact' | 'experiment' | 'candidate' | 'message' | 'other';
3357
+ export interface KnowledgeConsumerRef {
3360
3358
  readonly kind: KnowledgeConsumerKind;
3361
3359
  readonly uri: string;
3362
3360
  readonly digest?: Sha256Digest;
3363
3361
  }
3364
- interface KnowledgeUsedResult {
3362
+ export interface KnowledgeUsedResult {
3365
3363
  readonly rank: number;
3366
3364
  readonly pageId: string;
3367
3365
  readonly origin: PageOrigin;
@@ -3372,7 +3370,7 @@ interface KnowledgeUsedResult {
3372
3370
  * Immutable proof that one retrieved page was selected for a downstream
3373
3371
  * decision, artifact, experiment, candidate, or message.
3374
3372
  */
3375
- interface KnowledgeUseReceipt {
3373
+ export interface KnowledgeUseReceipt {
3376
3374
  readonly schemaVersion: typeof KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION;
3377
3375
  readonly kind: 'knowledge-use';
3378
3376
  readonly digestAlgorithm: typeof KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM;
@@ -3389,7 +3387,7 @@ interface KnowledgeUseReceipt {
3389
3387
  readonly evidenceRefs: readonly EvidenceRef[];
3390
3388
  readonly attributes: Readonly<Record<string, KnowledgeReceiptAttributeValue>>;
3391
3389
  }
3392
- interface CreateKnowledgeUseReceiptInput {
3390
+ export interface CreateKnowledgeUseReceiptInput {
3393
3391
  readonly retrieval: KnowledgeRetrievalReceipt;
3394
3392
  /** Exact one-based rank from the retrieval receipt. */
3395
3393
  readonly selectedRank: number;
@@ -3405,7 +3403,7 @@ interface CreateKnowledgeUseReceiptInput {
3405
3403
  * `irrelevant` means the returned pages did not bear on the question.
3406
3404
  * `no-use` means they did bear on it and the consumer still used none of them.
3407
3405
  */
3408
- type KnowledgeRetrievalDispositionRelation = 'irrelevant' | 'no-use';
3406
+ export type KnowledgeRetrievalDispositionRelation = 'irrelevant' | 'no-use';
3409
3407
  /**
3410
3408
  * Immutable proof that one retrieval led to no use.
3411
3409
  *
@@ -3413,7 +3411,7 @@ type KnowledgeRetrievalDispositionRelation = 'irrelevant' | 'no-use';
3413
3411
  * nothing would otherwise leave no record at all, and "no evidence of use" and
3414
3412
  * "evidence of no use" would look identical in the ledger.
3415
3413
  */
3416
- interface KnowledgeRetrievalDisposition {
3414
+ export interface KnowledgeRetrievalDisposition {
3417
3415
  readonly schemaVersion: typeof KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION;
3418
3416
  readonly kind: 'knowledge-retrieval-disposition';
3419
3417
  readonly digestAlgorithm: typeof KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM;
@@ -3429,7 +3427,7 @@ interface KnowledgeRetrievalDisposition {
3429
3427
  readonly evidenceRefs: readonly EvidenceRef[];
3430
3428
  readonly attributes: Readonly<Record<string, KnowledgeReceiptAttributeValue>>;
3431
3429
  }
3432
- interface CreateKnowledgeRetrievalDispositionInput {
3430
+ export interface CreateKnowledgeRetrievalDispositionInput {
3433
3431
  readonly retrieval: KnowledgeRetrievalReceipt;
3434
3432
  readonly relation: KnowledgeRetrievalDispositionRelation;
3435
3433
  readonly consumer: KnowledgeConsumerRef;
@@ -3442,7 +3440,7 @@ interface CreateKnowledgeRetrievalDispositionInput {
3442
3440
  * occur in the snapshot with the same page id and bytes; the receipt stores the
3443
3441
  * snapshot's reference, not its entries.
3444
3442
  */
3445
- declare function createKnowledgeRetrievalReceipt(input: CreateKnowledgeRetrievalReceiptInput): KnowledgeRetrievalReceipt;
3443
+ export declare function createKnowledgeRetrievalReceipt(input: CreateKnowledgeRetrievalReceiptInput): KnowledgeRetrievalReceipt;
3446
3444
  /**
3447
3445
  * Verify the receipt's schema, canonical digest, rank continuity, finite
3448
3446
  * scores, and well-formed visibility reference. This proves what the receipt
@@ -3450,28 +3448,28 @@ declare function createKnowledgeRetrievalReceipt(input: CreateKnowledgeRetrieval
3450
3448
  * Use `assertKnowledgeRetrievalMatchesVisibility` or
3451
3449
  * `assertKnowledgeRetrievalMatchesVisibilityArtifact` for that join.
3452
3450
  */
3453
- declare function verifyKnowledgeRetrievalReceipt(receipt: KnowledgeRetrievalReceipt): KnowledgeRetrievalReceipt;
3451
+ export declare function verifyKnowledgeRetrievalReceipt(receipt: KnowledgeRetrievalReceipt): KnowledgeRetrievalReceipt;
3454
3452
  /**
3455
3453
  * Prove that the receipt references exactly this snapshot and that every
3456
3454
  * returned result occurs in it with the same page id and bytes. Pass the
3457
3455
  * snapshot itself, or the originated pages to snapshot them first.
3458
3456
  */
3459
- declare function assertKnowledgeRetrievalMatchesVisibility(receipt: KnowledgeRetrievalReceipt, visibility: KnowledgeVisibilitySnapshot | readonly OriginatedPage[]): void;
3457
+ export declare function assertKnowledgeRetrievalMatchesVisibility(receipt: KnowledgeRetrievalReceipt, visibility: KnowledgeVisibilitySnapshot | readonly OriginatedPage[]): void;
3460
3458
  /**
3461
3459
  * Load the snapshot artifact the receipt references, prove the stored bytes
3462
3460
  * match the reference, and prove every returned result occurs in the decoded
3463
3461
  * snapshot. A snapshot that cannot be obtained raises
3464
3462
  * `KnowledgeVisibilityUnavailableError`; it is never treated as empty.
3465
3463
  */
3466
- declare function assertKnowledgeRetrievalMatchesVisibilityArtifact(receipt: KnowledgeRetrievalReceipt, loadArtifact: KnowledgeVisibilityArtifactLoader): Promise<KnowledgeVisibilitySnapshot>;
3464
+ export declare function assertKnowledgeRetrievalMatchesVisibilityArtifact(receipt: KnowledgeRetrievalReceipt, loadArtifact: KnowledgeVisibilityArtifactLoader): Promise<KnowledgeVisibilitySnapshot>;
3467
3465
  /** Create a downstream-use receipt for one exact ranked result. */
3468
- declare function createKnowledgeUseReceipt(input: CreateKnowledgeUseReceiptInput): KnowledgeUseReceipt;
3466
+ export declare function createKnowledgeUseReceipt(input: CreateKnowledgeUseReceiptInput): KnowledgeUseReceipt;
3469
3467
  /** Verify one use receipt against the exact retrieval that authorized it. */
3470
- declare function verifyKnowledgeUseReceipt(receipt: KnowledgeUseReceipt, retrieval: KnowledgeRetrievalReceipt): KnowledgeUseReceipt;
3468
+ export declare function verifyKnowledgeUseReceipt(receipt: KnowledgeUseReceipt, retrieval: KnowledgeRetrievalReceipt): KnowledgeUseReceipt;
3471
3469
  /** Record that one retrieval led to no use, with no rank to select. */
3472
- declare function createKnowledgeRetrievalDisposition(input: CreateKnowledgeRetrievalDispositionInput): KnowledgeRetrievalDisposition;
3470
+ export declare function createKnowledgeRetrievalDisposition(input: CreateKnowledgeRetrievalDispositionInput): KnowledgeRetrievalDisposition;
3473
3471
  /** Verify one disposition against the exact retrieval that authorized it. */
3474
- declare function verifyKnowledgeRetrievalDisposition(disposition: KnowledgeRetrievalDisposition, retrieval: KnowledgeRetrievalReceipt): KnowledgeRetrievalDisposition;
3472
+ export declare function verifyKnowledgeRetrievalDisposition(disposition: KnowledgeRetrievalDisposition, retrieval: KnowledgeRetrievalReceipt): KnowledgeRetrievalDisposition;
3475
3473
  //#endregion
3476
3474
  //#region src/lexical-index.d.ts
3477
3475
  /**
@@ -3481,10 +3479,10 @@ declare function verifyKnowledgeRetrievalDisposition(disposition: KnowledgeRetri
3481
3479
  * frequency can be counted. Indexing and querying share this function, so the
3482
3480
  * two vocabularies cannot drift.
3483
3481
  */
3484
- declare function tokenizeText(text: string): string[];
3482
+ export declare function tokenizeText(text: string): string[];
3485
3483
  /** The distinct query terms, in first-occurrence order. */
3486
- declare function tokenizeQuery(query: string): string[];
3487
- interface KnowledgeLexicalFieldBoosts {
3484
+ export declare function tokenizeQuery(query: string): string[];
3485
+ export interface KnowledgeLexicalFieldBoosts {
3488
3486
  /** Multiplier for a term occurrence in the page title. Defaults to 3. */
3489
3487
  title?: number;
3490
3488
  /** Multiplier for a term occurrence in the page path without its extension. Defaults to 2. */
@@ -3492,12 +3490,12 @@ interface KnowledgeLexicalFieldBoosts {
3492
3490
  /** Multiplier for a term occurrence in the page body. Defaults to 1. */
3493
3491
  text?: number;
3494
3492
  }
3495
- interface KnowledgeLexicalIndexOptions {
3493
+ export interface KnowledgeLexicalIndexOptions {
3496
3494
  /** Token stream of one text. Defaults to `tokenizeText`. */
3497
3495
  tokenize?: (text: string) => string[];
3498
3496
  fieldBoosts?: KnowledgeLexicalFieldBoosts;
3499
3497
  }
3500
- interface KnowledgeLexicalPosting {
3498
+ export interface KnowledgeLexicalPosting {
3501
3499
  /** Position of the page in `KnowledgeLexicalIndex.pages`. */
3502
3500
  ordinal: number;
3503
3501
  /** Field-boosted term frequency in that page. */
@@ -3509,7 +3507,7 @@ interface KnowledgeLexicalPosting {
3509
3507
  * Ordinals are positions in `pages`. `documentLengths` are field-boosted token
3510
3508
  * counts, so length normalization and term frequency use one scale.
3511
3509
  */
3512
- interface KnowledgeLexicalIndex {
3510
+ export interface KnowledgeLexicalIndex {
3513
3511
  readonly pages: readonly KnowledgePage[];
3514
3512
  readonly postings: ReadonlyMap<string, readonly KnowledgeLexicalPosting[]>;
3515
3513
  readonly documentLengths: readonly number[];
@@ -3518,24 +3516,24 @@ interface KnowledgeLexicalIndex {
3518
3516
  readonly tokenize: (text: string) => string[];
3519
3517
  readonly fieldBoosts: Readonly<Required<KnowledgeLexicalFieldBoosts>>;
3520
3518
  }
3521
- interface Bm25Options {
3519
+ export interface Bm25Options {
3522
3520
  /** Term-frequency saturation. Defaults to 1.2. */
3523
3521
  k1?: number;
3524
3522
  /** Length-normalization strength in [0, 1]. Defaults to 0.75. */
3525
3523
  b?: number;
3526
3524
  }
3527
- interface Bm25Hit {
3525
+ export interface Bm25Hit {
3528
3526
  page: KnowledgePage;
3529
3527
  score: number;
3530
3528
  }
3531
- declare function buildKnowledgeLexicalIndex(pages: readonly KnowledgePage[], options?: KnowledgeLexicalIndexOptions): KnowledgeLexicalIndex;
3529
+ export declare function buildKnowledgeLexicalIndex(pages: readonly KnowledgePage[], options?: KnowledgeLexicalIndexOptions): KnowledgeLexicalIndex;
3532
3530
  /**
3533
3531
  * Okapi BM25 over the distinct query terms, with the Lucene inverse document
3534
3532
  * frequency `ln(1 + (N - df + 0.5) / (df + 0.5))`, which is positive for every
3535
3533
  * indexed term. Pages with no matching term are absent. The result is ordered
3536
3534
  * by score, then by path, so it does not depend on page order.
3537
3535
  */
3538
- declare function scoreBm25(index: KnowledgeLexicalIndex, tokens: readonly string[], options?: Bm25Options): Bm25Hit[];
3536
+ export declare function scoreBm25(index: KnowledgeLexicalIndex, tokens: readonly string[], options?: Bm25Options): Bm25Hit[];
3539
3537
  //#endregion
3540
3538
  //#region src/search.d.ts
3541
3539
  /**
@@ -3544,8 +3542,8 @@ declare function scoreBm25(index: KnowledgeLexicalIndex, tokens: readonly string
3544
3542
  * reciprocal rank fusion with link and shared-source structure. Declare it as
3545
3543
  * the retriever id of a retrieval receipt minted from these results.
3546
3544
  */
3547
- declare const KNOWLEDGE_SEARCH_RETRIEVER_ID = "bm25-rrf-v1";
3548
- interface SearchKnowledgeOptions {
3545
+ export declare const KNOWLEDGE_SEARCH_RETRIEVER_ID = "bm25-rrf-v1";
3546
+ export interface SearchKnowledgeOptions {
3549
3547
  /** Maximum results returned. Defaults to 10. */
3550
3548
  limit?: number;
3551
3549
  /** Match pages whose stable id is one of these values. */
@@ -3576,24 +3574,24 @@ interface SearchKnowledgeOptions {
3576
3574
  * through the citation resolver. Later writes should persist the returned value. Keeping it at the result's top level prevents tool
3577
3575
  * renderers from accidentally hiding the only stable handle a model can copy.
3578
3576
  */
3579
- interface KnowledgeSearchHit extends KnowledgeSearchResult {
3577
+ export interface KnowledgeSearchHit extends KnowledgeSearchResult {
3580
3578
  citationId: KnowledgeId;
3581
3579
  }
3582
- declare function searchKnowledge(index: KnowledgeIndex, query: string, limit?: number): KnowledgeSearchHit[];
3583
- declare function searchKnowledge(index: KnowledgeIndex, query: string, options?: SearchKnowledgeOptions): KnowledgeSearchHit[];
3580
+ export declare function searchKnowledge(index: KnowledgeIndex, query: string, limit?: number): KnowledgeSearchHit[];
3581
+ export declare function searchKnowledge(index: KnowledgeIndex, query: string, options?: SearchKnowledgeOptions): KnowledgeSearchHit[];
3584
3582
  /**
3585
3583
  * Rank a page set that is not a built index, such as the chain a run can see.
3586
3584
  *
3587
3585
  * `searchKnowledge` is this function over `index.pages`, so both entry points
3588
3586
  * rank identically and neither can drift from the other.
3589
3587
  */
3590
- declare function searchKnowledgePages(pages: readonly KnowledgePage[], query: string, limitOrOptions?: number | SearchKnowledgeOptions): KnowledgeSearchHit[];
3591
- declare function reciprocalRankFusion(rankLists: string[][], k?: number): Map<string, number>;
3588
+ export declare function searchKnowledgePages(pages: readonly KnowledgePage[], query: string, limitOrOptions?: number | SearchKnowledgeOptions): KnowledgeSearchHit[];
3589
+ export declare function reciprocalRankFusion(rankLists: string[][], k?: number): Map<string, number>;
3592
3590
  //#endregion
3593
3591
  //#region src/knowledge-brief.d.ts
3594
3592
  /** Pages in a brief when the caller names no limit. */
3595
- declare const DEFAULT_KNOWLEDGE_BRIEF_LIMIT = 5;
3596
- interface KnowledgeBriefOptions {
3593
+ export declare const DEFAULT_KNOWLEDGE_BRIEF_LIMIT = 5;
3594
+ export interface KnowledgeBriefOptions {
3597
3595
  /** Maximum pages in the brief. Defaults to 5. */
3598
3596
  limit?: number;
3599
3597
  /**
@@ -3614,7 +3612,7 @@ interface KnowledgeBriefOptions {
3614
3612
  */
3615
3613
  maxChars?: number;
3616
3614
  }
3617
- interface KnowledgeBrief {
3615
+ export interface KnowledgeBrief {
3618
3616
  readonly question: string;
3619
3617
  /** Retriever id to declare in a receipt minted from `results`. */
3620
3618
  readonly retrieverId: typeof KNOWLEDGE_SEARCH_RETRIEVER_ID;
@@ -3638,10 +3636,10 @@ interface KnowledgeBrief {
3638
3636
  * The same page set produces the same brief on every run: ranking, ordering,
3639
3637
  * and rendering are deterministic, and no field carries a timestamp.
3640
3638
  */
3641
- declare function buildKnowledgeBrief(visiblePages: readonly OriginatedPage[], question: string, options?: KnowledgeBriefOptions): KnowledgeBrief;
3639
+ export declare function buildKnowledgeBrief(visiblePages: readonly OriginatedPage[], question: string, options?: KnowledgeBriefOptions): KnowledgeBrief;
3642
3640
  //#endregion
3643
3641
  //#region src/knowledge-tools.d.ts
3644
- interface CreateKnowledgeToolsOptions {
3642
+ export interface CreateKnowledgeToolsOptions {
3645
3643
  readonly stores: RunScopedStores;
3646
3644
  /** The run whose store is written and whose chain is read. */
3647
3645
  readonly runId: string;
@@ -3667,14 +3665,14 @@ interface CreateKnowledgeToolsOptions {
3667
3665
  * The four tools an agent needs to use a knowledge store: search, read, record,
3668
3666
  * resolve.
3669
3667
  */
3670
- declare function createKnowledgeTools(options: CreateKnowledgeToolsOptions): ToolDefinition[];
3668
+ export declare function createKnowledgeTools(options: CreateKnowledgeToolsOptions): ToolDefinition[];
3671
3669
  //#endregion
3672
3670
  //#region src/lint.d.ts
3673
- declare function lintKnowledgeIndex(index: KnowledgeIndex): KnowledgeLintFinding[];
3671
+ export declare function lintKnowledgeIndex(index: KnowledgeIndex): KnowledgeLintFinding[];
3674
3672
  //#endregion
3675
3673
  //#region src/material-facts-metric.d.ts
3676
3674
  /** Per-fact grade plus the fact's id/lens, for the audit trail. */
3677
- interface FactResult {
3675
+ export interface FactResult {
3678
3676
  id: string;
3679
3677
  lens: CompanyEvalCase['facts'][number]['lens'];
3680
3678
  surfaced: boolean;
@@ -3683,7 +3681,7 @@ interface FactResult {
3683
3681
  foundLabels: string[];
3684
3682
  }
3685
3683
  /** The metric's result for one company: the surfaced fraction + the per-fact trail. */
3686
- interface MaterialFactsResult {
3684
+ export interface MaterialFactsResult {
3687
3685
  ticker: string;
3688
3686
  company: string;
3689
3687
  /** Held-out facts the KB surfaced + grounded. */
@@ -3702,14 +3700,14 @@ interface MaterialFactsResult {
3702
3700
  * in spirit to `kbText` in the research-quality A/B so both metrics read a KB the
3703
3701
  * same way.
3704
3702
  */
3705
- declare function kbIndexToText(index: KnowledgeIndex): string;
3703
+ export declare function kbIndexToText(index: KnowledgeIndex): string;
3706
3704
  /**
3707
3705
  * Grade one company's KB against its held-out material-fact checklist, given the
3708
3706
  * KB's already-joined text. The pure core — no I/O — so calibration can score a
3709
3707
  * hand-written shallow/deep thesis string directly and the live path can score a
3710
3708
  * real KB. Returns the surfaced FRACTION plus the per-fact audit trail.
3711
3709
  */
3712
- declare function materialFactsSurfacedInText(company: CompanyEvalCase, kbText: string): MaterialFactsResult;
3710
+ export declare function materialFactsSurfacedInText(company: CompanyEvalCase, kbText: string): MaterialFactsResult;
3713
3711
  /**
3714
3712
  * `materialFactsSurfaced(kb, checklist)` — the metric in its KB-reading form.
3715
3713
  *
@@ -3720,7 +3718,7 @@ declare function materialFactsSurfacedInText(company: CompanyEvalCase, kbText: s
3720
3718
  * The checklist is HELD OUT by construction: it lives in the test eval set, is
3721
3719
  * never passed to the loop, and is read only here, after the loop finished.
3722
3720
  */
3723
- declare function materialFactsSurfaced(kb: string | KnowledgeIndex, checklist: CompanyEvalCase): Promise<MaterialFactsResult>;
3721
+ export declare function materialFactsSurfaced(kb: string | KnowledgeIndex, checklist: CompanyEvalCase): Promise<MaterialFactsResult>;
3724
3722
  //#endregion
3725
3723
  //#region src/mutation-lock.d.ts
3726
3724
  interface KnowledgeMutationLock {
@@ -3796,8 +3794,8 @@ interface KnowledgeMutationHold {
3796
3794
  * A caller that must decide between taking the lock and joining the one it is inside reads this
3797
3795
  * rather than guessing; taking a held lock from inside its own scope would block against itself.
3798
3796
  */
3799
- declare function isKnowledgeMutationHeld(root: string): boolean;
3800
- declare function withKnowledgeMutation<T>(root: string, mutate: (lock: KnowledgeMutationLock) => Promise<T> | T, options?: KnowledgeMutationOptions): Promise<T>;
3797
+ export declare function isKnowledgeMutationHeld(root: string): boolean;
3798
+ export declare function withKnowledgeMutation<T>(root: string, mutate: (lock: KnowledgeMutationLock) => Promise<T> | T, options?: KnowledgeMutationOptions): Promise<T>;
3801
3799
  /**
3802
3800
  * Run `body` inside this package's mutation scope for `root`, on a lock the caller already holds.
3803
3801
  *
@@ -3811,23 +3809,23 @@ declare function withKnowledgeMutation<T>(root: string, mutate: (lock: Knowledge
3811
3809
  * lock the caller does not actually hold is the one way to defeat the store's single-writer rule;
3812
3810
  * the hold is required, rather than assumed, so that is a statement the caller has to make.
3813
3811
  */
3814
- declare function runInKnowledgeMutationScope<T>(root: string, hold: KnowledgeMutationHold, body: (lock: KnowledgeMutationLock) => Promise<T> | T, options?: KnowledgeMutationOptions): Promise<T>;
3815
- declare function inspectPendingKnowledgeMutation(root: string): Promise<PendingKnowledgeMutation | null>;
3816
- declare function recoverPendingKnowledgeMutation(root: string, options: RecoverPendingKnowledgeMutationOptions): Promise<void>;
3817
- declare function withKnowledgeRead<T>(root: string, read: () => Promise<T> | T, options?: KnowledgeReadOptions): Promise<T>;
3812
+ export declare function runInKnowledgeMutationScope<T>(root: string, hold: KnowledgeMutationHold, body: (lock: KnowledgeMutationLock) => Promise<T> | T, options?: KnowledgeMutationOptions): Promise<T>;
3813
+ export declare function inspectPendingKnowledgeMutation(root: string): Promise<PendingKnowledgeMutation | null>;
3814
+ export declare function recoverPendingKnowledgeMutation(root: string, options: RecoverPendingKnowledgeMutationOptions): Promise<void>;
3815
+ export declare function withKnowledgeRead<T>(root: string, read: () => Promise<T> | T, options?: KnowledgeReadOptions): Promise<T>;
3818
3816
  //#endregion
3819
3817
  //#region src/promotion.d.ts
3820
- declare const KNOWLEDGE_PROMOTION_SCHEMA_VERSION: '1.0.0';
3821
- declare const KNOWLEDGE_PROMOTION_DIGEST_ALGORITHM: 'rfc8785-sha256';
3818
+ export declare const KNOWLEDGE_PROMOTION_SCHEMA_VERSION: '1.0.0';
3819
+ export declare const KNOWLEDGE_PROMOTION_DIGEST_ALGORITHM: 'rfc8785-sha256';
3822
3820
  /** Root-relative directory holding one JSON record per promotion. */
3823
- declare const KNOWLEDGE_PROMOTIONS_DIRECTORY = ".agent-knowledge/promotions";
3824
- type KnowledgePromotionErrorCode = 'unknown-page' | 'ambiguous-support' | 'id-conflict' | 'path-conflict';
3821
+ export declare const KNOWLEDGE_PROMOTIONS_DIRECTORY = ".agent-knowledge/promotions";
3822
+ export type KnowledgePromotionErrorCode = 'unknown-page' | 'ambiguous-support' | 'id-conflict' | 'path-conflict';
3825
3823
  /** A promotion that cannot be performed exactly as asked. */
3826
- declare class KnowledgePromotionError extends Error {
3824
+ export declare class KnowledgePromotionError extends Error {
3827
3825
  readonly code: KnowledgePromotionErrorCode;
3828
3826
  constructor(code: KnowledgePromotionErrorCode, message: string);
3829
3827
  }
3830
- interface KnowledgePromotionEntry {
3828
+ export interface KnowledgePromotionEntry {
3831
3829
  readonly pageId: KnowledgeId;
3832
3830
  readonly path: string;
3833
3831
  /** Where the page was read from in the source run's chain. */
@@ -3837,7 +3835,7 @@ interface KnowledgePromotionEntry {
3837
3835
  readonly requested: boolean;
3838
3836
  }
3839
3837
  /** Immutable record of one promotion into a shared store. */
3840
- interface KnowledgePromotionRecord {
3838
+ export interface KnowledgePromotionRecord {
3841
3839
  readonly schemaVersion: typeof KNOWLEDGE_PROMOTION_SCHEMA_VERSION;
3842
3840
  readonly kind: 'knowledge-promotion';
3843
3841
  readonly digestAlgorithm: typeof KNOWLEDGE_PROMOTION_DIGEST_ALGORITHM;
@@ -3849,7 +3847,7 @@ interface KnowledgePromotionRecord {
3849
3847
  /** Promoted pages first, then carried support, each group in path order. */
3850
3848
  readonly entries: readonly KnowledgePromotionEntry[];
3851
3849
  }
3852
- interface PromoteRunScopedPagesOptions extends KnowledgePagesOptions {
3850
+ export interface PromoteRunScopedPagesOptions extends KnowledgePagesOptions {
3853
3851
  /** Stable ids of the pages this run authored and wants in shared scope. */
3854
3852
  readonly pageIds: readonly KnowledgeId[];
3855
3853
  /** The curated store every run reads and no run writes directly. */
@@ -3871,12 +3869,12 @@ interface PromoteRunScopedPagesOptions extends KnowledgePagesOptions {
3871
3869
  * mutation and the record is content-addressed, so it lands at the same path
3872
3870
  * with the same bytes.
3873
3871
  */
3874
- declare function promoteRunScopedPages(stores: RunScopedStores, runId: string, options: PromoteRunScopedPagesOptions): Promise<KnowledgePromotionRecord>;
3872
+ export declare function promoteRunScopedPages(stores: RunScopedStores, runId: string, options: PromoteRunScopedPagesOptions): Promise<KnowledgePromotionRecord>;
3875
3873
  /** Read one promotion record written by `promoteRunScopedPages`. */
3876
- declare function loadKnowledgePromotionRecord(sharedRoot: string, recordDigest: Sha256Digest): Promise<KnowledgePromotionRecord | null>;
3874
+ export declare function loadKnowledgePromotionRecord(sharedRoot: string, recordDigest: Sha256Digest): Promise<KnowledgePromotionRecord | null>;
3877
3875
  //#endregion
3878
3876
  //#region src/propose-from-finding.d.ts
3879
- interface KnowledgeProposal {
3877
+ export interface KnowledgeProposal {
3880
3878
  /**
3881
3879
  * Stable id derived from the finding so cross-run diffs share an
3882
3880
  * identity. Re-proposing the same finding produces the same id.
@@ -3907,7 +3905,7 @@ interface KnowledgeProposal {
3907
3905
  analyst_id: string;
3908
3906
  };
3909
3907
  }
3910
- declare class KnowledgeProposalParseError extends Error {
3908
+ export declare class KnowledgeProposalParseError extends Error {
3911
3909
  readonly findingId: string;
3912
3910
  readonly subject: string;
3913
3911
  constructor(findingId: string, subject: string, message: string);
@@ -3924,21 +3922,21 @@ declare class KnowledgeProposalParseError extends Error {
3924
3922
  * list and filter out the `null`s; the orchestrator passes the
3925
3923
  * remaining proposals to the existing review / apply pipeline.
3926
3924
  */
3927
- declare function proposeFromFinding(finding: AnalystFinding): KnowledgeProposal | null;
3925
+ export declare function proposeFromFinding(finding: AnalystFinding): KnowledgeProposal | null;
3928
3926
  /**
3929
3927
  * Plural convenience: filter + map across an entire findings batch
3930
3928
  * with one call. Parse errors collect into `errors[]`; the loop
3931
3929
  * decides per-error whether to abort or continue.
3932
3930
  */
3933
- interface ProposeFromFindingsResult {
3931
+ export interface ProposeFromFindingsResult {
3934
3932
  proposals: KnowledgeProposal[];
3935
3933
  skipped: number;
3936
3934
  errors: KnowledgeProposalParseError[];
3937
3935
  }
3938
- declare function proposeFromFindings(findings: ReadonlyArray<AnalystFinding>): ProposeFromFindingsResult;
3936
+ export declare function proposeFromFindings(findings: ReadonlyArray<AnalystFinding>): ProposeFromFindingsResult;
3939
3937
  //#endregion
3940
3938
  //#region src/readiness-check.d.ts
3941
- interface EvaluateKnowledgeBaseReadinessOptions {
3939
+ export interface EvaluateKnowledgeBaseReadinessOptions {
3942
3940
  root: string;
3943
3941
  goal: string;
3944
3942
  readinessSpecs?: readonly KnowledgeReadinessSpec[];
@@ -3947,7 +3945,7 @@ interface EvaluateKnowledgeBaseReadinessOptions {
3947
3945
  strict?: ValidateKnowledgeOptions['strict'];
3948
3946
  kbQuality?: KnowledgeBaseQualityOptions;
3949
3947
  }
3950
- interface KnowledgeBaseReadinessEvaluation {
3948
+ export interface KnowledgeBaseReadinessEvaluation {
3951
3949
  ready: boolean;
3952
3950
  summary: string;
3953
3951
  index: KnowledgeIndex;
@@ -3960,16 +3958,16 @@ interface KnowledgeBaseReadinessEvaluation {
3960
3958
  blocking_readiness: number;
3961
3959
  };
3962
3960
  }
3963
- declare function evaluateKnowledgeBaseReadiness(options: EvaluateKnowledgeBaseReadinessOptions): Promise<KnowledgeBaseReadinessEvaluation>;
3961
+ export declare function evaluateKnowledgeBaseReadiness(options: EvaluateKnowledgeBaseReadinessOptions): Promise<KnowledgeBaseReadinessEvaluation>;
3964
3962
  //#endregion
3965
3963
  //#region src/relation-graph.d.ts
3966
- type KnowledgeRelationGraphErrorCode = 'invalid-node' | 'duplicate-node' | 'invalid-relation' | 'duplicate-relation' | 'undeclared-endpoint' | 'unknown-node' | 'invalid-query';
3964
+ export type KnowledgeRelationGraphErrorCode = 'invalid-node' | 'duplicate-node' | 'invalid-relation' | 'duplicate-relation' | 'undeclared-endpoint' | 'unknown-node' | 'invalid-query';
3967
3965
  /** A relation graph input or query that cannot be honored exactly. */
3968
- declare class KnowledgeRelationGraphError extends Error {
3966
+ export declare class KnowledgeRelationGraphError extends Error {
3969
3967
  readonly code: KnowledgeRelationGraphErrorCode;
3970
3968
  constructor(code: KnowledgeRelationGraphErrorCode, message: string);
3971
3969
  }
3972
- interface BuildKnowledgeRelationGraphInput {
3970
+ export interface BuildKnowledgeRelationGraphInput {
3973
3971
  /**
3974
3972
  * Declared node inventory. When present, every relation endpoint must name
3975
3973
  * one declared node; an undeclared endpoint is refused rather than added.
@@ -3982,21 +3980,21 @@ interface BuildKnowledgeRelationGraphInput {
3982
3980
  * `out` follows `sourceId -> targetId`, `in` follows `targetId -> sourceId`,
3983
3981
  * `both` follows a relation from either end.
3984
3982
  */
3985
- type KnowledgeRelationDirection = 'out' | 'in' | 'both';
3986
- interface KnowledgeRelationQuery {
3983
+ export type KnowledgeRelationDirection = 'out' | 'in' | 'both';
3984
+ export interface KnowledgeRelationQuery {
3987
3985
  /** Restrict to relations with this predicate. Every predicate when absent. */
3988
3986
  predicate?: string;
3989
3987
  direction: KnowledgeRelationDirection;
3990
3988
  }
3991
- interface KnowledgeRelationWalkOptions extends KnowledgeRelationQuery {
3989
+ export interface KnowledgeRelationWalkOptions extends KnowledgeRelationQuery {
3992
3990
  /** Most relations between the start node and a reported node. Unbounded when absent. */
3993
3991
  maxDepth?: number;
3994
3992
  }
3995
- interface KnowledgeRelationNeighbor {
3993
+ export interface KnowledgeRelationNeighbor {
3996
3994
  nodeId: KnowledgeId;
3997
3995
  relation: KnowledgeRelation;
3998
3996
  }
3999
- interface KnowledgeRelationWalkStep {
3997
+ export interface KnowledgeRelationWalkStep {
4000
3998
  nodeId: KnowledgeId;
4001
3999
  /** Number of relations between the start node and this node. */
4002
4000
  depth: number;
@@ -4013,22 +4011,22 @@ interface KnowledgeRelationWalkStep {
4013
4011
  * Node and relation metadata must be finite, acyclic JSON so the graph
4014
4012
  * round-trips through `KnowledgeRelationGraphSchema` unchanged.
4015
4013
  */
4016
- declare function buildKnowledgeRelationGraph(input: BuildKnowledgeRelationGraphInput): KnowledgeRelationGraph;
4014
+ export declare function buildKnowledgeRelationGraph(input: BuildKnowledgeRelationGraphInput): KnowledgeRelationGraph;
4017
4015
  /** Relations touching `id`, each with the node at the other end, in graph order. */
4018
- declare function neighbors(graph: KnowledgeRelationGraph, id: KnowledgeId, query: KnowledgeRelationQuery): KnowledgeRelationNeighbor[];
4016
+ export declare function neighbors(graph: KnowledgeRelationGraph, id: KnowledgeId, query: KnowledgeRelationQuery): KnowledgeRelationNeighbor[];
4019
4017
  /**
4020
4018
  * Breadth-first traversal from `id` over matching relations. Each reachable
4021
4019
  * node is reported once, at the depth where the search first reached it; the
4022
4020
  * start node is never reported, so a cycle back to it adds no step.
4023
4021
  */
4024
- declare function walk(graph: KnowledgeRelationGraph, id: KnowledgeId, options: KnowledgeRelationWalkOptions): KnowledgeRelationWalkStep[];
4022
+ export declare function walk(graph: KnowledgeRelationGraph, id: KnowledgeId, options: KnowledgeRelationWalkOptions): KnowledgeRelationWalkStep[];
4025
4023
  /**
4026
4024
  * Whether `to` is `from` or lies on a path of matching relations out of `from`.
4027
4025
  */
4028
- declare function isReachable(graph: KnowledgeRelationGraph, from: KnowledgeId, to: KnowledgeId, query: KnowledgeRelationQuery): boolean;
4026
+ export declare function isReachable(graph: KnowledgeRelationGraph, from: KnowledgeId, to: KnowledgeId, query: KnowledgeRelationQuery): boolean;
4029
4027
  //#endregion
4030
4028
  //#region src/release.d.ts
4031
- interface KnowledgeReleaseReport {
4029
+ export interface KnowledgeReleaseReport {
4032
4030
  release: KnowledgeRelease;
4033
4031
  scorecard: ReleaseConfidenceScorecard;
4034
4032
  candidateRuns: RunRecord[];
@@ -4038,7 +4036,7 @@ interface KnowledgeReleaseReport {
4038
4036
  * Build a knowledge release report from candidate and baseline run records,
4039
4037
  * optional trace evidence, and an optional decision record.
4040
4038
  */
4041
- interface KnowledgeReleaseInput {
4039
+ export interface KnowledgeReleaseInput {
4042
4040
  candidateId: string;
4043
4041
  baselineId?: string;
4044
4042
  candidateRuns: RunRecord[];
@@ -4057,11 +4055,11 @@ interface KnowledgeReleaseInput {
4057
4055
  createdAt?: string;
4058
4056
  minScore?: number;
4059
4057
  }
4060
- declare function knowledgeReleaseReport(input: KnowledgeReleaseInput): KnowledgeReleaseReport;
4058
+ export declare function knowledgeReleaseReport(input: KnowledgeReleaseInput): KnowledgeReleaseReport;
4061
4059
  //#endregion
4062
4060
  //#region src/research-driving-driver.d.ts
4063
4061
  /** The driver's accumulated research state — the completion oracle reads this. */
4064
- interface ResearchDrivingState {
4062
+ export interface ResearchDrivingState {
4065
4063
  /** Every extracted claim backed by a registered source, by id. */
4066
4064
  claims: TrackedClaim[];
4067
4065
  /** Every deep sub-question raised, by id. */
@@ -4077,7 +4075,7 @@ interface ResearchDrivingState {
4077
4075
  /** How many rounds the driver has folded steer for. */
4078
4076
  rounds: number;
4079
4077
  }
4080
- interface ResearchDrivingDriverOptions {
4078
+ export interface ResearchDrivingDriverOptions {
4081
4079
  /** Router client for claim extraction + deep-question generation. */
4082
4080
  router?: RouterClient;
4083
4081
  router_options?: TangleRouterOptions;
@@ -4103,7 +4101,7 @@ interface ResearchDrivingDriverOptions {
4103
4101
  * Options for the durable driver: the same driver plus a store to keep its
4104
4102
  * belief state in.
4105
4103
  */
4106
- interface PersistentResearchDrivingDriverOptions extends ResearchDrivingDriverOptions {
4104
+ export interface PersistentResearchDrivingDriverOptions extends ResearchDrivingDriverOptions {
4107
4105
  /** Where the claim ledger is read from and written to. */
4108
4106
  store: ClaimLedgerStore;
4109
4107
  /**
@@ -4114,7 +4112,7 @@ interface PersistentResearchDrivingDriverOptions extends ResearchDrivingDriverOp
4114
4112
  ledgerId: string;
4115
4113
  }
4116
4114
  /** What the driver folded into one round's worker prompt, surfaced for audit. */
4117
- interface ResearchDrivingSteer {
4115
+ export interface ResearchDrivingSteer {
4118
4116
  round: number;
4119
4117
  deepQuestions: DeepQuestion[];
4120
4118
  /** Claims it demanded corroborating/refuting evidence for this round. */
@@ -4129,7 +4127,7 @@ interface ResearchDrivingSteer {
4129
4127
  * `runVerifiedResearchLoop`) PLUS a completion oracle and live state, mirroring
4130
4128
  * how `createAdaptiveResearchDriver` exposes `stats()`.
4131
4129
  */
4132
- interface ResearchDrivingDriver extends ResearchDriver {
4130
+ export interface ResearchDrivingDriver extends ResearchDriver {
4133
4131
  /** Live snapshot of the claim ledger + deep questions. */
4134
4132
  researchState(): ResearchDrivingState;
4135
4133
  /**
@@ -4171,7 +4169,7 @@ interface ResearchDrivingDriver extends ResearchDriver {
4171
4169
  * process does — use `createPersistentResearchDrivingDriver` when the run must
4172
4170
  * survive a crash or resume.
4173
4171
  */
4174
- declare function createResearchDrivingDriver(options?: ResearchDrivingDriverOptions): ResearchDrivingDriver;
4172
+ export declare function createResearchDrivingDriver(options?: ResearchDrivingDriverOptions): ResearchDrivingDriver;
4175
4173
  /**
4176
4174
  * The durable driver: same behaviour, plus its claim ledger is read from the
4177
4175
  * store at construction and written back after every claim and every round.
@@ -4181,10 +4179,10 @@ declare function createResearchDrivingDriver(options?: ResearchDrivingDriverOpti
4181
4179
  * loaded lazily would answer "nothing researched, not complete" for a run that
4182
4180
  * had already corroborated everything.
4183
4181
  */
4184
- declare function createPersistentResearchDrivingDriver(options: PersistentResearchDrivingDriverOptions): Promise<ResearchDrivingDriver>;
4182
+ export declare function createPersistentResearchDrivingDriver(options: PersistentResearchDrivingDriverOptions): Promise<ResearchDrivingDriver>;
4185
4183
  //#endregion
4186
4184
  //#region src/schemas.d.ts
4187
- declare const SourceAnchorSchema: z.ZodObject<{
4185
+ export declare const SourceAnchorSchema: z.ZodObject<{
4188
4186
  id: z.ZodString;
4189
4187
  sourceId: z.ZodString;
4190
4188
  label: z.ZodOptional<z.ZodString>;
@@ -4196,7 +4194,7 @@ declare const SourceAnchorSchema: z.ZodObject<{
4196
4194
  timestampMs: z.ZodOptional<z.ZodNumber>;
4197
4195
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4198
4196
  }, z.core.$strip>;
4199
- declare const SourceRecordSchema: z.ZodObject<{
4197
+ export declare const SourceRecordSchema: z.ZodObject<{
4200
4198
  id: z.ZodString;
4201
4199
  uri: z.ZodString;
4202
4200
  title: z.ZodOptional<z.ZodString>;
@@ -4220,7 +4218,7 @@ declare const SourceRecordSchema: z.ZodObject<{
4220
4218
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4221
4219
  createdAt: z.ZodString;
4222
4220
  }, z.core.$strip>;
4223
- declare const KnowledgePageInvalidationSchema: z.ZodObject<{
4221
+ export declare const KnowledgePageInvalidationSchema: z.ZodObject<{
4224
4222
  verdict: z.ZodLiteral<"contradicted">;
4225
4223
  observedAt: z.ZodISODateTime;
4226
4224
  reason: z.ZodString;
@@ -4228,7 +4226,7 @@ declare const KnowledgePageInvalidationSchema: z.ZodObject<{
4228
4226
  grader: z.ZodOptional<z.ZodString>;
4229
4227
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4230
4228
  }, z.core.$strict>;
4231
- declare const KnowledgePageSchema: z.ZodObject<{
4229
+ export declare const KnowledgePageSchema: z.ZodObject<{
4232
4230
  id: z.ZodString;
4233
4231
  path: z.ZodString;
4234
4232
  title: z.ZodString;
@@ -4248,7 +4246,7 @@ declare const KnowledgePageSchema: z.ZodObject<{
4248
4246
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4249
4247
  }, z.core.$strict>>;
4250
4248
  }, z.core.$strip>;
4251
- declare const KnowledgeGraphNodeSchema: z.ZodObject<{
4249
+ export declare const KnowledgeGraphNodeSchema: z.ZodObject<{
4252
4250
  id: z.ZodString;
4253
4251
  title: z.ZodString;
4254
4252
  path: z.ZodString;
@@ -4257,26 +4255,26 @@ declare const KnowledgeGraphNodeSchema: z.ZodObject<{
4257
4255
  outDegree: z.ZodNumber;
4258
4256
  inDegree: z.ZodNumber;
4259
4257
  }, z.core.$strip>;
4260
- declare const KnowledgeGraphEdgeSchema: z.ZodObject<{
4258
+ export declare const KnowledgeGraphEdgeSchema: z.ZodObject<{
4261
4259
  source: z.ZodString;
4262
4260
  target: z.ZodString;
4263
4261
  weight: z.ZodNumber;
4264
4262
  reasons: z.ZodArray<z.ZodString>;
4265
4263
  }, z.core.$strip>;
4266
- declare const KnowledgeRelationSchema: z.ZodObject<{
4264
+ export declare const KnowledgeRelationSchema: z.ZodObject<{
4267
4265
  sourceId: z.ZodString;
4268
4266
  targetId: z.ZodString;
4269
4267
  predicate: z.ZodString;
4270
4268
  weight: z.ZodOptional<z.ZodNumber>;
4271
4269
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4272
4270
  }, z.core.$strip>;
4273
- declare const KnowledgeRelationNodeSchema: z.ZodObject<{
4271
+ export declare const KnowledgeRelationNodeSchema: z.ZodObject<{
4274
4272
  id: z.ZodString;
4275
4273
  kind: z.ZodString;
4276
4274
  label: z.ZodOptional<z.ZodString>;
4277
4275
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4278
4276
  }, z.core.$strip>;
4279
- declare const KnowledgeRelationGraphSchema: z.ZodObject<{
4277
+ export declare const KnowledgeRelationGraphSchema: z.ZodObject<{
4280
4278
  nodes: z.ZodArray<z.ZodObject<{
4281
4279
  id: z.ZodString;
4282
4280
  kind: z.ZodString;
@@ -4291,7 +4289,7 @@ declare const KnowledgeRelationGraphSchema: z.ZodObject<{
4291
4289
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4292
4290
  }, z.core.$strip>>;
4293
4291
  }, z.core.$strip>;
4294
- declare const KnowledgeIndexSchema: z.ZodObject<{
4292
+ export declare const KnowledgeIndexSchema: z.ZodObject<{
4295
4293
  root: z.ZodString;
4296
4294
  generatedAt: z.ZodString;
4297
4295
  sources: z.ZodArray<z.ZodObject<{
@@ -4356,7 +4354,7 @@ declare const KnowledgeIndexSchema: z.ZodObject<{
4356
4354
  }, z.core.$strip>>;
4357
4355
  }, z.core.$strip>;
4358
4356
  }, z.core.$strip>;
4359
- declare const KnowledgeEventSchema: z.ZodObject<{
4357
+ export declare const KnowledgeEventSchema: z.ZodObject<{
4360
4358
  id: z.ZodString;
4361
4359
  type: z.ZodEnum<{
4362
4360
  "index.built": "index.built";
@@ -4373,7 +4371,7 @@ declare const KnowledgeEventSchema: z.ZodObject<{
4373
4371
  target: z.ZodOptional<z.ZodString>;
4374
4372
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4375
4373
  }, z.core.$strip>;
4376
- declare const DeepQuestionSchema: z.ZodObject<{
4374
+ export declare const DeepQuestionSchema: z.ZodObject<{
4377
4375
  kind: z.ZodEnum<{
4378
4376
  comparative: "comparative";
4379
4377
  contradiction: "contradiction";
@@ -4386,7 +4384,7 @@ declare const DeepQuestionSchema: z.ZodObject<{
4386
4384
  addressed: z.ZodBoolean;
4387
4385
  raisedRound: z.ZodNumber;
4388
4386
  }, z.core.$strict>;
4389
- declare const ResearchClaimRecordSchema: z.ZodObject<{
4387
+ export declare const ResearchClaimRecordSchema: z.ZodObject<{
4390
4388
  id: z.ZodString;
4391
4389
  text: z.ZodString;
4392
4390
  supportingHosts: z.ZodArray<z.ZodString>;
@@ -4395,12 +4393,12 @@ declare const ResearchClaimRecordSchema: z.ZodObject<{
4395
4393
  contested: z.ZodBoolean;
4396
4394
  firstSeenRound: z.ZodNumber;
4397
4395
  }, z.core.$strict>;
4398
- declare const ResearchSourceVersionSchema: z.ZodObject<{
4396
+ export declare const ResearchSourceVersionSchema: z.ZodObject<{
4399
4397
  sourceId: z.ZodString;
4400
4398
  uri: z.ZodString;
4401
4399
  contentHash: z.ZodString;
4402
4400
  }, z.core.$strict>;
4403
- declare const ResearchClaimEvidenceSchema: z.ZodObject<{
4401
+ export declare const ResearchClaimEvidenceSchema: z.ZodObject<{
4404
4402
  id: z.ZodString;
4405
4403
  claimId: z.ZodString;
4406
4404
  text: z.ZodString;
@@ -4410,7 +4408,7 @@ declare const ResearchClaimEvidenceSchema: z.ZodObject<{
4410
4408
  contradictsClaimId: z.ZodOptional<z.ZodString>;
4411
4409
  firstSeenRound: z.ZodNumber;
4412
4410
  }, z.core.$strict>;
4413
- declare const ResearchClaimLedgerSchema: z.ZodObject<{
4411
+ export declare const ResearchClaimLedgerSchema: z.ZodObject<{
4414
4412
  schemaVersion: z.ZodLiteral<2>;
4415
4413
  id: z.ZodString;
4416
4414
  goal: z.ZodOptional<z.ZodString>;
@@ -4455,7 +4453,7 @@ declare const ResearchClaimLedgerSchema: z.ZodObject<{
4455
4453
  raisedRound: z.ZodNumber;
4456
4454
  }, z.core.$strict>>;
4457
4455
  }, z.core.$strict>;
4458
- declare const KnowledgeBaseCandidateSchema: z.ZodObject<{
4456
+ export declare const KnowledgeBaseCandidateSchema: z.ZodObject<{
4459
4457
  id: z.ZodString;
4460
4458
  units: z.ZodArray<z.ZodObject<{
4461
4459
  id: z.ZodString;
@@ -4498,13 +4496,13 @@ declare const KnowledgeBaseCandidateSchema: z.ZodObject<{
4498
4496
  }, z.core.$strip>;
4499
4497
  //#endregion
4500
4498
  //#region src/wikilinks.d.ts
4501
- declare const WIKILINK_REGEX: RegExp;
4502
- declare function extractWikilinks(content: string): string[];
4503
- declare function normalizeLinkTarget(target: string): string;
4499
+ export declare const WIKILINK_REGEX: RegExp;
4500
+ export declare function extractWikilinks(content: string): string[];
4501
+ export declare function normalizeLinkTarget(target: string): string;
4504
4502
  //#endregion
4505
4503
  //#region src/write-protocol.d.ts
4506
- declare function isSafeKnowledgePath(path: string, allowedPrefixes?: string[]): boolean;
4507
- declare function parseKnowledgeWriteBlocks(text: string, allowedPrefixes?: string[]): KnowledgeWriteParseResult;
4504
+ export declare function isSafeKnowledgePath(path: string, allowedPrefixes?: string[]): boolean;
4505
+ export declare function parseKnowledgeWriteBlocks(text: string, allowedPrefixes?: string[]): KnowledgeWriteParseResult;
4508
4506
  //#endregion
4509
- export { AdaptiveDecision, AdaptiveDriverOptions, AdaptiveResearchDriver, AdaptiveStats, AddSourceOptions, AddSourceTextInput, 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, ApplyKnowledgeWriteBlocksOptions, ApplyWriteBlocksResult, AuditKnowledgeCitationsOptions, Bm25Hit, Bm25Options, type BuildAgentMemorySequencesFromBenchmarkCasesOptions, BuildEvalKnowledgeBundleOptions, BuildKnowledgeRelationGraphInput, type BuildRetrievalBenchmarkCasesFromQrelsOptions, BuildRetrievalEvalDispatchOptions, CHECKABLE_RUNG_THRESHOLD, CITES_INVALIDATED_FIELD, CheckExecution, ChunkingOptions, ClaimEvidence, ClaimGrade, ClaimGroundingDriverOptions, ClaimLedgerGoalConflictError, ClaimLedgerMigrationRequiredError, ClaimLedgerStore, ClaimRef, ClaimVerdict, CompanyEvalCase, type CompareAgentMemoryLearningOptions, CornellLiiSelector, CornellLiiSourceOptions, CreateAgentMemoryBranchOptions, CreateKnowledgeRetrievalDispositionInput, CreateKnowledgeRetrievalReceiptInput, CreateKnowledgeToolsOptions, CreateKnowledgeUseReceiptInput, D1Adapter, DEADLINE_EXIT_CODE, DEFAULT_KNOWLEDGE_BRIEF_LIMIT, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, DEFAULT_PAGES_DIRECTORY, DedupReason, DeepQuestion, DeepQuestionKind, DeepQuestionSchema, DefineReadinessSpecInput, DetectChangesOptions, DetectChangesResult, DiscoveryLoopResult, DiscoveryLoopRound, DiscoveryLoopStopReason, DiscoveryResult, DiscoveryTask, DriverResearchContext, EvalKnowledgeBundleBuildResult, EvaluateKnowledgeBaseReadinessOptions, EvidenceRung, ExpectedGroup, type ExternalRagEvalScore, FactResult, FetchOpts, FileSystemFreshnessStoreOptions, FileSystemKbStore, FileSystemKbStoreOptions, FileSystemSearchOptions, FileSystemSearchProvider, FileSystemSearchProviderOptions, ForkAgentMemoryBranchSnapshotOptions, FragmentProvenance, FreshnessKey, FreshnessMark, FreshnessRecord, FreshnessTtl, GradeableClaim, GradedClaim, GraphitiMcpClientLike, GraphitiMemoryAdapterOptions, GraphitiToolNames, GroundClaimOptions, GroundingResult, INDUSTRY_MEMORY_BENCHMARKS, INDUSTRY_RAG_BENCHMARKS, IRS_DIMENSION_HINTS, type ImproveSelectedKnowledgeCandidateOptions, type ImproveSelectedKnowledgeCandidateResult, IrsPublicationsSourceOptions, KB_CLAIM_LEDGER_DIR, KB_EVENTS_PATH, KB_INDEX_PATH, KB_STORE_DIR, KNOWLEDGE_EVENT_TYPES, KNOWLEDGE_PROMOTIONS_DIRECTORY, KNOWLEDGE_PROMOTION_DIGEST_ALGORITHM, KNOWLEDGE_PROMOTION_SCHEMA_VERSION, KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM, KNOWLEDGE_SEARCH_RETRIEVER_ID, KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION, KbStore, type KnowledgeAnswerBenchmarkCase, type KnowledgeAnswerBenchmarkTaskKind, KnowledgeBaseCandidate, KnowledgeBaseCandidateSchema, type KnowledgeBaseQualityOptions, type KnowledgeBaseQualityReport, KnowledgeBaseReadinessEvaluation, 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, KnowledgeBrief, KnowledgeBriefOptions, KnowledgeChange, KnowledgeChangeKind, KnowledgeChunk, KnowledgeCitationAuditError, KnowledgeCitationAuditIssue, KnowledgeCitationAuditIssueKind, KnowledgeCitationAuditReport, KnowledgeCitationCandidate, KnowledgeCitationReference, KnowledgeCitationResolution, KnowledgeCitationResolutionError, KnowledgeCitationResolutionStatus, KnowledgeClaim, type KnowledgeClaimMatcher, KnowledgeConsumerKind, KnowledgeConsumerRef, KnowledgeControlLoopAction, KnowledgeControlLoopActionResult, KnowledgeControlLoopAdapter, KnowledgeControlLoopAdapterOptions, KnowledgeControlLoopState, KnowledgeDiscoveryDispatcher, KnowledgeDiscoveryWorker, KnowledgeDuplicateIntakeError, KnowledgeDuplicateIntakePair, type KnowledgeEvaluationPhase, KnowledgeEvent, KnowledgeEventQuery, KnowledgeEventSchema, KnowledgeEventType, KnowledgeExplanation, KnowledgeFragment, KnowledgeFreshnessStore, KnowledgeGap, KnowledgeGraph, KnowledgeGraphEdge, KnowledgeGraphEdgeSchema, KnowledgeGraphNode, KnowledgeGraphNodeSchema, KnowledgeId, type KnowledgeImprovementActivationPersistence, type KnowledgeImprovementCandidateRecord, type KnowledgeImprovementCandidateRef, KnowledgeImprovementCandidateRefSchema, type KnowledgeImprovementEvaluationInput, type KnowledgeImprovementEvaluator, type KnowledgeImprovementEvent, type KnowledgeImprovementEvidence, KnowledgeImprovementEvidenceSchema, type KnowledgeImprovementMetric, type KnowledgeImprovementMetricProvenance, type KnowledgeImprovementMutationReceipt, type KnowledgeImprovementMutationResult, type KnowledgeImprovementOptions, type KnowledgeImprovementRagOptimizationOptions, type KnowledgeImprovementRagOptimizationRunInput, type KnowledgeImprovementResult, type KnowledgeImprovementRetrievalOptions, type KnowledgeImprovementRunState, KnowledgeImprovementRunStateSchema, type KnowledgeImprovementStatus, type KnowledgeImprovementTarget, type KnowledgeImprovementUpdate, type KnowledgeImprovementUpdateInput, KnowledgeIndex, KnowledgeIndexSchema, KnowledgeInspection, KnowledgeInvalidationPlan, KnowledgeInvalidationStamp, KnowledgeLayout, KnowledgeLexicalFieldBoosts, KnowledgeLexicalIndex, KnowledgeLexicalIndexOptions, KnowledgeLexicalPosting, KnowledgeLintFinding, type KnowledgeMemoryBenchmarkCase, type KnowledgeMemoryBenchmarkTaskKind, type KnowledgeMemoryEvent, type KnowledgeMemoryFactMatcher, type KnowledgeMutationHold, type KnowledgeMutationLock, type KnowledgeMutationOptions, KnowledgePage, KnowledgePageInvalidation, KnowledgePageInvalidationSchema, KnowledgePageRelation, KnowledgePageRelationPredicate, KnowledgePageSchema, KnowledgePagesOptions, KnowledgePolicy, type KnowledgePolicyDispatch, KnowledgePromotionEntry, KnowledgePromotionError, KnowledgePromotionErrorCode, KnowledgePromotionRecord, KnowledgeProposal, KnowledgeProposalParseError, type KnowledgeReadOptions, KnowledgeReadinessSpec, KnowledgeReceiptAttributeValue, KnowledgeRelation, KnowledgeRelationDirection, KnowledgeRelationGraph, KnowledgeRelationGraphError, KnowledgeRelationGraphErrorCode, KnowledgeRelationGraphSchema, KnowledgeRelationNeighbor, KnowledgeRelationNode, KnowledgeRelationNodeSchema, KnowledgeRelationQuery, KnowledgeRelationSchema, KnowledgeRelationWalkOptions, KnowledgeRelationWalkStep, KnowledgeRelease, KnowledgeReleaseInput, KnowledgeReleaseReport, KnowledgeResearchLoopContext, KnowledgeResearchLoopDecision, KnowledgeResearchLoopResult, KnowledgeResearchLoopStep, type KnowledgeRetrievalBenchmarkCase, type KnowledgeRetrievalBenchmarkQrel, type KnowledgeRetrievalBenchmarkQuery, KnowledgeRetrievalDisposition, KnowledgeRetrievalDispositionRelation, KnowledgeRetrievalReceipt, KnowledgeRetrievalResultReceipt, KnowledgeRetrieverIdentity, KnowledgeSearchHit, KnowledgeSearchResult, KnowledgeSource, type KnowledgeStateScope, KnowledgeUnit, KnowledgeUseReceipt, KnowledgeUseRelation, KnowledgeUsedResult, KnowledgeVisibilityArtifactLoader, KnowledgeVisibilityArtifactRef, KnowledgeVisibilityRef, KnowledgeVisibilitySnapshot, KnowledgeVisibilitySnapshotEntry, KnowledgeVisibilityUnavailableError, KnowledgeVisibilityUnavailableReason, KnowledgeWriteBlock, KnowledgeWriteIntakeOptions, KnowledgeWriteIntakeRequest, KnowledgeWriteParseResult, type LoadKnowledgeImprovementActivationResultOptions, MAX_RESPONSE_BYTES, MIN_REQUEST_GAP_MS, MaterialFact, MaterialFactLens, MaterialFactsResult, type MeasuredKnowledgeSelectionReceipt, Mem0ClientMode, Mem0HostedClient, Mem0HostedMemoryAdapterOptions, Mem0MemoryAdapterOptions, Mem0OssClient, Mem0OssMemoryAdapterOptions, type MemoryAdapterBenchmarkCandidate, type MemoryAdapterBenchmarkRankingRow, type MemoryConfigScenario, MemoryKbStore, type NearDuplicateDetectionOptions, type NearDuplicatePair, type NearDuplicateReport, Neo4jAgentMemoryAdapterOptions, type OptimizeKnowledgeBasePolicyOptions, type OptimizeKnowledgeBasePolicyResult, OriginatedKnowledgeSearchResult, OriginatedPage, OwnedAgentMemoryRunLease, POLITE_USER_AGENT, PageOrigin, ParsedFrontmatter, PartitionRetrievalScenariosOptions, type PendingKnowledgeMutation, PersistentResearchDrivingDriverOptions, PoliteFetchOptions, PoliteFetchResult, type PromoteKnowledgeCandidateOptions, PromoteRunScopedPagesOptions, ProposeFromFindingsResult, READINESS_SPEC_DEFAULTS, RUN_LINEAGE_BASENAME, type RagAnswerEvalArtifact, type RagAnswerEvalCase, type RagAnswerEvalScenario, type RagAnswerMetricSummary, type RagAnswerQualityHookOptions, RagAnswerQualityInput, type RagAnswerQualityJudgeOptions, RagAnswerQualityResult, type RagCalibrationOptions, type RagCalibrationResult, RagDiagnosisInput, type RagEvalCitation, type RagEvalClaim, type RagEvalContext, type RagEvalMetricKey, type RagEvalProvider, type RagEvalSlice, RagGapFinding, RagGapKind, RagGapSeverity, RagKnowledgeAcquisitionInput, RagKnowledgeImprovementPhase, RagKnowledgeImprovementPhaseResult, RagKnowledgeImprovementPhaseStatus, RagKnowledgeResearchOptions, RagKnowledgeUpdateInput, RagKnowledgeUpdateResult, RagOptimizationConfig, RagOptimizationSelection, RagPhaseInputBase, RagPromotionInput, RagPromotionResult, type RagRequiredContext, type RecoverPendingKnowledgeMutationOptions, RegularFileSnapshot, RejectedSource, ResearchClaimEvidence, ResearchClaimEvidenceSchema, ResearchClaimLedger, ResearchClaimLedgerSchema, ResearchClaimRecord, ResearchClaimRecordSchema, ResearchContribution, ResearchDriver, ResearchDrivingDriver, ResearchDrivingDriverOptions, ResearchDrivingState, ResearchDrivingSteer, ResearchSourceProposal, ResearchSourceVersion, ResearchSourceVersionSchema, ResearchWorker, 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, RetrievalOptimizationSelection, RetrievalRecallJudgeOptions, RetrievalScenarioPartitions, RetrievedKnowledgeHit, RetrievedSourceSpan, RouterClient, RouterError, RouterUsage, type RunAgentMemoryExperimentOptions, type RunAgentMemoryExperimentResult, type RunAgentMemoryImprovementOptions, type RunAgentMemoryImprovementResult, type RunAgentMemoryLearningExperimentOptions, type RunAgentMemoryLearningExperimentResult, RunDiscoveryLoopOptions, type RunKnowledgeBenchmarkSuiteOptions, type RunKnowledgeBenchmarkSuiteResult, RunKnowledgeResearchLoopOptions, RunLineageAuthority, RunLineageRecord, type RunMemoryAdapterBenchmarkOptions, type RunMemoryAdapterBenchmarkResult, RunRagKnowledgeImprovementLoopOptions, RunRagKnowledgeImprovementLoopResult, RunRagOptimizationOptions, RunRagOptimizationResult, RunRetrievalImprovementLoopOptions, RunRetrievalImprovementLoopResult, RunScopedStores, RunScopedStoresOptions, RunSerializedKnowledgeOptimizationOptions, RunSerializedKnowledgeOptimizationResult, SCAFFOLD_PAGE_BASENAMES, SearchKnowledgeOptions, SerializedCandidate, SerializedCandidateCodec, SourceAdapter, SourceAdapterInput, SourceAdapterOutput, SourceAnchor, SourceAnchorSchema, SourceFreshnessInspection, SourceRecord, SourceRecordSchema, SourceRegistry, SourceVerdict, SourceVerificationContext, StateSosEntity, StateSosSourceConfig, TangleRouterOptions, ThesisRunOptions, ThesisRunResult, ThesisTaskInput, TrackedClaim, TriageClass, UncheckableClaimError, type UseKnowledgeImprovementCandidateOptions, ValidateKnowledgeOptions, ValidateKnowledgeResult, VerifiedGradeableEvidence, VerifiedResearchLoopOptions, VerifiedResearchLoopResult, VerifiedResearchRound, VerifyGradeableEvidenceOptions, VerifyingDriverOptions, WIKILINK_REGEX, WebResearchWorkerOptions, WebSearchHit, WorkerClaimDecorationOptions, WorkerResearchContext, __resetHttpThrottle, acquireAgentMemoryRunLease, addSourcePath, addSourceText, agentMemorySequenceJudge, applyKnowledgeWriteBlocks, applyKnowledgeWriteBlocksFile, applyRetrievalHoldout, applySessionStickyRetrievalHoldout, assertClaimLedgerId, assertCurrentRunCitationsResolved, assertDeepQuestionIntegrity, assertGradeableEvidence, assertKnowledgeCitationAudit, assertKnowledgeCitationsResolved, assertKnowledgeRetrievalMatchesVisibility, assertKnowledgeRetrievalMatchesVisibilityArtifact, assertKnowledgeWriteIntake, assertResearchClaimEvidenceIntegrity, assertResearchClaimLedgerIntegrity, assertRunScopedCitationsResolved, assertTrackedClaimIntegrity, auditCurrentRunCitations, auditKnowledgeCitations, buildAgentMemorySequenceScenarios, buildAgentMemorySequencesFromBenchmarkCases, buildEvalKnowledgeBundle, buildFirstPartyMemoryLifecycleBenchmarkCases, buildIndustryMemoryBenchmarkSmokeCases, buildIndustryRagBenchmarkSmokeCases, buildKnowledgeBenchmarkScenarios, buildKnowledgeBrief, buildKnowledgeGraph, buildKnowledgeIndex, buildKnowledgeLexicalIndex, buildKnowledgeRelationGraph, buildRetrievalBenchmarkCasesFromQrels, buildRetrievalEvalDispatch, calibrateRagAnswerJudge, canonicalPathsEqual, canonicalRelativeWithinRoot, canonicalizeUrl, chunkMarkdown, citedClaimKey, citedClaimOf, claimCheckKey, claimEvidenceId, claimId, claimSourceHost, compareAgentMemoryLearning, contentKey, createAdaptiveResearchDriver, createAgentMemoryBranch, createClaimDecorator, createClaimGroundingVerifier, createCollectionResearchDriver, createCornellLiiSource, createD1FreshnessStoreStub, createFileRunLineageAuthority, createFileSystemFreshnessStore, createFileSystemSearchProvider, createGraphitiMemoryAdapter, createInMemoryBenchmarkAdapter, createIrsPublicationsSource, createKnowledgeControlLoopAdapter, createKnowledgeEvent, createKnowledgeRetrievalDisposition, createKnowledgeRetrievalReceipt, createKnowledgeTools, createKnowledgeUseReceipt, createKnowledgeVisibilitySnapshot, createLocalDiscoveryDispatcher, createMem0MemoryAdapter, createMemoryExecutionPool, createNeo4jAgentMemoryAdapter, createNoopMemoryBenchmarkAdapter, createPersistentResearchDrivingDriver, createRagAnswerQualityHook, createResearchDrivingDriver, createRunScopedStores, createStateSosSource, createTangleRouterClient, createVerifyingResearchDriver, createWebResearchWorker, decodeKnowledgeVisibilitySnapshot, deepQuestionId, defaultGetMemoryContext, defineReadinessSpec, detectChanges, detectNearDuplicatePages, deterministicRng, diagnoseRagAnswerFailure, emitRetrievalHoldoutBypass, emptyClaimLedger, encodeKnowledgeVisibilitySnapshot, evaluateKnowledgeBaseReadiness, explainKnowledgeTarget, extractLinks, extractWikilinks, firstMatch, forkAgentMemoryBranchSnapshot, formatFrontmatter, formatKnowledgeCitationReference, formatKnowledgeInvalidationProposal, fromAgentCandidateKnowledgeRef, gradeClaims, gradeCompanyAgainstText, gradeFactAgainstText, gradeFor, graphitiMemoryAdapterIdentity, groundClaimInText, hashKnowledgeBase, htmlToText, improveKnowledgeBase, improveSelectedKnowledgeCandidate, initKnowledgeBase, innerHtmlById, inspectKnowledgeIndex, inspectPendingKnowledgeMutation, investmentThesisSet, isKernelAnchoredPath, isKnowledgeMemoryBenchmarkCase, isKnowledgeMutationHeld, isKnowledgePagePath, isMissingFile, isReachable, isSafeKnowledgePath, isScaffoldPath, jsonCandidateCodec, jsonObjectCandidateCodec, kbIndexToText, knowledgeBenchmarkJudge, knowledgeCitationAuditFindings, knowledgeImprovementCandidateRef, knowledgeImprovementRunDir, knowledgeImprovementRunId, knowledgePageDigest, knowledgePageFromMarkdown, knowledgePageRelations, knowledgeReleaseReport, knowledgeVisibilityArtifactRef, layoutFor, lensDistribution, linkClaimContradictions, lintCurrentRunCitations, lintKnowledgeIndex, listRegularFilesWithinRoot, loadKnowledgeImprovementActivationResult, loadKnowledgeImprovementEvents, loadKnowledgeImprovementState, loadKnowledgePages, loadKnowledgePromotionRecord, loadSourceRegistry, looksLikeBlockPage, materialFactsSurfaced, materialFactsSurfacedInText, materializeRegisteredClaimEvidence, mediaTypeFor, mem0MemoryAdapterIdentity, memoryHitToSourceRecord, memoryRecoveryDelayMs, memoryWriteResultToSourceRecord, mergeClaimLedgers, mergeTrackedClaims, neighbors, normalizeClaimText, normalizeExternalRagScores, normalizeKnowledgeStateScope, normalizeLinkTarget, normalizePageText, normalizePagesDirectory, optimizeKnowledgeBasePolicy, originatedPages, parseFrontmatter, parseKnowledgeBenchmarkJsonl, parseKnowledgeBenchmarkQrels, parseKnowledgeCitationReference, parseKnowledgeWriteBlocks, partitionRetrievalScenarios, planInvalidationPropagation, politeFetch, promoteKnowledgeCandidate, promoteRunScopedPages, proposeFromFinding, proposeFromFindings, ragAnswerQualityJudge, readRegularFileNoFollow, readRegularFileWithinRoot, reciprocalRankFusion, recoverPendingKnowledgeMutation, relativeWithinRoot, removeDurable, renameDurable, renderKnowledgeBenchmarkReportMarkdown, renderMemoryContext, researchSourceVersionKey, resetRetrievalHoldoutRegistry, resolveKnowledgeCitation, resolveKnowledgeCitations, resolveMemoryCleanupTimeoutMs, resolveRunScopedCitation, resolveRunScopedCitations, respondToIndustryMemoryBenchmarkSmokeCase, respondToIndustryRagBenchmarkSmokeCase, restoreKnowledgeCandidateBaseline, retrievalConfigFromSurface, retrievalConfigSurface, retrievalHoldoutConfigHash, retrievalRecallJudge, runAgentMemoryExperiment, runAgentMemoryImprovement, runAgentMemoryLearningExperiment, runBoundedMemoryLifecycle, runDiscoveryLoop, runInKnowledgeMutationScope, runInvestmentThesisTask, runKnowledgeBenchmarkSuite, runKnowledgeResearchLoop, runMemoryAdapterBenchmark, runRagKnowledgeImprovementLoop, runRagOptimization, runRetrievalImprovementLoop, runSerializedKnowledgeOptimization, runVerifiedResearchLoop, scenarioContentFingerprint, scoreBm25, scoreKnowledgeBaseIndex, scoreKnowledgeBenchmarkArtifact, scoreMemoryBenchmarkArtifact, scoreRagAnswerArtifact, scoreRetrievalArtifact, searchKnowledge, searchKnowledgePages, sha256, sleepForMemoryRecovery, slugify, snapshotSourceTextInput, sourceMatchesGaps, sourceRegistryPath, stableId, stripFrontmatter, summarizeKnowledgeBenchmarkCampaign, syncDirectory, textSourceAdapter, textSourceId, thesisReadinessSpecs, toAgentCandidateKnowledgeRef, toDeepEvalTestCases, toOffPolicyTrajectory, toRagCheckerRecords, toRagasEvaluationRows, toTruLensRecords, tokenizeQuery, tokenizeText, totalMaterialFacts, triageSource, validateKnowledgeIndex, verdictFor, verifyGradeableEvidence, verifyKnowledgeRetrievalDisposition, verifyKnowledgeRetrievalReceipt, verifyKnowledgeUseReceipt, verifyKnowledgeVisibilitySnapshot, walk, withCitedClaim, withKnowledgeImprovementCandidate, withKnowledgeImprovementComparison, withKnowledgeMutation, withKnowledgeRead, withSafeDescendant, withSafeDirectory, writeFileDurable, writeFileDurableWithinRoot, writeJson, writeJsonDurable, writeJsonDurableWithinRoot, writeKnowledgeIndex, writeSourceRegistry };
4507
+ 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, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, DeepQuestion, DeepQuestionKind, type ExternalRagEvalScore, FetchOpts, ForkAgentMemoryBranchSnapshotOptions, FragmentProvenance, GraphitiMcpClientLike, GraphitiMemoryAdapterOptions, GraphitiToolNames, 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, 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, OwnedAgentMemoryRunLease, POLITE_USER_AGENT, PartitionRetrievalScenariosOptions, type PendingKnowledgeMutation, 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, 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 RunMemoryAdapterBenchmarkOptions, type RunMemoryAdapterBenchmarkResult, 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, createInMemoryBenchmarkAdapter, createIrsPublicationsSource, createMem0MemoryAdapter, createMemoryExecutionPool, createNeo4jAgentMemoryAdapter, createNoopMemoryBenchmarkAdapter, createStateSosSource, defaultGetMemoryContext, deterministicRng, emitRetrievalHoldoutBypass, extractLinks, firstMatch, forkAgentMemoryBranchSnapshot, graphitiMemoryAdapterIdentity, 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 };
4510
4508
  //# sourceMappingURL=index.d.ts.map