@agentskit/doc-bridge 1.9.0 → 1.10.1

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.js CHANGED
@@ -256,11 +256,20 @@ var AnalysisConfigSchema = z.object({
256
256
  /**
257
257
  * How code areas are derived — the unit of architecture between a package and a file.
258
258
  * `roots` names directories that contain areas rather than being one (`src` holds
259
- * `src/query`); `depth` is how many levels below such a root an area sits.
259
+ * `src/query`); `depth` is how many levels below such a root an area sits; `exclude`
260
+ * names directories that hold code without being a unit of architecture.
260
261
  */
261
262
  areas: z.object({
262
263
  depth: z.number().int().min(1).max(8).optional(),
263
- roots: z.array(z.string().min(1).max(128)).max(32).optional()
264
+ roots: z.array(z.string().min(1).max(128)).max(32).optional(),
265
+ /**
266
+ * Glob patterns for directories that are not areas. A monorepo where every package
267
+ * keeps `tests/` and `fixtures/` beside `src/` derives one area per directory, and
268
+ * then connectivity asks for a document about a folder of test data. An ownership
269
+ * record naming an excluded path still makes it an area: a person saying a directory
270
+ * is a unit outranks a pattern saying it is not.
271
+ */
272
+ exclude: z.array(z.string().min(1).max(256)).max(64).optional()
264
273
  }).strict().optional()
265
274
  }).strict();
