simple-dynamsoft-mcp 7.6.1 → 7.7.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/README.md +2 -0
- package/package.json +4 -2
- package/scripts/eval-retrieval.mjs +64 -0
- package/scripts/lib/retrieval-eval.mjs +134 -0
- package/scripts/lib/scope-matcher.mjs +17 -0
- package/scripts/prebuild-rag-index.mjs +9 -1
- package/scripts/verify-doc-resources.mjs +2 -1
- package/src/data/repo-map.js +23 -4
- package/src/rag/config.js +4 -6
- package/src/rag/index.js +22 -2
- package/src/rag/lexical-provider.js +105 -53
- package/src/rag/search-utils.js +12 -2
- package/src/rag/vector-cache.js +77 -31
- package/src/server/resource-index/builders.js +56 -1
- package/src/server/resource-index/docs-loader.js +57 -4
- package/src/server/resource-index/shared-docs.js +161 -0
- package/src/server/resource-index.js +57 -37
- package/src/server/tools/register-index-tools.js +4 -1
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
} from "./normalizers.js";
|
|
18
18
|
import { DOCS_CONFIG } from "./resource-index/config.js";
|
|
19
19
|
import { loadMarkdownDocs } from "./resource-index/docs-loader.js";
|
|
20
|
+
import { selectSharedDcvDocs } from "./resource-index/shared-docs.js";
|
|
21
|
+
import { logEvent } from "../observability/logging.js";
|
|
20
22
|
import {
|
|
21
23
|
registryPath,
|
|
22
24
|
DOC_ROOTS,
|
|
@@ -149,40 +151,47 @@ let dcvMobileDocs = [];
|
|
|
149
151
|
let dcvServerDocs = [];
|
|
150
152
|
let dwtDocs = { articles: [] };
|
|
151
153
|
let ddvDocs = { articles: [] };
|
|
154
|
+
let dbrSharedDocs = { web: [], mobile: [], server: [] };
|
|
155
|
+
|
|
156
|
+
function loadDbrDocs(key, edition, platformResolver) {
|
|
157
|
+
const loaded = loadMarkdownDocs({
|
|
158
|
+
rootDir: DOC_ROOTS[key],
|
|
159
|
+
urlBase: DOCS_CONFIG[key].urlBase,
|
|
160
|
+
excludeDirs: DOCS_CONFIG[key].excludeDirs,
|
|
161
|
+
excludeFiles: DOCS_CONFIG[key].excludeFiles
|
|
162
|
+
});
|
|
163
|
+
return { articles: withEditionScope(loaded.articles, edition, platformResolver), siteVars: loaded.siteVars };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function selectDbrSharedDocs(key, edition, dbr, dcvEditionDocs) {
|
|
167
|
+
const dbrVersion = LATEST_VERSIONS.dbr[edition];
|
|
168
|
+
return selectSharedDcvDocs({
|
|
169
|
+
dbrArticles: dbr.articles,
|
|
170
|
+
dbrRoot: DOC_ROOTS[key],
|
|
171
|
+
siteVars: dbr.siteVars,
|
|
172
|
+
dbrVersion,
|
|
173
|
+
sources: [
|
|
174
|
+
{ articles: dcvEditionDocs, version: LATEST_VERSIONS.dcv[edition], editionSpecific: true, slugPrefix: "dcv", defaultPlatform: edition },
|
|
175
|
+
{ articles: dcvCoreDocs, version: LATEST_VERSIONS.dcv.core, editionSpecific: false, slugPrefix: "dcv-core", defaultPlatform: edition }
|
|
176
|
+
],
|
|
177
|
+
onSkip: ({ dcvVersion, slugPrefix }) => logEvent("data", "shared_docs_version_mismatch", {
|
|
178
|
+
edition,
|
|
179
|
+
dbr_version: dbrVersion,
|
|
180
|
+
dcv_version: dcvVersion,
|
|
181
|
+
source: slugPrefix
|
|
182
|
+
}, { level: "warn" })
|
|
183
|
+
});
|
|
184
|
+
}
|
|
152
185
|
|
|
153
186
|
function loadDocumentationSets() {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
rootDir: DOC_ROOTS.dbrWeb,
|
|
157
|
-
urlBase: DOCS_CONFIG.dbrWeb.urlBase,
|
|
158
|
-
excludeDirs: DOCS_CONFIG.dbrWeb.excludeDirs,
|
|
159
|
-
excludeFiles: DOCS_CONFIG.dbrWeb.excludeFiles
|
|
160
|
-
}).articles,
|
|
161
|
-
"web",
|
|
162
|
-
() => "web"
|
|
163
|
-
);
|
|
187
|
+
const dbrWeb = loadDbrDocs("dbrWeb", "web", () => "web");
|
|
188
|
+
dbrWebDocs = dbrWeb.articles;
|
|
164
189
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
rootDir: DOC_ROOTS.dbrMobile,
|
|
168
|
-
urlBase: DOCS_CONFIG.dbrMobile.urlBase,
|
|
169
|
-
excludeDirs: DOCS_CONFIG.dbrMobile.excludeDirs,
|
|
170
|
-
excludeFiles: DOCS_CONFIG.dbrMobile.excludeFiles
|
|
171
|
-
}).articles,
|
|
172
|
-
"mobile",
|
|
173
|
-
inferDbrMobilePlatform
|
|
174
|
-
);
|
|
190
|
+
const dbrMobile = loadDbrDocs("dbrMobile", "mobile", inferDbrMobilePlatform);
|
|
191
|
+
dbrMobileDocs = dbrMobile.articles;
|
|
175
192
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
rootDir: DOC_ROOTS.dbrServer,
|
|
179
|
-
urlBase: DOCS_CONFIG.dbrServer.urlBase,
|
|
180
|
-
excludeDirs: DOCS_CONFIG.dbrServer.excludeDirs,
|
|
181
|
-
excludeFiles: DOCS_CONFIG.dbrServer.excludeFiles
|
|
182
|
-
}).articles,
|
|
183
|
-
"server",
|
|
184
|
-
inferDbrServerPlatform
|
|
185
|
-
);
|
|
193
|
+
const dbrServer = loadDbrDocs("dbrServer", "server", inferDbrServerPlatform);
|
|
194
|
+
dbrServerDocs = dbrServer.articles;
|
|
186
195
|
|
|
187
196
|
dcvCoreDocs = withEditionScope(
|
|
188
197
|
loadMarkdownDocs({
|
|
@@ -252,6 +261,7 @@ function loadDocumentationSets() {
|
|
|
252
261
|
|
|
253
262
|
dwtDocs = loadMarkdownDocs({
|
|
254
263
|
rootDir: DOC_ROOTS.dwtArticles,
|
|
264
|
+
siteRoot: DOC_ROOTS.dwt,
|
|
255
265
|
urlBase: DOCS_CONFIG.dwt.urlBase,
|
|
256
266
|
includeDirNames: DOCS_CONFIG.dwt.includeDirNames
|
|
257
267
|
});
|
|
@@ -262,6 +272,12 @@ function loadDocumentationSets() {
|
|
|
262
272
|
excludeDirs: DOCS_CONFIG.ddv.excludeDirs,
|
|
263
273
|
excludeFiles: DOCS_CONFIG.ddv.excludeFiles
|
|
264
274
|
});
|
|
275
|
+
|
|
276
|
+
dbrSharedDocs = {
|
|
277
|
+
web: selectDbrSharedDocs("dbrWeb", "web", dbrWeb, dcvWebDocs),
|
|
278
|
+
mobile: selectDbrSharedDocs("dbrMobile", "mobile", dbrMobile, dcvMobileDocs),
|
|
279
|
+
server: selectDbrSharedDocs("dbrServer", "server", dbrServer, dcvServerDocs)
|
|
280
|
+
};
|
|
265
281
|
}
|
|
266
282
|
|
|
267
283
|
const dbrServerSdk = registry.sdks["dbr-server"];
|
|
@@ -339,6 +355,7 @@ function buildIndexData() {
|
|
|
339
355
|
dbrWebDocs,
|
|
340
356
|
dbrMobileDocs,
|
|
341
357
|
dbrServerDocs,
|
|
358
|
+
dbrSharedDocs,
|
|
342
359
|
dwtDocs,
|
|
343
360
|
ddvDocs,
|
|
344
361
|
discoverDcvWebSamples,
|
|
@@ -380,6 +397,7 @@ function buildResourceIndex() {
|
|
|
380
397
|
dbrWebDocs,
|
|
381
398
|
dbrMobileDocs,
|
|
382
399
|
dbrServerDocs,
|
|
400
|
+
dbrSharedDocs,
|
|
383
401
|
dwtDocs,
|
|
384
402
|
ddvDocs,
|
|
385
403
|
discoverDcvMobileSamples,
|
|
@@ -444,6 +462,8 @@ function editionMatches(normalizedEdition, entryEdition) {
|
|
|
444
462
|
function platformMatches(normalizedPlatform, entry) {
|
|
445
463
|
if (!normalizedPlatform) return true;
|
|
446
464
|
if (normalizedPlatform === entry.platform) return true;
|
|
465
|
+
// Shared pages (e.g. Capture Vision core reference) serve several platforms.
|
|
466
|
+
if (Array.isArray(entry.platforms) && entry.platforms.includes(normalizedPlatform)) return true;
|
|
447
467
|
if (normalizedPlatform === "web") return entry.platform === "web";
|
|
448
468
|
if (isWebFrameworkPlatform(normalizedPlatform)) {
|
|
449
469
|
const aliases = WEB_FRAMEWORK_TAG_ALIASES[normalizedPlatform] || [normalizedPlatform];
|
|
@@ -514,13 +534,12 @@ function buildResourceLookupCandidates(uri) {
|
|
|
514
534
|
const parts = String(rest || "").split("/").filter(Boolean);
|
|
515
535
|
if (parts.length < 5) return candidates;
|
|
516
536
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const canonical = `${scheme}://${head.join("/")}/${encodeURIComponent(slug)}`;
|
|
537
|
+
// Doc slugs are source paths; accept them with or without per-segment
|
|
538
|
+
// percent-encoding (clients differ in how they echo URIs back).
|
|
539
|
+
const head = parts.slice(0, 4).join("/");
|
|
540
|
+
const slugSegments = parts.slice(4).map((segment) => safeDecodeURIComponent(segment));
|
|
541
|
+
for (const slug of [slugSegments.join("/"), slugSegments.map((segment) => encodeURIComponent(segment)).join("/")]) {
|
|
542
|
+
const canonical = `${scheme}://${head}/${slug}`;
|
|
524
543
|
if (!candidates.includes(canonical)) {
|
|
525
544
|
candidates.push(canonical);
|
|
526
545
|
}
|
|
@@ -562,6 +581,7 @@ function getRagSignatureData() {
|
|
|
562
581
|
dbrWebDocCount: dbrWebDocs.length,
|
|
563
582
|
dbrMobileDocCount: dbrMobileDocs.length,
|
|
564
583
|
dbrServerDocCount: dbrServerDocs.length,
|
|
584
|
+
dbrSharedDocCount: dbrSharedDocs.web.length + dbrSharedDocs.mobile.length + dbrSharedDocs.server.length,
|
|
565
585
|
dwtDocCount: dwtDocs.articles.length,
|
|
566
586
|
ddvDocCount: ddvDocs.articles.length,
|
|
567
587
|
versions: LATEST_VERSIONS,
|
|
@@ -34,7 +34,10 @@ export function registerIndexTools({
|
|
|
34
34
|
const sampleId = entry.type === "sample" ? getSampleIdFromUri(entry.uri) : "";
|
|
35
35
|
const sampleHint = sampleId ? ` | sample_id: ${sampleId}` : "";
|
|
36
36
|
const scoreLabel = formatScoreLabel(entry);
|
|
37
|
-
|
|
37
|
+
const sharedLabel = entry.type === "doc" && Array.isArray(entry.tags) && entry.tags.includes("shared")
|
|
38
|
+
? ` | shared Capture Vision API used by DBR (DCV v${entry.sourceVersion || "n/a"})`
|
|
39
|
+
: "";
|
|
40
|
+
let desc = `${entry.type.toUpperCase()} | ${scopeLabel} | ${versionLabel}${sharedLabel}${scoreLabel} - ${entry.summary}${sampleHint}`;
|
|
38
41
|
if (entry.matchedSnippet) {
|
|
39
42
|
const snippet = String(entry.matchedSnippet).replace(/\s+/g, " ").slice(0, 220);
|
|
40
43
|
desc += ` — "${snippet}"`;
|