@konneal/engine 0.2.26 → 0.2.27

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,7 +1,7 @@
1
1
  import {
2
2
  handleAsk
3
- } from "./chunk-ADQEM7IS.js";
4
- import "./chunk-WKG65DBA.js";
3
+ } from "./chunk-JVN6SQAT.js";
4
+ import "./chunk-4G5OGWXY.js";
5
5
  import "./chunk-2RKYO3OC.js";
6
6
  import "./chunk-A3QHHUN5.js";
7
7
  import "./chunk-JGKSUSF5.js";
@@ -24405,6 +24405,7 @@ export {
24405
24405
  embed,
24406
24406
  generateOnce,
24407
24407
  ftsMatchQuery,
24408
+ refCodec,
24408
24409
  NO_CONTEXT,
24409
24410
  parseContext,
24410
24411
  namedDocumentIn,
@@ -7,7 +7,7 @@ import {
7
7
  sessionFrom,
8
8
  telemetry,
9
9
  understandQuery
10
- } from "./chunk-WKG65DBA.js";
10
+ } from "./chunk-4G5OGWXY.js";
11
11
  import {
12
12
  corsHeaders,
13
13
  err,
@@ -18,6 +18,7 @@ import {
18
18
  parseContext,
19
19
  portModelRunner,
20
20
  rawSessionToken,
21
+ refCodec,
21
22
  resolveDocScope,
22
23
  resolveLiveAccount,
23
24
  retrievalQuery,
@@ -27,7 +28,7 @@ import {
27
28
  syntheticUnderstanding,
28
29
  telemetry,
29
30
  understandQuery
30
- } from "./chunk-WKG65DBA.js";
31
+ } from "./chunk-4G5OGWXY.js";
31
32
  import {
32
33
  corsHeaders,
33
34
  err,
@@ -2014,19 +2015,16 @@ ${summary}` }] : [],
2014
2015
  if (aggregationVerdict) console.log("aggregation engine:", aggregationVerdict.operation, aggregationVerdict.table, "\u2192", aggregationVerdict.value);
2015
2016
  let boundaryNote = null;
2016
2017
  let boundaryBoost;
2017
- let modelEditionBoost;
2018
- if (boundModel && !boundModel.gated) {
2019
- const prefix = String(P().sources?.models?.standard_prefix ?? "");
2020
- if (prefix && boundModel.standard.startsWith(prefix)) {
2021
- const num3 = boundModel.standard.slice(prefix.length);
2022
- const family = `${prefix.slice(prefix.lastIndexOf("-") + 1).toUpperCase()}-${num3}`;
2023
- const row = await env.DB.prepare("SELECT edition FROM documents WHERE family = ?1 AND active = 1 ORDER BY edition DESC LIMIT 1").bind(family).first().catch(() => null);
2024
- if (row?.edition) modelEditionBoost = String(row.edition);
2025
- } else {
2026
- modelEditionBoost = boundModel.standard;
2018
+ let editionBoost;
2019
+ try {
2020
+ const fam = understanding?.doc ? refCodec().familyOf(understanding.doc) : null;
2021
+ if (fam) {
2022
+ const row = await env.DB.prepare("SELECT edition FROM documents WHERE family = ?1 AND active = 1 ORDER BY edition DESC LIMIT 1").bind(fam).first().catch(() => null);
2023
+ if (row?.edition) editionBoost = String(row.edition);
2027
2024
  }
2025
+ } catch {
2028
2026
  }
2029
- const lexicalBoost = [boundaryBoost, modelEditionBoost].filter(Boolean).join(" ") || void 0;
2027
+ const lexicalBoost = [boundaryBoost, editionBoost].filter(Boolean).join(" ") || void 0;
2030
2028
  if (P().sources?.licensed?.length) {
2031
2029
  const match = matchLicensedTopic(q.query, P().sources.licensed);
2032
2030
  if (match && !(standardKeys?.has(match.entry.key) ?? false)) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  handleSearch
3
- } from "./chunk-GAPT3WEN.js";
4
- import "./chunk-WKG65DBA.js";
3
+ } from "./chunk-5LCPKJ6V.js";
4
+ import "./chunk-4G5OGWXY.js";
5
5
  import "./chunk-2RKYO3OC.js";
6
6
  import "./chunk-A3QHHUN5.js";
7
7
  import "./chunk-JGKSUSF5.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  handleSearch
3
- } from "../../chunk-GAPT3WEN.js";
3
+ } from "../../chunk-5LCPKJ6V.js";
4
4
  import {
5
5
  checkQuoteAnchors,
6
6
  handleAsk,
7
7
  handleMemories,
8
8
  scoreJudge,
9
9
  standardForDocNumber
10
- } from "../../chunk-ADQEM7IS.js";
10
+ } from "../../chunk-JVN6SQAT.js";
11
11
  import {
12
12
  buildMessages,
13
13
  citations,
@@ -29,7 +29,7 @@ import {
29
29
  sessionFrom,
30
30
  telemetry,
31
31
  understandQuery
32
- } from "../../chunk-WKG65DBA.js";
32
+ } from "../../chunk-4G5OGWXY.js";
33
33
  import {
34
34
  authenticate,
35
35
  corsHeaders,
@@ -989,7 +989,7 @@ async function handleMcp(env, ctx, req, tier, key) {
989
989
  // stream:false forces the JSON lane (anon defaults to SSE)
990
990
  body: JSON.stringify({ ...args, stream: false })
991
991
  });
992
- const res = name === "ask" ? await (await import("../../ask-YN63SADP.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-MSFDEFQG.js")).handleSearch(env, ctx, inner, tier, key);
992
+ const res = name === "ask" ? await (await import("../../ask-Y7L6MDAV.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-4UK3RBEQ.js")).handleSearch(env, ctx, inner, tier, key);
993
993
  return res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
994
994
  });
995
995
  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.26",
30
+ "version": "0.2.27",
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",
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { LIMITS, MODELS, num, sha256Hex, roleModel, answerEffort, requestEffort, effortBudget } from "./config";
7
7
  import { portModelRunner } from "./env.ts";
8
+ import { refCodec } from "./codecs";
8
9
  import { buildMessages, citations, retrieve, retrievalQuery, identityNote, splitHistory, listwiseRerank, refusalAnswer, Hit } from "./pipeline";
9
10
  import { sessionFrom } from "./auth";
10
11
  import { retrieveInternal } from "./internal_gateway";
@@ -858,27 +859,24 @@ async function handleAsk(
858
859
  // publication's own clause — surface for a question the document's
859
860
  // vocabulary alone would miss
860
861
  let boundaryBoost: string | undefined;
861
- // the model-bound edition boost: the grounding pool tilts to the
862
- // CURRENT edition's chunks (the superseded dirty-corpus editions
863
- // otherwise outrank them on shared vocabulary and the answer's model
864
- // values read as ungrounded against 2017 passages)
865
- let modelEditionBoost: string | undefined;
866
- if (boundModel && !boundModel.gated) {
867
- const prefix = String(P().sources?.models?.standard_prefix ?? "");
868
- if (prefix && boundModel.standard.startsWith(prefix)) {
869
- // the profile's package prefix derives the graph family
870
- // (<prefix><num> → family <LETTER>-<num>) and the boost is the
871
- // family's ACTIVE edition
872
- const num = boundModel.standard.slice(prefix.length);
873
- const family = `${prefix.slice(prefix.lastIndexOf("-") + 1).toUpperCase()}-${num}`;
862
+ // the EDITION boost: the grounding pool tilts to the publication's
863
+ // ACTIVE edition (the graph's own registry) — the dirty corpus's
864
+ // superseded editions otherwise outrank the current ones on shared
865
+ // vocabulary, and the answer's current-edition values then read as
866
+ // ungrounded against superseded passages. The family key is the
867
+ // profile codec's (familyOf) — no publisher grammar here.
868
+ let editionBoost: string | undefined;
869
+ try {
870
+ const fam = understanding?.doc ? refCodec().familyOf(understanding.doc) : null;
871
+ if (fam) {
874
872
  const row = await env.DB.prepare("SELECT edition FROM documents WHERE family = ?1 AND active = 1 ORDER BY edition DESC LIMIT 1")
875
- .bind(family).first<any>().catch(() => null);
876
- if (row?.edition) modelEditionBoost = String(row.edition);
877
- } else {
878
- modelEditionBoost = boundModel.standard; // the doc number is embedded in the id
873
+ .bind(fam).first<any>().catch(() => null);
874
+ if (row?.edition) editionBoost = String(row.edition);
879
875
  }
876
+ } catch {
877
+ // a registry hiccup degrades to unsteered retrieval
880
878
  }
881
- const lexicalBoost = [boundaryBoost, modelEditionBoost].filter(Boolean).join(" ") || undefined;
879
+ const lexicalBoost = [boundaryBoost, editionBoost].filter(Boolean).join(" ") || undefined;
882
880
  if (P().sources?.licensed?.length) {
883
881
  const match = matchLicensedTopic(q.query, P().sources.licensed);
884
882
  if (match && !(standardKeys?.has(match.entry.key) ?? false)) {