@oss-scout/mcp 0.7.0 → 0.8.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.
@@ -37626,6 +37626,45 @@ function annotateBoost(candidates, preferLanguages, preferRepos) {
37626
37626
  }
37627
37627
  }
37628
37628
  }
37629
+ function applyDiversityRatio(candidates, maxResults, diversityRatio) {
37630
+ if (maxResults <= 0)
37631
+ return [];
37632
+ const ratio = Math.max(0, Math.min(1, diversityRatio));
37633
+ if (ratio === 0)
37634
+ return candidates.slice(0, maxResults);
37635
+ const diversityReserve = Math.min(Math.floor(maxResults * ratio), maxResults);
37636
+ if (diversityReserve === 0)
37637
+ return candidates.slice(0, maxResults);
37638
+ const mainBudget = maxResults - diversityReserve;
37639
+ const picks = [];
37640
+ const seen = /* @__PURE__ */ new Set();
37641
+ for (const c of candidates) {
37642
+ if (picks.length >= mainBudget)
37643
+ break;
37644
+ picks.push(c);
37645
+ seen.add(c.issue.url);
37646
+ }
37647
+ for (const c of candidates) {
37648
+ if (picks.length >= maxResults)
37649
+ break;
37650
+ if (seen.has(c.issue.url))
37651
+ continue;
37652
+ if (c.boostScore && c.boostScore > 0)
37653
+ continue;
37654
+ c.diversitySlot = true;
37655
+ picks.push(c);
37656
+ seen.add(c.issue.url);
37657
+ }
37658
+ for (const c of candidates) {
37659
+ if (picks.length >= maxResults)
37660
+ break;
37661
+ if (seen.has(c.issue.url))
37662
+ continue;
37663
+ picks.push(c);
37664
+ seen.add(c.issue.url);
37665
+ }
37666
+ return picks;
37667
+ }
37629
37668
 
37630
37669
  // ../core/dist/core/issue-discovery.js
37631
37670
  var MODULE10 = "issue-discovery";
@@ -38039,8 +38078,9 @@ var IssueDiscovery = class {
38039
38078
  return b.viabilityScore - a.viabilityScore;
38040
38079
  });
38041
38080
  const capped = applyPerRepoCap(allCandidates, 2);
38042
- info(MODULE10, `Search complete: ${tracker.getTotalCalls()} Search API calls used, ${capped.length} candidates returned`);
38043
- return { candidates: capped.slice(0, maxResults), strategiesUsed };
38081
+ const finalPicks = applyDiversityRatio(capped, maxResults, options.diversityRatio ?? 0);
38082
+ info(MODULE10, `Search complete: ${tracker.getTotalCalls()} Search API calls used, ${finalPicks.length} candidates returned`);
38083
+ return { candidates: finalPicks, strategiesUsed };
38044
38084
  }
38045
38085
  /**
38046
38086
  * Vet a specific issue for claimability and project health.
@@ -38870,7 +38910,8 @@ var OssScout = class {
38870
38910
  strategies: options?.strategies,
38871
38911
  skippedUrls,
38872
38912
  preferLanguages: options?.preferLanguages,
38873
- preferRepos: options?.preferRepos
38913
+ preferRepos: options?.preferRepos,
38914
+ diversityRatio: options?.diversityRatio
38874
38915
  });
38875
38916
  this.state.lastSearchAt = (/* @__PURE__ */ new Date()).toISOString();
38876
38917
  this.dirty = true;
@@ -39335,9 +39376,18 @@ function registerTools(server, scout) {
39335
39376
  ),
39336
39377
  preferRepos: external_exports3.array(external_exports3.string()).optional().describe(
39337
39378
  "Soft-boost ranking for candidates in one of these `owner/repo` slugs. Stronger weight than language match (#1244). Not a filter; only reorders."
39379
+ ),
39380
+ diversityRatio: external_exports3.number().min(0).max(1).optional().describe(
39381
+ "Diversity counterweight (#1244): fraction of result slots reserved for candidates that matched NEITHER preference list. Counters echo-chamber bias when boosts accumulate over time. 0 disables, 1 reserves every slot for diversity. Default 0."
39338
39382
  )
39339
39383
  },
39340
- async ({ maxResults, strategies, preferLanguages, preferRepos }) => {
39384
+ async ({
39385
+ maxResults,
39386
+ strategies,
39387
+ preferLanguages,
39388
+ preferRepos,
39389
+ diversityRatio
39390
+ }) => {
39341
39391
  try {
39342
39392
  const parsedStrategies = strategies ? strategies.split(",").map((s) => SearchStrategySchema.parse(s.trim())) : void 0;
39343
39393
  const result = await withTimeout(
@@ -39345,7 +39395,8 @@ function registerTools(server, scout) {
39345
39395
  maxResults: maxResults ?? 10,
39346
39396
  strategies: parsedStrategies,
39347
39397
  preferLanguages,
39348
- preferRepos
39398
+ preferRepos,
39399
+ diversityRatio
39349
39400
  })
39350
39401
  );
39351
39402
  scout.saveResults(result.candidates);
package/dist/tools.js CHANGED
@@ -26,7 +26,13 @@ export function registerTools(server, scout) {
26
26
  .array(z.string())
27
27
  .optional()
28
28
  .describe("Soft-boost ranking for candidates in one of these `owner/repo` slugs. Stronger weight than language match (#1244). Not a filter; only reorders."),
29
- }, async ({ maxResults, strategies, preferLanguages, preferRepos }) => {
29
+ diversityRatio: z
30
+ .number()
31
+ .min(0)
32
+ .max(1)
33
+ .optional()
34
+ .describe("Diversity counterweight (#1244): fraction of result slots reserved for candidates that matched NEITHER preference list. Counters echo-chamber bias when boosts accumulate over time. 0 disables, 1 reserves every slot for diversity. Default 0."),
35
+ }, async ({ maxResults, strategies, preferLanguages, preferRepos, diversityRatio, }) => {
30
36
  try {
31
37
  const parsedStrategies = strategies
32
38
  ? strategies
@@ -38,6 +44,7 @@ export function registerTools(server, scout) {
38
44
  strategies: parsedStrategies,
39
45
  preferLanguages,
40
46
  preferRepos,
47
+ diversityRatio,
41
48
  }));
42
49
  scout.saveResults(result.candidates);
43
50
  await scout.checkpoint();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oss-scout/mcp",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "MCP server for oss-scout — exposes issue discovery and vetting as MCP tools",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@modelcontextprotocol/sdk": "^1.27.1",
20
20
  "zod": "^4.3.6",
21
- "@oss-scout/core": "^0.10.0"
21
+ "@oss-scout/core": "^0.11.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^25.5.0",