@konneal/engine 0.2.97 → 0.2.99
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/ask-W6NUC3MG.js +15 -0
- package/dist/{chunk-CX3OVN3V.js → chunk-2SWMTCVX.js} +6 -6
- package/dist/{chunk-2PCUAJJO.js → chunk-BOAITSVV.js} +1 -0
- package/dist/{chunk-SPKPH54J.js → chunk-DTW4UW2E.js} +1 -1
- package/dist/{chunk-ZLQMRQOV.js → chunk-GY33RTEO.js} +5 -5
- package/dist/{chunk-LOBYXEVD.js → chunk-KNCRYAX3.js} +1 -1
- package/dist/{chunk-AJU6LMY3.js → chunk-QNLFNEI4.js} +140 -5
- package/dist/{chunk-PTCDEFI3.js → chunk-TXPWLKCI.js} +23 -16
- package/dist/{chunk-LVZTWUVJ.js → chunk-U4ERFUOK.js} +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/search-EQAOPFCC.js +13 -0
- package/dist/{tools-Z4HQH3QU.js → tools-ZNQY6ZMC.js} +4 -4
- package/dist/tools-content.d.ts +2 -0
- package/dist/worker_mcp/src/index.js +2 -2
- package/dist/worker_public/src/config.js +1 -1
- package/dist/worker_public/src/index.js +10 -10
- package/dist/worker_public/src/requestScope.js +2 -2
- package/package.json +1 -1
- package/workers/worker_public/src/config.ts +1 -0
- package/workers/worker_public/src/stages/licensedLane.ts +39 -21
- package/workers/worker_public/src/tools-content.ts +173 -1
- package/workers/worker_public/src/tools.ts +2 -2
- package/dist/ask-KKOQH7HK.js +0 -15
- package/dist/search-CGQFGYTR.js +0 -13
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleAsk
|
|
3
|
+
} from "./chunk-2SWMTCVX.js";
|
|
4
|
+
import "./chunk-QNLFNEI4.js";
|
|
5
|
+
import "./chunk-TXPWLKCI.js";
|
|
6
|
+
import "./chunk-KNCRYAX3.js";
|
|
7
|
+
import "./chunk-DTW4UW2E.js";
|
|
8
|
+
import "./chunk-A3QHHUN5.js";
|
|
9
|
+
import "./chunk-U4ERFUOK.js";
|
|
10
|
+
import "./chunk-BOAITSVV.js";
|
|
11
|
+
import "./chunk-JZFXSTYX.js";
|
|
12
|
+
import "./chunk-3FYJM7LH.js";
|
|
13
|
+
export {
|
|
14
|
+
handleAsk
|
|
15
|
+
};
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
tableRetyped,
|
|
19
19
|
toolNote,
|
|
20
20
|
verdictNote
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-QNLFNEI4.js";
|
|
22
22
|
import {
|
|
23
23
|
NO_CONTEXT,
|
|
24
24
|
answerQuality,
|
|
@@ -56,20 +56,20 @@ import {
|
|
|
56
56
|
tokenBudget,
|
|
57
57
|
understandQuery,
|
|
58
58
|
usageTotal
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-TXPWLKCI.js";
|
|
60
60
|
import {
|
|
61
61
|
embed,
|
|
62
62
|
generateOnce,
|
|
63
63
|
portModelRunner,
|
|
64
64
|
portStore
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-KNCRYAX3.js";
|
|
66
66
|
import {
|
|
67
67
|
corsHeaders,
|
|
68
68
|
err,
|
|
69
69
|
json,
|
|
70
70
|
readJson,
|
|
71
71
|
validateQuery
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-DTW4UW2E.js";
|
|
73
73
|
import {
|
|
74
74
|
canonicalRefusal,
|
|
75
75
|
refusalAnswer
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
requestSalt,
|
|
80
80
|
resolveRequestScope,
|
|
81
81
|
standardKeysFrom
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-U4ERFUOK.js";
|
|
83
83
|
import {
|
|
84
84
|
LIMITS,
|
|
85
85
|
MODELS,
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
requestEffort,
|
|
91
91
|
roleModel,
|
|
92
92
|
sha256Hex
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-BOAITSVV.js";
|
|
94
94
|
import {
|
|
95
95
|
certificateLinks,
|
|
96
96
|
registerNote,
|
|
@@ -65,6 +65,7 @@ var THRESHOLDS = {
|
|
|
65
65
|
* pool below the primary dense lane; they must earn their window
|
|
66
66
|
* slot under the cross-encoder, not by graph membership alone. */
|
|
67
67
|
graphLaneDiscount: 0.75,
|
|
68
|
+
licensedLaneScore: 0.5,
|
|
68
69
|
/** The entailment gate (TODO.new-era/10): the faithfulness scorer
|
|
69
70
|
* promoted from eval-only onto the serving path. The confidence line
|
|
70
71
|
* then states a measurement — claim support in the cited passages —
|
|
@@ -6,27 +6,27 @@ import {
|
|
|
6
6
|
sessionFrom,
|
|
7
7
|
telemetry,
|
|
8
8
|
understandQuery
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TXPWLKCI.js";
|
|
10
10
|
import {
|
|
11
11
|
portModelRunner
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KNCRYAX3.js";
|
|
13
13
|
import {
|
|
14
14
|
corsHeaders,
|
|
15
15
|
err,
|
|
16
16
|
json,
|
|
17
17
|
readJson,
|
|
18
18
|
validateQuery
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-DTW4UW2E.js";
|
|
20
20
|
import {
|
|
21
21
|
entitlementScope,
|
|
22
22
|
standardKeysFrom
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-U4ERFUOK.js";
|
|
24
24
|
import {
|
|
25
25
|
LIMITS,
|
|
26
26
|
MODELS,
|
|
27
27
|
num,
|
|
28
28
|
sha256Hex
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-BOAITSVV.js";
|
|
30
30
|
|
|
31
31
|
// workers/worker_public/src/search.ts
|
|
32
32
|
async function handleSearch(env, ctx, req, tier, key) {
|
|
@@ -2,14 +2,15 @@ import {
|
|
|
2
2
|
embed,
|
|
3
3
|
hasLane,
|
|
4
4
|
portIndex,
|
|
5
|
-
portModelRunner
|
|
6
|
-
|
|
5
|
+
portModelRunner,
|
|
6
|
+
portStore
|
|
7
|
+
} from "./chunk-KNCRYAX3.js";
|
|
7
8
|
import {
|
|
8
9
|
standardKeysFrom
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-U4ERFUOK.js";
|
|
10
11
|
import {
|
|
11
12
|
THRESHOLDS
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BOAITSVV.js";
|
|
13
14
|
import {
|
|
14
15
|
P
|
|
15
16
|
} from "./chunk-3FYJM7LH.js";
|
|
@@ -920,6 +921,140 @@ var bibEntry = {
|
|
|
920
921
|
}
|
|
921
922
|
}
|
|
922
923
|
};
|
|
924
|
+
async function unitByTerm(store, term) {
|
|
925
|
+
const t = term.trim();
|
|
926
|
+
if (!t) return null;
|
|
927
|
+
const q = (where, bind) => store.prepare(`SELECT * FROM units_db WHERE ${where} LIMIT 1`).bind(...bind).all().catch(() => ({ results: [] }));
|
|
928
|
+
const exact = await q("code = ?1 OR short = ?1 OR LOWER(name_en) = LOWER(?1)", [t]);
|
|
929
|
+
let rows = exact.results ?? [];
|
|
930
|
+
if (rows.length) return rows[0];
|
|
931
|
+
const sym = await q("LOWER(json_extract(symbols, '$.ascii')) = LOWER(?1)", [t]);
|
|
932
|
+
rows = sym.results ?? [];
|
|
933
|
+
if (rows.length) return rows[0];
|
|
934
|
+
const like = await q("LOWER(short) LIKE LOWER(?1) OR LOWER(name_en) LIKE LOWER(?1)", [`%${t}%`]);
|
|
935
|
+
rows = like.results ?? [];
|
|
936
|
+
return rows[0] ?? null;
|
|
937
|
+
}
|
|
938
|
+
async function resolveWithPrefix(store, term) {
|
|
939
|
+
const direct = await unitByTerm(store, term);
|
|
940
|
+
if (direct) return { unit: direct, prefixFactor: 1, prefixName: null };
|
|
941
|
+
const t = term.trim();
|
|
942
|
+
for (let cut = 1; cut < Math.min(t.length, 3); cut++) {
|
|
943
|
+
const pSym = t.slice(0, cut);
|
|
944
|
+
const rest = t.slice(cut);
|
|
945
|
+
if (!rest) continue;
|
|
946
|
+
const pres = await store.prepare("SELECT id, name_en, symbol, base, power FROM unit_prefixes WHERE symbol = ?1 AND base IS NOT NULL AND power IS NOT NULL").bind(pSym).all().catch(() => ({ results: [] }));
|
|
947
|
+
const prefix = (pres.results ?? [])[0];
|
|
948
|
+
if (!prefix) continue;
|
|
949
|
+
const unit = await unitByTerm(store, rest);
|
|
950
|
+
if (unit) return { unit, prefixFactor: Math.pow(prefix.base, prefix.power), prefixName: prefix.name_en };
|
|
951
|
+
}
|
|
952
|
+
return null;
|
|
953
|
+
}
|
|
954
|
+
var unitsLookup = {
|
|
955
|
+
name: "units.lookup",
|
|
956
|
+
description: "Look up a measurement unit in the unitsdb plane: its names and symbols, its dimension, its quantity kinds, and its SI decomposition. Bind a symbol or an everyday unit name to the dataset's canonical unit before computing with it.",
|
|
957
|
+
params: [{ key: "term", required: true, description: "a unit's code, short name, symbol or plain name, e.g. m, Pa, pascal, meter per second" }],
|
|
958
|
+
audiences: ["mcp"],
|
|
959
|
+
handler: async (env, args) => {
|
|
960
|
+
const term = String(args?.term ?? "").trim();
|
|
961
|
+
if (term.length < 1) return null;
|
|
962
|
+
try {
|
|
963
|
+
const store = portStore(env);
|
|
964
|
+
const unit = await unitByTerm(store, term);
|
|
965
|
+
if (!unit) {
|
|
966
|
+
return { name: "units.lookup", query: term, output: `No unit matches "${term}" in the unitsdb plane. State this plainly.` };
|
|
967
|
+
}
|
|
968
|
+
const qtyNames = [];
|
|
969
|
+
for (const qid of JSON.parse(unit.quantity_ids || "[]")) {
|
|
970
|
+
const r = await store.prepare("SELECT name_en FROM unit_quantities WHERE id = ?1").bind(qid).all().catch(() => ({ results: [] }));
|
|
971
|
+
const n = (r.results ?? [])[0]?.name_en;
|
|
972
|
+
if (n) qtyNames.push(n);
|
|
973
|
+
}
|
|
974
|
+
const roots = JSON.parse(unit.root_units || "[]");
|
|
975
|
+
const rootNames = await Promise.all(
|
|
976
|
+
roots.map(async (r) => {
|
|
977
|
+
const row = await unitByTerm(store, r.code);
|
|
978
|
+
return `${row?.short ?? r.code}^${r.power}`;
|
|
979
|
+
})
|
|
980
|
+
);
|
|
981
|
+
const symbols = JSON.parse(unit.symbols || "null");
|
|
982
|
+
return {
|
|
983
|
+
name: "units.lookup",
|
|
984
|
+
query: term,
|
|
985
|
+
output: JSON.stringify({
|
|
986
|
+
code: unit.code,
|
|
987
|
+
name_en: unit.name_en,
|
|
988
|
+
name_fr: unit.name_fr,
|
|
989
|
+
symbol: symbols?.ascii ?? null,
|
|
990
|
+
si_root: !!unit.root,
|
|
991
|
+
unit_system: unit.unit_system,
|
|
992
|
+
dimension: unit.dimension_ascii,
|
|
993
|
+
quantities: qtyNames.slice(0, 4),
|
|
994
|
+
si_decomposition: rootNames,
|
|
995
|
+
scale: unit.scale
|
|
996
|
+
})
|
|
997
|
+
};
|
|
998
|
+
} catch {
|
|
999
|
+
return null;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
var unitsConvert = {
|
|
1004
|
+
name: "units.convert",
|
|
1005
|
+
description: "Convert a value between two measurement units through the unitsdb plane. SI-coherent units convert exactly (prefix powers over the same dimension); a non-SI unit is stated honestly \u2014 the dataset defines a ratio scale for it, not a factor, and none is invented.",
|
|
1006
|
+
params: [
|
|
1007
|
+
{ key: "value", required: true, description: "the numeric value to convert" },
|
|
1008
|
+
{ key: "from_unit", required: true, description: "the source unit, e.g. kPa, km, m" },
|
|
1009
|
+
{ key: "to_unit", required: true, description: "the target unit, e.g. Pa, m" }
|
|
1010
|
+
],
|
|
1011
|
+
audiences: ["mcp"],
|
|
1012
|
+
handler: async (env, args) => {
|
|
1013
|
+
const value = Number(args?.value);
|
|
1014
|
+
const fromTerm = String(args?.from_unit ?? "").trim();
|
|
1015
|
+
const toTerm = String(args?.to_unit ?? "").trim();
|
|
1016
|
+
if (!Number.isFinite(value) || !fromTerm || !toTerm) return null;
|
|
1017
|
+
try {
|
|
1018
|
+
const store = portStore(env);
|
|
1019
|
+
const from = await resolveWithPrefix(store, fromTerm);
|
|
1020
|
+
const to = await resolveWithPrefix(store, toTerm);
|
|
1021
|
+
if (!from || !to) {
|
|
1022
|
+
const missing = !from ? fromTerm : toTerm;
|
|
1023
|
+
return { name: "units.convert", query: `${value} ${fromTerm} \u2192 ${toTerm}`, output: `No unit matches "${missing}" in the unitsdb plane. State this plainly.` };
|
|
1024
|
+
}
|
|
1025
|
+
if ((from.unit.dimension_ascii ?? "") !== (to.unit.dimension_ascii ?? "")) {
|
|
1026
|
+
return {
|
|
1027
|
+
name: "units.convert",
|
|
1028
|
+
query: `${value} ${fromTerm} \u2192 ${toTerm}`,
|
|
1029
|
+
output: `Not convertible: ${fromTerm} carries dimension ${from.unit.dimension_ascii ?? "unknown"} and ${toTerm} carries ${to.unit.dimension_ascii ?? "unknown"}. State this plainly.`
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
const coherent = (u) => !!u.unit_system && u.unit_system.toLowerCase().startsWith("si");
|
|
1033
|
+
if (!coherent(from.unit) || !coherent(to.unit)) {
|
|
1034
|
+
const nonSi = !coherent(from.unit) ? fromTerm : toTerm;
|
|
1035
|
+
return {
|
|
1036
|
+
name: "units.convert",
|
|
1037
|
+
query: `${value} ${fromTerm} \u2192 ${toTerm}`,
|
|
1038
|
+
output: `The dataset defines no numeric factor for ${nonSi} (a non-SI unit carried on a ${from.unit.scale ?? to.unit.scale ?? "ratio"} scale) \u2014 no factor is invented. State this plainly; the caller may supply the factor itself.`
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
const result = value * from.prefixFactor / to.prefixFactor;
|
|
1042
|
+
return {
|
|
1043
|
+
name: "units.convert",
|
|
1044
|
+
query: `${value} ${fromTerm} \u2192 ${toTerm}`,
|
|
1045
|
+
output: JSON.stringify({
|
|
1046
|
+
value,
|
|
1047
|
+
from: `${from.prefixName ? from.prefixName + " " : ""}${from.unit.name_en}`,
|
|
1048
|
+
to: `${to.prefixName ? to.prefixName + " " : ""}${to.unit.name_en}`,
|
|
1049
|
+
dimension: from.unit.dimension_ascii,
|
|
1050
|
+
result
|
|
1051
|
+
})
|
|
1052
|
+
};
|
|
1053
|
+
} catch {
|
|
1054
|
+
return null;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
923
1058
|
var glossaryLookup = {
|
|
924
1059
|
name: "glossary.lookup",
|
|
925
1060
|
description: "Look up a defined term in the terminology datasets \u2014 the concept's definition and its defining publication. Bind everyday words to the defined term before interpreting a question.",
|
|
@@ -988,7 +1123,7 @@ var certificatesSearch = {
|
|
|
988
1123
|
return { name: "certificates.search", query, output };
|
|
989
1124
|
}
|
|
990
1125
|
};
|
|
991
|
-
var TOOLS_REGISTRY = [certificatesSearch, unitsGet, graphCites, docsSection, glossaryLookup, documentsFamily, licensedSection, verdictEvaluate, conditionsCheck, bibEntry];
|
|
1126
|
+
var TOOLS_REGISTRY = [certificatesSearch, unitsGet, graphCites, docsSection, glossaryLookup, documentsFamily, licensedSection, verdictEvaluate, conditionsCheck, bibEntry, unitsLookup, unitsConvert];
|
|
992
1127
|
var TOOL_DECLARATION = [
|
|
993
1128
|
"You may use one tool before answering, by writing a single line:",
|
|
994
1129
|
...TOOLS_REGISTRY.filter((t) => t.audiences.includes("agent")).map((t) => {
|
|
@@ -3,12 +3,13 @@ import {
|
|
|
3
3
|
hasLane,
|
|
4
4
|
portIndex,
|
|
5
5
|
portModelRunner,
|
|
6
|
+
portStore,
|
|
6
7
|
rerank
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KNCRYAX3.js";
|
|
8
9
|
import {
|
|
9
10
|
bubbleConfirmPage,
|
|
10
11
|
isAllowedBubbleOrigin
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DTW4UW2E.js";
|
|
12
13
|
import {
|
|
13
14
|
DATASETS,
|
|
14
15
|
LIMITS,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
processExpansion,
|
|
19
20
|
sha256Hex,
|
|
20
21
|
today
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-BOAITSVV.js";
|
|
22
23
|
import {
|
|
23
24
|
P
|
|
24
25
|
} from "./chunk-3FYJM7LH.js";
|
|
@@ -22523,29 +22524,35 @@ var graphLane = {
|
|
|
22523
22524
|
};
|
|
22524
22525
|
|
|
22525
22526
|
// workers/worker_public/src/stages/licensedLane.ts
|
|
22527
|
+
var sha1Hex = async (s8) => {
|
|
22528
|
+
const digest = await crypto.subtle.digest("SHA-1", new TextEncoder().encode(s8));
|
|
22529
|
+
return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
22530
|
+
};
|
|
22526
22531
|
var licensedLane = {
|
|
22527
22532
|
name: "licensed-lane",
|
|
22528
22533
|
failure: "additive",
|
|
22529
|
-
when: (c) => !!c.opts.licensedDocNumbers?.length
|
|
22530
|
-
prefetch: (c) => {
|
|
22531
|
-
c.lane["licensed-lane"] = portIndex(c.env, "public").query({
|
|
22532
|
-
vector: c.vector,
|
|
22533
|
-
topK: 12,
|
|
22534
|
-
filter: { standard: { $in: c.opts.licensedDocNumbers } }
|
|
22535
|
-
});
|
|
22536
|
-
},
|
|
22534
|
+
when: (c) => !!c.opts.licensedDocNumbers?.length,
|
|
22537
22535
|
run: async (c) => {
|
|
22538
|
-
const
|
|
22536
|
+
const standards = c.opts.licensedDocNumbers;
|
|
22537
|
+
const placeholders = standards.map((_, i) => `?${i + 1}`).join(",");
|
|
22538
|
+
const rows = await portStore(c.env).prepare(`SELECT standard, node_id FROM model_nodes WHERE standard IN (${placeholders}) LIMIT 40`).bind(...standards).all().catch(() => ({ results: [] }));
|
|
22539
|
+
const ids = await Promise.all(
|
|
22540
|
+
(rows.results ?? []).map(
|
|
22541
|
+
async (r) => "m" + (await sha1Hex(`${r.standard}|${r.node_id}`)).slice(0, 16)
|
|
22542
|
+
)
|
|
22543
|
+
);
|
|
22544
|
+
if (!ids.length) return;
|
|
22545
|
+
const matches = await portIndex(c.env, "public").getByIds(ids);
|
|
22539
22546
|
const seenIds = new Set(c.matches.map((m) => m.id));
|
|
22540
22547
|
let merged = 0;
|
|
22541
|
-
for (const m of
|
|
22542
|
-
if (!seenIds.has(m.id)) {
|
|
22543
|
-
c.matches.push({ id: m.id, score:
|
|
22548
|
+
for (const m of matches) {
|
|
22549
|
+
if (m.metadata && !seenIds.has(m.id)) {
|
|
22550
|
+
c.matches.push({ id: m.id, score: THRESHOLDS.licensedLaneScore, metadata: m.metadata });
|
|
22544
22551
|
seenIds.add(m.id);
|
|
22545
22552
|
merged++;
|
|
22546
22553
|
}
|
|
22547
22554
|
}
|
|
22548
|
-
console.log("licensed lane:",
|
|
22555
|
+
console.log("licensed lane:", ids.length, "units,", matches.length, "vectors,", merged, "merged");
|
|
22549
22556
|
}
|
|
22550
22557
|
};
|
|
22551
22558
|
|
package/dist/config.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare const THRESHOLDS: {
|
|
|
37
37
|
* pool below the primary dense lane; they must earn their window
|
|
38
38
|
* slot under the cross-encoder, not by graph membership alone. */
|
|
39
39
|
readonly graphLaneDiscount: 0.75;
|
|
40
|
+
readonly licensedLaneScore: 0.5;
|
|
40
41
|
/** The entailment gate (TODO.new-era/10): the faithfulness scorer
|
|
41
42
|
* promoted from eval-only onto the serving path. The confidence line
|
|
42
43
|
* then states a measurement — claim support in the cited passages —
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleSearch
|
|
3
|
+
} from "./chunk-GY33RTEO.js";
|
|
4
|
+
import "./chunk-TXPWLKCI.js";
|
|
5
|
+
import "./chunk-KNCRYAX3.js";
|
|
6
|
+
import "./chunk-DTW4UW2E.js";
|
|
7
|
+
import "./chunk-A3QHHUN5.js";
|
|
8
|
+
import "./chunk-U4ERFUOK.js";
|
|
9
|
+
import "./chunk-BOAITSVV.js";
|
|
10
|
+
import "./chunk-3FYJM7LH.js";
|
|
11
|
+
export {
|
|
12
|
+
handleSearch
|
|
13
|
+
};
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
parseToolCall,
|
|
5
5
|
runTool,
|
|
6
6
|
toolNote
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-QNLFNEI4.js";
|
|
8
|
+
import "./chunk-KNCRYAX3.js";
|
|
9
|
+
import "./chunk-U4ERFUOK.js";
|
|
10
|
+
import "./chunk-BOAITSVV.js";
|
|
11
11
|
import "./chunk-3FYJM7LH.js";
|
|
12
12
|
export {
|
|
13
13
|
TOOLS_REGISTRY,
|
package/dist/tools-content.d.ts
CHANGED
|
@@ -7,4 +7,6 @@ export declare const licensedSection: ToolSpec;
|
|
|
7
7
|
export declare const verdictEvaluate: ToolSpec;
|
|
8
8
|
export declare const conditionsCheck: ToolSpec;
|
|
9
9
|
export declare const bibEntry: ToolSpec;
|
|
10
|
+
export declare const unitsLookup: ToolSpec;
|
|
11
|
+
export declare const unitsConvert: ToolSpec;
|
|
10
12
|
export declare const glossaryLookup: ToolSpec;
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
handleMemories,
|
|
5
5
|
scoreFaithfulness,
|
|
6
6
|
scoreJudge
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-2SWMTCVX.js";
|
|
8
8
|
import {
|
|
9
9
|
TOOLS_REGISTRY,
|
|
10
10
|
bindModelNode,
|
|
11
11
|
modelGroundingBlock
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-QNLFNEI4.js";
|
|
13
13
|
import {
|
|
14
14
|
handleSearch
|
|
15
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-GY33RTEO.js";
|
|
16
16
|
import {
|
|
17
17
|
buildMessages,
|
|
18
18
|
citations,
|
|
@@ -34,13 +34,13 @@ import {
|
|
|
34
34
|
sessionFrom,
|
|
35
35
|
telemetry,
|
|
36
36
|
understandQuery
|
|
37
|
-
} from "../../chunk-
|
|
37
|
+
} from "../../chunk-TXPWLKCI.js";
|
|
38
38
|
import {
|
|
39
39
|
cfBlobs,
|
|
40
40
|
embed,
|
|
41
41
|
generateOnce,
|
|
42
42
|
portModelRunner
|
|
43
|
-
} from "../../chunk-
|
|
43
|
+
} from "../../chunk-KNCRYAX3.js";
|
|
44
44
|
import {
|
|
45
45
|
authenticate,
|
|
46
46
|
corsHeaders,
|
|
@@ -49,14 +49,14 @@ import {
|
|
|
49
49
|
readJson,
|
|
50
50
|
validateQuery,
|
|
51
51
|
withCors
|
|
52
|
-
} from "../../chunk-
|
|
52
|
+
} from "../../chunk-DTW4UW2E.js";
|
|
53
53
|
import {
|
|
54
54
|
canonicalRefusal
|
|
55
55
|
} from "../../chunk-A3QHHUN5.js";
|
|
56
56
|
import {
|
|
57
57
|
entitlementScope,
|
|
58
58
|
standardKeysFrom
|
|
59
|
-
} from "../../chunk-
|
|
59
|
+
} from "../../chunk-U4ERFUOK.js";
|
|
60
60
|
import {
|
|
61
61
|
LIMITS,
|
|
62
62
|
MODELS,
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
roleModel,
|
|
68
68
|
sha256Hex,
|
|
69
69
|
today
|
|
70
|
-
} from "../../chunk-
|
|
70
|
+
} from "../../chunk-BOAITSVV.js";
|
|
71
71
|
import "../../chunk-JZFXSTYX.js";
|
|
72
72
|
import {
|
|
73
73
|
P,
|
|
@@ -990,13 +990,13 @@ async function callToolOnce(env, ctx, _req, tier, key, name, args, t0) {
|
|
|
990
990
|
// stream:false forces the JSON lane (anon defaults to SSE)
|
|
991
991
|
body: JSON.stringify({ ...args, stream: false })
|
|
992
992
|
});
|
|
993
|
-
const { runTool, TOOLS_REGISTRY: TOOLS_REGISTRY2 } = await import("../../tools-
|
|
993
|
+
const { runTool, TOOLS_REGISTRY: TOOLS_REGISTRY2 } = await import("../../tools-ZNQY6ZMC.js");
|
|
994
994
|
let payload;
|
|
995
995
|
if (TOOLS_REGISTRY2.some((t) => t.name === name && t.audiences.includes("mcp"))) {
|
|
996
996
|
const r = await runTool({ ...env, DB: env.DB }, { name, args }, "mcp");
|
|
997
997
|
payload = r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
|
|
998
998
|
} else {
|
|
999
|
-
const res = name === "ask" ? await (await import("../../ask-
|
|
999
|
+
const res = name === "ask" ? await (await import("../../ask-W6NUC3MG.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-EQAOPFCC.js")).handleSearch(env, ctx, inner, tier, key);
|
|
1000
1000
|
payload = await res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
|
|
1001
1001
|
}
|
|
1002
1002
|
telemetry(env, ctx, tier, `mcp:${name}`, null, !payload?.error, JSON.stringify(payload).length, await sha256Hex(`${name}:${JSON.stringify(args ?? {})}`), void 0, void 0, { durationMs: Date.now() - t0 });
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
requestSalt,
|
|
5
5
|
resolveRequestScope,
|
|
6
6
|
standardKeysFrom
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
7
|
+
} from "../../chunk-U4ERFUOK.js";
|
|
8
|
+
import "../../chunk-BOAITSVV.js";
|
|
9
9
|
import "../../chunk-3FYJM7LH.js";
|
|
10
10
|
export {
|
|
11
11
|
entitlementScope,
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"playwright": "^1.62.1",
|
|
28
28
|
"yaml": "^2.9.1"
|
|
29
29
|
},
|
|
30
|
-
"version": "0.2.
|
|
30
|
+
"version": "0.2.99",
|
|
31
31
|
"description": "The Konneal engine: the publisher-agnostic build pipeline and API plane for standards intelligence (retrieval, answer contract, verdicts, evaluation).",
|
|
32
32
|
"license": "BSD-3-Clause",
|
|
33
33
|
"type": "module",
|
|
@@ -62,6 +62,7 @@ export const THRESHOLDS = {
|
|
|
62
62
|
* pool below the primary dense lane; they must earn their window
|
|
63
63
|
* slot under the cross-encoder, not by graph membership alone. */
|
|
64
64
|
graphLaneDiscount: 0.75,
|
|
65
|
+
licensedLaneScore: 0.5,
|
|
65
66
|
/** The entailment gate (TODO.new-era/10): the faithfulness scorer
|
|
66
67
|
* promoted from eval-only onto the serving path. The confidence line
|
|
67
68
|
* then states a measurement — claim support in the cited passages —
|
|
@@ -1,38 +1,56 @@
|
|
|
1
1
|
// Licensed lane (additive): an entitled caller whose question is
|
|
2
2
|
// topically about a licensed standard gets that standard's typed units
|
|
3
|
-
// merged into the pool
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
3
|
+
// merged into the pool before rerank — the public restatements stop
|
|
4
|
+
// out-ranking the licensed package's own machinery (the rank-order gap
|
|
5
|
+
// the quality ledger has documented on every damp-heat run since the
|
|
6
|
+
// eleven-standard wave).
|
|
7
|
+
//
|
|
8
|
+
// Identity, not similarity: the units are resolved from the model
|
|
9
|
+
// plane's own registry (D1 model_nodes by standard) and turned into
|
|
10
|
+
// index ids with the exporter's hash — `m` + sha1(standard|node_id)
|
|
11
|
+
// truncated to 16 — then fetched by id. Vectorize metadata filtering
|
|
12
|
+
// plays no part (measured: REST and binding filters on this index
|
|
13
|
+
// return empty even for values proven present), and no similarity
|
|
14
|
+
// search is needed — the package's units are the package's units, and
|
|
15
|
+
// the pool's cross-encoder ranks them against the question like every
|
|
16
|
+
// other candidate.
|
|
10
17
|
import { THRESHOLDS } from "../config.ts";
|
|
11
|
-
import { portIndex } from "../env.ts";
|
|
18
|
+
import { portIndex, portStore } from "../env.ts";
|
|
12
19
|
import type { Stage } from "./types.ts";
|
|
13
20
|
|
|
21
|
+
const sha1Hex = async (s: string) => {
|
|
22
|
+
const digest = await crypto.subtle.digest("SHA-1", new TextEncoder().encode(s));
|
|
23
|
+
return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
24
|
+
};
|
|
25
|
+
|
|
14
26
|
export const licensedLane: Stage = {
|
|
15
27
|
name: "licensed-lane",
|
|
16
28
|
failure: "additive",
|
|
17
|
-
when: (c) => !!c.opts.licensedDocNumbers?.length
|
|
18
|
-
prefetch: (c) => {
|
|
19
|
-
c.lane["licensed-lane"] = portIndex(c.env, "public").query({
|
|
20
|
-
vector: c.vector,
|
|
21
|
-
topK: 12,
|
|
22
|
-
filter: { standard: { $in: c.opts.licensedDocNumbers } },
|
|
23
|
-
});
|
|
24
|
-
},
|
|
29
|
+
when: (c) => !!c.opts.licensedDocNumbers?.length,
|
|
25
30
|
run: async (c) => {
|
|
26
|
-
const
|
|
31
|
+
const standards = c.opts.licensedDocNumbers!;
|
|
32
|
+
const placeholders = standards.map((_, i) => `?${i + 1}`).join(",");
|
|
33
|
+
const rows = await portStore(c.env)
|
|
34
|
+
.prepare(`SELECT standard, node_id FROM model_nodes WHERE standard IN (${placeholders}) LIMIT 40`)
|
|
35
|
+
.bind(...standards)
|
|
36
|
+
.all()
|
|
37
|
+
.catch(() => ({ results: [] }));
|
|
38
|
+
const ids = await Promise.all(
|
|
39
|
+
((rows.results ?? []) as { standard: string; node_id: string }[]).map(async (r) =>
|
|
40
|
+
"m" + (await sha1Hex(`${r.standard}|${r.node_id}`)).slice(0, 16),
|
|
41
|
+
),
|
|
42
|
+
);
|
|
43
|
+
if (!ids.length) return;
|
|
44
|
+
const matches = await portIndex(c.env, "public").getByIds(ids);
|
|
27
45
|
const seenIds = new Set(c.matches.map((m: any) => m.id));
|
|
28
46
|
let merged = 0;
|
|
29
|
-
for (const m of
|
|
30
|
-
if (!seenIds.has(m.id)) {
|
|
31
|
-
c.matches.push({ id: m.id, score:
|
|
47
|
+
for (const m of matches) {
|
|
48
|
+
if (m.metadata && !seenIds.has(m.id)) {
|
|
49
|
+
c.matches.push({ id: m.id, score: THRESHOLDS.licensedLaneScore, metadata: m.metadata });
|
|
32
50
|
seenIds.add(m.id);
|
|
33
51
|
merged++;
|
|
34
52
|
}
|
|
35
53
|
}
|
|
36
|
-
console.log("licensed lane:",
|
|
54
|
+
console.log("licensed lane:", ids.length, "units,", matches.length, "vectors,", merged, "merged");
|
|
37
55
|
},
|
|
38
56
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// tool-selection quality degrades with menu size.
|
|
8
8
|
import type { ToolSpec } from "./tools.ts";
|
|
9
9
|
import { resolveBlocks } from "./refs.ts";
|
|
10
|
-
import { portIndex, portModelRunner, hasLane } from "./env.ts";
|
|
10
|
+
import { portIndex, portModelRunner, hasLane, portStore } from "./env.ts";
|
|
11
11
|
import { embed } from "./ai.ts";
|
|
12
12
|
import { THRESHOLDS } from "./config.ts";
|
|
13
13
|
import { standardKeysFrom } from "./requestScope.ts";
|
|
@@ -428,6 +428,178 @@ export const bibEntry: ToolSpec = {
|
|
|
428
428
|
},
|
|
429
429
|
};
|
|
430
430
|
|
|
431
|
+
|
|
432
|
+
// The unitsdb plane (the owner's 2026-10-05 direction): measurement
|
|
433
|
+
// units as machine-shaped data — the dataset's typed projection in D1
|
|
434
|
+
// (units_db / unit_quantities / unit_prefixes), served as tools agents
|
|
435
|
+
// compute with. Conversion is honest about its scope: SI-coherent
|
|
436
|
+
// units convert through prefix powers; the dataset defines no numeric
|
|
437
|
+
// factors for non-SI units (foot, pound) — a ratio scale is not a
|
|
438
|
+
// factor — and the tool says so instead of inventing one.
|
|
439
|
+
|
|
440
|
+
interface UnitRow {
|
|
441
|
+
code: string;
|
|
442
|
+
short: string | null;
|
|
443
|
+
name_en: string | null;
|
|
444
|
+
name_fr: string | null;
|
|
445
|
+
root: number;
|
|
446
|
+
symbols: string | null;
|
|
447
|
+
root_units: string | null;
|
|
448
|
+
dimension_id: string | null;
|
|
449
|
+
dimension_ascii: string | null;
|
|
450
|
+
quantity_ids: string | null;
|
|
451
|
+
unit_system: string | null;
|
|
452
|
+
scale: string | null;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
async function unitByTerm(store: any, term: string): Promise<UnitRow | null> {
|
|
456
|
+
const t = term.trim();
|
|
457
|
+
if (!t) return null;
|
|
458
|
+
const q = (where: string, bind: unknown[]) =>
|
|
459
|
+
store.prepare(`SELECT * FROM units_db WHERE ${where} LIMIT 1`).bind(...bind).all().catch(() => ({ results: [] }));
|
|
460
|
+
const exact = await q("code = ?1 OR short = ?1 OR LOWER(name_en) = LOWER(?1)", [t]);
|
|
461
|
+
let rows = (exact.results ?? []) as UnitRow[];
|
|
462
|
+
if (rows.length) return rows[0]!;
|
|
463
|
+
const sym = await q("LOWER(json_extract(symbols, '$.ascii')) = LOWER(?1)", [t]);
|
|
464
|
+
rows = (sym.results ?? []) as UnitRow[];
|
|
465
|
+
if (rows.length) return rows[0]!;
|
|
466
|
+
const like = await q("LOWER(short) LIKE LOWER(?1) OR LOWER(name_en) LIKE LOWER(?1)", [`%${t}%`]);
|
|
467
|
+
rows = (like.results ?? []) as UnitRow[];
|
|
468
|
+
return rows[0] ?? null;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/** A prefixed input ("kPa", "km"): the first symbols name a prefix,
|
|
472
|
+
* the remainder a unit — the dataset does not enumerate prefixed
|
|
473
|
+
* variants, they are derived. Returns the factor the prefix carries. */
|
|
474
|
+
async function resolveWithPrefix(store: any, term: string): Promise<{ unit: UnitRow; prefixFactor: number; prefixName: string | null } | null> {
|
|
475
|
+
const direct = await unitByTerm(store, term);
|
|
476
|
+
if (direct) return { unit: direct, prefixFactor: 1, prefixName: null };
|
|
477
|
+
const t = term.trim();
|
|
478
|
+
for (let cut = 1; cut < Math.min(t.length, 3); cut++) {
|
|
479
|
+
const pSym = t.slice(0, cut);
|
|
480
|
+
const rest = t.slice(cut);
|
|
481
|
+
if (!rest) continue;
|
|
482
|
+
const pres = await store
|
|
483
|
+
.prepare("SELECT id, name_en, symbol, base, power FROM unit_prefixes WHERE symbol = ?1 AND base IS NOT NULL AND power IS NOT NULL")
|
|
484
|
+
.bind(pSym)
|
|
485
|
+
.all()
|
|
486
|
+
.catch(() => ({ results: [] }));
|
|
487
|
+
const prefix = (pres.results ?? [])[0] as { id: string; name_en: string | null; symbol: string; base: number; power: number } | undefined;
|
|
488
|
+
if (!prefix) continue;
|
|
489
|
+
const unit = await unitByTerm(store, rest);
|
|
490
|
+
if (unit) return { unit, prefixFactor: Math.pow(prefix.base, prefix.power), prefixName: prefix.name_en };
|
|
491
|
+
}
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export const unitsLookup: ToolSpec = {
|
|
496
|
+
name: "units.lookup",
|
|
497
|
+
description:
|
|
498
|
+
"Look up a measurement unit in the unitsdb plane: its names and symbols, its dimension, its quantity kinds, and its SI decomposition. Bind a symbol or an everyday unit name to the dataset's canonical unit before computing with it.",
|
|
499
|
+
params: [{ key: "term", required: true, description: "a unit's code, short name, symbol or plain name, e.g. m, Pa, pascal, meter per second" }],
|
|
500
|
+
audiences: ["mcp"],
|
|
501
|
+
handler: async (env, args) => {
|
|
502
|
+
const term = String(args?.term ?? "").trim();
|
|
503
|
+
if (term.length < 1) return null;
|
|
504
|
+
try {
|
|
505
|
+
const store = portStore(env);
|
|
506
|
+
const unit = await unitByTerm(store, term);
|
|
507
|
+
if (!unit) {
|
|
508
|
+
return { name: "units.lookup", query: term, output: `No unit matches "${term}" in the unitsdb plane. State this plainly.` };
|
|
509
|
+
}
|
|
510
|
+
const qtyNames: string[] = [];
|
|
511
|
+
for (const qid of JSON.parse(unit.quantity_ids || "[]") as string[]) {
|
|
512
|
+
const r = await store.prepare("SELECT name_en FROM unit_quantities WHERE id = ?1").bind(qid).all().catch(() => ({ results: [] }));
|
|
513
|
+
const n = ((r.results ?? [])[0] as any)?.name_en;
|
|
514
|
+
if (n) qtyNames.push(n);
|
|
515
|
+
}
|
|
516
|
+
const roots: { code: string; power: number }[] = JSON.parse(unit.root_units || "[]");
|
|
517
|
+
const rootNames = await Promise.all(
|
|
518
|
+
roots.map(async (r) => {
|
|
519
|
+
const row = await unitByTerm(store, r.code);
|
|
520
|
+
return `${row?.short ?? r.code}^${r.power}`;
|
|
521
|
+
}),
|
|
522
|
+
);
|
|
523
|
+
const symbols = JSON.parse(unit.symbols || "null");
|
|
524
|
+
return {
|
|
525
|
+
name: "units.lookup",
|
|
526
|
+
query: term,
|
|
527
|
+
output: JSON.stringify({
|
|
528
|
+
code: unit.code,
|
|
529
|
+
name_en: unit.name_en,
|
|
530
|
+
name_fr: unit.name_fr,
|
|
531
|
+
symbol: symbols?.ascii ?? null,
|
|
532
|
+
si_root: !!unit.root,
|
|
533
|
+
unit_system: unit.unit_system,
|
|
534
|
+
dimension: unit.dimension_ascii,
|
|
535
|
+
quantities: qtyNames.slice(0, 4),
|
|
536
|
+
si_decomposition: rootNames,
|
|
537
|
+
scale: unit.scale,
|
|
538
|
+
}),
|
|
539
|
+
};
|
|
540
|
+
} catch {
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
export const unitsConvert: ToolSpec = {
|
|
547
|
+
name: "units.convert",
|
|
548
|
+
description:
|
|
549
|
+
"Convert a value between two measurement units through the unitsdb plane. SI-coherent units convert exactly (prefix powers over the same dimension); a non-SI unit is stated honestly — the dataset defines a ratio scale for it, not a factor, and none is invented.",
|
|
550
|
+
params: [
|
|
551
|
+
{ key: "value", required: true, description: "the numeric value to convert" },
|
|
552
|
+
{ key: "from_unit", required: true, description: "the source unit, e.g. kPa, km, m" },
|
|
553
|
+
{ key: "to_unit", required: true, description: "the target unit, e.g. Pa, m" },
|
|
554
|
+
],
|
|
555
|
+
audiences: ["mcp"],
|
|
556
|
+
handler: async (env, args) => {
|
|
557
|
+
const value = Number(args?.value);
|
|
558
|
+
const fromTerm = String(args?.from_unit ?? "").trim();
|
|
559
|
+
const toTerm = String(args?.to_unit ?? "").trim();
|
|
560
|
+
if (!Number.isFinite(value) || !fromTerm || !toTerm) return null;
|
|
561
|
+
try {
|
|
562
|
+
const store = portStore(env);
|
|
563
|
+
const from = await resolveWithPrefix(store, fromTerm);
|
|
564
|
+
const to = await resolveWithPrefix(store, toTerm);
|
|
565
|
+
if (!from || !to) {
|
|
566
|
+
const missing = !from ? fromTerm : toTerm;
|
|
567
|
+
return { name: "units.convert", query: `${value} ${fromTerm} → ${toTerm}`, output: `No unit matches "${missing}" in the unitsdb plane. State this plainly.` };
|
|
568
|
+
}
|
|
569
|
+
if ((from.unit.dimension_ascii ?? "") !== (to.unit.dimension_ascii ?? "")) {
|
|
570
|
+
return {
|
|
571
|
+
name: "units.convert",
|
|
572
|
+
query: `${value} ${fromTerm} → ${toTerm}`,
|
|
573
|
+
output: `Not convertible: ${fromTerm} carries dimension ${from.unit.dimension_ascii ?? "unknown"} and ${toTerm} carries ${to.unit.dimension_ascii ?? "unknown"}. State this plainly.`,
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
const coherent = (u: UnitRow) => !!u.unit_system && u.unit_system.toLowerCase().startsWith("si");
|
|
577
|
+
if (!coherent(from.unit) || !coherent(to.unit)) {
|
|
578
|
+
const nonSi = !coherent(from.unit) ? fromTerm : toTerm;
|
|
579
|
+
return {
|
|
580
|
+
name: "units.convert",
|
|
581
|
+
query: `${value} ${fromTerm} → ${toTerm}`,
|
|
582
|
+
output: `The dataset defines no numeric factor for ${nonSi} (a non-SI unit carried on a ${from.unit.scale ?? to.unit.scale ?? "ratio"} scale) — no factor is invented. State this plainly; the caller may supply the factor itself.`,
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
const result = (value * from.prefixFactor) / to.prefixFactor;
|
|
586
|
+
return {
|
|
587
|
+
name: "units.convert",
|
|
588
|
+
query: `${value} ${fromTerm} → ${toTerm}`,
|
|
589
|
+
output: JSON.stringify({
|
|
590
|
+
value,
|
|
591
|
+
from: `${from.prefixName ? from.prefixName + " " : ""}${from.unit.name_en}`,
|
|
592
|
+
to: `${to.prefixName ? to.prefixName + " " : ""}${to.unit.name_en}`,
|
|
593
|
+
dimension: from.unit.dimension_ascii,
|
|
594
|
+
result,
|
|
595
|
+
}),
|
|
596
|
+
};
|
|
597
|
+
} catch {
|
|
598
|
+
return null;
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
};
|
|
602
|
+
|
|
431
603
|
export const glossaryLookup: ToolSpec = {
|
|
432
604
|
name: "glossary.lookup",
|
|
433
605
|
description:
|
|
@@ -64,9 +64,9 @@ const certificatesSearch: ToolSpec = {
|
|
|
64
64
|
},
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
import { unitsGet, graphCites, docsSection, glossaryLookup, documentsFamily, licensedSection, verdictEvaluate, conditionsCheck, bibEntry } from "./tools-content.ts";
|
|
67
|
+
import { unitsGet, graphCites, docsSection, glossaryLookup, documentsFamily, licensedSection, verdictEvaluate, conditionsCheck, bibEntry, unitsLookup, unitsConvert } from "./tools-content.ts";
|
|
68
68
|
|
|
69
|
-
export const TOOLS_REGISTRY: ToolSpec[] = [certificatesSearch, unitsGet, graphCites, docsSection, glossaryLookup, documentsFamily, licensedSection, verdictEvaluate, conditionsCheck, bibEntry];
|
|
69
|
+
export const TOOLS_REGISTRY: ToolSpec[] = [certificatesSearch, unitsGet, graphCites, docsSection, glossaryLookup, documentsFamily, licensedSection, verdictEvaluate, conditionsCheck, bibEntry, unitsLookup, unitsConvert];
|
|
70
70
|
|
|
71
71
|
/** The agent loop's protocol declaration, GENERATED from the registry —
|
|
72
72
|
* the model's tool vocabulary is always the registry's, never a
|
package/dist/ask-KKOQH7HK.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
handleAsk
|
|
3
|
-
} from "./chunk-CX3OVN3V.js";
|
|
4
|
-
import "./chunk-AJU6LMY3.js";
|
|
5
|
-
import "./chunk-PTCDEFI3.js";
|
|
6
|
-
import "./chunk-LOBYXEVD.js";
|
|
7
|
-
import "./chunk-SPKPH54J.js";
|
|
8
|
-
import "./chunk-A3QHHUN5.js";
|
|
9
|
-
import "./chunk-LVZTWUVJ.js";
|
|
10
|
-
import "./chunk-2PCUAJJO.js";
|
|
11
|
-
import "./chunk-JZFXSTYX.js";
|
|
12
|
-
import "./chunk-3FYJM7LH.js";
|
|
13
|
-
export {
|
|
14
|
-
handleAsk
|
|
15
|
-
};
|
package/dist/search-CGQFGYTR.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
handleSearch
|
|
3
|
-
} from "./chunk-ZLQMRQOV.js";
|
|
4
|
-
import "./chunk-PTCDEFI3.js";
|
|
5
|
-
import "./chunk-LOBYXEVD.js";
|
|
6
|
-
import "./chunk-SPKPH54J.js";
|
|
7
|
-
import "./chunk-A3QHHUN5.js";
|
|
8
|
-
import "./chunk-LVZTWUVJ.js";
|
|
9
|
-
import "./chunk-2PCUAJJO.js";
|
|
10
|
-
import "./chunk-3FYJM7LH.js";
|
|
11
|
-
export {
|
|
12
|
-
handleSearch
|
|
13
|
-
};
|