oscar64-mcp-docs 1.1.3 → 1.1.4

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/README.md CHANGED
@@ -76,7 +76,7 @@ The executable entry is built to `dist/stdio.js`.
76
76
 
77
77
  Primary tools:
78
78
 
79
- - `search(query, limit, type, system, strict, min_confidence, debug_scoring)` -> unified manual/code search with agent-facing hit fields (`result_type`, `uri`, `title`, `preview`, `confidence`, `match_reasons`, `classification_summary`), optional `referenced_files` as `code://...` URIs readable by `read_uri`; `strict` suppresses broad fallback-only results, `min_confidence` applies threshold filtering, and strict/threshold no-match responses return `quality_status`, `failure_reasons`, and `suggested_refinement`; `debug_scoring=true` adds per-hit scoring diagnostics
79
+ - `search(query, limit, type, system, strict, min_confidence, debug_scoring)` -> unified manual/code search with agent-facing hit fields (`result_type`, `uri`, `title`, `preview`, `confidence`, `confidence_level`, `match_reasons`, `classification_summary`), optional `referenced_files` as `code://...` URIs readable by `read_uri`; `strict` requires at least one exact/API match reason (symbol/include/anchor/address/API token), `min_confidence` applies threshold filtering, and insufficient-quality responses return `quality_status`, `failure_reasons`, and `suggested_refinement`; `debug_scoring=true` adds per-hit scoring diagnostics
80
80
  - `read_uri(uri, binary_mode, max_base64_bytes)` -> returns `ok + data` where `data.content_type` is `text` or `binary` for `docs://...` and `code://...`
81
81
  - `list_indexes(type, system)` -> lists `topics`/`tutorials`/`samples`/`headers` entries; `type` defaults to `headers`, `system` defaults to `c64`, and `system=all` returns cross-system indexes
82
82
 
@@ -94,4 +94,3 @@ Standard tool output envelope:
94
94
  Index discovery:
95
95
 
96
96
  - `list_indexes(type)` returns only `docs://` and `code://` URIs that can be read directly with `read_uri`.
97
-
package/dist/stdio.js CHANGED
@@ -421,6 +421,7 @@ var searchHitDebugScoringSchema = z.object({
421
421
  base_score: z.number().describe("Original backend search score for this hit."),
422
422
  confidence_raw: z.number().describe("Unclamped confidence before range enforcement.")
423
423
  });
424
+ var confidenceLevelSchema = z.enum(["high", "medium", "low"]).describe("Deterministic confidence bucket derived from confidence.");
424
425
  var searchHitSchema = z.object({
425
426
  result_type: z.enum(["topics", "tutorials", "samples", "headers"]).describe("Artifact type for this result."),
426
427
  uri: z.string().describe("URI to pass into `read_uri` for full content."),
@@ -428,6 +429,7 @@ var searchHitSchema = z.object({
428
429
  preview: searchPreviewSchema.describe("Structured preview fields for relevance evaluation."),
429
430
  referenced_files: z.array(z.string()).optional().describe("Referenced `code://...` URIs that can be read with `read_uri` (for example from #embed or #include)."),
430
431
  confidence: z.number().min(0).max(1).describe("Normalized confidence score in range 0..1."),
432
+ confidence_level: confidenceLevelSchema,
431
433
  match_reasons: z.array(matchReasonSchema).min(1).describe("Deterministic ordered reason list for this hit."),
432
434
  debug_scoring: searchHitDebugScoringSchema.optional().describe("Per-hit scoring diagnostics, only present when debug_scoring=true."),
433
435
  classification_summary: classificationSummarySchema.describe("Compact classification metadata always returned.")
@@ -2057,6 +2059,13 @@ var REASON_WEIGHTS = {
2057
2059
  topic_semantic_match: 0.18,
2058
2060
  fallback_broad_match: 0.08
2059
2061
  };
2062
+ var STRICT_ACCEPTED_REASON_CODES = /* @__PURE__ */ new Set([
2063
+ "exact_symbol_match",
2064
+ "exact_include_path_match",
2065
+ "exact_manual_anchor_match",
2066
+ "register_or_address_exact_match",
2067
+ "api_name_token_match"
2068
+ ]);
2060
2069
  function pushReason(out, code) {
2061
2070
  if (out.some((item) => item.code === code)) return;
2062
2071
  out.push({ code, weight: REASON_WEIGHTS[code] });
@@ -2065,6 +2074,11 @@ function toDeterministicConfidence(value) {
2065
2074
  const clamped = Math.max(0.02, Math.min(0.99, value));
2066
2075
  return Number(clamped.toFixed(3));
2067
2076
  }
2077
+ function toConfidenceLevel(confidence) {
2078
+ if (confidence >= 0.8) return "high";
2079
+ if (confidence >= 0.55) return "medium";
2080
+ return "low";
2081
+ }
2068
2082
  function computeScoredReasons(hit) {
2069
2083
  const reasons = [];
2070
2084
  const uriLower = hit.uri.toLowerCase();
@@ -2190,6 +2204,7 @@ async function executeSearch(context) {
2190
2204
  preview,
2191
2205
  ...referencedUris ? { referenced_files: referencedUris } : {},
2192
2206
  confidence: scored.confidence,
2207
+ confidence_level: toConfidenceLevel(scored.confidence),
2193
2208
  match_reasons: scored.reasons,
2194
2209
  ...debugScoring ? {
2195
2210
  debug_scoring: {
@@ -2210,7 +2225,7 @@ async function executeSearch(context) {
2210
2225
  }).filter((entry) => requestedType === "all" || entry.hit.result_type === requestedType).filter((entry) => matchesSystemFilter(entry.systems, system));
2211
2226
  const filteredHits = candidateHits.filter((entry) => !(entry.matchReasons.length === 1 && entry.matchReasons[0]?.code === "fallback_broad_match")).filter((entry) => {
2212
2227
  if (!strict) return true;
2213
- return !(entry.matchReasons.length === 1 && entry.matchReasons[0]?.code === "fallback_broad_match");
2228
+ return entry.matchReasons.some((reason) => STRICT_ACCEPTED_REASON_CODES.has(reason.code));
2214
2229
  }).filter((entry) => typeof minConfidence === "number" ? entry.confidence >= minConfidence : true).sort((a, b) => b.confidence - a.confidence || a.hit.uri.localeCompare(b.hit.uri)).slice(0, limit);
2215
2230
  if (filteredHits.length === 0) {
2216
2231
  const reasonCounts = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oscar64-mcp-docs",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {