@konneal/engine 0.2.121 → 0.2.122

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.
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  handleAsk
3
- } from "./chunk-YMRBMZNT.js";
3
+ } from "./chunk-BRUHQEOT.js";
4
4
  import "./chunk-FKG5VGOL.js";
5
- import "./chunk-IIQWESHC.js";
5
+ import "./chunk-2JUWER2A.js";
6
6
  import "./chunk-TH5XGPD5.js";
7
7
  import "./chunk-DJ65EF5G.js";
8
8
  import "./chunk-A4A26BCV.js";
@@ -22901,9 +22901,11 @@ var rerankStage = {
22901
22901
  c.hits.forEach((h, i) => h.rerank_score = scores[i]);
22902
22902
  c.hits.sort((a, b) => (b.rerank_score ?? -Infinity) - (a.rerank_score ?? -Infinity));
22903
22903
  if (c.filter?.doc_number) {
22904
- const families = c.hits.filter((h) => h.metadata.clause_anchor === "family");
22905
- if (families.length) {
22906
- c.hits = [...families, ...c.hits.filter((h) => h.metadata.clause_anchor !== "family")];
22904
+ const families = c.hits.filter((h) => h.metadata.clause_anchor === "family" && String(h.metadata.doc_number ?? "").split("-")[0] === String(c.filter.doc_number).split("-")[0]);
22905
+ const own = families.length ? families : c.hits.filter((h) => String(h.metadata.doc_number ?? "") === String(c.filter.doc_number).split("-")[0] && /^(overview|)$/i.test(String(h.metadata.clause_anchor ?? "")));
22906
+ if (own.length) {
22907
+ const ownIds = new Set(own.map((h) => h.id));
22908
+ c.hits = [...own, ...c.hits.filter((h) => !ownIds.has(h.id))];
22907
22909
  }
22908
22910
  }
22909
22911
  }
@@ -63,7 +63,7 @@ import {
63
63
  tokenBudget,
64
64
  understandQuery,
65
65
  usageTotal
66
- } from "./chunk-IIQWESHC.js";
66
+ } from "./chunk-2JUWER2A.js";
67
67
  import {
68
68
  embed,
69
69
  generateOnce,
@@ -6,7 +6,7 @@ import {
6
6
  sessionFrom,
7
7
  telemetry,
8
8
  understandQuery
9
- } from "./chunk-IIQWESHC.js";
9
+ } from "./chunk-2JUWER2A.js";
10
10
  import {
11
11
  portModelRunner
12
12
  } from "./chunk-TH5XGPD5.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  handleSearch
3
- } from "./chunk-C5L55VI7.js";
4
- import "./chunk-IIQWESHC.js";
3
+ } from "./chunk-P6IRYZLL.js";
4
+ import "./chunk-2JUWER2A.js";
5
5
  import "./chunk-TH5XGPD5.js";
6
6
  import "./chunk-DJ65EF5G.js";
7
7
  import "./chunk-A4A26BCV.js";
@@ -4,7 +4,7 @@ import {
4
4
  handleMemories,
5
5
  scoreFaithfulness,
6
6
  scoreJudge
7
- } from "../../chunk-YMRBMZNT.js";
7
+ } from "../../chunk-BRUHQEOT.js";
8
8
  import {
9
9
  TOOLS_REGISTRY,
10
10
  bindModelNode,
@@ -12,7 +12,7 @@ import {
12
12
  } from "../../chunk-FKG5VGOL.js";
13
13
  import {
14
14
  handleSearch
15
- } from "../../chunk-C5L55VI7.js";
15
+ } from "../../chunk-P6IRYZLL.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-IIQWESHC.js";
37
+ } from "../../chunk-2JUWER2A.js";
38
38
  import {
39
39
  cfBlobs,
40
40
  embed,
@@ -1049,7 +1049,7 @@ async function callToolOnce(env, ctx, _req, tier, key, name, args, t0) {
1049
1049
  const r = await runTool({ ...env, DB: env.DB }, { name, args }, "mcp");
1050
1050
  payload = r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
1051
1051
  } else {
1052
- const res = name === "ask" ? await (await import("../../ask-5RWMWNX5.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-RMB4BL4P.js")).handleSearch(env, ctx, inner, tier, key);
1052
+ const res = name === "ask" ? await (await import("../../ask-J4QFS6Q2.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-OVUHVV35.js")).handleSearch(env, ctx, inner, tier, key);
1053
1053
  payload = await res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
1054
1054
  }
1055
1055
  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.121",
30
+ "version": "0.2.122",
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",
@@ -29,9 +29,19 @@ export const rerankStage: Stage = {
29
29
  c.hits.forEach((h, i) => (h.rerank_score = scores[i]));
30
30
  c.hits.sort((a, b) => (b.rerank_score ?? -Infinity) - (a.rerank_score ?? -Infinity));
31
31
  if (c.filter?.doc_number) {
32
- const families = c.hits.filter((h) => h.metadata.clause_anchor === "family");
33
- if (families.length) {
34
- c.hits = [...families, ...c.hits.filter((h) => h.metadata.clause_anchor !== "family")];
32
+ // pin the scoped doc's OWN front matter: the synthetic family
33
+ // chunk first; documents without one (D 29 — its chunks carry
34
+ // overview/empty anchors, no family synthetic exists) still get
35
+ // their overview pinned — the tail showed rerank preferring
36
+ // R 106-1's prose for "What is OIML D 29?" with the scoped
37
+ // doc's own content present in the pool (2026-10-10)
38
+ const families = c.hits.filter((h) => h.metadata.clause_anchor === "family" && String(h.metadata.doc_number ?? "").split("-")[0] === String(c.filter!.doc_number).split("-")[0]);
39
+ const own = families.length
40
+ ? families
41
+ : c.hits.filter((h) => String(h.metadata.doc_number ?? "") === String(c.filter!.doc_number).split("-")[0] && /^(overview|)$/i.test(String(h.metadata.clause_anchor ?? "")));
42
+ if (own.length) {
43
+ const ownIds = new Set(own.map((h) => h.id));
44
+ c.hits = [...own, ...c.hits.filter((h) => !ownIds.has(h.id))];
35
45
  }
36
46
  }
37
47
  }