@polycode-projects/the-mechanical-code-talker 6.0.19 → 6.0.21
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 +20 -23
- package/bin/tmct.mjs +16 -33
- package/corpus/LICENSES.json +0 -21
- package/corpus/README.md +10 -13
- package/corpus/reference/manifest.json +19 -19
- package/corpus/reference/shards/ref-01.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-04.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-08.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-10.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-11.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-17.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-20.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-25.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-2c.jsonl.gz +0 -0
- package/corpus/tier2/generate.mjs +6 -142
- package/corpus/tier2/manifest.json +0 -42
- package/package.json +4 -4
- package/src/adapters/corpus/child-seed.mjs +74 -0
- package/src/adapters/corpus/conceptnet.mjs +45 -26
- package/src/adapters/memory/blocks.mjs +7 -1
- package/src/adapters/memory/core.mjs +453 -103
- package/src/adapters/memory/corpus-bands.mjs +33 -10
- package/src/adapters/memory/inspect.mjs +24 -5
- package/src/adapters/memory/rows.mjs +106 -9
- package/src/adapters/memory/shacl.mjs +10 -3
- package/src/domain/ask.mjs +27 -10
- package/src/domain/cli-verbs.mjs +3 -4
- package/src/domain/completions/group.mjs +8 -3
- package/src/domain/completions/infer.mjs +7 -2
- package/src/domain/completions/prune.mjs +5 -1
- package/src/domain/completions/rank.mjs +7 -2
- package/src/domain/digest/compose.mjs +5 -1
- package/src/domain/digest/select.mjs +12 -6
- package/src/domain/domain.mjs +15 -8
- package/src/domain/el-classify.mjs +11 -2
- package/src/domain/fact-phrase.mjs +86 -4
- package/src/domain/hash.mjs +9 -0
- package/src/domain/memory/bias.mjs +8 -4
- package/src/domain/memory/capability.mjs +12 -6
- package/src/domain/memory/fact-order.mjs +29 -0
- package/src/domain/memory/resolution.mjs +3 -0
- package/src/domain/news-feed.mjs +422 -56
- package/src/domain/reference-pack.mjs +5 -0
- package/src/domain/sense-scope.mjs +116 -0
- package/src/domain/sense-split.mjs +1 -1
- package/src/domain/syllogise.mjs +21 -13
- package/src/domain/tableau.mjs +23 -14
- package/src/domain/worlds-pack.mjs +5 -1
- package/src/services/adventure-autoplay.mjs +6 -1
- package/src/services/adventure-editor.mjs +43 -21
- package/src/services/adventure-viz.mjs +26 -9
- package/src/services/adventure.mjs +40 -10
- package/src/services/chat.mjs +253 -113
- package/src/services/extensions.mjs +51 -58
- package/src/services/extract-facts.mjs +670 -95
- package/src/services/init.mjs +4 -4
- package/src/services/ledger-viz.mjs +9 -4
- package/src/services/memory-panel-viz.mjs +4 -5
- package/src/services/mud-editor.mjs +40 -16
- package/src/services/mud-viz.mjs +8 -2
- package/src/services/mudiii-turn.mjs +5 -3
- package/src/services/mudiii-viz.mjs +8 -2
- package/src/services/news.mjs +277 -11
- package/src/services/research-viz.mjs +1 -1
- package/src/services/sprite-catalog-viz.mjs +10 -5
- package/src/surfaces/web/adventure-browser-entry.mjs +6 -12
- package/src/surfaces/web/memory-ask-browser.bundle.js +152 -151
- package/src/surfaces/web/mud-browser-entry.mjs +7 -11
- package/src/surfaces/web/research-browser-entry.mjs +5 -2
- package/corpus/tier2/aws.jsonl +0 -39
- package/corpus/tier2/java.jsonl +0 -31
- package/corpus/tier2/python.jsonl +0 -30
|
@@ -761,18 +761,26 @@ function rulingTestimonyClaim(provenance, knower, currentEpoch = 0) {
|
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
/** What `person` knows about NOW: the object of every knows-about edge whose
|
|
764
|
-
* ruling claim still stands,
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
*
|
|
764
|
+
* ruling claim still stands, oldest learned first. Nothing is deleted — an edge
|
|
765
|
+
* whose newest claim says the thing is gone just stops reading back.
|
|
766
|
+
* `currentEpoch` is the run the reader is on, so a claim a recast has left
|
|
767
|
+
* behind cannot decide what a character knows today.
|
|
768
|
+
*
|
|
769
|
+
* The order comes off each edge's own ruling claim rather than off the row
|
|
770
|
+
* array, so it says what it means: a character lists what it learned in the
|
|
771
|
+
* order it learned it, and two peers holding one fact set read the same list.
|
|
772
|
+
* Two topics learned on one turn fall back to the topic word. */
|
|
768
773
|
function currentKnowsAboutTopics(rows, person, currentEpoch = 0) {
|
|
769
|
-
const
|
|
774
|
+
const known = [];
|
|
770
775
|
for (const row of rows || []) {
|
|
771
776
|
if (row.subject !== person || row.predicate !== KNOWS_ABOUT_PREDICATE) continue;
|
|
772
|
-
|
|
773
|
-
|
|
777
|
+
const claim = rulingTestimonyClaim(row.provenance, person, currentEpoch);
|
|
778
|
+
if (claim?.voided) continue;
|
|
779
|
+
known.push({ topic: row.object, epoch: claim?.epoch ?? 0, turn: claim?.turn ?? 0 });
|
|
774
780
|
}
|
|
775
|
-
|
|
781
|
+
known.sort((a, b) => a.epoch - b.epoch || a.turn - b.turn
|
|
782
|
+
|| (a.topic < b.topic ? -1 : a.topic > b.topic ? 1 : 0));
|
|
783
|
+
return known.map((entry) => entry.topic);
|
|
776
784
|
}
|
|
777
785
|
|
|
778
786
|
/**
|
|
@@ -1223,12 +1231,34 @@ export function freshObjectId(rows, kind, alsoTaken = new Set()) {
|
|
|
1223
1231
|
}
|
|
1224
1232
|
|
|
1225
1233
|
/** The kinds a room kind declares for one of the spawn pools, in the order the
|
|
1226
|
-
*
|
|
1234
|
+
* fold hands them over, or `fallback` when it declares none. A pool is a set of
|
|
1235
|
+
* rows, not a list, so the store keeps no rank between them and the order is
|
|
1236
|
+
* the fold's content order rather than the order the world file lists them in.
|
|
1237
|
+
* A caller that shows the whole pool can read it as it stands; one that takes
|
|
1238
|
+
* only part of it wants preferredDigKinds below. Pure. */
|
|
1227
1239
|
function declaredKindsOr(rows, roomClass, predicate, fallback) {
|
|
1228
1240
|
const declared = factObjects(rows, roomClass, predicate);
|
|
1229
1241
|
return declared.length ? declared : fallback;
|
|
1230
1242
|
}
|
|
1231
1243
|
|
|
1244
|
+
/** A dig pool ranked by what a dig should turn up first: the engine's own
|
|
1245
|
+
* DIG_SPAWN_KINDS order, then content order for a kind it does not name.
|
|
1246
|
+
*
|
|
1247
|
+
* A den shows everything it holds, so its pool needs no rank. A plain dig takes
|
|
1248
|
+
* the first few, so which few it takes is a real choice — and the fact store
|
|
1249
|
+
* holds the pool as a set, with no rank to read. Leaving it to the fold's own
|
|
1250
|
+
* order would decide it alphabetically, which puts a kind the world already
|
|
1251
|
+
* keeps as one hand-named prop ahead of one minted only by digging, and the
|
|
1252
|
+
* point of a minted id is that it names something a hand-authored prop does
|
|
1253
|
+
* not. Pure. */
|
|
1254
|
+
function preferredDigKinds(kinds) {
|
|
1255
|
+
const rank = (kind) => {
|
|
1256
|
+
const at = DIG_SPAWN_KINDS.indexOf(kind);
|
|
1257
|
+
return at < 0 ? DIG_SPAWN_KINDS.length : at;
|
|
1258
|
+
};
|
|
1259
|
+
return kinds.slice().sort((a, b) => rank(a) - rank(b) || (a < b ? -1 : a > b ? 1 : 0));
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1232
1262
|
/** The mass row a freshly minted instance needs, copied off its own class, or
|
|
1233
1263
|
* nothing when the class declares no mass. eat reads the instance's mass, so a
|
|
1234
1264
|
* dug carrot with none would be worth the flat default however the world
|
|
@@ -1499,7 +1529,7 @@ async function handleDigVerb(ctx) {
|
|
|
1499
1529
|
const spawnCount = DIG_SPAWN_MIN + stableIndex(dug, spawnMax - DIG_SPAWN_MIN + 1);
|
|
1500
1530
|
const spawnedKinds = isDen
|
|
1501
1531
|
? declaredKindsOr(rows, dugKind, DEN_SPAWN_PREDICATE, DIG_SPAWN_KINDS)
|
|
1502
|
-
: declaredKindsOr(rows, dugKind, DIG_SPAWN_PREDICATE, DIG_SPAWN_KINDS).slice(0, spawnCount);
|
|
1532
|
+
: preferredDigKinds(declaredKindsOr(rows, dugKind, DIG_SPAWN_PREDICATE, DIG_SPAWN_KINDS)).slice(0, spawnCount);
|
|
1503
1533
|
const minted = new Set();
|
|
1504
1534
|
const spawned = spawnedKinds.map((kind) => {
|
|
1505
1535
|
const id = freshObjectId(rows, kind, minted);
|