@semiont/make-meaning 0.5.27 → 0.5.28
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 +53 -26
- package/dist/index.js.map +1 -1
- package/dist/smelter-main.js +3 -3
- package/dist/smelter-main.js.map +1 -1
- package/dist/weaver-main.js +2 -1
- package/dist/weaver-main.js.map +1 -1
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -10014,15 +10014,20 @@ var GraphContext = class {
|
|
|
10014
10014
|
const citedSeen = /* @__PURE__ */ new Set();
|
|
10015
10015
|
for (const ann of referencedBy) {
|
|
10016
10016
|
const source = getTargetSource(ann.target);
|
|
10017
|
-
if (!source || source === String(resourceId10) ||
|
|
10018
|
-
citedSeen.
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10017
|
+
if (!source || source === String(resourceId10) || !ann.id || seen.has(ann.id)) continue;
|
|
10018
|
+
if (!citedSeen.has(source)) {
|
|
10019
|
+
citedSeen.add(source);
|
|
10020
|
+
const view = await kb.views.get(resourceId(source));
|
|
10021
|
+
addResourceNode(source, view?.resource?.name ?? source, view?.resource ? getResourceEntityTypes(view.resource) : []);
|
|
10022
|
+
}
|
|
10023
|
+
nodes.push({ id: ann.id, type: "annotation", label: ann.motivation ?? "annotation", entityTypes: getEntityTypes(ann), annotation: ann });
|
|
10024
|
+
seen.add(ann.id);
|
|
10025
|
+
edges.push({ source: ann.id, target: source, type: "annotation-of" });
|
|
10026
|
+
edges.push({ source: ann.id, target: mainId, type: "cites" });
|
|
10022
10027
|
}
|
|
10023
10028
|
for (const ann of annotations) {
|
|
10024
10029
|
if (!ann.id || seen.has(ann.id)) continue;
|
|
10025
|
-
nodes.push({ id: ann.id, type: "annotation", label: ann.motivation ?? "annotation", entityTypes: getEntityTypes(ann) });
|
|
10030
|
+
nodes.push({ id: ann.id, type: "annotation", label: ann.motivation ?? "annotation", entityTypes: getEntityTypes(ann), annotation: ann });
|
|
10026
10031
|
seen.add(ann.id);
|
|
10027
10032
|
edges.push({ source: ann.id, target: mainId, type: "annotation-of" });
|
|
10028
10033
|
}
|
|
@@ -10343,18 +10348,27 @@ Summary:`;
|
|
|
10343
10348
|
scoreThreshold: 0.5,
|
|
10344
10349
|
filter: { excludeResourceId: resourceId10 }
|
|
10345
10350
|
});
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10351
|
+
const similar = [];
|
|
10352
|
+
for (const r of results) {
|
|
10353
|
+
const matchView = await kb.views.get(r.resourceId);
|
|
10354
|
+
const resourceName = matchView?.resource?.name;
|
|
10355
|
+
if (!resourceName) {
|
|
10356
|
+
logger?.debug("Semantic match dropped \u2014 no view for source resource", { resourceId: String(r.resourceId) });
|
|
10357
|
+
continue;
|
|
10358
|
+
}
|
|
10359
|
+
similar.push({
|
|
10360
|
+
text: r.text,
|
|
10361
|
+
resourceId: r.resourceId,
|
|
10362
|
+
resourceName,
|
|
10363
|
+
annotationId: r.annotationId,
|
|
10364
|
+
score: r.score,
|
|
10365
|
+
entityTypes: r.entityTypes,
|
|
10366
|
+
...r.machineRead ? { machineRead: true } : {}
|
|
10367
|
+
});
|
|
10368
|
+
}
|
|
10369
|
+
if (similar.length > 0) {
|
|
10370
|
+
semanticContext = { similar };
|
|
10371
|
+
logger?.debug("Semantic context found", { matches: similar.length });
|
|
10358
10372
|
}
|
|
10359
10373
|
} catch (error) {
|
|
10360
10374
|
logger?.warn("Semantic context search failed", { error });
|
|
@@ -10686,17 +10700,30 @@ var LLMContext = class {
|
|
|
10686
10700
|
}
|
|
10687
10701
|
}
|
|
10688
10702
|
if (matches.length > 0) {
|
|
10689
|
-
|
|
10690
|
-
|
|
10703
|
+
const similar = [];
|
|
10704
|
+
for (const m of matches) {
|
|
10705
|
+
const matchView = await kb.views.get(m.resourceId);
|
|
10706
|
+
const resourceName = matchView?.resource?.name;
|
|
10707
|
+
if (!resourceName) {
|
|
10708
|
+
logger?.debug("Semantic match dropped \u2014 no view for source resource", { resourceId: String(m.resourceId) });
|
|
10709
|
+
continue;
|
|
10710
|
+
}
|
|
10711
|
+
similar.push({
|
|
10691
10712
|
text: m.text,
|
|
10692
10713
|
resourceId: m.resourceId,
|
|
10714
|
+
resourceName,
|
|
10693
10715
|
...m.annotationId ? { annotationId: m.annotationId } : {},
|
|
10694
10716
|
score: m.score,
|
|
10695
10717
|
...m.entityTypes ? { entityTypes: m.entityTypes } : {},
|
|
10696
10718
|
...m.machineRead ? { machineRead: true } : {}
|
|
10697
|
-
})
|
|
10698
|
-
|
|
10699
|
-
|
|
10719
|
+
});
|
|
10720
|
+
}
|
|
10721
|
+
if (similar.length > 0) {
|
|
10722
|
+
semanticContext = {
|
|
10723
|
+
similar,
|
|
10724
|
+
...excludeEntityTypes.length ? { excludedEntityTypes: excludeEntityTypes } : {}
|
|
10725
|
+
};
|
|
10726
|
+
}
|
|
10700
10727
|
}
|
|
10701
10728
|
return {
|
|
10702
10729
|
focus: {
|
|
@@ -13617,11 +13644,11 @@ var Smelter = class _Smelter {
|
|
|
13617
13644
|
key: checksum,
|
|
13618
13645
|
store: this.anchoredStore
|
|
13619
13646
|
});
|
|
13620
|
-
if ("declined"
|
|
13647
|
+
if (extracted.kind === "declined" || !extracted.items?.length) {
|
|
13621
13648
|
this.logger.info("Re-anchor extraction yielded no geometry", {
|
|
13622
13649
|
resourceId: rid,
|
|
13623
13650
|
contentType,
|
|
13624
|
-
..."declined"
|
|
13651
|
+
...extracted.kind === "declined" ? { declined: extracted.declined } : {}
|
|
13625
13652
|
});
|
|
13626
13653
|
return;
|
|
13627
13654
|
}
|
|
@@ -13656,7 +13683,7 @@ var Smelter = class _Smelter {
|
|
|
13656
13683
|
key: checksum,
|
|
13657
13684
|
store: this.anchoredStore
|
|
13658
13685
|
});
|
|
13659
|
-
if ("declined"
|
|
13686
|
+
if (extracted.kind === "declined") {
|
|
13660
13687
|
this.logger.debug("Extractor declined", { resourceId: resourceId10, contentType, reason: extracted.declined });
|
|
13661
13688
|
return { kind: "skipped", checksum, reason: extracted.declined };
|
|
13662
13689
|
}
|