@konneal/engine 0.2.78 → 0.2.80

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-JIN6Y4PD.js";
3
+ } from "./chunk-LTGOJVDF.js";
4
4
  import "./chunk-7HWJOFTQ.js";
5
5
  import "./chunk-SPKPH54J.js";
6
6
  import "./chunk-A3QHHUN5.js";
@@ -2083,8 +2083,13 @@ async function extractNameplate(ai, model, image) {
2083
2083
  // temperature is a READING temperature — a transcription task at
2084
2084
  // default sampling hallucinated brands on a low-res plate
2085
2085
  // (observed live 2026-10-03: "Tektronix" on a CAS label)
2086
- max_tokens: attempt === 0 ? 512 : 1536,
2087
- reasoning_effort: attempt === 0 ? "low" : "medium",
2086
+ // attempt 1 is cheap; the retry is the QUALITY leg — high effort
2087
+ // with the full budget, the escalation that measured 58% vs 25%
2088
+ // on hard extraction (the 2026-09-18 enrichment A/B), because a
2089
+ // hard plate is exactly that class of task. The flat 512 also
2090
+ // starved the JSON behind the transcribe-first prose.
2091
+ max_tokens: attempt === 0 ? 1536 : 3072,
2092
+ reasoning_effort: attempt === 0 ? "low" : "high",
2088
2093
  temperature: 0.15
2089
2094
  });
2090
2095
  const text = typeof res?.response === "string" ? res.response : res?.choices?.[0]?.message?.content;
@@ -3076,6 +3081,18 @@ ${q.query}` }],
3076
3081
  if (completionBlocks.length) console.log("contract completion:", completionBlocks.length, "table block(s) attached server-side");
3077
3082
  }
3078
3083
  completionBlocks.push(...await completeFigures(env.DB, answer, [...c2ns.blocks, ...completionBlocks], used));
3084
+ if (withImage && register?.rows?.length && answer.includes(refusalAnswer())) {
3085
+ console.log("blind-answer: the register note carried rows but the answer refused \u2014 regenerating once");
3086
+ const regen = await generateOnce(env, model, [
3087
+ ...messages.slice(0, -1),
3088
+ { role: "user", content: "The photograph was attached and the register note lists actual matching certificate rows. Present those rows \u2014 number, holder, model, status, and every document link \u2014 as the answer. Do not claim that nothing was provided." },
3089
+ messages[messages.length - 1]
3090
+ ], effort);
3091
+ if (regen && !regen.includes(refusalAnswer())) {
3092
+ answer = canonicalRefusal(regen);
3093
+ console.log("blind-answer: regeneration grounded");
3094
+ }
3095
+ }
3079
3096
  const jsonQuality = answerQuality(finalCites.map((c) => c.quality));
3080
3097
  let entailment = null;
3081
3098
  let entailmentNote = "";
@@ -6,7 +6,7 @@ import {
6
6
  modelGroundingBlock,
7
7
  scoreFaithfulness,
8
8
  scoreJudge
9
- } from "../../chunk-JIN6Y4PD.js";
9
+ } from "../../chunk-LTGOJVDF.js";
10
10
  import {
11
11
  handleSearch
12
12
  } from "../../chunk-KO6DRI7C.js";
@@ -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-IANJ4PXT.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-LVUQLA3C.js")).handleSearch(env, ctx, inner, tier, key);
962
+ const res = name === "ask" ? await (await import("../../ask-7V4ECBLN.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-LVUQLA3C.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.78",
30
+ "version": "0.2.80",
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",
@@ -1503,6 +1503,24 @@ let convEntities: Array<{ entity: string; kind: string }> = [];
1503
1503
  // figure completion (#172) — see ./completion for the rationale
1504
1504
  completionBlocks.push(...(await completeFigures(env.DB, answer, [...c2ns.blocks, ...completionBlocks], used)));
1505
1505
 
1506
+ // the blind-answer regeneration (2026-10-03, live on the photo case):
1507
+ // the multimodal call can answer AROUND an attached image — a 200 whose
1508
+ // text claims nothing was provided — while the bridge succeeded and the
1509
+ // register note carries actual rows. One bounded regeneration, decided on
1510
+ // that exact signature; the retry carries a sterner ground instruction.
1511
+ if (withImage && register?.rows?.length && answer.includes(refusalAnswer())) {
1512
+ console.log("blind-answer: the register note carried rows but the answer refused — regenerating once");
1513
+ const regen = await generateOnce(env, model, [
1514
+ ...messages.slice(0, -1),
1515
+ { role: "user", content: "The photograph was attached and the register note lists actual matching certificate rows. Present those rows — number, holder, model, status, and every document link — as the answer. Do not claim that nothing was provided." },
1516
+ messages[messages.length - 1],
1517
+ ], effort);
1518
+ if (regen && !regen.includes(refusalAnswer())) {
1519
+ answer = canonicalRefusal(regen);
1520
+ console.log("blind-answer: regeneration grounded");
1521
+ }
1522
+ }
1523
+
1506
1524
  const jsonQuality = answerQuality(finalCites.map((c: any) => c.quality));
1507
1525
  // the entailment gate (TODO.new-era/10): the eval battery's faithfulness
1508
1526
  // scorer, promoted onto the serving path — the confidence line states a
@@ -37,8 +37,13 @@ export async function extractNameplate(ai: any, model: string, image: string): P
37
37
  // temperature is a READING temperature — a transcription task at
38
38
  // default sampling hallucinated brands on a low-res plate
39
39
  // (observed live 2026-10-03: "Tektronix" on a CAS label)
40
- max_tokens: attempt === 0 ? 512 : 1536,
41
- reasoning_effort: attempt === 0 ? "low" : "medium",
40
+ // attempt 1 is cheap; the retry is the QUALITY leg — high effort
41
+ // with the full budget, the escalation that measured 58% vs 25%
42
+ // on hard extraction (the 2026-09-18 enrichment A/B), because a
43
+ // hard plate is exactly that class of task. The flat 512 also
44
+ // starved the JSON behind the transcribe-first prose.
45
+ max_tokens: attempt === 0 ? 1536 : 3072,
46
+ reasoning_effort: attempt === 0 ? "low" : "high",
42
47
  temperature: 0.15,
43
48
  });
44
49
  const text = typeof res?.response === "string" ? res.response : res?.choices?.[0]?.message?.content;