@konneal/engine 0.2.124 → 0.2.126

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,6 +1,6 @@
1
1
  import {
2
2
  handleAsk
3
- } from "./chunk-ZO6MMKGD.js";
3
+ } from "./chunk-ZHHORWM6.js";
4
4
  import "./chunk-J6LBR6GI.js";
5
5
  import "./chunk-2JUWER2A.js";
6
6
  import "./chunk-TH5XGPD5.js";
@@ -2082,9 +2082,33 @@ async function handleAsk(env, ctx, req, tier, key) {
2082
2082
  if (fam) {
2083
2083
  const agg = await registerAggregate(env.DB, fam);
2084
2084
  if (agg) {
2085
+ const latestLine = agg.latest ? `The latest certificate in the snapshot is ${agg.latest.num} \u2014 holder ${agg.latest.holder}, model "${agg.latest.model}"${agg.latest.year ? `, issued ${agg.latest.year}` : ""}, status ${agg.latest.status}.` : "No certificate rows are present in the snapshot.";
2086
+ const linkLine = agg.latest?.pdf_key ? `
2087
+
2088
+ [The latest certificate's document](${`/cert-pdf/${agg.latest.pdf_key}`}) is on file.` : "";
2089
+ const answer2 = aggIntent === "count" ? `The ${P().publisher.name} ${agg.family} family holds **${agg.count} certificate${agg.count === 1 ? "" : "s"}** in the ${P().publisher.name}-CS register snapshot (${agg.valid} valid${agg.suspended ? `, ${agg.suspended} suspended` : ""}).
2090
+
2091
+ Certificates are issued per recommendation family \u2014 the register carries no edition dimension, so the 2021 you named does not narrow the count. The register is a snapshot rather than live certification status.` : `${latestLine}${linkLine}
2092
+
2093
+ Certificates are issued per recommendation family \u2014 the register carries no edition dimension. The register is a snapshot rather than live certification status.`;
2094
+ const block = aggregateBlock(agg);
2095
+ registerBlock = block;
2085
2096
  aggregateNoteText = aggregateNote(agg);
2086
- registerBlock = aggregateBlock(agg);
2087
- console.log("register aggregate:", agg.family, "count", agg.count, "latest", agg.latest?.num ?? "none");
2097
+ const queryHash2 = await sha256Hex(q.query);
2098
+ telemetry(env, ctx, tier, "ask", MODELS.member, true, answer2.length, queryHash2, q.lang, void 0, telemetryMeta());
2099
+ const tq2 = await chargeAnswerTokens(env, bucketId, void 0, q.query.length, answer2.length);
2100
+ return json({
2101
+ answer: answer2,
2102
+ citations: [{ docidentifier: `${P().publisher.name}-CS certificate register (family ${agg.family})`, corpus: "register" }],
2103
+ model: MODELS.member,
2104
+ query_hash: queryHash2,
2105
+ follow_ups: [],
2106
+ blocks: [block],
2107
+ context_applied: NO_CONTEXT,
2108
+ read: readAs(),
2109
+ ...ablate ? { ablate } : {},
2110
+ quota: { ...quota, ...tq2 }
2111
+ });
2088
2112
  }
2089
2113
  }
2090
2114
  }
@@ -4,7 +4,7 @@ import {
4
4
  handleMemories,
5
5
  scoreFaithfulness,
6
6
  scoreJudge
7
- } from "../../chunk-ZO6MMKGD.js";
7
+ } from "../../chunk-ZHHORWM6.js";
8
8
  import {
9
9
  TOOLS_REGISTRY,
10
10
  bindModelNode,
@@ -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-XAI5SVJ7.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-OVUHVV35.js")).handleSearch(env, ctx, inner, tier, key);
1052
+ const res = name === "ask" ? await (await import("../../ask-RAQHKSPN.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.124",
30
+ "version": "0.2.126",
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",
@@ -770,9 +770,38 @@ let convEntities: Array<{ entity: string; kind: string }> = [];
770
770
  if (fam) {
771
771
  const agg = await registerAggregate(env.DB, fam);
772
772
  if (agg) {
773
+ // DETERMINISTIC ANSWER (the verdict engine's law applied to the
774
+ // register): a count/latest question is computed data — the
775
+ // model never enters the loop, so its scope training can never
776
+ // refuse a computed fact. The prose mirrors the note; the block
777
+ // carries the same numbers for the UI.
778
+ const latestLine = agg.latest
779
+ ? `The latest certificate in the snapshot is ${agg.latest.num} — holder ${agg.latest.holder}, model "${agg.latest.model}"${agg.latest.year ? `, issued ${agg.latest.year}` : ""}, status ${agg.latest.status}.`
780
+ : "No certificate rows are present in the snapshot.";
781
+ const linkLine = agg.latest?.pdf_key
782
+ ? `\n\n[The latest certificate's document](${`/cert-pdf/${agg.latest.pdf_key}`}) is on file.`
783
+ : "";
784
+ const answer = aggIntent === "count"
785
+ ? `The ${P().publisher.name} ${agg.family} family holds **${agg.count} certificate${agg.count === 1 ? "" : "s"}** in the ${P().publisher.name}-CS register snapshot (${agg.valid} valid${agg.suspended ? `, ${agg.suspended} suspended` : ""}).\n\nCertificates are issued per recommendation family — the register carries no edition dimension, so the 2021 you named does not narrow the count. The register is a snapshot rather than live certification status.`
786
+ : `${latestLine}${linkLine}\n\nCertificates are issued per recommendation family — the register carries no edition dimension. The register is a snapshot rather than live certification status.`;
787
+ const block = aggregateBlock(agg);
788
+ registerBlock = block;
773
789
  aggregateNoteText = aggregateNote(agg);
774
- registerBlock = aggregateBlock(agg);
775
- console.log("register aggregate:", agg.family, "count", agg.count, "latest", agg.latest?.num ?? "none");
790
+ const queryHash = await sha256Hex(q.query);
791
+ telemetry(env, ctx, tier, "ask", MODELS.member, true, answer.length, queryHash, q.lang, undefined, telemetryMeta());
792
+ const tq = await chargeAnswerTokens(env, bucketId, undefined, q.query.length, answer.length);
793
+ return json({
794
+ answer,
795
+ citations: [{ docidentifier: `${P().publisher.name}-CS certificate register (family ${agg.family})`, corpus: "register" }],
796
+ model: MODELS.member,
797
+ query_hash: queryHash,
798
+ follow_ups: [],
799
+ blocks: [block],
800
+ context_applied: NO_CONTEXT,
801
+ read: readAs(),
802
+ ...(ablate ? { ablate } : {}),
803
+ quota: { ...quota, ...tq },
804
+ });
776
805
  }
777
806
  }
778
807
  }