@konneal/engine 0.2.110 → 0.2.112

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-TNDH2QRT.js";
3
+ } from "./chunk-25VMZ7WE.js";
4
4
  import "./chunk-32UDKBA2.js";
5
5
  import "./chunk-2R7OVYAO.js";
6
6
  import "./chunk-TH5XGPD5.js";
@@ -1390,8 +1390,8 @@ function routeFor(u, query) {
1390
1390
  if ((u?.sub_queries ?? []).length > 0) features.push("sub-queries");
1391
1391
  if (u?.process_intent) features.push("process-intent");
1392
1392
  if (words > ROUTE_FAST_WORD_CAP) features.push("long-question");
1393
- if (features.length) return { route: "deep", features };
1394
1393
  if (u?.doc_number) features.push("doc-scoped");
1394
+ if (features.length) return { route: "deep", features };
1395
1395
  if (u?.term) features.push("definitional");
1396
1396
  if ((u?.defined_terms ?? []).length > 0) features.push("terminology");
1397
1397
  features.push("short-question");
@@ -2145,13 +2145,13 @@ ${summary}` }] : [],
2145
2145
  ...readAs() ? [{ type: "read", read: readAs() }] : [],
2146
2146
  { type: "citations", citations: citations2, context_applied: draftCtxApplied, ...draftPayload ? { draft: draftPayload } : {}, quota },
2147
2147
  { type: "token", v: verdict.answer },
2148
- { type: "done", model, query_hash: queryHash2, context_applied: draftCtxApplied, read: readAs() }
2148
+ { type: "done", model, query_hash: queryHash2, context_applied: draftCtxApplied, read: readAs(), ...ablate ? { ablate } : {} }
2149
2149
  ],
2150
2150
  corsHeaders(req)
2151
2151
  );
2152
2152
  }
2153
2153
  const tq2 = await chargeAnswerTokens(env, bucketId, void 0, q.query.length, verdict.answer.length);
2154
- return json({ answer: verdict.answer, citations: citations2, model, query_hash: queryHash2, follow_ups: [], context_applied: draftCtxApplied, read: readAs(), ...draftPayload ? { draft: draftPayload } : {}, quota: { ...quota, ...tq2 } });
2154
+ return json({ answer: verdict.answer, citations: citations2, model, query_hash: queryHash2, follow_ups: [], context_applied: draftCtxApplied, read: readAs(), ...draftPayload ? { draft: draftPayload } : {}, ...ablate ? { ablate } : {}, quota: { ...quota, ...tq2 } });
2155
2155
  }
2156
2156
  if (apiCallIntent) {
2157
2157
  const callCtxApplied = declaredCtx ? appliedContext(declaredCtx, null) : NO_CONTEXT;
@@ -2173,13 +2173,13 @@ ${summary}` }] : [],
2173
2173
  ...readAs() ? [{ type: "read", read: readAs() }] : [],
2174
2174
  { type: "citations", citations: [], context_applied: callCtxApplied, ...draftPayload ? { draft: draftPayload } : {}, quota },
2175
2175
  { type: "token", v: verdict.answer },
2176
- { type: "done", model, query_hash: queryHash2, context_applied: callCtxApplied, read: readAs() }
2176
+ { type: "done", model, query_hash: queryHash2, context_applied: callCtxApplied, read: readAs(), ...ablate ? { ablate } : {} }
2177
2177
  ],
2178
2178
  corsHeaders(req)
2179
2179
  );
2180
2180
  }
2181
2181
  const tq2 = await chargeAnswerTokens(env, bucketId, void 0, q.query.length, verdict.answer.length);
2182
- return json({ answer: verdict.answer, citations: [], model, query_hash: queryHash2, follow_ups: [], context_applied: callCtxApplied, read: readAs(), ...draftPayload ? { draft: draftPayload } : {}, quota: { ...quota, ...tq2 } });
2182
+ return json({ answer: verdict.answer, citations: [], model, query_hash: queryHash2, follow_ups: [], context_applied: callCtxApplied, read: readAs(), ...draftPayload ? { draft: draftPayload } : {}, ...ablate ? { ablate } : {}, quota: { ...quota, ...tq2 } });
2183
2183
  }
2184
2184
  let liveRecords;
2185
2185
  let accountNote;
@@ -4,7 +4,7 @@ import {
4
4
  handleMemories,
5
5
  scoreFaithfulness,
6
6
  scoreJudge
7
- } from "../../chunk-TNDH2QRT.js";
7
+ } from "../../chunk-25VMZ7WE.js";
8
8
  import {
9
9
  TOOLS_REGISTRY,
10
10
  bindModelNode,
@@ -1000,7 +1000,7 @@ async function callToolOnce(env, ctx, _req, tier, key, name, args, t0) {
1000
1000
  const r = await runTool({ ...env, DB: env.DB }, { name, args }, "mcp");
1001
1001
  payload = r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
1002
1002
  } else {
1003
- const res = name === "ask" ? await (await import("../../ask-DBIGV3SY.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-HKGN7F3O.js")).handleSearch(env, ctx, inner, tier, key);
1003
+ const res = name === "ask" ? await (await import("../../ask-FFDCQXAA.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-HKGN7F3O.js")).handleSearch(env, ctx, inner, tier, key);
1004
1004
  payload = await res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
1005
1005
  }
1006
1006
  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.110",
30
+ "version": "0.2.112",
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",
@@ -861,13 +861,13 @@ let convEntities: Array<{ entity: string; kind: string }> = [];
861
861
  ...(readAs() ? [{ type: "read", read: readAs() }] : []),
862
862
  { type: "citations", citations, context_applied: draftCtxApplied, ...(draftPayload ? { draft: draftPayload } : {}), quota, },
863
863
  { type: "token", v: verdict.answer },
864
- { type: "done", model, query_hash: queryHash, context_applied: draftCtxApplied, read: readAs() },
864
+ { type: "done", model, query_hash: queryHash, context_applied: draftCtxApplied, read: readAs(), ...(ablate ? { ablate } : {}) },
865
865
  ],
