@agentskit/doc-bridge 1.7.45 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/CHANGELOG.md +465 -0
  2. package/CONTRIBUTING.md +23 -0
  3. package/README.md +87 -40
  4. package/SECURITY.md +7 -0
  5. package/action.yml +1 -1
  6. package/bin/ak-docs.js +2 -2
  7. package/bin/ak-verify.js +13 -7
  8. package/dist/cli/program.d.ts +3 -1
  9. package/dist/cli/program.js +15861 -6223
  10. package/dist/cli/program.js.map +1 -1
  11. package/dist/config/index.d.ts +1 -1
  12. package/dist/config/index.js +86 -6
  13. package/dist/config/index.js.map +1 -1
  14. package/dist/{index-BUL0q7s8.d.ts → index-Beor6Yhi.d.ts} +133 -1
  15. package/dist/index.d.ts +9871 -1062
  16. package/dist/index.js +16126 -6125
  17. package/dist/index.js.map +1 -1
  18. package/docs/MARKETPLACE.md +1 -1
  19. package/docs/PRD-documentation-efficiency-study.md +406 -0
  20. package/docs/PRD-knowledge-retrieval-and-enrichment.md +466 -0
  21. package/docs/adr/0002-documentation-audit-boundary.md +22 -0
  22. package/docs/adr/0003-study-protocol-and-historical-evidence.md +40 -0
  23. package/docs/adr/0004-controlled-study-runner.md +25 -0
  24. package/docs/adr/0005-documentation-quality-and-criticality.md +20 -0
  25. package/docs/adr/0006-registry-semantic-grounding.md +20 -0
  26. package/docs/adr/0007-longitudinal-study-metrics.md +21 -0
  27. package/docs/adr/0008-study-verification-boundary.md +21 -0
  28. package/docs/adr/0009-study-provider-cli-adapter.md +25 -0
  29. package/docs/agent-corpus/INDEX.md +12 -1
  30. package/docs/agent-corpus/OVERVIEW.md +25 -0
  31. package/docs/agent-corpus/chat.md +5 -1
  32. package/docs/agent-corpus/cli.md +16 -0
  33. package/docs/agent-corpus/conformance.md +12 -0
  34. package/docs/agent-corpus/doc-bridge.md +47 -0
  35. package/docs/agent-corpus/doctor.md +8 -0
  36. package/docs/agent-corpus/gates.md +4 -0
  37. package/docs/agent-corpus/mcp.md +13 -0
  38. package/docs/agent-corpus/memory.md +4 -0
  39. package/docs/agent-corpus/query.md +33 -0
  40. package/docs/bench/README.md +122 -0
  41. package/docs/bench/retrieval-baseline-v1.json +28 -0
  42. package/docs/bench/retrieval-suite-v1.json +1033 -0
  43. package/docs/chat-and-rag.md +3 -2
  44. package/docs/for-agents.md +9 -1
  45. package/docs/getting-started.md +4 -11
  46. package/docs/guides/gate-ci.md +11 -1
  47. package/docs/guides/install-and-run.md +9 -65
  48. package/docs/index.md +22 -1
  49. package/docs/knowledge-engine-runbook.md +38 -3
  50. package/docs/landing/assets/context-payload-reduction.svg +21 -0
  51. package/docs/landing/assets/controlled-ab-comparison.svg +30 -0
  52. package/docs/landing/index.html +119 -5
  53. package/docs/loop-workflow.md +117 -0
  54. package/docs/mcp.md +6 -1
  55. package/docs/parity/public-claims-v1.json +145 -0
  56. package/docs/playbook/doc-bridge-pattern.md +1 -1
  57. package/docs/query.md +90 -2
  58. package/docs/recipes/index-pipeline.md +1 -1
  59. package/docs/schemas/agent-handoff-v1.md +15 -0
  60. package/docs/schemas/doc-bridge-index-v1.md +65 -0
  61. package/docs/spec/benchmark-v1.md +33 -1
  62. package/docs/spec/cli.md +30 -10
  63. package/docs/spec/config-v1.md +147 -8
  64. package/docs/spec/documentation-audit-v1.md +61 -0
  65. package/docs/spec/enrichment-overlay-v1.md +241 -0
  66. package/docs/spec/graph-signals-v1.md +92 -0
  67. package/docs/spec/incremental-scan-v1.md +102 -0
  68. package/docs/spec/markdown-analyzer-v1.md +73 -0
  69. package/docs/spec/mcp-knowledge-tools-v1.md +147 -0
  70. package/docs/spec/measured-enrichment-v1.md +229 -0
  71. package/docs/spec/public-parity-v1.md +119 -0
  72. package/docs/spec/registry-agents.md +6 -0
  73. package/docs/spec/render-v1.md +122 -0
  74. package/docs/spec/retrieval-index-v1.md +164 -0
  75. package/docs/spec/study-metrics-v1.md +58 -0
  76. package/docs/spec/study-protocol-v1.md +46 -0
  77. package/docs/spec/study-provider-cli-v1.md +116 -0
  78. package/docs/spec/study-runner-v1.md +35 -0
  79. package/docs/spec/study-task-suite-v1.md +41 -0
  80. package/docs/spec/study-verification-v1.md +40 -0
  81. package/docs/study/README.md +84 -0
  82. package/docs/study/ab-adjudicated-cost-analysis-v1.md +29 -0
  83. package/docs/study/ab-adjudicated-cost-plan-v1.json +33 -0
  84. package/docs/study/ab-adjudicated-cost-plan-v2-v1.json +33 -0
  85. package/docs/study/ab-adjudicated-cost-result-v1.json +80 -0
  86. package/docs/study/ab-baseline-analysis-v1.md +21 -0
  87. package/docs/study/ab-baseline-plan-v1.json +33 -0
  88. package/docs/study/ab-baseline-recovery-plan-v1.json +33 -0
  89. package/docs/study/ab-baseline-result-v1.json +79 -0
  90. package/docs/study/documentation-audit-round-2026-08-31.json +183 -0
  91. package/docs/study/historical-evidence-v1.json +252 -0
  92. package/docs/study/observation-ledger-v1.json +30632 -0
  93. package/docs/study/phase3-task-coverage-v1.json +34 -0
  94. package/docs/study/phase4-public-pilot-ledger-v1.json +1344 -0
  95. package/docs/study/phase4-public-pilot-result-v1.json +52 -0
  96. package/docs/study/phase4-public-pilot-run-plan-v1.json +26 -0
  97. package/docs/study/phase4-public-pilot-task-suite-v1.json +71 -0
  98. package/docs/study/pilot-round-2026-08-31.json +46 -0
  99. package/docs/study/protocol-v1.json +90 -0
  100. package/docs/study/publication-gate-v1.md +45 -0
  101. package/docs/study/quality-scorecard-cycle-plan.md +545 -0
  102. package/docs/study/quality-scorecard-v1.json +38 -0
  103. package/docs/study/round-1-adjudicated-smoke-v1.json +30642 -0
  104. package/docs/study/round-1-instrumentation-plan-v1.md +39 -0
  105. package/docs/study/round-2-expanded-adjudication-v1.json +91 -0
  106. package/docs/study/round-2-expanded-validation-v1.md +58 -0
  107. package/docs/study/round-3-evidence-contract-v1.json +75 -0
  108. package/docs/study/round-3-evidence-contract-v1.md +57 -0
  109. package/docs/study/round-4-confirmation-v1.json +75 -0
  110. package/docs/study/round-4-confirmation-v1.md +55 -0
  111. package/docs/study/run-plan-v1.json +33 -0
  112. package/docs/study/semantic-adjudication-cycle-8.md +20 -0
  113. package/docs/study/task-suite-v1.json +96 -0
  114. package/docs/study/token-efficiency-plan-v1.md +337 -0
  115. package/docs/study/token-efficiency-protocol-v2.json +62 -0
  116. package/docs/study/verification-binding-v1.json +27 -0
  117. package/docs/validation-cycle-plan.md +14 -0
  118. package/docs/verification-harness.md +11 -6
  119. package/ecosystem-claims.json +2 -2
  120. package/ecosystem-upstream.json +2 -2
  121. package/ecosystem.json +4 -4
  122. package/mcpb/manifest.json +9 -1
  123. package/package.json +25 -6
  124. package/scripts/check-ecosystem-upstream.mjs +34 -6
  125. package/skills/doc-bridge-handoff/fixtures/synthetic-repo/docs/for-agents/packages/payments.md +7 -0
  126. package/skills/doc-bridge-handoff/scripts/resolve-handoff.mjs +1 -1
  127. package/src/agents/registry-adapter.ts +192 -24
  128. package/src/audit/documentation.ts +513 -0
  129. package/src/bench/baseline.ts +198 -0
  130. package/src/bench/overlay-delta.ts +139 -0
  131. package/src/bench/retrieval.ts +319 -0
  132. package/src/budget/compile.ts +91 -0
  133. package/src/budget/sections.ts +70 -0
  134. package/src/cli/program.ts +684 -74
  135. package/src/cli/usage.ts +71 -0
  136. package/src/config/defaults.ts +1 -0
  137. package/src/config/index.ts +4 -0
  138. package/src/config/schema.ts +117 -2
  139. package/src/conformance/documentation-standard-v1.ts +8 -6
  140. package/src/discovery/areas.ts +182 -0
  141. package/src/discovery/documentation.ts +211 -5
  142. package/src/discovery/identity.ts +24 -0
  143. package/src/discovery/incremental.ts +314 -0
  144. package/src/discovery/inputs.ts +110 -0
  145. package/src/discovery/markdown.ts +481 -0
  146. package/src/discovery/repository.ts +484 -101
  147. package/src/doctor/run-doctor.ts +244 -12
  148. package/src/enrich/approvals.ts +190 -0
  149. package/src/enrich/cache.ts +93 -0
  150. package/src/enrich/context-pack.ts +272 -0
  151. package/src/enrich/overlay.ts +255 -0
  152. package/src/enrich/review.ts +106 -0
  153. package/src/enrich/stage.ts +374 -0
  154. package/src/enrich/stats.ts +100 -0
  155. package/src/enrich/validate.ts +410 -0
  156. package/src/federation/llms.ts +2 -4
  157. package/src/findings/report.ts +103 -0
  158. package/src/graph/build.ts +356 -0
  159. package/src/graph/memory.ts +208 -0
  160. package/src/index-builder/build-handoffs.ts +22 -11
  161. package/src/index-builder/build-index.ts +132 -3
  162. package/src/index-builder/llms-txt.ts +48 -8
  163. package/src/index-builder/project-corpus.ts +111 -0
  164. package/src/index.ts +630 -2
  165. package/src/lib/fuzzy-match.ts +235 -0
  166. package/src/mcp/knowledge.ts +554 -0
  167. package/src/mcp/server.ts +113 -18
  168. package/src/metrics/benchmark.ts +21 -0
  169. package/src/parity/check.ts +309 -0
  170. package/src/parity/claims.ts +259 -0
  171. package/src/parity/resolve.ts +160 -0
  172. package/src/query/handoff.ts +326 -0
  173. package/src/query/load-index.ts +53 -1
  174. package/src/query/query.ts +92 -59
  175. package/src/query/search.ts +289 -92
  176. package/src/query/text.ts +155 -0
  177. package/src/reconciliation/reconcile.ts +101 -10
  178. package/src/render/data.ts +356 -0
  179. package/src/render/engine.ts +398 -0
  180. package/src/render/generated.ts +77 -0
  181. package/src/render/render.ts +209 -0
  182. package/src/render/template-source.ts +52 -0
  183. package/src/render/templates.ts +289 -0
  184. package/src/report/html.ts +2 -2
  185. package/src/retrieval/bm25.ts +161 -0
  186. package/src/retrieval/project.ts +495 -0
  187. package/src/retrieval/rank.ts +383 -0
  188. package/src/retrieval/weights.ts +39 -0
  189. package/src/retriever/doc-bridge-retriever.ts +100 -15
  190. package/src/rules/engine.ts +30 -10
  191. package/src/schemas/agent-handoff.ts +56 -0
  192. package/src/schemas/budget.ts +37 -0
  193. package/src/schemas/doc-bridge-index.ts +53 -2
  194. package/src/schemas/enrichment.ts +369 -0
  195. package/src/schemas/json-schemas.ts +39 -2
  196. package/src/schemas/knowledge.ts +14 -1
  197. package/src/schemas/retrieval-index.ts +152 -0
  198. package/src/shims/graphology.d.ts +91 -0
  199. package/src/study/adjudication.ts +196 -0
  200. package/src/study/execution.ts +350 -0
  201. package/src/study/expectations.ts +219 -0
  202. package/src/study/metrics.ts +467 -0
  203. package/src/study/protocol.ts +271 -0
  204. package/src/study/provider-cli.ts +115 -0
  205. package/src/study/provider-telemetry.ts +47 -0
  206. package/src/study/quality-scorecard.ts +164 -0
  207. package/src/study/runner.ts +461 -0
  208. package/src/study/task-suite.ts +321 -0
  209. package/src/study/verification.ts +134 -0
  210. package/src/validate.ts +1 -4
  211. package/src/version.ts +1 -1
  212. package/src/workflow/engine.ts +36 -11
  213. package/scripts/verification-harness.mjs +0 -482
