@konneal/engine 0.2.46 → 0.2.47

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.
@@ -1643,7 +1643,8 @@ async function feedbackRoute(c) {
1643
1643
  if (!/^[a-f0-9]{64}$/.test(queryHash) || ![1, -1].includes(rating)) {
1644
1644
  return withCors(err(400, "invalid_input", "query_hash and rating (1 or -1) are required"), corsHeaders(c.req));
1645
1645
  }
1646
- await c.env.DB.prepare("INSERT INTO feedback (query_hash, rating, ts) VALUES (?1,?2,?3)").bind(queryHash, rating, (/* @__PURE__ */ new Date()).toISOString()).run();
1646
+ const note = typeof body?.note === "string" ? body.note.trim().slice(0, 280) : "";
1647
+ await c.env.DB.prepare("INSERT INTO feedback (query_hash, rating, ts, note) VALUES (?1,?2,?3,?4)").bind(queryHash, rating, (/* @__PURE__ */ new Date()).toISOString(), note || null).run();
1647
1648
  return json({ ok: true, ...corsHeaders(c.req) });
1648
1649
  }
1649
1650
  async function unitAssetRoute(c) {
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.46",
30
+ "version": "0.2.47",
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",
@@ -0,0 +1,3 @@
1
+ -- the feedback vote's optional reason (the 👎 reason chips) — read by the
2
+ -- triage clustering, never by the answer path
3
+ ALTER TABLE feedback ADD COLUMN note TEXT;
@@ -459,8 +459,11 @@ async function feedbackRoute(c: RouteContext): Promise<Response> {
459
459
  if (!/^[a-f0-9]{64}$/.test(queryHash) || ![1, -1].includes(rating)) {
460
460
  return withCors(err(400, "invalid_input", "query_hash and rating (1 or -1) are required"), corsHeaders(c.req));
461
461
  }
462
- await c.env.DB.prepare("INSERT INTO feedback (query_hash, rating, ts) VALUES (?1,?2,?3)")
463
- .bind(queryHash, rating, new Date().toISOString())
462
+ // an optional free-text note (the reason chips) - capped, stored with
463
+ // the vote, and read by the triage script's clustering
464
+ const note = typeof body?.note === "string" ? body.note.trim().slice(0, 280) : "";
465
+ await c.env.DB.prepare("INSERT INTO feedback (query_hash, rating, ts, note) VALUES (?1,?2,?3,?4)")
466
+ .bind(queryHash, rating, new Date().toISOString(), note || null)
464
467
  .run();
465
468
  return json({ ok: true, ...corsHeaders(c.req) });
466
469
  }