@konneal/engine 0.2.60 → 0.2.62
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-I6DJFZKL.js → ask-QKBW4DP4.js} +2 -2
- package/dist/{certificates-7HZZBOPW.js → certificates-IQU7GQCJ.js} +1 -1
- package/dist/certificates.d.ts +1 -1
- package/dist/{chunk-PCP4AQQQ.js → chunk-D6CMIRMB.js} +4 -4
- package/dist/{chunk-OEXJFPNO.js → chunk-HTHYQ4RV.js} +3 -3
- package/dist/worker_public/src/index.js +3 -3
- package/package.json +1 -1
- package/workers/worker_public/src/certificates.ts +6 -4
- package/workers/worker_public/src/tools.ts +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handleAsk
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HTHYQ4RV.js";
|
|
4
4
|
import "./chunk-TPV5GPY2.js";
|
|
5
5
|
import "./chunk-SPKPH54J.js";
|
|
6
6
|
import "./chunk-A3QHHUN5.js";
|
|
7
7
|
import "./chunk-LVZTWUVJ.js";
|
|
8
8
|
import "./chunk-2PCUAJJO.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-D6CMIRMB.js";
|
|
10
10
|
import "./chunk-3FYJM7LH.js";
|
|
11
11
|
export {
|
|
12
12
|
handleAsk
|
package/dist/certificates.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare function buildRegisterQuery(tokens: string[]): {
|
|
|
33
33
|
sql: string;
|
|
34
34
|
params: string[];
|
|
35
35
|
};
|
|
36
|
-
export declare function searchRegister(db: any, query: string): Promise<{
|
|
36
|
+
export declare function searchRegister(db: any, query: string, force?: boolean): Promise<{
|
|
37
37
|
rows: RegisterRow[];
|
|
38
38
|
tokens: string[];
|
|
39
39
|
} | null>;
|
|
@@ -84,12 +84,12 @@ function buildRegisterQuery(tokens) {
|
|
|
84
84
|
return `(holder LIKE ?${n} OR model LIKE ?${n} OR num LIKE ?${n})`;
|
|
85
85
|
});
|
|
86
86
|
return {
|
|
87
|
-
sql: `SELECT num, family, holder, model, year, status, pdf_key FROM certificates WHERE ${clauses.join(" OR ")} LIMIT 6`,
|
|
87
|
+
sql: `SELECT num, family, holder, model, year, status, pdf_key FROM certificates WHERE family = ?FAMILY AND (${clauses.join(" OR ")}) LIMIT 6`,
|
|
88
88
|
params
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
async function searchRegister(db, query) {
|
|
92
|
-
if (!isRegisterShaped(query)) return null;
|
|
91
|
+
async function searchRegister(db, query, force = false) {
|
|
92
|
+
if (!force && !isRegisterShaped(query)) return null;
|
|
93
93
|
const tokens = registerTokens(query);
|
|
94
94
|
if (!tokens.length) return null;
|
|
95
95
|
const built = buildRegisterQuery(tokens);
|
|
@@ -97,7 +97,7 @@ async function searchRegister(db, query) {
|
|
|
97
97
|
const family = queryFamily(query);
|
|
98
98
|
if (family) {
|
|
99
99
|
sql = sql.replace(/\?(\d+)/g, (_, n) => `?${Number(n) + 1}`);
|
|
100
|
-
sql = sql.replace("
|
|
100
|
+
sql = sql.replace("?FAMILY", "?1");
|
|
101
101
|
params.unshift(family.replace(/^[A-Za-z]+/, ""));
|
|
102
102
|
}
|
|
103
103
|
try {
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
certificateLinks,
|
|
69
69
|
registerNote,
|
|
70
70
|
searchRegister
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-D6CMIRMB.js";
|
|
72
72
|
import {
|
|
73
73
|
P
|
|
74
74
|
} from "./chunk-3FYJM7LH.js";
|
|
@@ -1892,8 +1892,8 @@ async function runTool(db, call) {
|
|
|
1892
1892
|
if (call.name !== "register_search") return null;
|
|
1893
1893
|
const query = String(call.args?.query ?? "").trim().slice(0, 160);
|
|
1894
1894
|
if (!query) return null;
|
|
1895
|
-
const { searchRegister: searchRegister2, registerNote: registerNote2 } = await import("./certificates-
|
|
1896
|
-
const reg = await searchRegister2(db, query);
|
|
1895
|
+
const { searchRegister: searchRegister2, registerNote: registerNote2 } = await import("./certificates-IQU7GQCJ.js");
|
|
1896
|
+
const reg = await searchRegister2(db, query, true);
|
|
1897
1897
|
const output = reg?.rows?.length ? registerNote2(reg.rows) : `No certificate was found for "${query}" in the certificates database (the register snapshot). State this as the search's result, with the searched string visible.`;
|
|
1898
1898
|
return { name: call.name, query, output };
|
|
1899
1899
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
modelGroundingBlock,
|
|
7
7
|
scoreFaithfulness,
|
|
8
8
|
scoreJudge
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-HTHYQ4RV.js";
|
|
10
10
|
import {
|
|
11
11
|
handleSearch
|
|
12
12
|
} from "../../chunk-FLNX4O7C.js";
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
sha256Hex,
|
|
64
64
|
today
|
|
65
65
|
} from "../../chunk-2PCUAJJO.js";
|
|
66
|
-
import "../../chunk-
|
|
66
|
+
import "../../chunk-D6CMIRMB.js";
|
|
67
67
|
import {
|
|
68
68
|
P,
|
|
69
69
|
setProfile
|
|
@@ -959,7 +959,7 @@ async function handleMcp(env, ctx, req, tier, key) {
|
|
|
959
959
|
// stream:false forces the JSON lane (anon defaults to SSE)
|
|
960
960
|
body: JSON.stringify({ ...args, stream: false })
|
|
961
961
|
});
|
|
962
|
-
const res = name === "ask" ? await (await import("../../ask-
|
|
962
|
+
const res = name === "ask" ? await (await import("../../ask-QKBW4DP4.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-PBOODCMQ.js")).handleSearch(env, ctx, inner, tier, key);
|
|
963
963
|
return res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
|
|
964
964
|
});
|
|
965
965
|
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.62",
|
|
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",
|
|
@@ -84,13 +84,15 @@ export function buildRegisterQuery(tokens: string[]): { sql: string; params: str
|
|
|
84
84
|
return `(holder LIKE ?${n} OR model LIKE ?${n} OR num LIKE ?${n})`;
|
|
85
85
|
});
|
|
86
86
|
return {
|
|
87
|
-
sql: `SELECT num, family, holder, model, year, status, pdf_key FROM certificates WHERE ${clauses.join(" OR ")} LIMIT 6`,
|
|
87
|
+
sql: `SELECT num, family, holder, model, year, status, pdf_key FROM certificates WHERE family = ?FAMILY AND (${clauses.join(" OR ")}) LIMIT 6`,
|
|
88
88
|
params,
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
export async function searchRegister(db: any, query: string): Promise<{ rows: RegisterRow[]; tokens: string[] } | null> {
|
|
93
|
-
|
|
92
|
+
export async function searchRegister(db: any, query: string, force = false): Promise<{ rows: RegisterRow[]; tokens: string[] } | null> {
|
|
93
|
+
// the shaping gate exists for ASK questions (is this a register
|
|
94
|
+
// question?); a TOOL invocation already decided — skip the gate
|
|
95
|
+
if (!force && !isRegisterShaped(query)) return null;
|
|
94
96
|
const tokens = registerTokens(query);
|
|
95
97
|
if (!tokens.length) return null;
|
|
96
98
|
const built = buildRegisterQuery(tokens);
|
|
@@ -102,7 +104,7 @@ export async function searchRegister(db: any, query: string): Promise<{ rows: Re
|
|
|
102
104
|
// the prepend shifts every token placeholder by one: renumber them,
|
|
103
105
|
// or each token binds the family string and nothing matches
|
|
104
106
|
sql = sql.replace(/\?(\d+)/g, (_, n) => `?${Number(n) + 1}`);
|
|
105
|
-
sql = sql.replace("
|
|
107
|
+
sql = sql.replace("?FAMILY", "?1");
|
|
106
108
|
params.unshift(family.replace(/^[A-Za-z]+/, ""));
|
|
107
109
|
}
|
|
108
110
|
try {
|
|
@@ -41,7 +41,7 @@ export async function runTool(db: any, call: ToolCall): Promise<ToolResult | nul
|
|
|
41
41
|
const query = String(call.args?.query ?? "").trim().slice(0, 160);
|
|
42
42
|
if (!query) return null;
|
|
43
43
|
const { searchRegister, registerNote } = await import("./certificates");
|
|
44
|
-
const reg = await searchRegister(db, query);
|
|
44
|
+
const reg = await searchRegister(db, query, true); // the tool decided — no shaping gate
|
|
45
45
|
const output = reg?.rows?.length
|
|
46
46
|
? registerNote(reg.rows)
|
|
47
47
|
: `No certificate was found for "${query}" in the certificates database (the register snapshot). State this as the search's result, with the searched string visible.`;
|