@polycode-projects/the-mechanical-code-talker 2.11.11 → 2.11.12

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.
@@ -27,6 +27,7 @@
27
27
  // it fresh on every deploy, never committed, the same posture the chat/ingest
28
28
  // bundles document for their own output.
29
29
  import { runTurn, vocabExampleHint, factAnswer, factReadBack } from "../../services/chat.mjs";
30
+ import { clampResearchConfig } from "../../services/research.mjs";
30
31
  import { createInMemoryStore, normFactTerm, loadMemory, readFactRows, removeFacts } from "../../adapters/memory/core.mjs";
31
32
  import { serializeFactsJsonl } from "../../adapters/memory/export-jsonl.mjs";
32
33
  import { provenanceTagToSource } from "../../domain/memory/trust.mjs";
@@ -222,6 +223,11 @@ export function createResearchSession({ seedPayload = null, vocabSeeded = false,
222
223
  const normLive = (v) => (v === "always" ? "always" : v === "supplement" ? "supplement" : Boolean(v));
223
224
  let liveReferenceOn = normLive(liveReference);
224
225
  let synthesisBudgetOn = Number.isFinite(synthesisBudget) ? synthesisBudget : 12;
226
+ // The two research node knobs the page exposes ("maximum response nodes",
227
+ // "maximum node depth"), clamped to the engineered ranges. A change applies
228
+ // to the NEXT run started; a run already going keeps the knobs it captured
229
+ // (they ride its persisted state), so its queue stays internally consistent.
230
+ let researchConfig = clampResearchConfig();
225
231
 
226
232
  return {
227
233
  memoryDir,
@@ -232,6 +238,11 @@ export function createResearchSession({ seedPayload = null, vocabSeeded = false,
232
238
  setLiveReference(v) { liveReferenceOn = normLive(v); },
233
239
  get synthesisBudget() { return synthesisBudgetOn; },
234
240
  setSynthesisBudget(n) { synthesisBudgetOn = Number.isFinite(n) && n > 0 ? Math.floor(n) : 0; },
241
+ get researchConfig() { return { ...researchConfig }; },
242
+ /** Update the node knobs for the NEXT run. `partial` is any of
243
+ * { maxTopics, maxDepth, fanoutLimit, minIntervalMs }; each is clamped and
244
+ * unset keys keep their current value. */
245
+ setResearchConfig(partial) { researchConfig = clampResearchConfig({ ...researchConfig, ...(partial || {}) }); },
235
246
 
236
247
  /** One chat-engine turn (research/teach/ask). A throw never kills the
237
248
  * session — the page has no other chance to show this turn's answer. */
@@ -240,7 +251,7 @@ export function createResearchSession({ seedPayload = null, vocabSeeded = false,
240
251
  try {
241
252
  result = await runTurn(line, {
242
253
  config: null, source: null, graph, focus, last, memoryDir, sessionId: chatSessionId,
243
- env: {}, lexicon, vocabHint, planState, researchState,
254
+ env: {}, lexicon, vocabHint, planState, researchState, researchConfig,
244
255
  liveReference: liveReferenceOn, onLiveLookup,
245
256
  uiContext: "browser", synthesisBudget: synthesisBudgetOn,
246
257
  });