@konneal/engine 0.2.113 → 0.2.114
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-645ZWTEQ.js → ask-53QRX3KB.js} +2 -2
- package/dist/{chunk-WUD4XR7Y.js → chunk-4J3CRJH3.js} +1 -1
- package/dist/{chunk-NO4WHD3K.js → chunk-4RQ4X7SA.js} +2 -2
- package/dist/{chunk-PSI5SR2A.js → chunk-VSZBGAEE.js} +1 -1
- package/dist/{search-6J5FUJOC.js → search-5HDTEMZD.js} +2 -2
- package/dist/worker_public/src/index.js +4 -4
- package/package.json +1 -1
- package/workers/worker_public/src/stages/dense.ts +3 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handleAsk
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VSZBGAEE.js";
|
|
4
4
|
import "./chunk-32UDKBA2.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-4RQ4X7SA.js";
|
|
6
6
|
import "./chunk-TH5XGPD5.js";
|
|
7
7
|
import "./chunk-DJ65EF5G.js";
|
|
8
8
|
import "./chunk-A3QHHUN5.js";
|
|
@@ -22158,11 +22158,11 @@ var dense = {
|
|
|
22158
22158
|
const allMatches = (await env.VECTORIZE.query(vector, q)).matches ?? [];
|
|
22159
22159
|
let matches = allMatches;
|
|
22160
22160
|
const before = matches.length;
|
|
22161
|
-
matches = matches.filter((m) =>
|
|
22161
|
+
matches = matches.filter((m) => matchesDocScope(m.metadata ?? {}, filters.doc_number));
|
|
22162
22162
|
if (filters.edition) matches = matches.filter((m) => !m.metadata?.edition || String(m.metadata.edition) === filters.edition);
|
|
22163
22163
|
console.log("dense scope (in code):", before, "\u2192", matches.length, "in doc", filters.doc_number, filters.edition ? `@${filters.edition}` : "");
|
|
22164
22164
|
if (filters && filters.edition && matches.length < 3) {
|
|
22165
|
-
const docOnly = allMatches.filter((m) =>
|
|
22165
|
+
const docOnly = allMatches.filter((m) => matchesDocScope(m.metadata ?? {}, filters.doc_number));
|
|
22166
22166
|
if (docOnly.length > matches.length) {
|
|
22167
22167
|
console.log("edition pin dropped:", filters.doc_number, "@", filters.edition, "\u2192", docOnly.length, "doc-scoped hits (edition not in corpus)");
|
|
22168
22168
|
matches = docOnly;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
handleMemories,
|
|
5
5
|
scoreFaithfulness,
|
|
6
6
|
scoreJudge
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-VSZBGAEE.js";
|
|
8
8
|
import {
|
|
9
9
|
TOOLS_REGISTRY,
|
|
10
10
|
bindModelNode,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "../../chunk-32UDKBA2.js";
|
|
13
13
|
import {
|
|
14
14
|
handleSearch
|
|
15
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-4J3CRJH3.js";
|
|
16
16
|
import {
|
|
17
17
|
buildMessages,
|
|
18
18
|
citations,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
sessionFrom,
|
|
35
35
|
telemetry,
|
|
36
36
|
understandQuery
|
|
37
|
-
} from "../../chunk-
|
|
37
|
+
} from "../../chunk-4RQ4X7SA.js";
|
|
38
38
|
import {
|
|
39
39
|
cfBlobs,
|
|
40
40
|
embed,
|
|
@@ -1000,7 +1000,7 @@ async function callToolOnce(env, ctx, _req, tier, key, name, args, t0) {
|
|
|
1000
1000
|
const r = await runTool({ ...env, DB: env.DB }, { name, args }, "mcp");
|
|
1001
1001
|
payload = r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
|
|
1002
1002
|
} else {
|
|
1003
|
-
const res = name === "ask" ? await (await import("../../ask-
|
|
1003
|
+
const res = name === "ask" ? await (await import("../../ask-53QRX3KB.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-5HDTEMZD.js")).handleSearch(env, ctx, inner, tier, key);
|
|
1004
1004
|
payload = await res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
|
|
1005
1005
|
}
|
|
1006
1006
|
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 });
|
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.114",
|
|
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",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// saved), the doc/edition-filtered query with its guessed-pin drop and
|
|
5
5
|
// sparse-filter widen, and the plain unfiltered query.
|
|
6
6
|
import { LIMITS } from "../config.ts";
|
|
7
|
+
import { matchesDocScope } from "../context.ts";
|
|
7
8
|
import type { Stage } from "./types.ts";
|
|
8
9
|
|
|
9
10
|
export const dense: Stage = {
|
|
@@ -37,7 +38,7 @@ export const dense: Stage = {
|
|
|
37
38
|
const allMatches: any[] = (await env.VECTORIZE.query(vector, q)).matches ?? [];
|
|
38
39
|
let matches: any[] = allMatches;
|
|
39
40
|
const before = matches.length;
|
|
40
|
-
matches = matches.filter((m) =>
|
|
41
|
+
matches = matches.filter((m) => matchesDocScope(m.metadata ?? {}, filters.doc_number!));
|
|
41
42
|
if (filters.edition) matches = matches.filter((m) => !m.metadata?.edition || String(m.metadata.edition) === filters.edition);
|
|
42
43
|
console.log("dense scope (in code):", before, "→", matches.length, "in doc", filters.doc_number, filters.edition ? `@${filters.edition}` : "");
|
|
43
44
|
// an edition pin corroborated by (almost) nothing means the pin
|
|
@@ -52,7 +53,7 @@ export const dense: Stage = {
|
|
|
52
53
|
// the same guess-drop, in code: a pinned edition that starved the
|
|
53
54
|
// scoped set drops to the doc-only scope
|
|
54
55
|
if (filters && filters.edition && matches.length < 3) {
|
|
55
|
-
const docOnly = allMatches.filter((m) =>
|
|
56
|
+
const docOnly = allMatches.filter((m) => matchesDocScope(m.metadata ?? {}, filters.doc_number!));
|
|
56
57
|
if (docOnly.length > matches.length) {
|
|
57
58
|
console.log("edition pin dropped:", filters.doc_number, "@", filters.edition, "→", docOnly.length, "doc-scoped hits (edition not in corpus)");
|
|
58
59
|
matches = docOnly;
|