@konneal/engine 0.2.139 → 0.2.141
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.
|
@@ -2633,7 +2633,7 @@ Answer account questions from these records ONLY: name the record when you use i
|
|
|
2633
2633
|
}
|
|
2634
2634
|
}
|
|
2635
2635
|
}
|
|
2636
|
-
const canonical0 =
|
|
2636
|
+
const canonical0 = exciseMisplacedPin(canonicalRefusal(full.replace(/^TOOL [a-z_.]+.*$\n?/gm, "").replace(/^\n+/, ""), refusalScope(answerCites(full))), answerCites(full));
|
|
2637
2637
|
const c2 = canonical0.includes(refusalAnswer()) ? { text: canonical0, blocks: [], dropped: [] } : await contractV2(env.DB, canonical0, usedHits);
|
|
2638
2638
|
send({
|
|
2639
2639
|
type: "done",
|
|
@@ -2717,8 +2717,11 @@ Answer account questions from these records ONLY: name the record when you use i
|
|
|
2717
2717
|
);
|
|
2718
2718
|
answer = await generateOnce(env, MODELS.fallback, flat, routeEffort(routed.route));
|
|
2719
2719
|
}
|
|
2720
|
+
const scrubToolLines = (t) => t.replace(/^TOOL [a-z_.]+.*$\n?/gm, "").replace(/^\n+/, "");
|
|
2721
|
+
if (answer) answer = scrubToolLines(answer);
|
|
2720
2722
|
if (answer) answer = canonicalRefusal(answer, refusalScope(answerCites(answer)));
|
|
2721
|
-
if (answer
|
|
2723
|
+
if (answer) answer = scrubToolLines(answer);
|
|
2724
|
+
if (answer) answer = exciseMisplacedPin(answer, answerCites(answer));
|
|
2722
2725
|
stageTiming.generate = Date.now() - tGen;
|
|
2723
2726
|
let used = usedHits;
|
|
2724
2727
|
if (answer && !answer.includes(refusalAnswer())) {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
handleMemories,
|
|
5
5
|
scoreFaithfulness,
|
|
6
6
|
scoreJudge
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-VTQ7FWRI.js";
|
|
8
8
|
import "../../chunk-GBGRHXRU.js";
|
|
9
9
|
import {
|
|
10
10
|
TOOLS_REGISTRY,
|
|
@@ -1079,7 +1079,7 @@ async function callToolOnce(env, ctx, _req, tier, key, name, args, t0) {
|
|
|
1079
1079
|
const r = await runTool({ ...env, DB: env.DB }, { name, args }, "mcp");
|
|
1080
1080
|
payload = r ? { tool: r.name, query: r.query, result: r.output } : { error: { message: `tool ${name} returned nothing for the given arguments` } };
|
|
1081
1081
|
} else {
|
|
1082
|
-
const res = name === "ask" ? await (await import("../../ask-
|
|
1082
|
+
const res = name === "ask" ? await (await import("../../ask-WZCRMTTX.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-VEGQBEFC.js")).handleSearch(env, ctx, inner, tier, key);
|
|
1083
1083
|
payload = await res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
|
|
1084
1084
|
}
|
|
1085
1085
|
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.
|
|
30
|
+
"version": "0.2.141",
|
|
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",
|
|
@@ -1570,7 +1570,7 @@ let convEntities: Array<{ entity: string; kind: string }> = [];
|
|
|
1570
1570
|
}
|
|
1571
1571
|
// the misplaced-pin wall rides the streamed path too: a
|
|
1572
1572
|
// CITED stream is not a refusal
|
|
1573
|
-
const canonical0 =
|
|
1573
|
+
const canonical0 = exciseMisplacedPin(canonicalRefusal(full.replace(/^TOOL [a-z_.]+.*$\n?/gm, "").replace(/^\n+/, ""), refusalScope(answerCites(full))), answerCites(full));
|
|
1574
1574
|
// answer contract v2: validate [[u:]] refs, resolve typed blocks
|
|
1575
1575
|
const c2 = canonical0.includes(refusalAnswer())
|
|
1576
1576
|
? { text: canonical0, blocks: [], dropped: [] as string[] }
|
|
@@ -1674,12 +1674,19 @@ let convEntities: Array<{ entity: string; kind: string }> = [];
|
|
|
1674
1674
|
);
|
|
1675
1675
|
answer = await generateOnce(env, MODELS.fallback, flat, routeEffort(routed.route));
|
|
1676
1676
|
}
|
|
1677
|
+
// the protocol scrub: a TOOL line is the agent loop's wire protocol,
|
|
1678
|
+
// never user-facing prose — the answer model occasionally echoes the
|
|
1679
|
+
// line it just composed (observed live: 'TOOL db.find …' opened a
|
|
1680
|
+
// served answer). Stripped here and on the streamed path.
|
|
1681
|
+
const scrubToolLines = (t: string) => t.replace(/^TOOL [a-z_.]+.*$\n?/gm, "").replace(/^\n+/, "");
|
|
1682
|
+
if (answer) answer = scrubToolLines(answer);
|
|
1677
1683
|
if (answer) answer = canonicalRefusal(answer, refusalScope(answerCites(answer)));
|
|
1684
|
+
if (answer) answer = scrubToolLines(answer);
|
|
1678
1685
|
// the misplaced-pin wall: a CITED answer is not a refusal — excise
|
|
1679
1686
|
// the pinned sentence if the model dropped it in as a disclaimer
|
|
1680
1687
|
// (measured on chip-scoped asks: correct cited answers carrying the
|
|
1681
1688
|
// pin mid-text, read by users and graders as total refusals)
|
|
1682
|
-
if (answer
|
|
1689
|
+
if (answer) answer = exciseMisplacedPin(answer, answerCites(answer));
|
|
1683
1690
|
stageTiming.generate = Date.now() - tGen;
|
|
1684
1691
|
|
|
1685
1692
|
// ── Deterministic quote-anchor + table-retyping check ──
|