@polycode-projects/the-mechanical-code-talker 2.7.7 → 2.7.9

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.7.7",
3
+ "version": "2.7.9",
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.",
@@ -492,9 +492,15 @@ const VERB_SYNONYMS = new Map([
492
492
  ["pick up", "take"], ["pick", "take"], ["grab", "take"],
493
493
  ["put down", "drop"], ["set down", "drop"], ["leave", "drop"],
494
494
  ["talk to", "talk"], ["speak to", "talk"], ["speak with", "talk"], ["talk", "talk"], ["speak", "talk"],
495
+ ["chat with", "talk"], ["converse with", "talk"],
495
496
  ["look at", "examine"], ["examine", "examine"], ["inspect", "examine"],
497
+ ["have a look at", "examine"], ["take a look at", "examine"], ["check out", "examine"],
496
498
  ["shut", "close"],
497
499
  ]);
500
+ // The longest entry's token count — resolveImperativeVerb tries prefixes
501
+ // longest-first down to 2, so a multi-word idiom ("have a look at") is
502
+ // consumed whole before any shorter prefix inside it gets a chance to match.
503
+ const VERB_SYNONYM_MAX_PREFIX = Math.max(...[...VERB_SYNONYMS.keys()].map((k) => k.split(" ").length));
498
504
 
499
505
  const VERB_FUZZY_CANDIDATES = [...new Set([...IMPERATIVE_VERBS, ...VERB_SYNONYMS.values()])];
500
506
  const IMPERATIVE_FUZZY_BOUND = 1; // this project's existing distance-1 tolerance elsewhere (interpret/fuzzy.mjs)
@@ -518,10 +524,10 @@ const NEVER_FUZZY_VERB = new Set(["walk", "wake", "make"]);
518
524
  * fuzzy tier. Null when nothing at all recognises the leading token(s). */
519
525
  function resolveImperativeVerb(toks) {
520
526
  const first = toks[0].toLowerCase();
521
- if (toks.length > 1) {
522
- const twoWord = `${first} ${toks[1].toLowerCase()}`;
523
- const twoHit = VERB_SYNONYMS.get(twoWord);
524
- if (twoHit) return { verb: twoHit, consumed: 2, corrected: null };
527
+ const lower = toks.map((t) => t.toLowerCase());
528
+ for (let n = Math.min(VERB_SYNONYM_MAX_PREFIX, toks.length); n >= 2; n -= 1) {
529
+ const hit = VERB_SYNONYMS.get(lower.slice(0, n).join(" "));
530
+ if (hit) return { verb: hit, consumed: n, corrected: null };
525
531
  }
526
532
  if (IMPERATIVE_VERBS.has(first)) return { verb: first, consumed: 1, corrected: null };
527
533
  const oneHit = VERB_SYNONYMS.get(first);
@@ -490,7 +490,12 @@ async function runWorldCommand(cmd, { world, memoryDir, env, graph, cache }) {
490
490
  const digest = await worldDigest(object, { memoryDir, memory, rows, state, graph });
491
491
  const body = digest ?? `nothing more about the ${object} is written down yet.`;
492
492
  const containerNote = !person && isContainer(rows, object) ? ` ${containerStatusPhrase(object, { state })}` : "";
493
- const text = person ? `the ${object} doesn't have much to say, but you know: ${body}` : `${body}${containerNote}`;
493
+ // Framing follows the VERB the player typed, not the object's type: talking
494
+ // to a lamp still reads as an attempted conversation (nothing replies, but
495
+ // you learn what's known), and examining a person still reads as a plain
496
+ // inspection, never the "doesn't have much to say" framing that belongs to
497
+ // a failed talk attempt.
498
+ const text = cmd.verb === "talk" ? `the ${object} doesn't have much to say, but you know: ${body}` : `${body}${containerNote}`;
494
499
  return answer(
495
500
  text,
496
501
  noteFor(`${cmd.verb} — an extractive completions digest over the current world facts mentioning "${object}"`),
@@ -21709,7 +21709,7 @@ ${codeblock}`, options);
21709
21709
  });
21710
21710
 
21711
21711
  // src/domain/grammar/ace.mjs
21712
- var PATTERN_SUB_CLASS_OF, PATTERN_TYPE_ASSERTION, PATTERN_RELATION, PATTERN_SOME_VALUES_FROM, PATTERN_CARDINALITY, PATTERN_DISJOINT_WITH, PATTERN_POSSESSIVE, PATTERN_ADJECTIVE, PATTERN_CAPABILITY, PATTERNS, IMPERATIVE_VERBS, VERB_SYNONYMS, VERB_FUZZY_CANDIDATES;
21712
+ var PATTERN_SUB_CLASS_OF, PATTERN_TYPE_ASSERTION, PATTERN_RELATION, PATTERN_SOME_VALUES_FROM, PATTERN_CARDINALITY, PATTERN_DISJOINT_WITH, PATTERN_POSSESSIVE, PATTERN_ADJECTIVE, PATTERN_CAPABILITY, PATTERNS, IMPERATIVE_VERBS, VERB_SYNONYMS, VERB_SYNONYM_MAX_PREFIX, VERB_FUZZY_CANDIDATES;
21713
21713
  var init_ace2 = __esm({
21714
21714
  "src/domain/grammar/ace.mjs"() {
21715
21715
  init_lexicon();
@@ -21747,11 +21747,17 @@ ${codeblock}`, options);
21747
21747
  ["speak with", "talk"],
21748
21748
  ["talk", "talk"],
21749
21749
  ["speak", "talk"],
21750
+ ["chat with", "talk"],
21751
+ ["converse with", "talk"],
21750
21752
  ["look at", "examine"],
21751
21753
  ["examine", "examine"],
21752
21754
  ["inspect", "examine"],
21755
+ ["have a look at", "examine"],
21756
+ ["take a look at", "examine"],
21757
+ ["check out", "examine"],
21753
21758
  ["shut", "close"]
21754
21759
  ]);
21760
+ VERB_SYNONYM_MAX_PREFIX = Math.max(...[...VERB_SYNONYMS.keys()].map((k) => k.split(" ").length));
21755
21761
  VERB_FUZZY_CANDIDATES = [.../* @__PURE__ */ new Set([...IMPERATIVE_VERBS, ...VERB_SYNONYMS.values()])];
21756
21762
  }
21757
21763
  });