@polycode-projects/the-mechanical-code-talker 2.11.1 → 2.11.2
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polycode-projects/the-mechanical-code-talker",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "The Mechanical Code Talker (tmct) — a tolerant, offline, $0 chat surface that guides you toward precision queries about a software repository. ELIZA/PARRY-style but domain-obsessed with code. No model calls; no codebase index of its own.",
|
package/src/services/chat.mjs
CHANGED
|
@@ -6826,7 +6826,7 @@ const FACT_ANSWER_CAP = 32;
|
|
|
6826
6826
|
* RELATION_WHO_ASK_RE's required leading "is/are/was/were" (those two live in
|
|
6827
6827
|
* the separate factReadBack, only ever reached via `factAnswer(...) ??
|
|
6828
6828
|
* factReadBack(...)` — never both). */
|
|
6829
|
-
const CAN_ASK_RE = /^(?:can|could)\s+(?:an?\s+)?([\w'-]+(?:\s+[\w'-]+)*?)\s+([a-z]+)[?.!\s]*$/i;
|
|
6829
|
+
const CAN_ASK_RE = /^(?:can|could)\s+(all\s+|every\s+)?(?:an?\s+)?([\w'-]+(?:\s+[\w'-]+)*?)\s+([a-z]+)[?.!\s]*$/i;
|
|
6830
6830
|
const DOES_HAVE_ASK_RE = /^(?:does|do)\s+(?:an?\s+|the\s+)?(.+?)\s+have\s+(?:an?\s+|the\s+)?(.+?)[?.!\s]*$/i;
|
|
6831
6831
|
const WHAT_CAN_DO_RE = /^what\s+can\s+(?:an?\s+)?(.+?)\s+do[?.!\s]*$/i;
|
|
6832
6832
|
const WHAT_HAS_RE = /^what\s+has\s+(?:an?\s+)?(.+?)[?.!\s]*$/i;
|
|
@@ -7584,14 +7584,24 @@ async function factAnswerReaders(memoryDir, query, envelope, miss, biasByBundle
|
|
|
7584
7584
|
const can = positiveQuestionSurface(q).match(CAN_ASK_RE);
|
|
7585
7585
|
if (can) {
|
|
7586
7586
|
const facts = await factRows(memoryDir, cache);
|
|
7587
|
-
const
|
|
7587
|
+
const canUniversal = can[1];
|
|
7588
|
+
const reply = capabilityReply(can[2], can[3], facts);
|
|
7589
|
+
// Quantified ("can all/every X ..."): the stored facts are generic, and a
|
|
7590
|
+
// bare "yes" would claim universality the memory can't support — the same
|
|
7591
|
+
// hedge the do-support surface applies, echoing the quantifier as typed.
|
|
7592
|
+
if (reply && canUniversal) {
|
|
7593
|
+
return {
|
|
7594
|
+
text: `I can't speak for ${canUniversal.trim()} ${can[2]} — what I remember is generic, not universal. ${reply.text}.`,
|
|
7595
|
+
replace: true,
|
|
7596
|
+
};
|
|
7597
|
+
}
|
|
7588
7598
|
if (reply) return reply;
|
|
7589
7599
|
// A KNOWN subject with capability facts, none matching: an honest,
|
|
7590
7600
|
// specific miss citing what it CAN do — the same closer the is-a ladder
|
|
7591
7601
|
// answers with, instead of the misleading structural parse wall. An
|
|
7592
7602
|
// unknown subject still declines. Never a guessed "no": absence of a
|
|
7593
7603
|
// capableOf fact proves nothing.
|
|
7594
|
-
const subj = factTermVariants(normFactTerm, can[
|
|
7604
|
+
const subj = factTermVariants(normFactTerm, can[2]);
|
|
7595
7605
|
const knownCan = facts.filter((f) => f.predicate === "mgx:capableOf" && subj.has(f.subject));
|
|
7596
7606
|
if (knownCan.length) {
|
|
7597
7607
|
const shown = knownCan.slice(0, 3).map(renderFactLine).join("; ");
|
|
@@ -7599,14 +7609,14 @@ async function factAnswerReaders(memoryDir, query, envelope, miss, biasByBundle
|
|
|
7599
7609
|
// not as the user typed it — 'teach me: "a birds can swim"' is a
|
|
7600
7610
|
// garbled hint that can't round-trip.
|
|
7601
7611
|
return {
|
|
7602
|
-
text: `I can't confirm that — nothing I remember says ${can[
|
|
7612
|
+
text: `I can't confirm that — nothing I remember says ${can[2]} can ${can[3]}. I do know: ${shown}. If it's true, teach me: "a ${knownCan[0].subject} can ${can[3]}".`,
|
|
7603
7613
|
replace: true,
|
|
7604
7614
|
miss: true,
|
|
7605
7615
|
};
|
|
7606
7616
|
}
|
|
7607
7617
|
// nothing about the subject at all — report the class base rate, and answer
|
|
7608
7618
|
// neither yes nor no
|
|
7609
|
-
return capabilityBaseRateReply(can[
|
|
7619
|
+
return capabilityBaseRateReply(can[2], can[3], facts);
|
|
7610
7620
|
}
|
|
7611
7621
|
|
|
7612
7622
|
// (b2b) "does a dog have a tail" — yes iff a remembered possession fact
|
|
@@ -7685,8 +7695,10 @@ async function factAnswerReaders(memoryDir, query, envelope, miss, biasByBundle
|
|
|
7685
7695
|
// penguin fly" can never disagree in one session
|
|
7686
7696
|
const reply = capabilityReply(doAsk[2], doAsk[3], facts);
|
|
7687
7697
|
if (reply && universal) {
|
|
7698
|
+
// Echo the quantifier as typed ("every dog", "all dogs") — "all dog"
|
|
7699
|
+
// for a singular every-question is a garbled echo.
|
|
7688
7700
|
return {
|
|
7689
|
-
text: `I can't speak for
|
|
7701
|
+
text: `I can't speak for ${doAsk[1].trim()} ${doAsk[2]} — what I remember is generic, not universal. ${reply.text}.`,
|
|
7690
7702
|
replace: true,
|
|
7691
7703
|
};
|
|
7692
7704
|
}
|