@polycode-projects/the-mechanical-code-talker 6.0.2 → 6.0.4
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 +12 -0
- package/package.json +1 -1
- package/src/adapters/memory/core.mjs +7 -1
- package/src/adapters/memory/rows.mjs +18 -10
- package/src/adapters/source.mjs +12 -9
- package/src/domain/news-feed.mjs +7 -7
- package/src/services/chat-page-viz.mjs +189 -26
- package/src/services/ledger-viz.mjs +91 -6
- package/src/services/memory-panel-viz.mjs +12 -8
- package/src/services/news-viz.mjs +185 -10
- package/src/surfaces/web/chat-browser-entry.mjs +42 -5
- package/src/surfaces/web/http-row-backend.mjs +57 -1
- package/src/surfaces/web/ledger-browser-entry.mjs +30 -8
- package/src/surfaces/web/memory-ask-browser.bundle.js +67 -67
- package/src/surfaces/web/news-browser-entry.mjs +268 -32
- package/src/tools/graph-load.mjs +4 -2
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
// never published — only the hosted demo site's public/ledger.html links to
|
|
18
18
|
// it, as an optional sibling script the page degrades honestly without.
|
|
19
19
|
import { vocabExampleHint } from "../../services/chat.mjs";
|
|
20
|
-
import { createInMemoryStore, normFactTerm, applySeedPayload, loadMemory, readFactRows } from "../../adapters/memory/core.mjs";
|
|
20
|
+
import { createInMemoryStore, normFactTerm, applySeedPayload, loadMemory, readFactRows, wrapRowBackend } from "../../adapters/memory/core.mjs";
|
|
21
|
+
import { createHttpRowBackend, withOneRetryOnUnavailable } from "./http-row-backend.mjs";
|
|
21
22
|
import { splitSentencesPreservingPaths } from "../../services/sentences.mjs";
|
|
22
23
|
import { parseEntities } from "../../domain/codegraph.mjs";
|
|
23
24
|
import { memoryFactGraphPayload } from "../../domain/memory-facts.mjs";
|
|
@@ -45,14 +46,35 @@ import { graphAsk, enginePlan } from "./engine-surface.mjs";
|
|
|
45
46
|
* traverses those facts while a code-structure question still refuses honestly.
|
|
46
47
|
*
|
|
47
48
|
* ledger-viz.mjs's own inline script calls computeLedgerDataFromPayload
|
|
48
|
-
* (re-exported below) on
|
|
49
|
-
* a successful write (`via: "assert"` or `via: "retract"`,
|
|
50
|
-
* re-derive the page's rows/terms/edges/stats and re-mount
|
|
51
|
-
* fresh page load would have rendered — a plain query never
|
|
49
|
+
* (re-exported below) on the session's current payload after a turn whose
|
|
50
|
+
* record shows a successful write (`via: "assert"` or `via: "retract"`,
|
|
51
|
+
* `miss: false`) to re-derive the page's rows/terms/edges/stats and re-mount
|
|
52
|
+
* the same view a fresh page load would have rendered — a plain query never
|
|
53
|
+
* re-derives.
|
|
54
|
+
*
|
|
55
|
+
* `awsSessionKey` (optional): the page's AWS-mode backend choice, the same
|
|
56
|
+
* seam chat-browser-entry.mjs's own createChatSession takes — given, the
|
|
57
|
+
* session's memory binds to `createHttpRowBackend({apiBase: "/", sessionKey:
|
|
58
|
+
* awsSessionKey, fetchImpl})` wrapped with `seedPayload` as its read-only
|
|
59
|
+
* seed overlay; omitted, memory stays the plain in-memory store. `fetchImpl`
|
|
60
|
+
* (optional) overrides the ambient `fetch` the row backend calls through —
|
|
61
|
+
* a test points it at a running row-service double.
|
|
52
62
|
*/
|
|
53
|
-
export function createLedgerSession({
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
export function createLedgerSession({
|
|
64
|
+
seedPayload = null, vocabSeeded = false, awsSessionKey = null,
|
|
65
|
+
fetchImpl = (...args) => globalThis.fetch(...args),
|
|
66
|
+
} = {}) {
|
|
67
|
+
// onOversizedRow: "drop" — see chat-browser-entry.mjs's own createChatSession
|
|
68
|
+
// for why: a real corpus seed's high-fan-out mgx:statedBy group is already
|
|
69
|
+
// over the row cap before this session teaches anything, and a session's
|
|
70
|
+
// own new fact adding one more edge to it can't fit one wire row either.
|
|
71
|
+
// The read side (core.mjs) always keeps every seed row regardless, so
|
|
72
|
+
// nothing about the seed itself is lossy — only that one property's
|
|
73
|
+
// cross-fact edge index stays as unwritable as the seed's own copy of it.
|
|
74
|
+
const memoryDir = awsSessionKey
|
|
75
|
+
? wrapRowBackend(withOneRetryOnUnavailable(createHttpRowBackend({ apiBase: "/", sessionKey: awsSessionKey, fetchImpl })), { basePayload: seedPayload, onOversizedRow: "drop" })
|
|
76
|
+
: createInMemoryStore();
|
|
77
|
+
if (!awsSessionKey) applySeedPayload(memoryDir, seedPayload);
|
|
56
78
|
|
|
57
79
|
const codeGraph = parseEntities({ individuals: [], objectProperties: [] });
|
|
58
80
|
|