266
275
  var WorkflowConfigSchema = z.object({
@@ -1322,8 +1331,13 @@ var RetrievalIndexV1Schema = z5.object({
1322
1331
  schemaVersion: z5.literal(RETRIEVAL_INDEX_SCHEMA_VERSION),
1323
1332
  contentHash: hash2,
1324
1333
  contentHashAlgo: z5.literal("sha256-normalized-v1"),
1325
- /** The three inputs the projection is a function of. Same three hashes, same projection. */
1334
+ /**
1335
+ * Which snapshot this was projected from. Provenance, not a seal input: it carries the
1336
+ * snapshot's `sourceRevision`, and the projection is a function of what the snapshot observed
1337
+ * rather than of the revision it was observed at.
1338
+ */
1326
1339
  snapshotHash: hash2,
1340
+ /** The inputs the projection is a function of. Same hashes, same projection. */
1327
1341
  overlayHash: hash2,
1328
1342
  configurationHash: hash2,
1329
1343
  lexiconVersion: z5.number().int().nonnegative().max(1e3),
@@ -2501,6 +2515,9 @@ var areaSuggestionCoverage = (snapshot, options = {}) => {
2501
2515
  }));
2502
2516
  };
2503
2517
 
2518
+ // src/discovery/areas.ts
2519
+ import { minimatch as minimatch2 } from "minimatch";
2520
+
2504
2521
  // src/discovery/identity.ts
2505
2522
  var MAX_ID_LENGTH = 256;
2506
2523
  var ID_HASH_LENGTH = 32;
@@ -2550,10 +2567,12 @@ var deriveAreas = (options) => {
2550
2567
  const depth = options.depth ?? DEFAULT_AREA_DEPTH;
2551
2568
  const roots = options.roots ?? [...DEFAULT_AREA_ROOTS];
2552
2569
  const ownership = (options.ownership ?? []).map((record) => ({ ...record, path: normalize(record.path) }));
2570
+ const excluded = options.exclude ?? [];
2571
+ const isExcluded2 = (path) => excluded.some((pattern) => minimatch2(path, pattern, { dot: true }));
2553
2572
  const candidates = /* @__PURE__ */ new Map();
2554
2573
  for (const module of options.modules) {
2555
2574
  const path = conventionalAreaPath(module, depth, roots);
2556
- if (path && !candidates.has(path)) candidates.set(path, module.packageId);
2575
+ if (path && !candidates.has(path) && !isExcluded2(path)) candidates.set(path, module.packageId);
2557
2576
  }
2558
2577
  for (const record of ownership) {
2559
2578
  if (!record.path || candidates.has(record.path)) continue;
@@ -3651,7 +3670,8 @@ var discoverRepository = (opts = {}) => {
3651
3670
  modules: areaModules,
3652
3671
  ownership: Object.entries(opts.config?.routing?.options?.ownership ?? {}).map(([id, record]) => ({ id, path: record.path })),
3653
3672
  ...opts.config?.analysis?.areas?.depth !== void 0 ? { depth: opts.config.analysis.areas.depth } : {},
3654
- ...opts.config?.analysis?.areas?.roots !== void 0 ? { roots: opts.config.analysis.areas.roots } : {}
3673
+ ...opts.config?.analysis?.areas?.roots !== void 0 ? { roots: opts.config.analysis.areas.roots } : {},
3674
+ ...opts.config?.analysis?.areas?.exclude !== void 0 ? { exclude: opts.config.analysis.areas.exclude } : {}
3655
3675
  });
3656
3676
  const areasById = new Map(areas.map((area) => [area.id, area]));
3657
3677
  const areasByPath = new Map(areas.map((area) => [area.path, area.id]));
@@ -3952,7 +3972,7 @@ var readBoundedText = (path, budget, limits) => {
3952
3972
  };
3953
3973
 
3954
3974
  // src/index-builder/scan-corpus.ts
3955
- import { minimatch as minimatch2 } from "minimatch";
3975
+ import { minimatch as minimatch3 } from "minimatch";
3956
3976
 
3957
3977
  // src/lib/markdown.ts
3958
3978
  var parseFrontmatter = (markdown) => {
@@ -4103,8 +4123,8 @@ var configuredPathMatches = (relPath, include, exclude) => {
4103
4123
  const normalize3 = (pattern) => toPosix(pattern).replace(/^\.\//, "");
4104
4124
  const included = include?.filter(Boolean).map(normalize3) ?? [];
4105
4125
  const excluded = exclude?.filter(Boolean).map(normalize3) ?? [];
4106
- if (excluded.some((pattern) => minimatch2(relPath, pattern, { dot: true }))) return false;
4107
- return included.length === 0 || included.some((pattern) => minimatch2(relPath, pattern, { dot: true }));
4126
+ if (excluded.some((pattern) => minimatch3(relPath, pattern, { dot: true }))) return false;
4127
+ return included.length === 0 || included.some((pattern) => minimatch3(relPath, pattern, { dot: true }));
4108
4128
  };
4109
4129
  var scanAgentCorpus = (root, config) => {
4110
4130
  const agentRoot = containedProjectPath(root, config.corpus.agent.root);
@@ -4378,7 +4398,7 @@ var buildLookup = (config, packages, corpus, indexOutFile, humanDocs = {}, root
4378
4398
  };
4379
4399
 
4380
4400
  // src/version.ts
4381
- var PACKAGE_VERSION = "1.9.0";
4401
+ var PACKAGE_VERSION = "1.10.1";
4382
4402
 
4383
4403
  // src/index-builder/capabilities.ts
4384
4404
  var renderCapabilitiesJson = (config, index, paths) => {
@@ -5285,14 +5305,14 @@ var nextraAdapter = {
5285
5305
  };
5286
5306
 
5287
5307
  // src/index-builder/human-adapters/plain-markdown.ts
5288
- import { minimatch as minimatch3 } from "minimatch";
5308
+ import { minimatch as minimatch4 } from "minimatch";
5289
5309
  var stringPatterns = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string" && item.length > 0) : [];
5290
5310
  var matchesConfiguredPath = (relPath, options) => {
5291
5311
  const normalize3 = (pattern) => pattern.replaceAll("\\", "/").replace(/^\.\//, "");
5292
5312
  const include = stringPatterns(options?.include).map(normalize3);
5293
5313
  const exclude = stringPatterns(options?.exclude).map(normalize3);
5294
- if (exclude.some((pattern) => minimatch3(relPath, pattern, { dot: true }))) return false;
5295
- return include.length === 0 || include.some((pattern) => minimatch3(relPath, pattern, { dot: true }));
5314
+ if (exclude.some((pattern) => minimatch4(relPath, pattern, { dot: true }))) return false;
5315
+ return include.length === 0 || include.some((pattern) => minimatch4(relPath, pattern, { dot: true }));
5296
5316
  };
5297
5317
  var plainMarkdownAdapter = {
5298
5318
  plugin: "plain-markdown",
@@ -5330,7 +5350,7 @@ var starlightAdapter = {
5330
5350
  };
5331
5351
 
5332
5352
  // src/index-builder/human-adapters/vitepress.ts
5333
- import { minimatch as minimatch4 } from "minimatch";
5353
+ import { minimatch as minimatch5 } from "minimatch";
5334
5354
  var isVitePressPage = (relPath) => !relPath.split("/").some((part) => part === ".vitepress" || part.startsWith("."));
5335
5355
  var srcExcludePatterns = (value) => {
5336
5356
  if (value === void 0) return [];
@@ -5344,7 +5364,7 @@ var srcExcludePatterns = (value) => {
5344
5364
  return pattern;
5345
5365
  });
5346
5366
  };
5347
- var isExcluded = (relPath, patterns) => patterns.some((pattern) => minimatch4(relPath, pattern, { dot: true }));
5367
+ var isExcluded = (relPath, patterns) => patterns.some((pattern) => minimatch5(relPath, pattern, { dot: true }));
5348
5368
  var vitepressSlug = (relPath, cleanUrls) => {
5349
5369
  const slug2 = routeSlug(relPath);
5350
5370
  if (cleanUrls || /(?:^|\/)index\.mdx?$/.test(relPath)) return slug2;
@@ -5958,7 +5978,7 @@ var resolveSearchParams = (configured) => ({
5958
5978
  });
5959
5979
 
5960
5980
  // src/retrieval/project.ts
5961
- var RETRIEVAL_PROJECTION_VERSION = 1;
5981
+ var RETRIEVAL_PROJECTION_VERSION = 2;
5962
5982
  var DOCUMENT_BODY_LIMIT = 4e3;
5963
5983
  var MAX_EDGES = 64;
5964
5984
  var MAX_ALIASES = 32;
@@ -5966,6 +5986,12 @@ var MAX_TAGS = 32;
5966
5986
  var MAX_SYMBOLS = 256;
5967
5987
  var MAX_SUMMARY = 400;
5968
5988
  var EMPTY_OVERLAY_HASH = sha256NormalizedV1({ accepted: [] });
5989
+ var snapshotObservationHash = (snapshot) => sha256NormalizedV1({
5990
+ pipelineVersion: snapshot.pipelineVersion,
5991
+ analyzerVersions: snapshot.analyzerVersions,
5992
+ entities: snapshot.entities,
5993
+ relations: snapshot.relations
5994
+ });
5969
5995
  var CONFIDENCE_RANK = { observed: 0, declared: 1, fuzzy: 2, proposed: 3 };
5970
5996
  var weakerConfidence = (a, b) => CONFIDENCE_RANK[a] >= CONFIDENCE_RANK[b] ? a : b;
5971
5997
  var relationConfidence = (relation) => relation.metadata?.confidence === "fuzzy" ? "fuzzy" : relation.provenance;
@@ -6226,7 +6252,7 @@ var projectRetrievalIndex = (options) => {
6226
6252
  };
6227
6253
  const contentHash = sha256NormalizedV1({
6228
6254
  projectionVersion: RETRIEVAL_PROJECTION_VERSION,
6229
- snapshotHash: base.snapshotHash,
6255
+ observationHash: snapshotObservationHash(snapshot),
6230
6256
  overlayHash: base.overlayHash,
6231
6257
  configurationHash: base.configurationHash,
6232
6258
  lexiconVersion: base.lexiconVersion,
@@ -7970,7 +7996,7 @@ var reconcileKnowledge = (observed, declared, options = {}) => {
7970
7996
  // src/audit/documentation.ts
7971
7997
  import { readFileSync as readFileSync13 } from "fs";
7972
7998
  import { resolve as resolve12 } from "path";
7973
- import { minimatch as minimatch5 } from "minimatch";
7999
+ import { minimatch as minimatch6 } from "minimatch";
7974
8000
 
7975
8001
  // src/query/handoff.ts
7976
8002
  var MAX_RELATED = 3;
@@ -8504,7 +8530,7 @@ var bodyForDuplicate = (content) => {
8504
8530
  const start = lines[0] === "---" ? lines.findIndex((line, index) => index > 0 && line === "---") + 1 : 0;
8505
8531
  return lines.slice(start).join("\n").replace(/\s+/g, " ").trim().toLocaleLowerCase();
8506
8532
  };
8507
- var matches = (path, patterns) => patterns.some((pattern) => minimatch5(path, pattern, { dot: true }));
8533
+ var matches = (path, patterns) => patterns.some((pattern) => minimatch6(path, pattern, { dot: true }));
8508
8534
  var rate = (count4, total) => total ? count4 / total : null;
8509
8535
  var metadataPresent = (content, key) => {
8510
8536
  const value = parseFrontmatter(content).data[key];
@@ -10270,7 +10296,7 @@ var formatStudyVerificationText = (binding) => [
10270
10296
  ];
10271
10297
 
10272
10298
  // src/rules/engine.ts
10273
- import { minimatch as minimatch6 } from "minimatch";
10299
+ import { minimatch as minimatch7 } from "minimatch";
10274
10300
  var diagnosticRules = {
10275
10301
  DOCUMENTATION_QUALITY: "documentation-quality",
10276
10302
  RELATION_UNDOCUMENTED: "graph-undocumented-relation",
@@ -10344,7 +10370,7 @@ var evaluateRules = (report, options = {}) => {
10344
10370
  findings.push(criticalFinding(finding, criticalSeverity, matchingEntity));
10345
10371
  }
10346
10372
  for (const path of resolved.criticalPaths) {
10347
- if (finding.evidence.some((item) => minimatch6(item.path, path, { dot: true })) && !resolved.ignore.has("critical-path-risk") && criticalSeverity !== "off") {
10373
+ if (finding.evidence.some((item) => minimatch7(item.path, path, { dot: true })) && !resolved.ignore.has("critical-path-risk") && criticalSeverity !== "off") {
10348
10374
  findings.push(criticalFinding(finding, criticalSeverity, path));
10349
10375
  }
10350
10376
  }
@@ -17867,6 +17893,7 @@ export {
17867
17893
  selectTaskExecutions,
17868
17894
  sha256NormalizedV1,
17869
17895
  singularizeSearchToken,
17896
+ snapshotObservationHash,
17870
17897
  startInkChat,
17871
17898
  startMcpStdioServer,
17872
17899
  studyRetrievalSuite,