package/src/index.ts CHANGED
@@ -9,10 +9,12 @@ export {
9
9
  } from './config/load-config.js'
10
10
  export {
11
11
  DocBridgeConfigV1Schema,
12
+ DocumentationAuditConfigSchema,
12
13
  DocumentationStandardRuleIdSchema,
13
14
  DocumentationStandardV1ConfigSchema,
14
15
  EcosystemContractEvidenceSchema,
15
16
  type DocBridgeConfigV1,
17
+ type DocumentationAuditConfig,
16
18
  type AgentCorpusConfig,
17
19
  type DocumentationStandardV1Config,
18
20
  RuleIdSchema,
@@ -33,6 +35,7 @@ export {
33
35
  AgentHandoffV1Schema,
34
36
  AgentHandoffLegacySchema,
35
37
  AgentSearchV1Schema,
38
+ AgentQueryModeSchema,
36
39
  HandoffTargetTypeSchema,
37
40
  HANDOFF_SCHEMA_VERSION,
38
41
  normalizeAgentHandoff,
@@ -40,6 +43,7 @@ export {
40
43
  type AgentHandoffV1,
41
44
  type HandoffBridge,
42
45
  type AgentSearchV1,
46
+ type AgentQueryMode,
43
47
  type HandoffTarget,
44
48
  type HandoffTargetType,
45
49
  } from './schemas/agent-handoff.js'
@@ -47,9 +51,13 @@ export {
47
51
  export {
48
52
  DocBridgeIndexV1Schema,
49
53
  KnowledgeEntrySchema,
54
+ RepositoryInputsSchema,
55
+ RetrievalMetadataSchema,
50
56
  INDEX_SCHEMA_VERSION,
51
57
  type DocBridgeIndexV1,
52
58
  type KnowledgeEntry,
59
+ type RepositoryInputs,
60
+ type RetrievalMetadata,
53
61
  } from './schemas/doc-bridge-index.js'
54
62
 
55
63
  export {
@@ -82,7 +90,171 @@ export {
82
90
  } from './validate.js'
83
91
 
84
92
  export { buildDocBridgeIndex, type BuildIndexOptions, type BuildIndexResult } from './index-builder/build-index.js'
93
+ export {
94
+ CORPUS_PROJECTION_VERSION,
95
+ PROJECTED_ENTRY_TYPES,
96
+ indexConfigurationHash,
97
+ isProjectedEntry,
98
+ repositoryInputs,
99
+ type RepositoryInputsV1,
100
+ } from './index-builder/project-corpus.js'
101
+ export {
102
+ DOCUMENT_BODY_LIMIT,
103
+ EMPTY_OVERLAY_HASH,
104
+ RETRIEVAL_PROJECTION_VERSION,
105
+ projectRetrievalIndex,
106
+ relationConfidence,
107
+ toKnowledgeEntry,
108
+ weakerConfidence,
109
+ type CuratedDocument,
110
+ type ProjectRetrievalOptions,
111
+ type RetrievalOverlayInput,
112
+ type RetrievalRoutes,
113
+ } from './retrieval/project.js'
114
+ export {
115
+ ACCEPTED_SIGNALS_WEIGHT,
116
+ RELEVANCE_FLOOR,
117
+ rankRetrieval,
118
+ type RankExplanation,
119
+ type RankOptions,
120
+ type RankedEntry,
121
+ type ScoreComponents,
122
+ } from './retrieval/rank.js'
123
+ export {
124
+ RETRIEVAL_INDEX_SCHEMA_VERSION,
125
+ RetrievalEntrySchema,
126
+ RetrievalIndexV1Schema,
127
+ RetrievalKindSchema,
128
+ ConfidenceSchema,
129
+ AudienceSchema,
130
+ type Audience,
131
+ type Confidence,
132
+ type RetrievalEdge,
133
+ type RetrievalEntry,
134
+ type RetrievalFields,
135
+ type RetrievalGraph,
136
+ type RetrievalIndexV1,
137
+ type RetrievalKind,
138
+ } from './schemas/retrieval-index.js'
139
+ export { entityId, relationId } from './discovery/identity.js'
140
+ export {
141
+ DEFAULT_COMMUNITY_SEED,
142
+ DEFAULT_PROXIMITY_DEPTH,
143
+ DOCUMENTATION_EDGE_KINDS,
144
+ GRAPH_ANALYZER_VERSION,
145
+ IMPORT_EDGE_KINDS,
146
+ MAX_REPORTED_CYCLES,
147
+ PROXIMITY_EDGE_KINDS,
148
+ areaSuggestionCoverage,
149
+ areaSuggestions,
150
+ buildKnowledgeGraph,
151
+ canonicality,
152
+ centrality,
153
+ importCycles,
154
+ proximity,
155
+ seededRandom,
156
+ type AreaSuggestion,
157
+ type BuildGraphOptions,
158
+ type GraphSignal,
159
+ type ImportCycle,
160
+ type ProximityOptions,
161
+ } from './graph/build.js'
162
+ export {
163
+ createDocBridgeGraphMemory,
164
+ type GraphEdge,
165
+ type GraphMemory,
166
+ type GraphNode,
167
+ type GraphQuery,
168
+ type KnowledgeOverlay,
169
+ } from './graph/memory.js'
170
+ export {
171
+ AREA_ANALYZER_VERSION,
172
+ DEFAULT_AREA_DEPTH,
173
+ DEFAULT_AREA_ROOTS,
174
+ conventionalAreaPath,
175
+ deriveAreas,
176
+ unobservedOwnershipPaths,
177
+ type AreaModule,
178
+ type AreaOwnership,
179
+ type DeriveAreasOptions,
180
+ type DerivedArea,
181
+ } from './discovery/areas.js'
182
+ export {
183
+ MARKDOWN_ANALYZER_VERSION,
184
+ MARKDOWN_RELATION_CAP,
185
+ analyzeMarkdownDocument,
186
+ declaredAudience,
187
+ markdownContentHash,
188
+ parseMarkdownDocument,
189
+ type MarkdownAnalysis,
190
+ type MarkdownDocumentV1,
191
+ type MarkdownFrontmatter,
192
+ type MarkdownGeneratedRegion,
193
+ type MarkdownHeading,
194
+ type MarkdownNote,
195
+ type MarkdownReference,
196
+ type MarkdownResolution,
197
+ } from './discovery/markdown.js'
198
+ export {
199
+ FUZZY_RESOLUTION_THRESHOLD,
200
+ fuzzyMatchList,
201
+ jaro,
202
+ jaroWinkler,
203
+ resolveFuzzyReference,
204
+ type FuzzyMatch,
205
+ } from './lib/fuzzy-match.js'
206
+ export {
207
+ CONFIG_EXTENSIONS,
208
+ DOCUMENT_EXTENSIONS,
209
+ SOURCE_EXTENSIONS,
210
+ documentClassification,
211
+ exportedNames,
212
+ safeWalkOptions,
213
+ } from './discovery/inputs.js'
214
+ export {
215
+ BM25_VERSION,
216
+ bm25Idf,
217
+ bm25Search,
218
+ buildBm25Index,
219
+ type Bm25FieldWeights,
220
+ type Bm25Hit,
221
+ type Bm25Index,
222
+ type Bm25Input,
223
+ type Bm25Params,
224
+ } from './retrieval/bm25.js'
225
+ export {
226
+ DEFAULT_SEARCH_PARAMS,
227
+ DEFAULT_SEARCH_WEIGHTS,
228
+ resolveSearchParams,
229
+ resolveSearchWeights,
230
+ } from './retrieval/weights.js'
231
+ export {
232
+ SEARCH_LEXICON_VERSION,
233
+ SEARCH_STOPWORDS,
234
+ expandSearchToken,
235
+ foldAccents,
236
+ hasSearchToken,
237
+ isSearchStopword,
238
+ searchTokens,
239
+ singularizeSearchToken,
240
+ tokenizeSearchText,
241
+ type SearchTokenizeOptions,
242
+ } from './query/text.js'
85
243
  export { discoverRepository, type DiscoveryOptions } from './discovery/repository.js'
244
+ export {
245
+ FILE_BACKED_KINDS,
246
+ declaredExportsOf,
247
+ exportsOf,
248
+ fileContentHash,
249
+ indexPriorSnapshot,
250
+ moduleUniverseFingerprint,
251
+ replayableRelations,
252
+ resolutionFingerprint,
253
+ reuseCoverage,
254
+ type PriorFile,
255
+ type PriorSnapshot,
256
+ type ReuseLedger,
257
+ } from './discovery/incremental.js'
86
258
  export { containedPath, DEFAULT_SAFETY_EXCLUDES, redactSecrets, redactValue, safeWalkFiles, type SafeWalkOptions, type SafeWalkResult } from './safety/repository.js'
87
259
  export { DEFAULT_REGISTRY_AGENT_ID, createRegistryAgentAdapter, loadRegistryAgentMetadata, loadRegistryAgentRunner, persistRegistryAgentProposal, type RegistryAgentAdapter, type RegistryAgentContext, type RegistryAgentMetadata, type RegistryAgentRunner } from './agents/registry-adapter.js'
88
260
  export {
@@ -95,6 +267,18 @@ export {
95
267
  type DocumentationDiagnostic,
96
268
  } from './discovery/documentation.js'
97
269
  export { reconcileKnowledge } from './reconciliation/reconcile.js'
270
+ export {
271
+ DOCUMENTATION_AUDIT_SCHEMA_VERSION,
272
+ DocumentationAuditDocumentSchema,
273
+ DocumentationAuditFindingSchema,
274
+ DocumentationAuditReportV1Schema,
275
+ auditDocumentation,
276
+ formatDocumentationAuditText,
277
+ type DocumentationAuditFinding,
278
+ type DocumentationAuditDocument,
279
+ type DocumentationAuditOptions,
280
+ type DocumentationAuditReportV1,
281
+ } from './audit/documentation.js'
98
282
  export {
99
283
  DEFAULT_LARGE_REPORT_THRESHOLD_BYTES,
100
284
  renderOfflineReport,
@@ -122,6 +306,32 @@ export {
122
306
  type WorkflowStageContext,
123
307
  type WorkflowStageHandler,
124
308
  } from './workflow/engine.js'
309
+ export {
310
+ STUDY_METRICS_SCHEMA_VERSION,
311
+ StudyMetricsReportV1Schema,
312
+ calculateStudyMetrics,
313
+ formatStudyMetricsText,
314
+ parseStudyMetrics,
315
+ type StudyMetricComparisonV1,
316
+ type StudyMetricGroupV1,
317
+ type StudyMetricSetV1,
318
+ type StudyMetricsReportV1,
319
+ } from './study/metrics.js'
320
+ export {
321
+ ControlledStudyVerifiedResultV1Schema,
322
+ STUDY_VERIFICATION_CONTENT_HASH_ALGO,
323
+ STUDY_VERIFICATION_SCHEMA_VERSION,
324
+ StudyVerificationBindingV1Schema,
325
+ createControlledStudyVerifiedResult,
326
+ createStudyVerificationBinding,
327
+ formatStudyVerificationText,
328
+ parseControlledStudyVerifiedResult,
329
+ parseStudyVerificationBinding,
330
+ scanStudyPublicationArtifact,
331
+ type ControlledStudyVerifiedResultV1,
332
+ type StudyPrivacyScan,
333
+ type StudyVerificationBindingV1,
334
+ } from './study/verification.js'
125
335
  export {
126
336
  evaluateRules,
127
337
  parseRuleId,
@@ -174,6 +384,7 @@ export {
174
384
  type DoctorBadgeMetrics,
175
385
  } from './doctor/badge.js'
176
386
  export { watchDocBridgeIndex, type WatchIndexOptions } from './index-builder/watch-index.js'
387
+ export { evaluateQualityScorecard, type QualityScorecard, type QualityScorecardInput, type ScorecardCriterion, type ScorecardDimension, type ScorecardStatus } from './study/quality-scorecard.js'
177
388
  export {
178
389
  promoteMemoryToGithubPr,
179
390
  writePromotionDraft,
@@ -200,8 +411,10 @@ export {
200
411
  compareBenchmarkSnapshots,
201
412
  formatBenchmarkText,
202
413
  measureAgentEfficiency,
414
+ measureAgentTaskEfficiency,
203
415
  measureBenchmark,
204
416
  type AgentEfficiencyObservation,
417
+ type AgentTaskEfficiencyObservation,
205
418
  type BenchmarkFixtureV1,
206
419
  type BenchmarkObservation,
207
420
  type BenchmarkResult,
@@ -209,10 +422,136 @@ export {
209
422
  type BenchmarkSnapshot,
210
423
  type BenchmarkSnapshotDiff,
211
424
  } from './metrics/benchmark.js'
425
+ export {
426
+ EVAL_FORMAT_VERSION,
427
+ RETRIEVAL_BENCH_SCHEMA_VERSION,
428
+ RetrievalBenchResultV1Schema,
429
+ RetrievalSuiteCaseSchema,
430
+ RetrievalSuiteSchema,
431
+ formatRetrievalBenchText,
432
+ matchesRetrievalExpectation,
433
+ parseRetrievalBenchResult,
434
+ parseRetrievalSuite,
435
+ rankedOutput,
436
+ runRetrievalBench,
437
+ type RetrievalBenchResultV1,
438
+ type RetrievalCaseOutcome,
439
+ type RetrievalMetrics,
440
+ type RetrievalSuite,
441
+ type RetrievalSuiteCase,
442
+ type RunRetrievalBenchOptions,
443
+ } from './bench/retrieval.js'
444
+ export {
445
+ RetrievalBaselineV1Schema,
446
+ compareRetrievalBaseline,
447
+ createRetrievalBaseline,
448
+ formatRetrievalComparisonText,
449
+ parseRetrievalBaseline,
450
+ type CompareRetrievalBaselineOptions,
451
+ type CreateRetrievalBaselineOptions,
452
+ type RetrievalBaselineV1,
453
+ type RetrievalComparison,
454
+ type RetrievalComparisonStatus,
455
+ type RetrievalMetricDelta,
456
+ } from './bench/baseline.js'
457
+ export {
458
+ STUDY_PROTOCOL_CONTENT_HASH_ALGO,
459
+ STUDY_PROTOCOL_SCHEMA_VERSION,
460
+ StudyProtocolV1Schema,
461
+ HistoricalEvidenceRecordV1Schema,
462
+ HistoricalEvidenceRegistryV1Schema,
463
+ createStudyProtocol,
464
+ parseStudyProtocol,
465
+ createHistoricalEvidenceRegistry,
466
+ parseHistoricalEvidenceRegistry,
467
+ validateHistoricalEvidenceRegistry,
468
+ formatStudyProtocolText,
469
+ formatHistoricalEvidenceText,
470
+ type StudyProtocolV1,
471
+ type HistoricalEvidenceRecordV1,
472
+ type HistoricalEvidenceRegistryV1,
473
+ } from './study/protocol.js'
474
+ export {
475
+ STUDY_TASK_SUITE_CONTENT_HASH_ALGO,
476
+ STUDY_TASK_SUITE_SCHEMA_VERSION,
477
+ StudyTaskSuiteV1Schema,
478
+ createStudyTaskSuite,
479
+ evaluateStudyTask,
480
+ formatStudyTaskSuiteText,
481
+ parseStudyTaskSuite,
482
+ selectTaskExecutions,
483
+ validateStudyTaskSuite,
484
+ type StudyTaskSuiteV1,
485
+ type StudyTaskV1,
486
+ type TaskEvaluation,
487
+ type TaskEvaluationInput,
488
+ type TaskExecution,
489
+ type TaskOutcomeStatus,
490
+ } from './study/task-suite.js'
491
+ export {
492
+ STUDY_RUNNER_CONTENT_HASH_ALGO,
493
+ STUDY_RUNNER_SCHEMA_VERSION,
494
+ ControlledStudyObservationLedgerV1Schema,
495
+ ControlledStudyObservationV1Schema,
496
+ ControlledStudyRunPlanV1Schema,
497
+ createControlledStudyLedger,
498
+ createControlledStudyObservation,
499
+ createControlledStudyRunPlan,
500
+ formatControlledStudyRunPlanText,
501
+ parseControlledStudyLedger,
502
+ parseControlledStudyObservation,
503
+ parseControlledStudyRunPlan,
504
+ persistControlledStudyLedger,
505
+ runControlledCommand,
506
+ upsertControlledStudyObservation,
507
+ type ControlledCommandRequest,
508
+ type ControlledStudyObservationLedgerV1,
509
+ type ControlledStudyObservationV1,
510
+ type ControlledStudyRunPlanV1,
511
+ type TaskExecutionV1,
512
+ } from './study/runner.js'
513
+ export {
514
+ STUDY_PROVIDER_CLI_CONTENT_HASH_ALGO,
515
+ STUDY_PROVIDER_CLI_SCHEMA_VERSION,
516
+ StudyProviderCliConfigV1Schema,
517
+ createStudyProviderCliConfig,
518
+ calculateStudyCostUsd,
519
+ formatStudyProviderCliText,
520
+ parseStudyProviderCliConfig,
521
+ providerForStudyExecution,
522
+ validateStudyProviderCommand,
523
+ type StudyProviderCli,
524
+ type StudyProviderCliConfigV1,
525
+ type StudyProviderCostPricing,
526
+ type StudyAdjudicatorCli,
527
+ } from './study/provider-cli.js'
528
+ export {
529
+ STUDY_ADJUDICATION_METHOD,
530
+ adjudicatedLedgerInputHash,
531
+ independentlyAdjudicateStudyLedger,
532
+ independentlyAdjudicateStudyObservation,
533
+ persistIndependentlyAdjudicatedLedger,
534
+ type IndependentStudyAdjudicationOptions,
535
+ } from './study/adjudication.js'
536
+ export { measureProviderToolTelemetry, type ProviderToolTelemetry } from './study/provider-telemetry.js'
537
+ export {
538
+ STUDY_REPOSITORY_CONFIG_CONTENT_HASH_ALGO,
539
+ STUDY_REPOSITORY_CONFIG_SCHEMA_VERSION,
540
+ StudyRepositoryConfigV1Schema,
541
+ createStudyRepositoryConfig,
542
+ formatControlledStudyRunText,
543
+ adjudicateControlledStudyObservation,
544
+ parseStudyRepositoryConfig,
545
+ runControlledStudy,
546
+ type ControlledStudyRunOptions,
547
+ type ControlledStudyRunSummary,
548
+ type StudyRepositoryConfigV1,
549
+ } from './study/execution.js'
212
550
  export {
213
551
  AgentProposalV1Schema,
214
552
  AffectedFileSchema,
215
553
  CoverageSchema,
554
+ CorrelationContextV1Schema,
216
555
  DiagnosticSeveritySchema,
217
556
  DiscoverySnapshotV1Schema,
218
557
  EntitySchema,
@@ -234,6 +573,7 @@ export {
234
573
  WorkflowStateSchema,
235
574
  WorkflowTransitionSchema,
236
575
  type AgentProposalV1,
576
+ type CorrelationContextV1,
237
577
  type DiagnosticSeverity,
238
578
  type DiscoverySnapshotV1,
239
579
  type Evidence,
@@ -249,9 +589,10 @@ export {
249
589
  type WorkflowRunV1,
250
590
  type WorkflowState,
251
591
  } from './schemas/knowledge.js'
252
- export { IndexNotFoundError, indexFilePath, loadDocBridgeIndex, resolveRoot } from './query/load-index.js'
592
+ export { IndexNotFoundError, IndexStaleError, indexFilePath, loadDocBridgeIndex, loadFreshDocBridgeIndex, resolveRoot } from './query/load-index.js'
253
593
  export { runQuery, type QueryKind, type QueryRequest, type QueryResult } from './query/query.js'
254
- export { searchIndex, type SearchMatch } from './query/search.js'
594
+ export { searchIndex, type SearchMatch, type SearchOptions } from './query/search.js'
595
+ export { handoffForEntity, resolveHandoffEntry, type HandoffOptions } from './query/handoff.js'
255
596
  export {
256
597
  ingestAgentMemory,
257
598
  ingestCursorRules,
@@ -280,9 +621,13 @@ export {
280
621
  export {
281
622
  createDocBridgeRetriever,
282
623
  retrieveDocBridgeChunks,
624
+ retrieveDocBridgeDocuments,
283
625
  type DocBridgeRetrievedChunk,
284
626
  type DocBridgeRetriever,
285
627
  type DocBridgeRetrieverOptions,
628
+ type RetrievedDocument,
629
+ type Retriever,
630
+ type RetrieverRequest,
286
631
  } from './retriever/doc-bridge-retriever.js'
287
632
 
288
633
  export { PACKAGE_VERSION } from './version.js'
@@ -299,3 +644,286 @@ export {
299
644
  docBridgePatternMarkdown,
300
645
  docBridgePatternPayload,
301
646
  } from './playbook/doc-bridge-pattern.js'
647
+
648
+ // KR-08: MCP knowledge tools, findings reporter, measured doctor
649
+ export {
650
+ approximateCounter,
651
+ compileBudget,
652
+ TOKEN_METHOD,
653
+ type BudgetMessage,
654
+ type BudgetTokenCounter,
655
+ type CompileBudgetInput,
656
+ type CompileBudgetResult,
657
+ } from './budget/compile.js'
658
+ export { applyBudget, type BudgetedSection } from './budget/sections.js'
659
+ export { BUDGET_SECTION_ORDER, BudgetReportSchema, BudgetSectionSchema, type BudgetReport, type BudgetSection } from './schemas/budget.js'
660
+ export {
661
+ budgetedHandoff,
662
+ formatKnowledgeLookupText,
663
+ formatKnowledgeSearchText,
664
+ knowledgeLookup,
665
+ knowledgeSearch,
666
+ KNOWLEDGE_TOOLS_SCHEMA_VERSION,
667
+ MAX_LOOKUP_DEPTH,
668
+ resolveLookupEntry,
669
+ type KnowledgeDocumentRef,
670
+ type KnowledgeLookupEntity,
671
+ type KnowledgeEvidence,
672
+ type KnowledgeLookupOptions,
673
+ type KnowledgeLookupRequest,
674
+ type KnowledgeLookupResponse,
675
+ type KnowledgeNeighbour,
676
+ type KnowledgeSearchRequest,
677
+ type KnowledgeSearchResponse,
678
+ type KnowledgeSearchResult,
679
+ } from './mcp/knowledge.js'
680
+ export { findingFromDiagnostic, findingsFromDiagnostics, SEVERITY_ORDER, type Finding, type ReportableDiagnostic, type Severity } from './findings/report.js'
681
+ export { formatRetrievedDocuments } from './retriever/doc-bridge-retriever.js'
682
+ // KR-09: Markdown renderings
683
+ export {
684
+ compileTemplate,
685
+ renderCompiledTemplate,
686
+ renderTemplate,
687
+ renderTemplateWithKnap,
688
+ TemplateError,
689
+ type CompiledTemplate,
690
+ type TemplateVariables,
691
+ } from './render/engine.js'
692
+ export {
693
+ GENERATED_REGION_CLOSE,
694
+ generatedRegionHash,
695
+ generatedRegionOpen,
696
+ verifyGeneratedRegions,
697
+ wrapGeneratedRegion,
698
+ type GeneratedRegionMismatch,
699
+ type GeneratedRegionRef,
700
+ } from './render/generated.js'
701
+ export {
702
+ BUNDLED_TEMPLATES,
703
+ RENDER_TEMPLATES,
704
+ RENDER_TEMPLATE_NAMES,
705
+ isRenderTemplateName,
706
+ type RenderTemplateInfo,
707
+ type RenderTemplateName,
708
+ } from './render/templates.js'
709
+ export { renderNamedTemplate, resolveTemplateSource, type TemplateSource } from './render/template-source.js'
710
+ export {
711
+ areaPagesView,
712
+ changeDigestView,
713
+ overlayReviewView,
714
+ ownershipPagesView,
715
+ pageFileName,
716
+ type AreaPageView,
717
+ type ChangeDigestView,
718
+ type OverlayReviewInput,
719
+ type OverlayReviewView,
720
+ type OwnershipPageView,
721
+ type RenderedPage,
722
+ type SnapshotForDigest,
723
+ } from './render/data.js'
724
+ export {
725
+ applyGeneratedRegions,
726
+ renderArtifact,
727
+ writeRenderedPages,
728
+ type RenderArtifactOptions,
729
+ type RenderArtifactResult,
730
+ } from './render/render.js'
731
+ export { llmsTxtVariables, type LlmsTxtEntry, type LlmsTxtVariables } from './index-builder/llms-txt.js'
732
+ // KR-10: enrichment overlay
733
+ export {
734
+ ALIAS_MAX,
735
+ ENRICHMENT_KINDS,
736
+ ENRICHMENT_POLICY,
737
+ ENRICHMENT_REJECTION_REASONS,
738
+ ENRICHMENT_SCHEMA_VERSION,
739
+ INTENT_MAX,
740
+ PROPOSABLE_RELATION_KINDS,
741
+ SUMMARY_MAX,
742
+ AcceptedEnrichmentSchema,
743
+ EnrichmentAdjudicationV1Schema,
744
+ EnrichmentOriginSchema,
745
+ EnrichmentOverlayV1Schema,
746
+ EnrichmentProposalV1Schema,
747
+ PendingEnrichmentSchema,
748
+ RejectedEnrichmentSchema,
749
+ enrichmentAdjudicationId,
750
+ enrichmentOverlayContentHash,
751
+ enrichmentProposalId,
752
+ enrichmentProposalKey,
753
+ isEnrichmentKind,
754
+ type AcceptedEnrichment,
755
+ type EnrichmentAdjudicationV1,
756
+ type EnrichmentKind,
757
+ type EnrichmentOrigin,
758
+ type EnrichmentOverlayV1,
759
+ type EnrichmentPayloads,
760
+ type EnrichmentPolicy,
761
+ type EnrichmentProposalOf,
762
+ type EnrichmentProposalV1,
763
+ type EnrichmentRejectionReason,
764
+ type EnrichmentStats,
765
+ type PendingEnrichment,
766
+ type RejectedEnrichment,
767
+ } from './schemas/enrichment.js'
768
+ export {
769
+ ALIAS_COLLISION_THRESHOLD,
770
+ applyEnrichmentAdjudication,
771
+ entityContentHash,
772
+ partitionEnrichmentProposals,
773
+ revalidateEnrichmentOverlay,
774
+ validateEnrichmentAdjudication,
775
+ validateEnrichmentProposal,
776
+ type EnrichmentPartition,
777
+ type EnrichmentValidationContext,
778
+ type EnrichmentVerdict,
779
+ } from './enrich/validate.js'
780
+ export {
781
+ ENRICHMENT_DIR,
782
+ ENRICHMENT_OVERLAY_FILE,
783
+ assertObservedSurvive,
784
+ effectiveEnrichment,
785
+ enrichmentFindings,
786
+ enrichmentOverlayHash,
787
+ enrichmentOverlayPath,
788
+ parseEnrichmentOverlay,
789
+ projectEnrichmentOverlay,
790
+ readEnrichmentOverlay,
791
+ sealEnrichmentOverlay,
792
+ withAcceptedRelations,
793
+ writeEnrichmentOverlay,
794
+ type EffectiveOverlay,
795
+ } from './enrich/overlay.js'
796
+ export {
797
+ CONTEXT_PACK_VERSION,
798
+ DEFAULT_PACK_BYTES,
799
+ MAX_PACK_NEIGHBOURS,
800
+ batchContextPacks,
801
+ buildContextPacks,
802
+ contextPackHash,
803
+ fitContextPack,
804
+ packByteBudget,
805
+ type BuildContextPacksOptions,
806
+ type ContextPack,
807
+ type EnrichmentTask,
808
+ } from './enrich/context-pack.js'
809
+ export { createEnrichmentCache, createMemoryEnrichmentCache, enrichmentCacheKey, type EnrichmentCache, type EnrichmentCacheKeyInput } from './enrich/cache.js'
810
+ export {
811
+ APPROVALS_DIR,
812
+ ENRICHMENT_APPROVAL_GATE,
813
+ FIX_APPROVAL_GATE,
814
+ approvalsDir,
815
+ createApprovalGateMirror,
816
+ createFileApprovalStore,
817
+ enrichmentApprovalId,
818
+ fixApprovalId,
819
+ listApprovals,
820
+ loadApprovalGate,
821
+ recordApproval,
822
+ type Approval,
823
+ type ApprovalDecision,
824
+ type ApprovalGate,
825
+ type ApprovalStore,
826
+ } from './enrich/approvals.js'
827
+ export {
828
+ ROLE_TARGET_KINDS,
829
+ ROLE_TASK,
830
+ formatEnrichmentText,
831
+ resolveEnrichmentRoles,
832
+ runEnrichment,
833
+ type EnrichmentAgent,
834
+ type EnrichmentRole,
835
+ type EnrichmentRunOptions,
836
+ type EnrichmentRunResult,
837
+ type ResolvedRole,
838
+ } from './enrich/stage.js'
839
+ export { decideEnrichment, listEnrichment, type DecideEnrichmentOptions, type DecideEnrichmentResult, type EnrichmentReview } from './enrich/review.js'
840
+ export { REGISTRY_AGENT_PROTOCOL_V2, type RegistryEnrichmentContext } from './agents/registry-adapter.js'
841
+ export { ACCEPTED_SIGNALS_SHARE } from './retrieval/rank.js'
842
+
843
+ // KR-11: overlay statistics, the assisted study arm, tokens to first evidence
844
+ export {
845
+ INVENTED_RELATION_REASONS,
846
+ } from './schemas/enrichment.js'
847
+ export {
848
+ cacheHitRate,
849
+ enrichmentCost,
850
+ enrichmentStability,
851
+ formatEnrichmentStatsText,
852
+ inventedReferenceCount,
853
+ overlayProposalIds,
854
+ type EnrichmentStability,
855
+ } from './enrich/stats.js'
856
+ export {
857
+ OVERLAY_BLOCKING_METRIC,
858
+ OVERLAY_DELTA_METRICS,
859
+ formatOverlayRetrievalDeltaText,
860
+ measureOverlayRetrievalDelta,
861
+ type MeasureOverlayRetrievalDeltaOptions,
862
+ type OverlayMetricDelta,
863
+ type OverlayRetrievalDelta,
864
+ } from './bench/overlay-delta.js'
865
+ export {
866
+ RUBRIC_MECHANICAL_CHECKS,
867
+ hasRetrievalExpectations,
868
+ mechanicalRubricItems,
869
+ modelRubricItems,
870
+ rubricItemCheck,
871
+ rubricItemText,
872
+ taskRetrievalQueries,
873
+ type RubricItem,
874
+ type RubricMechanicalCheck,
875
+ type ValidateStudyTaskSuiteOptions,
876
+ } from './study/task-suite.js'
877
+ export {
878
+ STUDY_EXPECTATIONS_SCHEMA_VERSION,
879
+ StudyExpectationsV1Schema,
880
+ checkStudyExpectations,
881
+ createStudyExpectations,
882
+ formatStudyExpectationsText,
883
+ parseStudyExpectations,
884
+ studyRetrievalSuite,
885
+ type CheckStudyExpectationsOptions,
886
+ type StudyExpectationCheck,
887
+ type StudyExpectationOutcome,
888
+ type StudyExpectationsV1,
889
+ type StudyRetrievalSuite,
890
+ type UnresolvedExpectation,
891
+ } from './study/expectations.js'
892
+ export { ASSISTED_SCENARIO, assistedArmReadiness, type AssistedArmStatus } from './study/execution.js'
893
+ export { adjudicatorRubric } from './study/adjudication.js'
894
+
895
+ // #158: the public documentation parity report — claims, resolvers and the gate over them
896
+ export {
897
+ CLAIM_TRANSFORMS,
898
+ CLAIM_VALUE_TYPES,
899
+ PUBLIC_CLAIMS_CONTENT_HASH_ALGO,
900
+ PUBLIC_CLAIMS_SCHEMA_VERSION,
901
+ PublicClaimsV1Schema,
902
+ claimPattern,
903
+ claimSurfaces,
904
+ createPublicClaims,
905
+ exceptionFor,
906
+ parsePublicClaims,
907
+ renderClaim,
908
+ templateFor,
909
+ type ClaimEvidence,
910
+ type ClaimTransform,
911
+ type ClaimValueType,
912
+ type PublicClaim,
913
+ type PublicClaimException,
914
+ type PublicClaimsV1,
915
+ } from './parity/claims.js'
916
+ export { resolveClaim, type ResolveContext, type ResolvedClaim } from './parity/resolve.js'
917
+ export {
918
+ PARITY_CODES,
919
+ PARITY_EXCERPT_LIMIT,
920
+ PUBLIC_PARITY_SCHEMA_VERSION,
921
+ PublicParityReportV1Schema,
922
+ checkPublicParity,
923
+ formatPublicParityText,
924
+ parsePublicParityReport,
925
+ type CheckParityOptions,
926
+ type ParityCode,
927
+ type ParityFinding,
928
+ type PublicParityReportV1,
929
+ } from './parity/check.js'