@polycode-projects/the-mechanical-code-talker 4.0.0 → 4.1.0

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.
Files changed (108) hide show
  1. package/README.md +178 -9
  2. package/corpus/reference/index.json.gz +0 -0
  3. package/corpus/reference/manifest.json +8 -8
  4. package/corpus/reference/shards/ref-00.jsonl.gz +0 -0
  5. package/corpus/sprites/src/sprite-facts.jsonl +401 -0
  6. package/corpus/worlds/index.json.gz +0 -0
  7. package/corpus/worlds/manifest.json +49 -9
  8. package/corpus/worlds/shards/greyvale-museum.jsonl.gz +0 -0
  9. package/corpus/worlds/shards/lantern-cottage.jsonl.gz +0 -0
  10. package/corpus/worlds/shards/mud-hollow.jsonl.gz +0 -0
  11. package/corpus/worlds/shards/mud-warren.jsonl.gz +0 -0
  12. package/corpus/worlds/shards/spider-fly.jsonl.gz +0 -0
  13. package/corpus/worlds/src/greyvale-museum.jsonl +136 -0
  14. package/corpus/worlds/src/lantern-cottage.jsonl +60 -0
  15. package/corpus/worlds/src/mud-hollow.jsonl +82 -0
  16. package/corpus/worlds/src/mud-warren.jsonl +124 -0
  17. package/corpus/worlds/src/spider-fly.jsonl +1 -1
  18. package/data/sprites/animal-icon.toml +11 -5
  19. package/data/sprites/book-icon.toml +9 -5
  20. package/data/sprites/cabinet-icon.toml +10 -5
  21. package/data/sprites/cellar-icon.toml +16 -6
  22. package/data/sprites/container-icon.toml +7 -3
  23. package/data/sprites/desk-icon.toml +8 -5
  24. package/data/sprites/dog-icon.toml +8 -5
  25. package/data/sprites/dog-with-colour-icon.toml +13 -12
  26. package/data/sprites/drawing-room-icon.toml +14 -5
  27. package/data/sprites/egg-icon.toml +6 -3
  28. package/data/sprites/fly-icon.toml +10 -5
  29. package/data/sprites/furniture-icon.toml +5 -3
  30. package/data/sprites/garden-icon.toml +10 -3
  31. package/data/sprites/key-icon.toml +3 -1
  32. package/data/sprites/kitchen-icon.toml +15 -6
  33. package/data/sprites/lamp-icon.toml +9 -4
  34. package/data/sprites/letter-icon.toml +7 -4
  35. package/data/sprites/library-icon.toml +14 -3
  36. package/data/sprites/pan-icon.toml +7 -3
  37. package/data/sprites/person-icon.toml +6 -2
  38. package/data/sprites/poodle-icon.toml +1 -1
  39. package/data/sprites/portable-icon.toml +6 -4
  40. package/data/sprites/portrait-icon.toml +7 -4
  41. package/data/sprites/room-icon.toml +11 -2
  42. package/data/sprites/spider-icon.toml +9 -3
  43. package/data/sprites/study-icon.toml +10 -2
  44. package/package.json +5 -4
  45. package/src/adapters/memory/core.mjs +20 -0
  46. package/src/domain/ask-vocab.mjs +71 -0
  47. package/src/domain/ask.mjs +168 -0
  48. package/src/domain/game-config.mjs +11 -0
  49. package/src/domain/grammar/ace.mjs +40 -4
  50. package/src/domain/grammar/lexicon-core.json +2 -1
  51. package/src/domain/grammar/lexicon.mjs +18 -0
  52. package/src/domain/mud-facts.mjs +15 -0
  53. package/src/domain/reference-pack.mjs +31 -7
  54. package/src/domain/router/drive.mjs +35 -9
  55. package/src/domain/router/registry.mjs +24 -4
  56. package/src/domain/router/resolver.mjs +102 -40
  57. package/src/domain/scene-compose.mjs +117 -0
  58. package/src/domain/spider-fly-world.mjs +37 -1
  59. package/src/domain/sprite-facts.mjs +0 -0
  60. package/src/domain/sprite-request.mjs +156 -0
  61. package/src/domain/sprite-templates.mjs +169 -20
  62. package/src/services/adventure-editor.mjs +8 -14
  63. package/src/services/adventure-viz.mjs +209 -157
  64. package/src/services/adventure.mjs +526 -391
  65. package/src/services/chat-page-viz.mjs +69 -25
  66. package/src/services/chat.mjs +200 -51
  67. package/src/services/code-explorer-viz.mjs +102 -62
  68. package/src/services/extract-facts.mjs +4 -7
  69. package/src/services/ingest-viz.mjs +68 -82
  70. package/src/services/ledger-viz.mjs +136 -67
  71. package/src/services/memory-panel-viz.mjs +62 -0
  72. package/src/services/mud-editor.mjs +10 -15
  73. package/src/services/mud-turn.mjs +6 -6
  74. package/src/services/mud-viz.mjs +1016 -208
  75. package/src/services/p2p-room.mjs +90 -23
  76. package/src/services/plan-pddl.mjs +3 -1
  77. package/src/services/plan-viz.mjs +123 -64
  78. package/src/services/research-viz.mjs +160 -108
  79. package/src/services/spider-fly-turn.mjs +15 -23
  80. package/src/services/spider-fly-viz.mjs +146 -161
  81. package/src/services/spider-fly.mjs +69 -11
  82. package/src/services/sprite-catalog-viz.mjs +414 -240
  83. package/src/services/viz-boot.mjs +71 -0
  84. package/src/services/viz-room-graph.mjs +203 -0
  85. package/src/services/viz-theme.mjs +90 -1
  86. package/src/services/viz-ticker.mjs +22 -0
  87. package/src/surfaces/web/adventure-browser-entry.mjs +49 -33
  88. package/src/surfaces/web/chat-browser-entry.mjs +30 -105
  89. package/src/surfaces/web/code-explorer-browser-entry.mjs +168 -24
  90. package/src/surfaces/web/ingest-browser-entry.mjs +3 -13
  91. package/src/surfaces/web/ledger-browser-entry.mjs +7 -47
  92. package/src/surfaces/web/memory-ask-browser.bundle.js +127 -124
  93. package/src/surfaces/web/memory-stats.mjs +11 -0
  94. package/src/surfaces/web/mud-browser-entry.mjs +71 -29
  95. package/src/surfaces/web/plan-browser-entry.mjs +22 -40
  96. package/src/surfaces/web/research-browser-entry.mjs +26 -41
  97. package/src/surfaces/web/spider-fly-browser-entry.mjs +45 -28
  98. package/src/surfaces/web/sprites-browser-entry.mjs +14 -27
  99. package/src/surfaces/web/turn-session.mjs +120 -0
  100. package/src/tools/definitions.mjs +30 -0
  101. package/src/tools/handlers/index.mjs +6 -3
  102. package/src/tools/handlers/kit.mjs +19 -2
  103. package/src/tools/handlers/tmct-ask.mjs +11 -6
  104. package/src/tools/handlers/tmct-ingest.mjs +5 -1
  105. package/src/tools/handlers/tmct-related.mjs +4 -4
  106. package/src/tools/handlers/tmct-sprite.mjs +147 -0
  107. package/src/tools/memory-fallthrough.mjs +9 -2
  108. package/src/tools/server.mjs +25 -1
