@polycode-projects/the-mechanical-code-talker 3.0.1 → 3.0.3
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 +11 -0
- package/bin/tmct.mjs +93 -1
- package/data/templates/constructions/digest-sentence-structures.toml +97 -0
- package/package.json +7 -1
- package/src/adapters/corpus/digest-bank.mjs +62 -0
- package/src/adapters/toml-config.mjs +5 -0
- package/src/domain/ask.mjs +53 -4
- package/src/domain/cli-verbs.mjs +11 -0
- package/src/domain/digest/article.mjs +106 -0
- package/src/domain/digest/compose.mjs +103 -0
- package/src/domain/digest/config.json +13 -0
- package/src/domain/digest/index.mjs +38 -0
- package/src/domain/digest/select.mjs +233 -0
- package/src/domain/digest/store-stats.mjs +77 -0
- package/src/domain/digest/structures.mjs +100 -0
- package/src/domain/digest/words.mjs +40 -0
- package/src/domain/discourse.mjs +0 -0
- package/src/domain/hash.mjs +6 -1
- package/src/domain/router/goal-reasoner.mjs +6 -2
- package/src/services/chat-session.mjs +6 -1
- package/src/services/chat.mjs +317 -53
- package/src/services/ledger-viz.mjs +63 -3
- package/src/services/research-viz.mjs +106 -6
- package/src/surfaces/web/digest-client.mjs +73 -0
- package/src/surfaces/web/ledger-browser-entry.mjs +2 -1
- package/src/surfaces/web/memory-ask-browser-entry.mjs +6 -1
- package/src/surfaces/web/memory-ask-browser.bundle.js +144 -139
- package/src/surfaces/web/research-browser-entry.mjs +20 -1
|
@@ -38,6 +38,7 @@ import { registerReferencePackProvider } from "../../adapters/corpus/reference-p
|
|
|
38
38
|
import { registerLiveReferenceProvider, registerResearchProvider } from "../../adapters/corpus/wikipedia-live.mjs";
|
|
39
39
|
import { groundTextToFacts } from "./ingest-browser-entry.mjs";
|
|
40
40
|
import { openPersistedStore } from "./idb-persist.mjs";
|
|
41
|
+
import { digestTermFromPayloadBrowser } from "./digest-client.mjs";
|
|
41
42
|
|
|
42
43
|
// The Fact individual's first-write-wins timestamp, read straight off the
|
|
43
44
|
// stored attribute (mgx:createdAt) so a "recently learned" ordering never
|
|
@@ -202,7 +203,7 @@ export async function researchSnapshot(memoryDir, sessionIds = {}, { recentCap =
|
|
|
202
203
|
*
|
|
203
204
|
* Returns the store plus both session ids so the page can classify provenance.
|
|
204
205
|
*/
|
|
205
|
-
export function createResearchSession({ seedPayload = null, vocabSeeded = false, liveReference = false, onLiveLookup = null, synthesisBudget = 12 } = {}) {
|
|
206
|
+
export function createResearchSession({ seedPayload = null, vocabSeeded = false, liveReference = false, onLiveLookup = null, synthesisBudget = 12, digestStructures = null } = {}) {
|
|
206
207
|
const memoryDir = createInMemoryStore();
|
|
207
208
|
if (seedPayload) memoryDir.payload = { ...memoryDir.payload, ...seedPayload };
|
|
208
209
|
|
|
@@ -311,6 +312,24 @@ export function createResearchSession({ seedPayload = null, vocabSeeded = false,
|
|
|
311
312
|
}
|
|
312
313
|
return ans && ans.text ? { text: ans.text, miss: false } : { text: "", miss: true };
|
|
313
314
|
},
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* A deterministic digest of one term over the live in-browser store, run
|
|
318
|
+
* client-side through the pure digest layer from the structure table
|
|
319
|
+
* embedded in the page (no filesystem, no LLM). Returns the render-ready
|
|
320
|
+
* view { term, paragraphs, sources, facts, factCount } — the narrative
|
|
321
|
+
* leads, the sources ride through, the full fact list stays behind the
|
|
322
|
+
* "show the facts" escape — or null when the term holds no facts, no
|
|
323
|
+
* structures were embedded, or the selector kept nothing renderable.
|
|
324
|
+
*/
|
|
325
|
+
async digest(term, { budget = 10 } = {}) {
|
|
326
|
+
const t = normFactTerm(term);
|
|
327
|
+
if (!t) return null;
|
|
328
|
+
let payload;
|
|
329
|
+
try { payload = await loadMemory(memoryDir); } catch { return null; }
|
|
330
|
+
try { return digestTermFromPayloadBrowser(payload, t, digestStructures, { budget }); }
|
|
331
|
+
catch { return null; }
|
|
332
|
+
},
|
|
314
333
|
};
|
|
315
334
|
}
|
|
316
335
|
|