@mnmal-ai/substrate-nl 1.0.0-alpha.20 → 1.0.0-alpha.21
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.
|
@@ -516,11 +516,6 @@ function findPaths(pack, from, to, maxHops = 3) {
|
|
|
516
516
|
function pathLabel(ns, p) {
|
|
517
517
|
return p.map((h) => h.dir === "in" ? `in ${ns}/${h.owner}.${h.field}` : `out ${h.field}`).join(" > ");
|
|
518
518
|
}
|
|
519
|
-
const PICKED = {
|
|
520
|
-
latest: "latest",
|
|
521
|
-
max: "highest",
|
|
522
|
-
min: "lowest"
|
|
523
|
-
};
|
|
524
519
|
const PICK_WORDS = {
|
|
525
520
|
latest: "latest",
|
|
526
521
|
current: "latest",
|
|
@@ -998,18 +993,6 @@ function compose(input) {
|
|
|
998
993
|
w.excludes = w.excludes.filter((x) => !isDefault(x, w.type));
|
|
999
994
|
w.notes.push(defaultYield(w.type, yieldTo, []));
|
|
1000
995
|
}
|
|
1001
|
-
let pickDropped = false;
|
|
1002
|
-
for (const w of walks.values()) {
|
|
1003
|
-
if (w.pick === void 0 || w.excludes.length === 0) continue;
|
|
1004
|
-
const names = w.excludes.flatMap((x) => x.plan.map((c) => `'${String(c.path.at(-1)).replace(/^ruling:/, "")}'`)).join(", ");
|
|
1005
|
-
dropped.push({
|
|
1006
|
-
span: w.pick.span,
|
|
1007
|
-
reason: `cannot pick the ${PICKED[w.pick.kind]} ${w.type} while the ${names} exclusion applies`,
|
|
1008
|
-
kind: "filter"
|
|
1009
|
-
});
|
|
1010
|
-
delete w.pick;
|
|
1011
|
-
pickDropped = true;
|
|
1012
|
-
}
|
|
1013
996
|
const taken = /* @__PURE__ */ new Set();
|
|
1014
997
|
const ordered = [...walks.values()].sort((x, y) => hopKey(ns, x.path[0]).localeCompare(hopKey(ns, y.path[0])));
|
|
1015
998
|
for (const w of ordered) if (w.path.length === 1 && w.pick === void 0) w.alias = aliasFor(w.type, taken);
|
|
@@ -1039,7 +1022,7 @@ function compose(input) {
|
|
|
1039
1022
|
...seedLatest !== void 0 ? { seedLatest } : {},
|
|
1040
1023
|
...seedOrder !== void 0 ? { seedOrder } : {},
|
|
1041
1024
|
walked: walks.size > 0 || seedParts.some((p) => p.plan.some((c) => c.kind === "ref")) || plan.length > 0,
|
|
1042
|
-
strict:
|
|
1025
|
+
strict: ordered.some((w) => w.pick !== void 0) || composed.some((p) => p.plan.some((c) => c.kind === "ref"))
|
|
1043
1026
|
};
|
|
1044
1027
|
}
|
|
1045
1028
|
const isDefault = (x, type) => x.plan.some((c) => c.path.at(-1) === `ruling:${type} default exclude`);
|
|
@@ -1048,34 +1031,47 @@ function hopKey(ns, h) {
|
|
|
1048
1031
|
}
|
|
1049
1032
|
/** One walk as a (possibly nested) `_walk` clause. */
|
|
1050
1033
|
function walkPart(ns, w, exclude) {
|
|
1034
|
+
const among = w.pick === void 0 ? null : andOf(w.excludes);
|
|
1051
1035
|
const inner = andOf([
|
|
1052
1036
|
...w.filters,
|
|
1053
1037
|
...w.window,
|
|
1054
|
-
...w.excludes
|
|
1038
|
+
...among === null ? w.excludes : []
|
|
1055
1039
|
]);
|
|
1056
1040
|
const label = w.pick === void 0 ? "any" : `pick:${w.pick.kind}(${w.pick.by}) from ${w.pick.source}`;
|
|
1057
1041
|
let node = {
|
|
1058
1042
|
...w.alias !== void 0 ? { as: w.alias } : {},
|
|
1059
1043
|
...edge(ns, w.path[w.path.length - 1]),
|
|
1060
1044
|
...inner !== null ? { where: inner.where } : {},
|
|
1061
|
-
...w.pick !== void 0 ? { pick: { [w.pick.kind]: w.pick.by } } : {}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1045
|
+
...w.pick !== void 0 ? { pick: { [w.pick.kind]: w.pick.by } } : {},
|
|
1046
|
+
...among !== null ? { among: among.where } : {}
|
|
1047
|
+
};
|
|
1048
|
+
let plan = [
|
|
1049
|
+
{
|
|
1050
|
+
path: [
|
|
1051
|
+
"_walk",
|
|
1052
|
+
hopKey(ns, w.path[w.path.length - 1]),
|
|
1053
|
+
label
|
|
1054
|
+
],
|
|
1055
|
+
kind: "hop",
|
|
1056
|
+
served: true
|
|
1057
|
+
},
|
|
1058
|
+
...(among?.plan ?? []).map((c) => ({
|
|
1059
|
+
...c,
|
|
1060
|
+
path: [
|
|
1061
|
+
"_walk",
|
|
1062
|
+
"among",
|
|
1063
|
+
...c.path
|
|
1064
|
+
]
|
|
1065
|
+
})),
|
|
1066
|
+
...[...inner?.plan ?? [], ...w.notes].map((c) => ({
|
|
1067
|
+
...c,
|
|
1068
|
+
path: [
|
|
1069
|
+
"_walk",
|
|
1070
|
+
"where",
|
|
1071
|
+
...c.path
|
|
1072
|
+
]
|
|
1073
|
+
}))
|
|
1074
|
+
];
|
|
1079
1075
|
for (let i = w.path.length - 2; i >= 0; i--) {
|
|
1080
1076
|
const h = w.path[i];
|
|
1081
1077
|
const ex = exclude(h.to);
|
package/dist/bootstrap.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as askHandler, c as profileNamespace, d as runAsk, f as parseWithJudge, g as readRulings, h as mergeRulings, i as createNlPlugin, l as buildNamespacePack, m as NamespaceRulingsSchema, n as bootstrap, o as packHandler, p as parseQuestion, r as CONTRACT_VERSION, s as PackService, t as NlBootstrapConfigSchema, u as OllamaJudge } from "./bootstrap-
|
|
1
|
+
import { a as askHandler, c as profileNamespace, d as runAsk, f as parseWithJudge, g as readRulings, h as mergeRulings, i as createNlPlugin, l as buildNamespacePack, m as NamespaceRulingsSchema, n as bootstrap, o as packHandler, p as parseQuestion, r as CONTRACT_VERSION, s as PackService, t as NlBootstrapConfigSchema, u as OllamaJudge } from "./bootstrap-BPLe_YWE.js";
|
|
2
2
|
import { complete } from "./complete.js";
|
|
3
3
|
|
|
4
4
|
export { CONTRACT_VERSION, NamespaceRulingsSchema, NlBootstrapConfigSchema, OllamaJudge, PackService, askHandler, bootstrap, buildNamespacePack, complete, createNlPlugin, mergeRulings, packHandler, parseQuestion, parseWithJudge, profileNamespace, readRulings, runAsk };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walks.d.ts","sourceRoot":"","sources":["../../src/parse/walks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,yGAAyG;AACzG,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,EAAc,GAAG,UAAU,CAMhG;AAED,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,IAAI,GAAG,KAAK,CAAC;IAClB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC;AAiBzB,iGAAiG;AACjG,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,IAA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|
1
1
|
{
|
|
2
2
|
"name": "@mnmal-ai/substrate-nl",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.21",
|
|
4
4
|
"description": "Natural-language questions for Substrate — a deterministic parser with an optional constrained judge, served at POST /substrate/v1/nl and GET /substrate/v1/nl/pack/:ns, plus browser-safe completion.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@biomejs/biome": "2.6.4",
|
|
40
|
-
"@mnmal-ai/substrate": "1.0.0-alpha.
|
|
41
|
-
"@mnmal-ai/substrate-config": "1.0.0-alpha.
|
|
40
|
+
"@mnmal-ai/substrate": "1.0.0-alpha.21",
|
|
41
|
+
"@mnmal-ai/substrate-config": "1.0.0-alpha.21",
|
|
42
42
|
"@types/node": "^26.6.4",
|
|
43
43
|
"tsdown": "^0.23.0",
|
|
44
44
|
"typescript": "^7.0.2",
|