package/README.md CHANGED
@@ -130,6 +130,168 @@ and never run: one would touch the network, the other needs an LLM judge.
130
130
  `docs/public-examples.md` maps every example on every public surface to the
131
131
  test that holds it.
132
132
 
133
+ Facts don't have to come entirely from teaching. tmct's corpus already knows
134
+ a dog can bark; teach it that Rover is a dog and it reasons the rest, citing
135
+ both the taught fact and the corpus fact the answer chained through:
136
+
137
+ ```output cmd="node examples/rover-infer.mjs" cwd=repo
138
+ tmct> Rover is a dog.
139
+ noted — remembered 1 fact: rover rdfs:subClassOf dog (rover is a type of dog)
140
+
141
+ Goal (inferred): Teach/remember a new fact.
142
+
143
+ Canonical: rover rdfs:subClassOf dog — fact("rover", "rdfs:subClassOf", "dog")
144
+
145
+ tmct> Does Rover bark?
146
+ yes — dog can bark (source: corpus:human /r/CapableOf) — via: rover is a kind of dog (source: ace:chat:<session-id>@<timestamp>)
147
+ ```
148
+
149
+ Every fact above is a small stored record, not just words in an answer. Here
150
+ are two of them exactly as they sit in the graph — `dog capableOf bark` and
151
+ `dog subClassOf animal` — timestamps normalized so this stays reproducible:
152
+
153
+ ```output cmd="node examples/raw-fact-shape.mjs" cwd=repo
154
+ {
155
+ "id": "fact:d5327019d311a956",
156
+ "label": "dog mgx:capableOf bark",
157
+ "class": "Fact",
158
+ "derived_from": [],
159
+ "mentions": [],
160
+ "attributes": [
161
+ {
162
+ "prop": "rdf:type",
163
+ "key": "type",
164
+ "value": "rdf:Statement"
165
+ },
166
+ {
167
+ "prop": "rdf:subject",
168
+ "key": "subject",
169
+ "value": "dog"
170
+ },
171
+ {
172
+ "prop": "rdf:predicate",
173
+ "key": "predicate",
174
+ "value": "mgx:capableOf"
175
+ },
176
+ {
177
+ "prop": "rdf:object",
178
+ "key": "object",
179
+ "value": "bark"
180
+ },
181
+ {
182
+ "prop": "mgx:createdAt",
183
+ "key": "createdAt",
184
+ "value": "<timestamp>"
185
+ },
186
+ {
187
+ "prop": "mgx:factProvenance",
188
+ "key": "provenance",
189
+ "value": "corpus:human /r/CapableOf"
190
+ },
191
+ {
192
+ "prop": "mgx:hasProseTokens",
193
+ "key": "prose_tokens",
194
+ "value": "bark capableof dog mgx"
195
+ },
196
+ {
197
+ "prop": "mgx:trustScore",
198
+ "key": "trustScore",
199
+ "value": "0.7"
200
+ },
201
+ {
202
+ "prop": "mgx:trustInputs",
203
+ "key": "trustInputs",
204
+ "value": {
205
+ "sourceTypes": [
206
+ "corpus"
207
+ ],
208
+ "corroboration": 1,
209
+ "createdAt": "<timestamp>",
210
+ "recency": 1
211
+ }
212
+ },
213
+ {
214
+ "prop": "mgx:updatedAt",
215
+ "key": "updatedAt",
216
+ "value": "<timestamp>"
217
+ }
218
+ ]
219
+ }
220
+
221
+ {
222
+ "id": "fact:08d02295fc0fed1c",
223
+ "label": "dog rdfs:subClassOf animal",
224
+ "class": "Fact",
225
+ "derived_from": [],
226
+ "mentions": [],
227
+ "attributes": [
228
+ {
229
+ "prop": "rdf:type",
230
+ "key": "type",
231
+ "value": "rdf:Statement"
232
+ },
233
+ {
234
+ "prop": "rdf:subject",
235
+ "key": "subject",
236
+ "value": "dog"
237
+ },
238
+ {
239
+ "prop": "rdf:predicate",
240
+ "key": "predicate",
241
+ "value": "rdfs:subClassOf"
242
+ },
243
+ {
244
+ "prop": "rdf:object",
245
+ "key": "object",
246
+ "value": "animal"
247
+ },
248
+ {
249
+ "prop": "mgx:createdAt",
250
+ "key": "createdAt",
251
+ "value": "<timestamp>"
252
+ },
253
+ {
254
+ "prop": "mgx:factProvenance",
255
+ "key": "provenance",
256
+ "value": "corpus:human /r/IsA"
257
+ },
258
+ {
259
+ "prop": "mgx:hasProseTokens",
260
+ "key": "prose_tokens",
261
+ "value": "animal dog rdfs subclassof"
262
+ },
263
+ {
264
+ "prop": "mgx:trustScore",
265
+ "key": "trustScore",
266
+ "value": "0.7"
267
+ },
268
+ {
269
+ "prop": "mgx:trustInputs",
270
+ "key": "trustInputs",
271
+ "value": {
272
+ "sourceTypes": [
273
+ "corpus"
274
+ ],
275
+ "corroboration": 1,
276
+ "createdAt": "<timestamp>",
277
+ "recency": 1
278
+ }
279
+ },
280
+ {
281
+ "prop": "mgx:updatedAt",
282
+ "key": "updatedAt",
283
+ "value": "<timestamp>"
284
+ }
285
+ ]
286
+ }
287
+ ```
288
+
289
+ Every attribute value here is a plain string except `mgx:trustInputs`, which
290
+ is `JSON.stringify`'d into its `value` field in the actual store (parsed back
291
+ out above for readability) since the flat attribute list has nowhere else to
292
+ put a nested object. `mgx:trustScore` is computed from exactly those inputs —
293
+ source type, corroboration count, recency — never guessed.
294
+
133
295
  Point it at a codebase's graph and the same engine answers structural questions.
