@konneal/engine 0.2.0 → 0.2.1

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-LNUSF3UK.js";
3
+ } from "./chunk-3OXSQH7Y.js";
4
4
  import "./chunk-LNSDBEKS.js";
5
- import "./chunk-6HCFW5PM.js";
5
+ import "./chunk-6GOSMLRH.js";
6
6
  import "./chunk-SN3ANQ3Y.js";
7
7
  import "./chunk-WGXATDXY.js";
8
8
  import "./chunk-Q6LI4T7M.js";
@@ -31,7 +31,7 @@ import {
31
31
  syntheticUnderstanding,
32
32
  telemetry,
33
33
  understandQuery
34
- } from "./chunk-6HCFW5PM.js";
34
+ } from "./chunk-6GOSMLRH.js";
35
35
  import {
36
36
  corsHeaders,
37
37
  err,
@@ -271,8 +271,9 @@ async function generateOnce(env, model, messages, effort) {
271
271
  temperature: 0.6,
272
272
  top_p: 0.95
273
273
  });
274
- if (typeof res?.response === "string") return res.response;
275
- if (typeof res?.choices?.[0]?.message?.content === "string") return res.choices[0].message.content;
274
+ if (typeof res?.response === "string" && res.response.trim()) return res.response;
275
+ if (typeof res?.choices?.[0]?.message?.content === "string" && res.choices[0].message.content.trim()) return res.choices[0].message.content;
276
+ if (attempt === 0) console.error("generate returned empty:", model);
276
277
  } catch (e) {
277
278
  console.error("generate failed:", model, String(e).slice(0, 120));
278
279
  }
@@ -7,7 +7,7 @@ import {
7
7
  sessionFrom,
8
8
  telemetry,
9
9
  understandQuery
10
- } from "./chunk-6HCFW5PM.js";
10
+ } from "./chunk-6GOSMLRH.js";
11
11
  import {
12
12
  corsHeaders,
13
13
  err,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  handleSearch
3
- } from "./chunk-RFG3QKVY.js";
4
- import "./chunk-6HCFW5PM.js";
3
+ } from "./chunk-VJZLVU3S.js";
4
+ import "./chunk-6GOSMLRH.js";
5
5
  import "./chunk-SN3ANQ3Y.js";
6
6
  import "./chunk-WGXATDXY.js";
7
7
  import "./chunk-Q6LI4T7M.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  handleSearch
3
- } from "../../chunk-RFG3QKVY.js";
3
+ } from "../../chunk-VJZLVU3S.js";
4
4
  import {
5
5
  checkQuoteAnchors,
6
6
  handleAsk,
7
7
  handleMemories,
8
8
  scoreJudge,
9
9
  standardForDocNumber
10
- } from "../../chunk-LNUSF3UK.js";
10
+ } from "../../chunk-3OXSQH7Y.js";
11
11
  import "../../chunk-LNSDBEKS.js";
12
12
  import {
13
13
  buildMessages,
@@ -30,7 +30,7 @@ import {
30
30
  sessionFrom,
31
31
  telemetry,
32
32
  understandQuery
33
- } from "../../chunk-6HCFW5PM.js";
33
+ } from "../../chunk-6GOSMLRH.js";
34
34
  import {
35
35
  authenticate,
36
36
  corsHeaders,
@@ -956,7 +956,7 @@ async function handleMcp(env, ctx, req, tier, key) {
956
956
  // stream:false forces the JSON lane (anon defaults to SSE)
957
957
  body: JSON.stringify({ ...args, stream: false })
958
958
  });
959
- const res = name === "ask" ? await (await import("../../ask-NAWBPZPU.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-7XMYAV34.js")).handleSearch(env, ctx, inner, tier, key);
959
+ const res = name === "ask" ? await (await import("../../ask-47RNGK2R.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-OMPBMZT4.js")).handleSearch(env, ctx, inner, tier, key);
960
960
  return res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
961
961
  });
962
962
  if (out.ok && "accepted" in out) return new Response(null, { status: 202 });
package/package.json CHANGED
@@ -36,7 +36,7 @@
36
36
  "@konneal/engine": "github:konneal/engine#2d6c39b",
37
37
  "@oimlsmart/oiml-pubid": "^1.2.1"
38
38
  },
39
- "version": "0.2.0",
39
+ "version": "0.2.1",
40
40
  "description": "The Konneal engine: the publisher-agnostic build pipeline and API plane for standards intelligence (retrieval, answer contract, verdicts, evaluation).",
41
41
  "license": "BSD-3-Clause",
42
42
  "type": "module",
@@ -61,8 +61,16 @@ export async function generateOnce(env: any, model: string, messages: any[], eff
61
61
  temperature: 0.6,
62
62
  top_p: 0.95,
63
63
  });
64
- if (typeof res?.response === "string") return res.response;
65
- if (typeof res?.choices?.[0]?.message?.content === "string") return res.choices[0].message.content;
64
+ // an EMPTY string is a failed generation, not an answer: the
65
+ // platform intermittently returns empty bodies with a 200 (observed
66
+ // live 2026-09-20 — answers went blank platform-wide while retrieval
67
+ // and the deterministic paths kept working). Treating "" as success
68
+ // shipped blank answers; treating it as a failure falls through to
69
+ // the retry and then the fallback model, so the service rides out
70
+ // the mode instead of serving nothing.
71
+ if (typeof res?.response === "string" && res.response.trim()) return res.response;
72
+ if (typeof res?.choices?.[0]?.message?.content === "string" && res.choices[0].message.content.trim()) return res.choices[0].message.content;
73
+ if (attempt === 0) console.error("generate returned empty:", model);
66
74
  } catch (e) {
67
75
  console.error("generate failed:", model, String(e).slice(0, 120));
68
76
  }