866
866
  corsHeaders(req),
867
867
  );
868
868
  }
869
869
  const tq = await chargeAnswerTokens(env, bucketId, undefined, q.query.length, verdict.answer.length);
870
- return json({ answer: verdict.answer, citations, model, query_hash: queryHash, follow_ups: [], context_applied: draftCtxApplied, read: readAs(), ...(draftPayload ? { draft: draftPayload } : {}), quota: { ...quota, ...tq } });
870
+ return json({ answer: verdict.answer, citations, model, query_hash: queryHash, follow_ups: [], context_applied: draftCtxApplied, read: readAs(), ...(draftPayload ? { draft: draftPayload } : {}), ...(ablate ? { ablate } : {}), quota: { ...quota, ...tq } });
871
871
  }
872
872
 
873
873
  // ── The api_call draft (TODO.ai-platform/09) — the operations
@@ -899,13 +899,13 @@ let convEntities: Array<{ entity: string; kind: string }> = [];
899
899
  ...(readAs() ? [{ type: "read", read: readAs() }] : []),
900
900
  { type: "citations", citations: [], context_applied: callCtxApplied, ...(draftPayload ? { draft: draftPayload } : {}), quota, },
901
901
  { type: "token", v: verdict.answer },
902
- { type: "done", model, query_hash: queryHash, context_applied: callCtxApplied, read: readAs() },
902
+ { type: "done", model, query_hash: queryHash, context_applied: callCtxApplied, read: readAs(), ...(ablate ? { ablate } : {}) },
903
903
  ],
904
904
  corsHeaders(req),
905
905
  );
906
906
  }
907
907
  const tq = await chargeAnswerTokens(env, bucketId, undefined, q.query.length, verdict.answer.length);
908
- return json({ answer: verdict.answer, citations: [], model, query_hash: queryHash, follow_ups: [], context_applied: callCtxApplied, read: readAs(), ...(draftPayload ? { draft: draftPayload } : {}), quota: { ...quota, ...tq } });
908
+ return json({ answer: verdict.answer, citations: [], model, query_hash: queryHash, follow_ups: [], context_applied: callCtxApplied, read: readAs(), ...(draftPayload ? { draft: draftPayload } : {}), ...(ablate ? { ablate } : {}), quota: { ...quota, ...tq } });
909
909
  }
910
910
 
911
911
  // (declared before the retrieval try: the account block, the refusal
@@ -56,14 +56,24 @@ export function routeFor(u: RouteFeatures | null, query: string): {
56
56
  if ((u?.sub_queries ?? []).length > 0) features.push("sub-queries");
57
57
  if (u?.process_intent) features.push("process-intent");
58
58
  if (words > ROUTE_FAST_WORD_CAP) features.push("long-question");
59
+ // a document scope (named in the question OR declared by a context
60
+ // chip — the chip writes the same understanding fields) NARROWS the
61
+ // candidate pool structurally: the dense filter does the scoping, and
62
+ // the sealed/narrowed pool needs every lane feeding it (the
63
+ // multi-query variants are its redundancy). The 2026-10-08 gate
64
+ // caught this class: ctx-entity-r60, chip-declared and routed fast,
65
+ // refused intermittently — a starved sealed pool (the 2026-09-08
66
+ // diagnosis's shape). Scoped questions ride deep until the grid
67
+ // prices the lanes against a sealed pool.
68
+ if (u?.doc_number) features.push("doc-scoped");
59
69
  if (features.length) return { route: "deep", features };
60
70
 
61
- // FAST — everything else: a question within the word cap rides the
62
- // fast registry. The conservative direction is structural here: the
63
- // long, the complex, the multi-perspective and the process-shaped all
64
- // routed deep above; under-routing costs accuracy, over-routing costs
65
- // only latency, and the grid prices both.
66
- if (u?.doc_number) features.push("doc-scoped");
71
+ // FAST — everything else: an UNscoped question within the word cap
72
+ // rides the fast registry. The conservative direction is structural
73
+ // here: the long, the complex, the multi-perspective, the
74
+ // process-shaped and the scoped all routed deep above; under-routing
75
+ // costs accuracy, over-routing costs only latency, and the grid
76
+ // prices both.
67
77
  if (u?.term) features.push("definitional");
68
78
  if ((u?.defined_terms ?? []).length > 0) features.push("terminology");
69
79
  features.push("short-question");