134
296
  `examples/mini-webapp` ships in this repo, so this runs as written:
135
297
 
@@ -145,8 +307,8 @@ tmct> /exit
145
307
  **[Try it live in your browser →](https://tmct.polycode.co.uk/)**
146
308
  runs the actual query engine client-side. No server, no install. The landing
147
309
  page answers codebase questions live, and eight more pages each ground their
148
- own domain: a full chat seeded with 32,646 facts (the same nine bands as
149
- `npm run init:xl`, capped to a 38.7 MB download, 2.1 MB on the wire), the
310
+ own domain: a full chat seeded with 72,098 facts (the same nine bands as
311
+ `npm run init:xl`, uncapped, 4.4 MB on the wire), the
150
312
  **memory ledger** (every fact as a readable sentence; drill by clicking the
151
313
  terms inside), and the **code explorer** (the same ledger UI refocused on a
152
314
  code graph, with a hint rail of suggested next questions). An **ingest
@@ -897,13 +1059,19 @@ once with `tmct init --memory-backend <...>` and every later `tmct chat` in that
897
1059
  repo picks it up with no flag needed.
898
1060
  ```
899
1061
 
900
- `npm run init:large` in `package.json` chains one `init` and five `import --corpus`
1062
+ `npm run init` in `package.json` chains one `init` and five `import --corpus`
901
1063
  calls to combine every shipped bundle (human persona + seon + conceptnet +
902
- aws/python/java) into ~7,380 facts on the default sqlite backend, a working
903
- example to copy from. `init:xl` starts from the large persona tier and adds
904
- the wordnet-xl corpus (~72,000 facts); `init:xxl` swaps wordnet-xl for the
905
- full WordNet slice plus namenet (~239,000 facts, the biggest committed
906
- vocabulary, so expect its imports to take a minute). The xl chain, spelled out:
1064
+ aws/python/java) into ~37,800 facts on the default sqlite backend, a working
1065
+ example to copy from (`init:large` is now just an alias for it). `npm run
1066
+ init:small` is the lighter variant: a bare `tmct init`, default persona only,
1067
+ no big corpora, 688 facts. It's what a first `npm run chat` in an
1068
+ uninitialized repo bootstraps automatically, so no init command is required
1069
+ just to start talking; running `init:small` explicitly (after `rm -rf
1070
+ tmct.toml .tmct`) gets you back to that same minimal state on purpose.
1071
+ `init:xl` starts from the large persona tier and adds the wordnet-xl corpus
1072
+ (~72,000 facts); `init:xxl` swaps wordnet-xl for the full WordNet slice plus
1073
+ namenet (~239,000 facts, the biggest committed vocabulary, so expect its
1074
+ imports to take a minute). The xl chain, spelled out:
907
1075
 
908
1076
  ```bash e2e heavy
909
1077
  npx tmct init --persona-size large # npm run init:xl runs this whole chain from a clone
@@ -1100,7 +1268,7 @@ loads a repo's graph into a `{ dispatch, resolve, graph }` context,
1100
1268
 
1101
1269
  ## The tool surface
1102
1270
 
1103
- Everything above runs on the same 25 tools. Each one is read-only, answers one question in a single call, and returns bounded output. None of them calls a model. A tool that cannot ground an answer says so — the same honest miss you get everywhere else in tmct.
1271
+ Everything above runs on the same 26 tools. Each one is read-only, answers one question in a single call, and returns bounded output. None of them calls a model. A tool that cannot ground an answer says so — the same honest miss you get everywhere else in tmct.
1104
1272
 
1105
1273
  Three of them are **hot**: their schemas stay resident, so an agent driving tmct sees them every turn and reaches for one call instead of a Read/Grep loop.
1106
1274
 
@@ -1161,6 +1329,7 @@ The remaining tools are **cold**: still served, but not billed to an agent every
1161
1329
  | `tmct_members` | A class's methods + attributes (file:line, decorators) in one slice. | `class` (required) |
1162
1330
  | `tmct_subclasses` | A class's base classes plus the transitive set of classes that extend it. | `class` (required) |
1163
1331
  | `tmct_related` | A term's synonyms (skos:altLabel) and related concepts (skos:related), from the memory graph's relation facts. | `term` (required) |
1332
+ | `tmct_sprite` | The sprite markup for a class, resolved up the taught rdfs:subClassOf chain — with the expression and size asked for, and the ancestor chain the resolver walked to find it. | `class` (required), `expression`, `size` |
1164
1333
  | `tmct_architecture` | Package/module map + the most-imported hub modules (optionally scoped to a package). | `package` |
1165
1334
  | `tmct_exports` | A module's public __all__ surface, each name resolved to the module that defines it. | `module` (required) |
1166
1335
  | `tmct_tests_for` | The test modules covering a symbol or module, from the typed test edges. | `symbol` (required) |
Binary file
@@ -9,29 +9,29 @@
9
9
  },
