@konneal/engine 0.2.93 → 0.2.94
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-RP2Z7CIV.js → ask-HCKUKBPB.js} +2 -2
- package/dist/{chunk-WZKLWK7E.js → chunk-2JC7GXRV.js} +1 -1
- package/dist/{chunk-PE2D5MFD.js → chunk-64IG3ZLT.js} +15 -5
- package/dist/{tools-SVP6MKBR.js → tools-O7OGW54R.js} +1 -1
- package/dist/worker_public/src/index.js +4 -4
- package/package.json +1 -1
- package/workers/worker_public/src/tools-content.ts +23 -7
|
@@ -754,17 +754,17 @@ var verdictEvaluate = {
|
|
|
754
754
|
description: "Deterministically evaluate a model-plane node's machine checks (OCL boolean expressions, threshold limits) against the quantities a question states. Returns pass/fail with every check's expression and values, or void with the missing parameter names when the question does not state enough. The machine computes; cite the node's clause.",
|
|
755
755
|
params: [
|
|
756
756
|
{ key: "node_id", required: true, description: "the model-plane node id, e.g. /req/metrological/repeatability (node ids appear in answers' verdict blocks)" },
|
|
757
|
-
{ key: "question", required: true, description: "the statement carrying the quantities, e.g. 'is mpe 0.02 with n_lc 3000 within the limit?'" }
|
|
757
|
+
{ key: "question", required: true, description: "the statement carrying the quantities, e.g. 'is mpe 0.02 with n_lc 3000 within the limit?'" },
|
|
758
|
+
{ key: "standard", required: false, description: "the package id when the node id indexes under several standards, as the ambiguity message names it" }
|
|
758
759
|
],
|
|
759
760
|
audiences: ["mcp"],
|
|
760
761
|
handler: async (env, args) => {
|
|
761
762
|
const node_id = String(args?.node_id ?? "").trim();
|
|
762
763
|
const question = String(args?.question ?? "").trim();
|
|
764
|
+
const standard = args?.standard ? String(args.standard).trim() : null;
|
|
763
765
|
if (!node_id.startsWith("/") || question.length < 4) return null;
|
|
764
766
|
try {
|
|
765
|
-
const rows = await env.DB.prepare(
|
|
766
|
-
"SELECT standard, kind, name, content FROM model_nodes WHERE node_id = ?1 LIMIT 2"
|
|
767
|
-
).bind(node_id).all();
|
|
767
|
+
const rows = standard ? await env.DB.prepare("SELECT standard, kind, name, content FROM model_nodes WHERE node_id = ?1 AND standard = ?2 LIMIT 2").bind(node_id, standard).all() : await env.DB.prepare("SELECT standard, kind, name, content FROM model_nodes WHERE node_id = ?1 LIMIT 2").bind(node_id).all();
|
|
768
768
|
const found = rows.results ?? [];
|
|
769
769
|
if (found.length !== 1) {
|
|
770
770
|
return {
|
|
@@ -865,7 +865,17 @@ var bibEntry = {
|
|
|
865
865
|
const rows = await env.DB.prepare(
|
|
866
866
|
"SELECT id, kind, label FROM graph_nodes WHERE label = ?1 COLLATE NOCASE LIMIT 5"
|
|
867
867
|
).bind(label).all();
|
|
868
|
-
|
|
868
|
+
let nodes = rows.results ?? [];
|
|
869
|
+
if (!nodes.length) {
|
|
870
|
+
const d = await env.DB.prepare(
|
|
871
|
+
"SELECT canonical_id, docidentifier FROM documents WHERE docidentifier = ?1 COLLATE NOCASE LIMIT 5"
|
|
872
|
+
).bind(label).all();
|
|
873
|
+
nodes = (d.results ?? []).map((r) => ({
|
|
874
|
+
id: r.canonical_id,
|
|
875
|
+
kind: "doc",
|
|
876
|
+
label: r.docidentifier
|
|
877
|
+
}));
|
|
878
|
+
}
|
|
869
879
|
if (!nodes.length) {
|
|
870
880
|
return { name: "bib.entry", query: label, output: `No registry node carries the label "${label}". State this plainly.` };
|
|
871
881
|
}
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
handleMemories,
|
|
5
5
|
scoreFaithfulness,
|
|
6
6
|
scoreJudge
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-2JC7GXRV.js";
|
|
8
8
|
import {
|
|
9
9
|
TOOLS_REGISTRY,
|
|
10
10
|
bindModelNode,
|
|
11
11
|
modelGroundingBlock
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-64IG3ZLT.js";
|
|
13
13
|
import {
|
|
14
14
|
handleSearch
|
|
15
15
|
} from "../../chunk-TJTEBS4S.js";
|
|
@@ -973,12 +973,12 @@ async function handleMcp(env, ctx, req, tier, key) {
|
|
|
973
973
|
// stream:false forces the JSON lane (anon defaults to SSE)
|
|
974
974
|
body: JSON.stringify({ ...args, stream: false })
|
|
975
975
|
});
|
|
976
|
-
const { runTool, TOOLS_REGISTRY: TOOLS_REGISTRY2 } = await import("../../tools-
|
|
976
|
+
const { runTool, TOOLS_REGISTRY: TOOLS_REGISTRY2 } = await import("../../tools-O7OGW54R.js");
|
|
977
977
|
if (TOOLS_REGISTRY2.some((t) => t.name === name && t.audiences.includes("mcp"))) {
|
|
978
978
|
const r = await runTool({ ...env, DB: env.DB }, { name, args }, "mcp");
|
|
979
979
|
return r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
|
|
980
980
|
}
|
|
981
|
-
const res = name === "ask" ? await (await import("../../ask-
|
|
981
|
+
const res = name === "ask" ? await (await import("../../ask-HCKUKBPB.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-G76DK4AF.js")).handleSearch(env, ctx, inner, tier, key);
|
|
982
982
|
return res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
|
|
983
983
|
});
|
|
984
984
|
if (out.ok && "accepted" in out) return new Response(null, { status: 202 });
|
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.94",
|
|
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",
|
|
@@ -236,21 +236,22 @@ export const verdictEvaluate: ToolSpec = {
|
|
|
236
236
|
params: [
|
|
237
237
|
{ key: "node_id", required: true, description: "the model-plane node id, e.g. /req/metrological/repeatability (node ids appear in answers' verdict blocks)" },
|
|
238
238
|
{ key: "question", required: true, description: "the statement carrying the quantities, e.g. 'is mpe 0.02 with n_lc 3000 within the limit?'" },
|
|
239
|
+
{ key: "standard", required: false, description: "the package id when the node id indexes under several standards, as the ambiguity message names it" },
|
|
239
240
|
],
|
|
240
241
|
audiences: ["mcp"],
|
|
241
242
|
handler: async (env, args) => {
|
|
242
243
|
const node_id = String(args?.node_id ?? "").trim();
|
|
243
244
|
const question = String(args?.question ?? "").trim();
|
|
245
|
+
const standard = args?.standard ? String(args.standard).trim() : null;
|
|
244
246
|
if (!node_id.startsWith("/") || question.length < 4) return null;
|
|
245
247
|
try {
|
|
246
248
|
// the same zero-or-ambiguous rule bindModelNode applies: a node
|
|
247
249
|
// id that indexes under exactly one standard resolves; several
|
|
248
|
-
// or none resolve to nothing — no silent pick
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
.bind(node_id)
|
|
253
|
-
.all();
|
|
250
|
+
// or none resolve to nothing — no silent pick (the standard
|
|
251
|
+
// param is the caller's disambiguator)
|
|
252
|
+
const rows = standard
|
|
253
|
+
? await env.DB.prepare("SELECT standard, kind, name, content FROM model_nodes WHERE node_id = ?1 AND standard = ?2 LIMIT 2").bind(node_id, standard).all()
|
|
254
|
+
: await env.DB.prepare("SELECT standard, kind, name, content FROM model_nodes WHERE node_id = ?1 LIMIT 2").bind(node_id).all();
|
|
254
255
|
const found = (rows.results ?? []) as { standard: string; kind: string; name: string | null; content: string }[];
|
|
255
256
|
if (found.length !== 1) {
|
|
256
257
|
return {
|
|
@@ -362,7 +363,22 @@ export const bibEntry: ToolSpec = {
|
|
|
362
363
|
)
|
|
363
364
|
.bind(label)
|
|
364
365
|
.all();
|
|
365
|
-
|
|
366
|
+
let nodes = ((rows.results ?? []) as { id: string; kind: string; label: string }[]);
|
|
367
|
+
if (!nodes.length) {
|
|
368
|
+
// the docidentifier form ("OIML R 60:2017") is a documents-
|
|
369
|
+
// registry key, not a graph label (labels are titles) — resolve
|
|
370
|
+
// it through the registry and synthesize the node rows
|
|
371
|
+
const d = await env.DB.prepare(
|
|
372
|
+
"SELECT canonical_id, docidentifier FROM documents WHERE docidentifier = ?1 COLLATE NOCASE LIMIT 5",
|
|
373
|
+
)
|
|
374
|
+
.bind(label)
|
|
375
|
+
.all();
|
|
376
|
+
nodes = ((d.results ?? []) as { canonical_id: string; docidentifier: string }[]).map((r) => ({
|
|
377
|
+
id: r.canonical_id,
|
|
378
|
+
kind: "doc",
|
|
379
|
+
label: r.docidentifier,
|
|
380
|
+
}));
|
|
381
|
+
}
|
|
366
382
|
if (!nodes.length) {
|
|
367
383
|
return { name: "bib.entry", query: label, output: `No registry node carries the label "${label}". State this plainly.` };
|
|
368
384
|
}
|