@polycode-projects/the-mechanical-code-talker 2.10.5 → 2.11.1
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 +2 -2
- package/corpus/sprites/src/sprite-facts.jsonl +18 -0
- package/corpus/worlds/manifest.json +5 -5
- package/corpus/worlds/shards/ashcombe-hall.jsonl.gz +0 -0
- package/corpus/worlds/src/ashcombe-hall.jsonl +27 -0
- package/data/sprites/book-icon.toml +12 -0
- package/data/sprites/cellar-icon.toml +12 -0
- package/data/sprites/drawing-room-icon.toml +13 -0
- package/data/sprites/garden-icon.toml +12 -0
- package/data/sprites/kitchen-icon.toml +13 -0
- package/data/sprites/library-icon.toml +12 -0
- package/data/sprites/pan-icon.toml +11 -0
- package/data/sprites/study-icon.toml +12 -0
- package/data/templates/responses.jsonl +1 -0
- package/package.json +5 -2
- package/src/adapters/corpus/wikipedia-live.mjs +182 -26
- package/src/adapters/corpus/worlds-pack.mjs +8 -2
- package/src/adapters/toml-config.mjs +6 -0
- package/src/domain/ask-vocab.mjs +17 -0
- package/src/domain/ask.mjs +51 -1
- package/src/domain/grammar/ace.mjs +43 -3
- package/src/domain/interpret/normalize.mjs +6 -2
- package/src/domain/interpret/strategies/grammar.mjs +47 -17
- package/src/domain/interpret/strategies/keywords.mjs +53 -4
- package/src/domain/memory/trust.mjs +11 -0
- package/src/domain/router/registry.mjs +8 -1
- package/src/domain/worlds-pack.mjs +50 -0
- package/src/services/adventure-autoplay.mjs +5 -2
- package/src/services/adventure-viz.mjs +301 -33
- package/src/services/adventure.mjs +162 -14
- package/src/services/chat-page-viz.mjs +265 -189
- package/src/services/chat-session.mjs +15 -5
- package/src/services/chat.mjs +471 -79
- package/src/services/code-explorer-viz.mjs +183 -75
- package/src/services/extract-facts.mjs +118 -28
- package/src/services/ingest-viz.mjs +328 -79
- package/src/services/ledger-viz.mjs +99 -0
- package/src/services/memory-panel-viz.mjs +159 -0
- package/src/services/research.mjs +266 -0
- package/src/services/sentences.mjs +19 -0
- package/src/services/spider-fly-viz.mjs +21 -5
- package/src/surfaces/web/adventure-browser-entry.mjs +9 -5
- package/src/surfaces/web/chat-browser-entry.mjs +28 -11
- package/src/surfaces/web/code-explorer-browser-entry.mjs +27 -11
- package/src/surfaces/web/ingest-browser-entry.mjs +123 -41
- package/src/surfaces/web/ledger-browser-entry.mjs +10 -4
- package/src/surfaces/web/memory-ask-browser.bundle.js +116 -116
- package/src/surfaces/web/memory-stats.mjs +53 -0
|
@@ -28,6 +28,7 @@ import * as defaultSource from "../adapters/source.mjs";
|
|
|
28
28
|
import { resolveExtensions, mergedLexiconExtra } from "./extensions.mjs";
|
|
29
29
|
import { runTurn, hasSeededVocabulary, vocabExampleHint } from "./chat.mjs";
|
|
30
30
|
import { resolveGameConfig } from "../domain/game-config.mjs";
|
|
31
|
+
import { resolveResearchConfig } from "./research.mjs";
|
|
31
32
|
import { sessionLogHeaderMarkdown, sessionLogTurnMarkdown, sessionLogEndMarkdown } from "./session-log-format.mjs";
|
|
32
33
|
|
|
33
34
|
/** Where session logs live, relative to the target repo. `.tmct/` is the repo's
|
|
@@ -199,6 +200,11 @@ export async function createSession({
|
|
|
199
200
|
// to the shipped defaults for every key.
|
|
200
201
|
const gameConfig = resolveGameConfig(toml);
|
|
201
202
|
|
|
203
|
+
// The research lane's knobs (fan-out cap, depth, the polite interval) —
|
|
204
|
+
// resolved once per session from the same tmct.toml, defaults filling
|
|
205
|
+
// every unset key exactly as resolveGameConfig does above.
|
|
206
|
+
const researchConfig = resolveResearchConfig(toml);
|
|
207
|
+
|
|
202
208
|
// tmct.toml's corpus tier3 opts the session into the live supplement too —
|
|
203
209
|
// the flag/env tiers above stay authoritative when set.
|
|
204
210
|
if (toml?.corpus?.tier === "tier3") liveReferenceOn = true;
|
|
@@ -337,6 +343,7 @@ export async function createSession({
|
|
|
337
343
|
let focus = null; // the current focus entity ({id,label}) — threaded turn to turn
|
|
338
344
|
let last = null; // the last dispatched answer ({query,answer,detail}) — why/say-more re-renders it
|
|
339
345
|
let planState = null; // the in-progress plan (goals/moves/cursor) — cleared by completion or a fresh goal, never by an aside
|
|
346
|
+
let researchState = null; // the in-progress research queue — advanced by "research next", cleared by completion or "research stop"
|
|
340
347
|
let closed = false;
|
|
341
348
|
|
|
342
349
|
return {
|
|
@@ -347,6 +354,7 @@ export async function createSession({
|
|
|
347
354
|
get focus() { return focus; },
|
|
348
355
|
get lastAnswer() { return last; },
|
|
349
356
|
get planState() { return planState; },
|
|
357
|
+
get researchState() { return researchState; },
|
|
350
358
|
get turns() { return turns; },
|
|
351
359
|
get narrate() { return narrateOn; },
|
|
352
360
|
get liveReference() { return liveReferenceOn; },
|
|
@@ -360,7 +368,7 @@ export async function createSession({
|
|
|
360
368
|
async turn(line) {
|
|
361
369
|
let result;
|
|
362
370
|
try {
|
|
363
|
-
result = await runTurn(line, { config, source, graph, focus, last, memoryDir, sessionId, env, lexicon, narrate: narrateOn, liveReference: liveReferenceOn, vocabHint, tel, biasByBundle, planState, gameConfig });
|
|
371
|
+
result = await runTurn(line, { config, source, graph, focus, last, memoryDir, sessionId, env, lexicon, narrate: narrateOn, liveReference: liveReferenceOn, vocabHint, tel, biasByBundle, planState, gameConfig, researchState, researchConfig });
|
|
364
372
|
} catch (e) {
|
|
365
373
|
const ts = new Date().toISOString();
|
|
366
374
|
const message = e instanceof Error ? e.message : String(e);
|
|
@@ -375,13 +383,15 @@ export async function createSession({
|
|
|
375
383
|
focus = nextFocus;
|
|
376
384
|
last = nextLast;
|
|
377
385
|
if ("planState" in result) planState = result.planState;
|
|
386
|
+
if ("researchState" in result) researchState = result.researchState;
|
|
378
387
|
// /narrate on|off and /wiki on|off (runCommand) ride the turn RESULT the
|
|
379
388
|
// same way a focus update does — apply them to this handle's
|
|
380
389
|
// session-scoped state.
|
|
381
390
|
if (typeof nextNarrate === "boolean") narrateOn = nextNarrate;
|
|
382
|
-
//
|
|
383
|
-
// append a cited read-out under every grounded answer)
|
|
384
|
-
|
|
391
|
+
// four-state: false (off), true (rescue on a miss), "supplement" (also
|
|
392
|
+
// append a cited read-out under every grounded vocabulary answer), or
|
|
393
|
+
// "always" (widen that to every grounded answer).
|
|
394
|
+
if (typeof nextLiveReference === "boolean" || nextLiveReference === "supplement" || nextLiveReference === "always") liveReferenceOn = nextLiveReference;
|
|
385
395
|
await writeLog(sessionLogTurnMarkdown({ startedAt: record.ts, turnNumber: turns + 1, query: line, answer }));
|
|
386
396
|
await writeSidecar(record);
|
|
387
397
|
turnRecords.push(record);
|
|
@@ -394,7 +404,7 @@ export async function createSession({
|
|
|
394
404
|
});
|
|
395
405
|
await upsertGraph(record.ts);
|
|
396
406
|
turns += 1;
|
|
397
|
-
return { answer, end: Boolean(end), prompt: promptFor(focus), plan: result.plan ?? null, record };
|
|
407
|
+
return { answer, end: Boolean(end), prompt: promptFor(focus), plan: result.plan ?? null, research: result.research, record };
|
|
398
408
|
},
|
|
399
409
|
|
|
400
410
|
/** End-of-session close: end lines in both artifacts, the final graph upsert
|