10
10
  "built": "2026-07-18",
11
11
  "counts": {
12
- "articles": 3887,
12
+ "articles": 3888,
13
13
  "aliases": 337,
14
14
  "shards": 64
15
15
  },
16
16
  "budgets": {
17
17
  "textBytes": {
18
- "used": 2591481,
18
+ "used": 2591621,
19
19
  "max": 10485760
20
20
  },
21
21
  "shardsGzBytes": {
22
- "used": 1223112,
22
+ "used": 1223319,
23
23
  "max": 3670016
24
24
  },
25
25
  "indexGzBytes": {
26
- "used": 55502,
26
+ "used": 55514,
27
27
  "max": 614400
28
28
  }
29
29
  },
30
30
  "files": [
31
31
  {
32
32
  "file": "index.json.gz",
33
- "bytes": 55502,
34
- "sha256": "3d66d7e464228950ab630dcc97a032b662aefaaaac79cdce1bb44232b4797d99"
33
+ "bytes": 55514,
34
+ "sha256": "3c7812b454707e9b9208c8dfb7f482632d46ce4fa2ca4eab7cda488957c29577"
35
35
  },
36
36
  {
37
37
  "file": "LICENSE-NOTICE",
@@ -45,8 +45,8 @@
45
45
  },
46
46
  {
47
47
  "file": "shards/ref-00.jsonl.gz",
48
- "bytes": 17728,
49
- "sha256": "424b91143053c5bc9832b26f964bddb980d2ecd1775042620590d8fa088a969b"
48
+ "bytes": 17935,
49
+ "sha256": "20098111783f9b3b5a0de00c7545589d057a4984b75cbba69d922e19b4f6310f"
50
50
  },
51
51
  {
52
52
  "file": "shards/ref-01.jsonl.gz",