@polycode-projects/the-mechanical-code-talker 5.0.30 → 5.0.32
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/README.md +15 -3
- package/package.json +7 -3
- package/src/adapters/toml-config.mjs +2 -1
- package/src/adapters/uuid.mjs +19 -4
- package/src/domain/choice-question.mjs +128 -0
- package/src/domain/news-feed.mjs +20 -2
- package/src/domain/reasoning-config.mjs +27 -0
- package/src/domain/tableau.mjs +226 -29
- package/src/domain/term-ledger.mjs +1 -1
- package/src/services/chat.mjs +434 -33
- package/src/services/extract-facts.mjs +19 -10
- package/src/services/mudiii-viz.mjs +103 -29
- package/src/services/news-viz.mjs +36 -11
- package/src/services/news.mjs +3 -2
- package/src/surfaces/web/memory-ask-browser.bundle.js +130 -130
- package/src/surfaces/web/mudiii-browser-entry.mjs +45 -13
- package/src/surfaces/web/news-browser-entry.mjs +25 -3
- package/test-benchmarks/agentbench/README.md +196 -0
- package/test-benchmarks/agentbench/envelope-reader.mjs +13 -0
- package/test-benchmarks/agentbench/envelope.json +120 -0
package/README.md
CHANGED
|
@@ -1452,6 +1452,17 @@ loads a repo's graph into a `{ dispatch, resolve, graph }` context,
|
|
|
1452
1452
|
`declaredCapabilityNames()` lists every capability a caller can declare. See
|
|
1453
1453
|
"Planning across the graph" above.
|
|
1454
1454
|
|
|
1455
|
+
```js
|
|
1456
|
+
import { agentbenchEnvelope } from "@polycode-projects/the-mechanical-code-talker/envelope";
|
|
1457
|
+
```
|
|
1458
|
+
|
|
1459
|
+
This reads the AGENTBENCH capability envelope
|
|
1460
|
+
(`test-benchmarks/agentbench/envelope.json`, see "Measuring it" below) at
|
|
1461
|
+
runtime instead of a hand-copied snapshot. It carries the measured tool-loop
|
|
1462
|
+
rung reached, `structuredOk`/`toolsOk`, and `maxContextTokens` (`null` until
|
|
1463
|
+
AGENTBENCH measures one). A calibration elsewhere can check itself against
|
|
1464
|
+
these figures instead of drifting from them.
|
|
1465
|
+
|
|
1455
1466
|
<!-- generated by scripts/generate-tool-docs.mjs from src/tools/definitions.mjs — do not edit by hand -->
|
|
1456
1467
|
|
|
1457
1468
|
## The tool surface
|
|
@@ -1577,9 +1588,10 @@ and transcripts are in the linked write-ups.
|
|
|
1577
1588
|
| Determinism | Byte-identical on rerun: a 379-case `--replay` clean across 2 runs, no LLM, no network, $0 per turn | A property of the no-model pipeline. | `archive/BENCHMARK_INFERENCE_2.7.12.md` |
|
|
1578
1589
|
| Dialogue robustness (persona sweep) | A 6-persona sweep (textbook logician, casual newcomer, new developer, adversarial sceptic, returning user, planning user) fixed 25 of the prior cycle's 29 routed findings (21 clean, 4 with a residual noted); 4 remain broken, 2 in a shape distinct from the original complaint | Free exploration across all six personas surfaced roughly 60 fresh findings beyond the ratchet check. The single highest-signal pattern: tmct's own suggested repair text was itself frequently broken when followed verbatim (since fixed, see `NEXT.md`). | `archive/BENCHMARK_CONVERSATION_2.7.11.md` |
|
|
1579
1590
|
|
|
1580
|
-
Seven offline benchmark rigs live in a clone (
|
|
1581
|
-
|
|
1582
|
-
|
|
1591
|
+
Seven offline benchmark rigs live in a clone (the harnesses themselves are
|
|
1592
|
+
not in the npm package; AGENTBENCH's capability envelope is, see "As a
|
|
1593
|
+
library" above). Each replays a committed case set through the real product
|
|
1594
|
+
and writes graded rows you can diff between runs:
|
|
1583
1595
|
|
|
1584
1596
|
- `npm run chatbench:run` measures chat quality against CEFR-graded English
|
|
1585
1597
|
cases with deterministic tier-1 checks (the full tuning loop is in
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polycode-projects/the-mechanical-code-talker",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.32",
|
|
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; indexes a repo on request (tmct index) or reads any producer's graph.",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"./memory": "./src/adapters/memory/core.mjs",
|
|
51
51
|
"./repository-interface": "./src/adapters/repository-interface.mjs",
|
|
52
52
|
"./conformance": "./src/tools/conformance.mjs",
|
|
53
|
-
"./ask-browser": "./src/surfaces/web/graph-ask-browser-entry.mjs"
|
|
53
|
+
"./ask-browser": "./src/surfaces/web/graph-ask-browser-entry.mjs",
|
|
54
|
+
"./envelope": "./test-benchmarks/agentbench/envelope-reader.mjs"
|
|
54
55
|
},
|
|
55
56
|
"files": [
|
|
56
57
|
"bin/",
|
|
@@ -71,7 +72,9 @@
|
|
|
71
72
|
"!corpus/wordnet/generate.mjs",
|
|
72
73
|
"!corpus/namenet/generate.mjs",
|
|
73
74
|
"data/",
|
|
74
|
-
"!data/sprites-large/"
|
|
75
|
+
"!data/sprites-large/",
|
|
76
|
+
"test-benchmarks/agentbench/envelope.json",
|
|
77
|
+
"test-benchmarks/agentbench/envelope-reader.mjs"
|
|
75
78
|
],
|
|
76
79
|
"publishConfig": {
|
|
77
80
|
"access": "public"
|
|
@@ -165,6 +168,7 @@
|
|
|
165
168
|
"claim:commonsenseqa": "node scripts/claims/claim-commonsenseqa.mjs",
|
|
166
169
|
"claim:planner": "node scripts/claims/claim-planner.mjs",
|
|
167
170
|
"claim:syllogist": "node scripts/claims/claim-syllogist.mjs",
|
|
171
|
+
"claim:news": "node scripts/news-rig.mjs",
|
|
168
172
|
"roll": "node scripts/roll.mjs",
|
|
169
173
|
"build:ask-bundle": "node scripts/build-ask-bundle.mjs",
|
|
170
174
|
"build:chat-bundle": "node scripts/build-chat-bundle.mjs",
|
|
@@ -165,7 +165,8 @@ export async function normalizeConfig(raw, { configDir } = {}) {
|
|
|
165
165
|
// PASS-THROUGH, same discipline as [games.*]/[research]/[recognition] —
|
|
166
166
|
// the raw `[reasoning]` table (syllogise_budget/syllogise_depth/
|
|
167
167
|
// classify_budget/classify_rounds/max_environments/prove_steps/
|
|
168
|
-
// prove_branches/prove_nodes
|
|
168
|
+
// prove_branches/prove_nodes/ask_prove_fallback/ask_prove_steps/
|
|
169
|
+
// ask_prove_branches/ask_prove_nodes, snake_case) rides through unmodified;
|
|
169
170
|
// mapping onto the internal camelCase shape and default-filling is
|
|
170
171
|
// resolveReasoningConfig's job.
|
|
171
172
|
if (src.reasoning !== undefined) cfg.reasoning = src.reasoning;
|
package/src/adapters/uuid.mjs
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
// uuid.mjs — RFC 9562 UUIDv7 (node:crypto ships v4 only). Lifted verbatim from
|
|
2
2
|
// chat.mjs so the chat session id, the telemetry invocation id, and the bench
|
|
3
3
|
// per-run stamp all share ONE time-sortable implementation (no second copy, no dep).
|
|
4
|
+
//
|
|
5
|
+
// Built on globalThis.crypto.getRandomValues (Web Crypto — every real browser,
|
|
6
|
+
// and Node >=19, well under this package's >=24 floor) rather than
|
|
7
|
+
// node:crypto's randomBytes: chat.mjs's runTurn stamps a session id here on
|
|
8
|
+
// every turn, and a browser bundle has no node:crypto to import — the
|
|
9
|
+
// browser build's own stub throws the moment randomBytes is actually called
|
|
10
|
+
// (scripts/lib/browser-bundle.mjs's stubNodeBuiltins), which every strict-
|
|
11
|
+
// tier ingest turn news.html's replay/poll/teach paths run through would
|
|
12
|
+
// hit. Web Crypto needs no environment branch: it is the same call in both.
|
|
4
13
|
|
|
5
|
-
|
|
14
|
+
/** 16 cryptographically random bytes as a plain Uint8Array. */
|
|
15
|
+
function randomBytes16() {
|
|
16
|
+
return globalThis.crypto.getRandomValues(new Uint8Array(16));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const toHexByte = (n) => n.toString(16).padStart(2, "0");
|
|
6
20
|
|
|
7
21
|
/** UUID v7 (RFC 9562): 48-bit big-endian unix-ms timestamp, then version/variant
|
|
8
22
|
* bits over crypto-random tail — time-sortable, unlike crypto.randomUUID()'s v4. */
|
|
9
23
|
export function uuidv7(now = Date.now()) {
|
|
10
|
-
const b =
|
|
11
|
-
|
|
24
|
+
const b = randomBytes16();
|
|
25
|
+
// 48-bit unix-ms timestamp, big-endian, written by hand (no Buffer here).
|
|
26
|
+
for (let i = 0; i < 6; i += 1) b[5 - i] = (now / 2 ** (8 * i)) & 0xff;
|
|
12
27
|
b[6] = (b[6] & 0x0f) | 0x70; // version 7
|
|
13
28
|
b[8] = (b[8] & 0x3f) | 0x80; // variant 10xx
|
|
14
|
-
const h = b.
|
|
29
|
+
const h = Array.from(b, toHexByte).join("");
|
|
15
30
|
return `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20)}`;
|
|
16
31
|
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
// that declines whenever a candidate option itself reads as a second,
|
|
19
19
|
// embedded question ("is it a bird or is it a plane").
|
|
20
20
|
import { leadsInterrogative, QUESTION_LEAD_RE } from "./interpret/normalize.mjs";
|
|
21
|
+
import { gerundOf, pastOf } from "./inflect.mjs";
|
|
21
22
|
|
|
22
23
|
/** The recognized shapes. Frozen so a caller can switch on the value
|
|
23
24
|
* without inventing its own string. */
|
|
@@ -526,3 +527,130 @@ export function isChoiceQuestion(text) {
|
|
|
526
527
|
export function choiceDeclineReason(text) {
|
|
527
528
|
return coreParse(text).reason;
|
|
528
529
|
}
|
|
530
|
+
|
|
531
|
+
// ---- relation routing ----
|
|
532
|
+
//
|
|
533
|
+
// The direct-edge probe in chat.mjs's probeChoiceOptions accepts an edge
|
|
534
|
+
// under any predicate, which is close to no evidence when CommonsenseQA's
|
|
535
|
+
// distractors sit on the same relation as the gold answer (section 2.3 of
|
|
536
|
+
// the design survey). Routing narrows the accepted edge set to the relation
|
|
537
|
+
// family the stem itself names, before the graph is even touched — a closed
|
|
538
|
+
// cue table, not a general parser, matching the house style of every other
|
|
539
|
+
// table in this module.
|
|
540
|
+
//
|
|
541
|
+
// Ordered by measured cue yield on the committed fixture (section 10.2):
|
|
542
|
+
// AtLocation cues the most stems by a wide margin, so it is tried first.
|
|
543
|
+
// First cue that matches wins; a stem matching none routes to null, which
|
|
544
|
+
// the caller reads as "no relation named" and falls back to any-predicate
|
|
545
|
+
// matching for that question.
|
|
546
|
+
export const CHOICE_RELATION_ROUTES = Object.freeze([
|
|
547
|
+
{
|
|
548
|
+
family: "AtLocation",
|
|
549
|
+
predicates: Object.freeze(["mgx:atLocation", "mgx:locatedNear"]),
|
|
550
|
+
cue: /\b(where|located|location)\b/i,
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
family: "IsA/Synonym/HasProperty",
|
|
554
|
+
predicates: Object.freeze(["rdfs:subClassOf", "mgx:synonym", "mgx:hasProperty"]),
|
|
555
|
+
// Narrower than a bare "what is a ...?" lead on purpose — that shape
|
|
556
|
+
// matches almost any noun question ("what is a dog capable of?",
|
|
557
|
+
// "what is a hammer used for?"), which would shadow every other family.
|
|
558
|
+
cue: /\b(kind of|type of|another word for|same as|synonym)\b/i,
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
family: "HasPrerequisite/HasSubevent",
|
|
562
|
+
predicates: Object.freeze(["mgx:hasPrerequisite", "mgx:hasSubevent", "mgx:hasFirstSubevent", "mgx:hasLastSubevent"]),
|
|
563
|
+
cue: /\b(before|after|first|next|then|once you|in order to)\b/i,
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
family: "Desires/MotivatedByGoal",
|
|
567
|
+
predicates: Object.freeze(["mgx:desires", "mgx:motivatedByGoal", "mgx:causesDesire"]),
|
|
568
|
+
cue: /\b(want\w*|desire\w*|motivat\w*)\b/i,
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
family: "Causes",
|
|
572
|
+
predicates: Object.freeze(["mgx:causes", "mgx:causesDesire"]),
|
|
573
|
+
cue: /\b(cause\w*|result(?:s|ed)? in|leads? to|led to)\b/i,
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
family: "PartOf/HasA/MadeOf",
|
|
577
|
+
predicates: Object.freeze(["mgx:partOf", "mgx:hasA", "mgx:madeOf"]),
|
|
578
|
+
cue: /\b(part of|made of|has a|have a)\b/i,
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
family: "CapableOf",
|
|
582
|
+
predicates: Object.freeze(["mgx:capableOf", "mgxneg:capableOf"]),
|
|
583
|
+
cue: /\b(capable of|able to)\b/i,
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
family: "UsedFor",
|
|
587
|
+
predicates: Object.freeze(["mgx:usedFor"]),
|
|
588
|
+
cue: /\b(used for|used to|use for)\b/i,
|
|
589
|
+
},
|
|
590
|
+
]);
|
|
591
|
+
|
|
592
|
+
// ---- lemma normalization (rung 4, lever 1) ----
|
|
593
|
+
//
|
|
594
|
+
// An option's surface form and a stored edge's surface form differ in
|
|
595
|
+
// regular inflection ("getting full" against an edge to "get full"). Reverse
|
|
596
|
+
// inflection is ambiguous by nature ("having" could come from "hav" or
|
|
597
|
+
// "have"), so every candidate base is SELF-VERIFIED against inflect.mjs's
|
|
598
|
+
// own forward rules before it counts — a candidate survives only when
|
|
599
|
+
// running it back through gerundOf/pastOf reproduces the exact word it came
|
|
600
|
+
// from. No new inflection rule is invented here; this only reverses the
|
|
601
|
+
// existing regular -ing/-ed ones. Plural -s/-es stays out of scope: chat.mjs's
|
|
602
|
+
// own factTermVariants already folds that at the noun level.
|
|
603
|
+
|
|
604
|
+
function gerundBaseCandidates(word) {
|
|
605
|
+
if (!word.endsWith("ing") || word.length <= 4) return [];
|
|
606
|
+
const stem = word.slice(0, -3);
|
|
607
|
+
const candidates = new Set([stem, stem.slice(0, -1), `${stem}e`]);
|
|
608
|
+
return [...candidates].filter((c) => c.length > 1 && gerundOf(c) === word);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
function pastBaseCandidates(word) {
|
|
612
|
+
if (!word.endsWith("ed") || word.length <= 3) return [];
|
|
613
|
+
const candidates = new Set([word.slice(0, -1), word.slice(0, -2), word.slice(0, -2).slice(0, -1)]);
|
|
614
|
+
if (word.endsWith("ied")) candidates.add(`${word.slice(0, -3)}y`);
|
|
615
|
+
return [...candidates].filter((c) => c.length > 1 && pastOf(c) === word);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/** Every phrase reachable from `text` by lemmatizing exactly one word's
|
|
619
|
+
* regular -ing/-ed inflection back to its base form — "getting full" ->
|
|
620
|
+
* "get full", "she reduced it" untouched (no word survives self-
|
|
621
|
+
* verification as a genuine -ing/-ed inflection). */
|
|
622
|
+
export function lemmaFoldVariants(text) {
|
|
623
|
+
const words = String(text ?? "").toLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
624
|
+
const variants = new Set();
|
|
625
|
+
words.forEach((word, i) => {
|
|
626
|
+
for (const base of [...gerundBaseCandidates(word), ...pastBaseCandidates(word)]) {
|
|
627
|
+
variants.add([...words.slice(0, i), base, ...words.slice(i + 1)].join(" "));
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
return variants;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
// ---- head-noun backoff (rung 4, lever 2) ----
|
|
634
|
+
|
|
635
|
+
/** The head noun of a multi-word phrase — its LAST word, the house style's
|
|
636
|
+
* own head-final assumption ("fast food restaurant" -> "restaurant", "train
|
|
637
|
+
* station" -> "station"). Returns "" for a single-word phrase: there is
|
|
638
|
+
* nothing to back off to when the phrase already IS its own head. Bounded
|
|
639
|
+
* and closed on purpose — the head only, never every sub-phrase — so the
|
|
640
|
+
* caller stays a single, cheap fallback pass rather than a fuzzy search. */
|
|
641
|
+
export function headNounOf(text) {
|
|
642
|
+
const words = String(text ?? "").toLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
643
|
+
return words.length > 1 ? words[words.length - 1] : "";
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
/** Reads the relation family a stem's own wording names, first cue wins.
|
|
647
|
+
* Returns null when no route's cue matches, which the caller reads as "no
|
|
648
|
+
* relation named" — the probe then falls back to any-predicate matching.
|
|
649
|
+
* @returns {null | { family: string, predicates: string[] }} */
|
|
650
|
+
export function routeChoiceRelation(stem) {
|
|
651
|
+
const text = String(stem ?? "");
|
|
652
|
+
for (const route of CHOICE_RELATION_ROUTES) {
|
|
653
|
+
if (route.cue.test(text)) return { family: route.family, predicates: [...route.predicates] };
|
|
654
|
+
}
|
|
655
|
+
return null;
|
|
656
|
+
}
|
package/src/domain/news-feed.mjs
CHANGED
|
@@ -26,18 +26,36 @@ function toMs(value) {
|
|
|
26
26
|
return Number.isFinite(t) ? t : NaN;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// The ingest seam wraps a caller's tag in its own audit prefix
|
|
30
|
+
// (extracted:news-fixture:…, optimistic-extract:news:…), so the news tag is
|
|
31
|
+
// matched at any segment boundary, never only at the front.
|
|
32
|
+
const NEWS_WINDOW_PROVENANCE_RE = /(?:^|:)(?:news|news-fixture|research):/;
|
|
30
33
|
|
|
31
34
|
/** Rows whose provenance carries a `news:`, `news-fixture:` or `research:`
|
|
32
35
|
* tag and whose observedAt (else createdAt) falls inside [now - windowMs,
|
|
33
36
|
* now]. Pure filter — `now` is the caller's clock reading, nothing here
|
|
34
37
|
* reads a live one. */
|
|
38
|
+
/** A row's own observation moment: the top-level stamp when a caller set
|
|
39
|
+
* one, else the latest per-assertion stamp the fold surfaces — readFactRows
|
|
40
|
+
* keeps observedAt/createdAt on each assertion record, not on the row. */
|
|
41
|
+
function rowObservedMs(row) {
|
|
42
|
+
const own = toMs(row.observedAt || "");
|
|
43
|
+
if (Number.isFinite(own)) return own;
|
|
44
|
+
let latest = NaN;
|
|
45
|
+
for (const a of row.assertions || []) {
|
|
46
|
+
const t = toMs(a.observedAt || a.createdAt || "");
|
|
47
|
+
if (Number.isFinite(t) && !(latest >= t)) latest = t;
|
|
48
|
+
}
|
|
49
|
+
if (Number.isFinite(latest)) return latest;
|
|
50
|
+
return toMs(row.createdAt || "");
|
|
51
|
+
}
|
|
52
|
+
|
|
35
53
|
export function newsWindowRows(rows, { now, windowMs }) {
|
|
36
54
|
const nowMs = toMs(now);
|
|
37
55
|
const startMs = nowMs - windowMs;
|
|
38
56
|
return rows.filter((row) => {
|
|
39
57
|
if (!NEWS_WINDOW_PROVENANCE_RE.test(String(row.provenance || ""))) return false;
|
|
40
|
-
const t =
|
|
58
|
+
const t = rowObservedMs(row);
|
|
41
59
|
return Number.isFinite(t) && t >= startMs && t <= nowMs;
|
|
42
60
|
});
|
|
43
61
|
}
|
|
@@ -16,6 +16,13 @@ export const DEFAULT_REASONING_CONFIG = Object.freeze({
|
|
|
16
16
|
proveSteps: 5000,
|
|
17
17
|
proveBranches: 256,
|
|
18
18
|
proveNodes: 512,
|
|
19
|
+
// The automatic /prove fallback's OWN, tighter budget — kept apart from
|
|
20
|
+
// prove_steps/branches/nodes above so raising the command's budget never
|
|
21
|
+
// slows every ordinary question that falls through to it on a miss.
|
|
22
|
+
askProveFallback: true,
|
|
23
|
+
askProveSteps: 1000,
|
|
24
|
+
askProveBranches: 64,
|
|
25
|
+
askProveNodes: 128,
|
|
19
26
|
});
|
|
20
27
|
|
|
21
28
|
// snake_case tmct.toml key -> camelCase internal key — mirrors game-config.mjs's own KEY_MAP tables.
|
|
@@ -28,6 +35,16 @@ const REASONING_KEY_MAP = Object.freeze({
|
|
|
28
35
|
prove_steps: "proveSteps",
|
|
29
36
|
prove_branches: "proveBranches",
|
|
30
37
|
prove_nodes: "proveNodes",
|
|
38
|
+
ask_prove_steps: "askProveSteps",
|
|
39
|
+
ask_prove_branches: "askProveBranches",
|
|
40
|
+
ask_prove_nodes: "askProveNodes",
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// The one boolean knob in this table — folded through clampBoolean, never
|
|
44
|
+
// clampPositiveInt, because clampPositiveInt rejects 0 and would silently
|
|
45
|
+
// restore the default the moment someone tried to set ask_prove_fallback = 0.
|
|
46
|
+
const REASONING_BOOLEAN_KEY_MAP = Object.freeze({
|
|
47
|
+
ask_prove_fallback: "askProveFallback",
|
|
31
48
|
});
|
|
32
49
|
|
|
33
50
|
/** A positive-integer knob, clamped to its shipped default when the raw value
|
|
@@ -38,6 +55,13 @@ function clampPositiveInt(raw, fallback) {
|
|
|
38
55
|
return Number.isInteger(n) && n > 0 ? n : fallback;
|
|
39
56
|
}
|
|
40
57
|
|
|
58
|
+
/** A boolean knob, clamped to its shipped default when the raw value isn't
|
|
59
|
+
* literally `true` or `false` — the same corrupt-value-degrades-to-default
|
|
60
|
+
* contract clampPositiveInt gives every numeric knob. */
|
|
61
|
+
function clampBoolean(raw, fallback) {
|
|
62
|
+
return typeof raw === "boolean" ? raw : fallback;
|
|
63
|
+
}
|
|
64
|
+
|
|
41
65
|
/**
|
|
42
66
|
* Fold a normalized tmct.toml's `reasoning` table (the raw sparse pass-through
|
|
43
67
|
* src/adapters/toml-config.mjs's normalizeConfig produces — snake_case keys,
|
|
@@ -52,5 +76,8 @@ export function resolveReasoningConfig(toml) {
|
|
|
52
76
|
for (const [tomlKey, camelKey] of Object.entries(REASONING_KEY_MAP)) {
|
|
53
77
|
if (raw[tomlKey] !== undefined) out[camelKey] = clampPositiveInt(raw[tomlKey], DEFAULT_REASONING_CONFIG[camelKey]);
|
|
54
78
|
}
|
|
79
|
+
for (const [tomlKey, camelKey] of Object.entries(REASONING_BOOLEAN_KEY_MAP)) {
|
|
80
|
+
if (raw[tomlKey] !== undefined) out[camelKey] = clampBoolean(raw[tomlKey], DEFAULT_REASONING_CONFIG[camelKey]);
|
|
81
|
+
}
|
|
55
82
|
return out;
|
|
56
83
|
}
|