@konneal/engine 0.2.95 → 0.2.96

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.
@@ -991,12 +991,14 @@ async function callToolOnce(env, ctx, _req, tier, key, name, args, t0) {
991
991
  body: JSON.stringify({ ...args, stream: false })
992
992
  });
993
993
  const { runTool, TOOLS_REGISTRY: TOOLS_REGISTRY2 } = await import("../../tools-Z4HQH3QU.js");
994
+ let payload;
994
995
  if (TOOLS_REGISTRY2.some((t) => t.name === name && t.audiences.includes("mcp"))) {
995
996
  const r = await runTool({ ...env, DB: env.DB }, { name, args }, "mcp");
996
- return r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
997
+ payload = r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
998
+ } else {
999
+ const res = name === "ask" ? await (await import("../../ask-KKOQH7HK.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-CGQFGYTR.js")).handleSearch(env, ctx, inner, tier, key);
1000
+ payload = await res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
997
1001
  }
998
- const res = name === "ask" ? await (await import("../../ask-KKOQH7HK.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-CGQFGYTR.js")).handleSearch(env, ctx, inner, tier, key);
999
- const payload = await res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
1000
1002
  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 });
1001
1003
  return payload;
1002
1004
  }
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.95",
30
+ "version": "0.2.96",
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",
@@ -68,14 +68,16 @@ async function callToolOnce(
68
68
  // registry tools (certificates.search, units.get, …) dispatch through
69
69
  // the SAME handlers the API would — the no-drift rule, now structural
70
70
  const { runTool, TOOLS_REGISTRY } = await import("./tools.ts");
71
+ let payload: any;
71
72
  if (TOOLS_REGISTRY.some((t) => t.name === name && t.audiences.includes("mcp"))) {
72
73
  const r = await runTool({ ...env, DB: (env as any).DB }, { name, args }, "mcp");
73
- return r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
74
+ payload = r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
75
+ } else {
76
+ const res = name === "ask"
77
+ ? await (await import("./ask")).handleAsk(env, ctx as any, inner, tier, key)
78
+ : await (await import("./search")).handleSearch(env, ctx as any, inner, tier, key);
79
+ payload = await res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
74
80
  }
75
- const res = name === "ask"
76
- ? await (await import("./ask")).handleAsk(env, ctx as any, inner, tier, key)
77
- : await (await import("./search")).handleSearch(env, ctx as any, inner, tier, key);
78
- const payload: any = await res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
79
81
  telemetry(env, ctx, tier, `mcp:${name}`, null, !payload?.error, JSON.stringify(payload).length, await sha256Hex(`${name}:${JSON.stringify(args ?? {})}`), undefined, undefined, { durationMs: Date.now() - t0 });
80
82
  return payload;
81
83
  }