@konneal/engine 0.2.168 → 0.2.169

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-AGL4NGXY.js";
3
+ } from "./chunk-NTZX65GT.js";
4
4
  import "./chunk-ECOYO7EX.js";
5
5
  import "./chunk-PTY2OSC4.js";
6
6
  import "./chunk-LIZJLRXZ.js";
@@ -2785,12 +2785,21 @@ Answer account questions from these records ONLY: name the record when you use i
2785
2785
  }
2786
2786
  const canonical0 = exciseMisplacedPin(canonicalRefusal(full.replace(/^TOOL [a-z_.]+.*$\n?/gm, "").replace(/^\n+/, ""), refusalScope(answerCites(full))), answerCites(full));
2787
2787
  const c2 = canonical0.includes(refusalAnswer()) ? { text: canonical0, blocks: [], dropped: [] } : await contractV2(env.DB, canonical0, usedHits);
2788
+ let streamedCompletionBlocks = [];
2789
+ if (!canonical0.includes(refusalAnswer())) {
2790
+ try {
2791
+ streamedCompletionBlocks = await completeTables(env.DB, canonical0, usedHits);
2792
+ streamedCompletionBlocks.push(...await completeFigures(env.DB, canonical0, [...c2.blocks, ...streamedCompletionBlocks], usedHits, q2.query));
2793
+ if (streamedCompletionBlocks.length) console.log("streamed completion:", streamedCompletionBlocks.length, "block(s) attached");
2794
+ } catch {
2795
+ }
2796
+ }
2788
2797
  send({
2789
2798
  type: "done",
2790
2799
  model,
2791
2800
  query_hash: queryHash,
2792
2801
  follow_ups: refusalShaped(canonical0, refusalScope(answerCites(full))) ? [] : understanding?.follow_ups ?? [],
2793
- blocks: [...c2.blocks, ...verdictBlock ? [verdictBlock] : [], ...conditionBlock ? [conditionBlock] : [], ...aggregationBlock ? [aggregationBlock] : []],
2802
+ blocks: [...c2.blocks, ...verdictBlock ? [verdictBlock] : [], ...conditionBlock ? [conditionBlock] : [], ...aggregationBlock ? [aggregationBlock] : [], ...streamedCompletionBlocks],
2794
2803
  context_applied: ctxApplied,
2795
2804
  read: readAs(),
2796
2805
  // the evidence view's ground truth: the exact passages this
@@ -4,7 +4,7 @@ import {
4
4
  handleMemories,
5
5
  scoreFaithfulness,
6
6
  scoreJudge
7
- } from "../../chunk-AGL4NGXY.js";
7
+ } from "../../chunk-NTZX65GT.js";
8
8
  import "../../chunk-ECOYO7EX.js";
9
9
  import {
10
10
  TOOLS_REGISTRY,
@@ -1125,7 +1125,7 @@ async function callToolOnce(env, ctx, _req, tier, key, name, args, t0) {
1125
1125
  const r = await runTool({ ...env, DB: env.DB }, { name, args }, "mcp");
1126
1126
  payload = r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
1127
1127
  } else {
1128
- const res = name === "ask" ? await (await import("../../ask-RUMLIO35.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-Y4Y46Y57.js")).handleSearch(env, ctx, inner, tier, key);
1128
+ const res = name === "ask" ? await (await import("../../ask-OZO3KHFV.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-Y4Y46Y57.js")).handleSearch(env, ctx, inner, tier, key);
1129
1129
  payload = await res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
1130
1130
  }
1131
1131
  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.168",
30
+ "version": "0.2.169",
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",
@@ -1702,7 +1702,19 @@ let convEntities: Array<{ entity: string; kind: string }> = [];
1702
1702
  const c2 = canonical0.includes(refusalAnswer())
1703
1703
  ? { text: canonical0, blocks: [], dropped: [] as string[] }
1704
1704
  : await contractV2(env.DB, canonical0, usedHits);
1705
- send({ type: "done", model, query_hash: queryHash, follow_ups: refusalShaped(canonical0, refusalScope(answerCites(full))) ? [] : (understanding?.follow_ups ?? []), blocks: [...c2.blocks, ...(verdictBlock ? [verdictBlock] : []), ...(conditionBlock ? [conditionBlock] : []), ...(aggregationBlock ? [aggregationBlock] : [])], context_applied: ctxApplied, read: readAs(),
1705
+ // the completions ride the streamed lane too (parity: the UI's
1706
+ // bubble IS this lane — the table/figure blocks never reached it
1707
+ // before): additive D1 reads after the tokens are out, refusal
1708
+ // answers carry nothing to complete
1709
+ let streamedCompletionBlocks: Awaited<ReturnType<typeof completeTables>> = [];
1710
+ if (!canonical0.includes(refusalAnswer())) {
1711
+ try {
1712
+ streamedCompletionBlocks = await completeTables(env.DB, canonical0, usedHits);
1713
+ streamedCompletionBlocks.push(...(await completeFigures(env.DB, canonical0, [...c2.blocks, ...streamedCompletionBlocks], usedHits, q.query)));
1714
+ if (streamedCompletionBlocks.length) console.log("streamed completion:", streamedCompletionBlocks.length, "block(s) attached");
1715
+ } catch { /* additive — the answer stands without the blocks */ }
1716
+ }
1717
+ send({ type: "done", model, query_hash: queryHash, follow_ups: refusalShaped(canonical0, refusalScope(answerCites(full))) ? [] : (understanding?.follow_ups ?? []), blocks: [...c2.blocks, ...(verdictBlock ? [verdictBlock] : []), ...(conditionBlock ? [conditionBlock] : []), ...(aggregationBlock ? [aggregationBlock] : []), ...streamedCompletionBlocks], context_applied: ctxApplied, read: readAs(),
1706
1718
  // the evidence view's ground truth: the exact passages this
1707
1719
  // answer was built from, compact — cache hits carry none,
1708
1720
  // because the cache stores the answer and never the passages