@polycode-projects/the-mechanical-code-talker 2.6.1 → 2.7.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 +46 -1
- package/corpus/LICENSES.json +14 -0
- package/corpus/child/LICENSE-NOTICE +43 -0
- package/corpus/child/README.md +79 -0
- package/corpus/child/index.json.gz +0 -0
- package/corpus/child/manifest.json +313 -0
- package/corpus/child/shards/child-00.jsonl.gz +0 -0
- package/corpus/child/shards/child-01.jsonl.gz +0 -0
- package/corpus/child/shards/child-02.jsonl.gz +0 -0
- package/corpus/child/shards/child-03.jsonl.gz +0 -0
- package/corpus/child/shards/child-04.jsonl.gz +0 -0
- package/corpus/child/shards/child-05.jsonl.gz +0 -0
- package/corpus/child/shards/child-06.jsonl.gz +0 -0
- package/corpus/child/shards/child-07.jsonl.gz +0 -0
- package/corpus/child/shards/child-08.jsonl.gz +0 -0
- package/corpus/child/shards/child-09.jsonl.gz +0 -0
- package/corpus/child/shards/child-0a.jsonl.gz +0 -0
- package/corpus/child/shards/child-0b.jsonl.gz +0 -0
- package/corpus/child/shards/child-0c.jsonl.gz +0 -0
- package/corpus/child/shards/child-0d.jsonl.gz +0 -0
- package/corpus/child/shards/child-0e.jsonl.gz +0 -0
- package/corpus/child/shards/child-0f.jsonl.gz +0 -0
- package/corpus/child/shards/child-10.jsonl.gz +0 -0
- package/corpus/child/shards/child-11.jsonl.gz +0 -0
- package/corpus/child/shards/child-12.jsonl.gz +0 -0
- package/corpus/child/shards/child-13.jsonl.gz +0 -0
- package/corpus/child/shards/child-14.jsonl.gz +0 -0
- package/corpus/child/shards/child-15.jsonl.gz +0 -0
- package/corpus/child/shards/child-16.jsonl.gz +0 -0
- package/corpus/child/shards/child-17.jsonl.gz +0 -0
- package/corpus/child/shards/child-18.jsonl.gz +0 -0
- package/corpus/child/shards/child-19.jsonl.gz +0 -0
- package/corpus/child/shards/child-1a.jsonl.gz +0 -0
- package/corpus/child/shards/child-1b.jsonl.gz +0 -0
- package/corpus/child/shards/child-1c.jsonl.gz +0 -0
- package/corpus/child/shards/child-1d.jsonl.gz +0 -0
- package/corpus/child/shards/child-1e.jsonl.gz +0 -0
- package/corpus/child/shards/child-1f.jsonl.gz +0 -0
- package/corpus/conceptnet/child-seed.mjs +169 -0
- package/corpus/conceptnet/filter-dump.mjs +69 -48
- package/corpus/worlds/README.md +26 -0
- package/corpus/worlds/index.json.gz +0 -0
- package/corpus/worlds/manifest.json +33 -0
- package/corpus/worlds/shards/ashcombe-hall.jsonl.gz +0 -0
- package/corpus/worlds/src/ashcombe-hall.jsonl +64 -0
- package/package.json +4 -1
- package/src/adapters/corpus/child-pack.mjs +115 -0
- package/src/adapters/corpus/conceptnet-map.toml +7 -0
- package/src/adapters/corpus/worlds-pack.mjs +122 -0
- package/src/domain/ask-vocab.mjs +10 -2
- package/src/domain/ask.mjs +6 -0
- package/src/domain/child-pack.mjs +79 -0
- package/src/domain/grammar/ace.mjs +77 -0
- package/src/domain/grammar/lexicon-core.json +6 -0
- package/src/domain/interpret/normalize.mjs +32 -8
- package/src/domain/memory/trust.mjs +17 -0
- package/src/domain/worlds-pack.mjs +71 -0
- package/src/services/adventure.mjs +718 -0
- package/src/services/chat.mjs +137 -31
- package/src/surfaces/web/memory-ask-browser.bundle.js +555 -46
- package/src/tools/definitions.mjs +2 -2
|
@@ -673,12 +673,17 @@
|
|
|
673
673
|
"symbols"
|
|
674
674
|
]);
|
|
675
675
|
BOOLEAN_CONNECTIVES = Object.freeze({
|
|
676
|
+
"but do not": "difference",
|
|
677
|
+
"but does not": "difference",
|
|
678
|
+
"and do not": "difference",
|
|
679
|
+
"and does not": "difference",
|
|
676
680
|
"but not": "difference",
|
|
677
681
|
"and not": "difference",
|
|
678
682
|
"except": "difference",
|
|
679
683
|
"without": "difference",
|
|
680
684
|
"and": "intersection",
|
|
681
685
|
"plus": "intersection",
|
|
686
|
+
"but": "intersection",
|
|
682
687
|
"or": "union"
|
|
683
688
|
});
|
|
684
689
|
QUALIFIERS = Object.freeze({
|
|
@@ -945,9 +950,9 @@
|
|
|
945
950
|
const layer = layers[name];
|
|
946
951
|
if (!layer || typeof layer !== "object") continue;
|
|
947
952
|
const posting = layer[t];
|
|
948
|
-
const
|
|
949
|
-
if (!
|
|
950
|
-
for (const id of
|
|
953
|
+
const list2 = Array.isArray(posting) ? posting : Array.isArray(posting?.ids) ? posting.ids : null;
|
|
954
|
+
if (!list2?.length) continue;
|
|
955
|
+
for (const id of list2) ids.add(id);
|
|
951
956
|
via.add(name);
|
|
952
957
|
}
|
|
953
958
|
return ids.size ? { ids: [...ids].sort(), via: [...via].sort().join("+") } : empty;
|
|
@@ -984,6 +989,8 @@
|
|
|
984
989
|
const head = t.split(/\s+/)[0];
|
|
985
990
|
if (head.startsWith("corpus-weak:")) return { kind: "corpusWeak", name: head.slice("corpus-weak:".length) || "unknown" };
|
|
986
991
|
if (head.startsWith("corpus:")) return { kind: "corpus", name: head.slice("corpus:".length) || "unknown" };
|
|
992
|
+
if (head.startsWith("child:")) return { kind: "corpus", name: head.slice("child:".length).split(":")[0] || "unknown" };
|
|
993
|
+
if (head.startsWith("world:")) return { kind: "corpus", name: head.slice("world:".length).split(":")[0] || "unknown" };
|
|
987
994
|
if (head.startsWith("ace:")) return { kind: "operator", ...parseChatTagRest(head.slice("ace:".length)) };
|
|
988
995
|
if (head.startsWith("teach:")) {
|
|
989
996
|
return { kind: "teach", ...parseChatTagRest(head.slice("teach:".length)) };
|
|
@@ -1331,8 +1338,8 @@
|
|
|
1331
1338
|
return lines.join("\n");
|
|
1332
1339
|
}
|
|
1333
1340
|
function truncationNote(graph) {
|
|
1334
|
-
const
|
|
1335
|
-
return `note: partial edge lists for: ${
|
|
1341
|
+
const list2 = graph.truncated.map((t) => `${t.predicate} (${t.shown}/${t.count})`).join(", ");
|
|
1342
|
+
return `note: partial edge lists for: ${list2}. Counts are complete; the lists are not.`;
|
|
1336
1343
|
}
|
|
1337
1344
|
function impactClosure(graph, ind, { maxDepth = 8 } = {}) {
|
|
1338
1345
|
const dependents = /* @__PURE__ */ new Map();
|
|
@@ -2532,9 +2539,9 @@ ${shown.join("\n")}${tail}`;
|
|
|
2532
2539
|
const modLabel = graph.byId.get(modId)?.label || modId;
|
|
2533
2540
|
const hits = cochangeNeighbours(graph, modId);
|
|
2534
2541
|
if (!hits.length) return `${modLabel}: no change-coupling recorded (rarely co-committed, or outside the git-log window).`;
|
|
2535
|
-
const
|
|
2542
|
+
const list2 = hits.slice(0, COCHANGE_CAP).map((h) => `${h.label} (\xD7${h.weight})`);
|
|
2536
2543
|
return `${modLabel} \u2014 usually changes together with ${hits.length} module(s) (edit these too):
|
|
2537
|
-
${
|
|
2544
|
+
${list2.join("\n ")}` + (hits.length > COCHANGE_CAP ? `
|
|
2538
2545
|
\u2026+${hits.length - COCHANGE_CAP} more` : "");
|
|
2539
2546
|
}
|
|
2540
2547
|
function renderExports(graph, ind) {
|
|
@@ -2543,14 +2550,14 @@ ${shown.join("\n")}${tail}`;
|
|
|
2543
2550
|
const modLabel = graph.byId.get(modId)?.label || modId;
|
|
2544
2551
|
const edges = edgesOfKind(graph, "reexports").filter((e) => e.subject === modId);
|
|
2545
2552
|
if (!edges.length) return `${modLabel}: no public exports recorded (no export list / __all__ found, or none resolved).`;
|
|
2546
|
-
const
|
|
2553
|
+
const list2 = edges.slice(0, EXPORTS_CAP).map((e) => {
|
|
2547
2554
|
const origin = graph.byId.get(e.object);
|
|
2548
2555
|
const where = origin ? siteOf(origin) : null;
|
|
2549
2556
|
const from = where ? ` \u2190 ${where.path}` : "";
|
|
2550
2557
|
return `${e.objectLabel || e.object}${from}`;
|
|
2551
2558
|
});
|
|
2552
2559
|
return `${modLabel} \u2014 public API (${edges.length} export(s)):
|
|
2553
|
-
${
|
|
2560
|
+
${list2.join("\n ")}` + (edges.length > EXPORTS_CAP ? `
|
|
2554
2561
|
\u2026+${edges.length - EXPORTS_CAP} more` : "");
|
|
2555
2562
|
}
|
|
2556
2563
|
var PROP_KIND, isProvRef, DESCRIBE_EDGE_CAP, PROV_CAP, IMPACT_DEPTHS_LISTED, IMPACT_PER_DEPTH, IMPACT_TESTS_PER_DEP, SEARCH_LIMIT, SEARCH_SYMBOLS_SHOWN, PATH_W, SYM_W, EXACT_W, SYM_MATCH_CAP, PROX_FRAC, PROX_CAP_FRAC, NONPROD_DEMOTE, isNonProdLabel, CALL_PROX_FRAC, CALL_PROX_CAP_FRAC, IMPL_PROX_FRAC, IMPL_PROX_CAP_FRAC, isCsModuleLabel, looksLikeCsInterface, PROSE_PROX_FRAC, PROSE_PROX_CAP_FRAC, PROSE_LOOKUP_LIMIT, PROSE_LAYER_FRAC, PROSE_LAYER_CAP_FRAC, PROSE_LAYER_DISCOUNT, LIT_W, LIT_MIN_COMPONENTS, LIT_COMP_CAP, LIT_FRAC, LIT_CAP_FRAC, BEAM_MARGIN_FRAC, BEAM_PROX_FRAC, BEAM_PROX_CAP_FRAC, BEAM_OVERFLOW_CAP, BEAM_PLIES, BEAM_EDGE_GROUPS, SPIRAL_DEPTH_DEFAULT, SPIRAL_NODE_LIMIT_DEFAULT, SPIRAL_Q_DEFAULT, SPIRAL_EXPAND_KINDS, SPIRAL_EMIT_FRAC, SPIRAL_HOP_DECAY, SPIRAL_PROX_FRAC, SPIRAL_PROX_CAP_FRAC, NAME_PATTERN_MAX_LENGTH, NAME_PATTERN_MAX_QUANTIFIERS, NAME_MATCH_MAX_LABEL, NAME_MATCH_BUDGET_MS, NameFilterBudgetExceeded, edgesOfKindCache, MEMBERS_CAP, SUBCLASS_CAP, CALL_CAP, attrVal, ARCH_PKG_CAP, ARCH_HUB_CAP, COVERAGE_CAP, TESTS_GRAIN_NOTE, HISTORY_CAP, CALL_SYMBOL_CLASSES, CALL_HINT_CAP, SYMBOL_CLASSES, CONTEXT_SIBLING_CAP, CLASS_MEMBER_CAP, COCHANGE_MID_CAP, CONTEXT_TESTS_CAP, TINY_MAX_LOC, TINY_MAX_ARITY, LARGE_CLASS_MEMBERS, INLINE_CALLEE_CAP, splitDecs, tokenize, countParams, modeOf, COCHANGE_CAP, EXPORTS_CAP;
|
|
@@ -2751,9 +2758,12 @@ ${shown.join("\n")}${tail}`;
|
|
|
2751
2758
|
function applySubordinationFrames(text) {
|
|
2752
2759
|
let q = String(text || "");
|
|
2753
2760
|
for (let pass = 0; pass < 3; pass++) {
|
|
2754
|
-
const
|
|
2755
|
-
|
|
2756
|
-
q = m[1].trim();
|
|
2761
|
+
const before = q;
|
|
2762
|
+
let m = q.match(SUBORDINATION_FRAMES_RE);
|
|
2763
|
+
if (m) q = m[1].trim();
|
|
2764
|
+
m = q.match(TRAILING_SUBORDINATION_RE);
|
|
2765
|
+
if (m) q = m[1].trim();
|
|
2766
|
+
if (q === before) break;
|
|
2757
2767
|
}
|
|
2758
2768
|
return q;
|
|
2759
2769
|
}
|
|
@@ -2798,6 +2808,7 @@ ${shown.join("\n")}${tail}`;
|
|
|
2798
2808
|
q = applySubordinationFrames(q);
|
|
2799
2809
|
q = applyConditionalFrames(q);
|
|
2800
2810
|
q = stripFillerWords(q);
|
|
2811
|
+
q = stripTrailingDiscourseTag(q);
|
|
2801
2812
|
q = q.replace(/\?{2,}\s*$/, "?");
|
|
2802
2813
|
return q.replace(/\s+/g, " ").trim();
|
|
2803
2814
|
}
|
|
@@ -2823,7 +2834,7 @@ ${shown.join("\n")}${tail}`;
|
|
|
2823
2834
|
if (!predicate) return null;
|
|
2824
2835
|
return { entWord, predicate };
|
|
2825
2836
|
}
|
|
2826
|
-
var tableRe, CONTRACTION_RE, correctionRe, MISSPELLING_RE, WRONG_WORD_RE, W_SLASH_RE, FOR_DIGIT_THANKS_RE, FOR_DIGIT_EXAMPLE_RE, KIND_NOUN_ANAPHORA_RE, VERB_ALTERNATION, FILLER_RE, RELATION_VERB_RE, INTERROGATIVE_LEAD_RE, LISTING_TAIL_KINDS, BARE_KIND_RE, isListingRemainder, GREETING_PREAMBLE_RE, THANKS_PREAMBLE_RE, ACK_PREAMBLE_RE, BROWSING_PREAMBLE_RE, HEDGE_ADVERB_PREAMBLE_RE, TROUBLE_ASIDE_RE, MODAL_WRAPPER_RE, EXPLAIN_WRAPPER_RE, TELL_ME_WRAPPER_RE, KNOW_WRAPPER_RE, WANT_KNOW_WRAPPER_RE, WONDERING_WRAPPER_RE, EMBEDDED_WHATIS_RE, EMBEDDED_MEANS_RE, SHOW_GIVE_ME_RE, LEADING_CONNECTIVE_RE, QUESTION_AUX_LEAD_RE, TOPIC_SWITCH_PREAMBLE_RE, SUBORDINATION_FRAMES_RE, SELF_CORRECTION_RE, CONDITIONAL_VERB_GERUND, CONDITIONAL_KIND_PLURAL, CONDITIONAL_QUALIFIER_SRC, CONDITIONAL_QUALIFIER_RE, COUNTERFACTUAL_RE, WHERE_TRAILING_TEMPORAL_RE, PHRASING_FRAMES, NEGATION_SET_RE, STOPWORDS2, splitWords, wordsOf;
|
|
2837
|
+
var tableRe, CONTRACTION_RE, correctionRe, MISSPELLING_RE, WRONG_WORD_RE, W_SLASH_RE, FOR_DIGIT_THANKS_RE, FOR_DIGIT_EXAMPLE_RE, KIND_NOUN_ANAPHORA_RE, VERB_ALTERNATION, FILLER_RE, RELATION_VERB_RE, INTERROGATIVE_LEAD_RE, LISTING_TAIL_KINDS, BARE_KIND_RE, isListingRemainder, GREETING_PREAMBLE_RE, THANKS_PREAMBLE_RE, ACK_PREAMBLE_RE, BROWSING_PREAMBLE_RE, HEDGE_ADVERB_PREAMBLE_RE, TROUBLE_ASIDE_RE, MODAL_WRAPPER_RE, EXPLAIN_WRAPPER_RE, TELL_ME_WRAPPER_RE, KNOW_WRAPPER_RE, WANT_KNOW_WRAPPER_RE, WONDERING_WRAPPER_RE, EMBEDDED_WHATIS_RE, EMBEDDED_MEANS_RE, SHOW_GIVE_ME_RE, LEADING_CONNECTIVE_RE, QUESTION_AUX_LEAD_RE, TOPIC_SWITCH_PREAMBLE_RE, SUBORDINATION_FRAMES_RE, TRAILING_SUBORDINATION_RE, SELF_CORRECTION_RE, CONDITIONAL_VERB_GERUND, CONDITIONAL_KIND_PLURAL, CONDITIONAL_QUALIFIER_SRC, CONDITIONAL_QUALIFIER_RE, COUNTERFACTUAL_RE, WHERE_TRAILING_TEMPORAL_RE, PHRASING_FRAMES, NEGATION_SET_RE, STOPWORDS2, splitWords, wordsOf;
|
|
2827
2838
|
var init_normalize = __esm({
|
|
2828
2839
|
"src/domain/interpret/normalize.mjs"() {
|
|
2829
2840
|
init_ask_vocab();
|
|
@@ -2892,7 +2903,8 @@ ${shown.join("\n")}${tail}`;
|
|
|
2892
2903
|
LEADING_CONNECTIVE_RE = /^(?:and|also|so|then|now|but)\s+(.+)$/i;
|
|
2893
2904
|
QUESTION_AUX_LEAD_RE = /^(?:does|do|did|is|are|was|were|has|have|had|can|could|will|would|should)\b/i;
|
|
2894
2905
|
TOPIC_SWITCH_PREAMBLE_RE = /^(?:(?:actually|no\s+wait|wait|hold\s+on|never\s+mind|scratch\s+that|on\s+second\s+thought|i\s+mean(?:t)?)[\s,.]+)+(.+)$/i;
|
|
2895
|
-
SUBORDINATION_FRAMES_RE = /^(?:since|although|though|while|because|whereas|given\s+that|now\s+that)\s+.+?,\s*(.+)$/i;
|
|
2906
|
+
SUBORDINATION_FRAMES_RE = /^(?:since|although|(?:even\s+)?though|while|because|whereas|given\s+that|now\s+that)\s+.+?,\s*(.+)$/i;
|
|
2907
|
+
TRAILING_SUBORDINATION_RE = /^(.+?),\s*(?:since|although|(?:even\s+)?though|while|because|whereas|given\s+that|now\s+that)\s+.+$/i;
|
|
2896
2908
|
SELF_CORRECTION_RE = /^.+?(?:\s*(?:--|—|-)\s*)?\b(?:sorry|i\s+mean)\b\s*(?:--|—|-|,|:)\s*(.+)$/i;
|
|
2897
2909
|
CONDITIONAL_VERB_GERUND = Object.freeze({
|
|
2898
2910
|
imports: "importing",
|
|
@@ -2991,6 +3003,10 @@ ${shown.join("\n")}${tail}`;
|
|
|
2991
3003
|
// CO-CHANGE → "what co-changes with X" (the plainest phrasing a developer types).
|
|
2992
3004
|
{ re: /^what\s+does\s+(.+?)\s+changes?\s+together\s+with\??$/i, to: (m) => `what co-changes with ${m[1]}` },
|
|
2993
3005
|
{ re: /^what\s+changes?\s+together\s+with\s+(.+?)\??$/i, to: (m) => `what co-changes with ${m[1]}` },
|
|
3006
|
+
// COMMIT-COUNT PASSIVE ("how many commits are recorded for X") → the touch
|
|
3007
|
+
// phrasing the count restrictor already compiles. "recorded" is no relation
|
|
3008
|
+
// verb, so the passive otherwise dies in the restrictor parse.
|
|
3009
|
+
{ re: /^how\s+many\s+commits\s+(?:are|were)\s+(?:recorded|logged)\s+(?:for|against)\s+(?:the\s+)?(.+?)\??$/i, to: (m) => `how many commits touched ${m[1]}` },
|
|
2994
3010
|
// AUTHORSHIP → "who touched X" (tmct's touch edge IS the authorship signal).
|
|
2995
3011
|
// A commit sha object is excluded — that dumps the commit's touch-set, not its author.
|
|
2996
3012
|
{ re: /^who\s+(?:wrote|authored)\s+(?:the\s+)?(?!(?:commit\s+)?[0-9a-f]{7,40}\??$)(.+?)\??$/i, to: (m) => `who touched ${m[1]}` },
|
|
@@ -3907,6 +3923,7 @@ ${shown.join("\n")}${tail}`;
|
|
|
3907
3923
|
if (!noun) continue;
|
|
3908
3924
|
const head = w.slice(0, r - 1);
|
|
3909
3925
|
if (!head.length) continue;
|
|
3926
|
+
if (head.every((x) => QUALIFIERS[x.toLowerCase()])) continue;
|
|
3910
3927
|
const outer = parseSimpleClause([...head, NEST_SENTINEL].join(" "), nlp);
|
|
3911
3928
|
if (!outer || outer.shape !== "reverse" && outer.shape !== "forward") continue;
|
|
3912
3929
|
if (outer.modifier && outer.modifier !== "direct") continue;
|
|
@@ -4855,7 +4872,7 @@ ${shown.join("\n")}${tail}`;
|
|
|
4855
4872
|
items = items.filter((ind) => ok.has(ind.id));
|
|
4856
4873
|
}
|
|
4857
4874
|
}
|
|
4858
|
-
const sameClass = (
|
|
4875
|
+
const sameClass = (list2) => list2.length && list2.every((x) => x.class === list2[0].class) ? list2[0].class : null;
|
|
4859
4876
|
const common = items.length ? sameClass(items) : sameClass(baseItems);
|
|
4860
4877
|
if (ast.mode === "count") return { compositeKind: "count", count: items.length, entityType: common, matches: [] };
|
|
4861
4878
|
return { compositeKind: "set", matches: items, entityType: common };
|
|
@@ -6341,8 +6358,8 @@ ${branches.map((b, i) => `${i + 1}) ${b.candidate.label}: ${b.rendered.content}`
|
|
|
6341
6358
|
byModule.get(mod).push(symbolLabelOf(m));
|
|
6342
6359
|
}
|
|
6343
6360
|
const clauses = [...byModule.entries()].map(([mod, syms], i) => {
|
|
6344
|
-
const
|
|
6345
|
-
return i === 0 ? `in ${mod} there is ${
|
|
6361
|
+
const list2 = listJoin(syms);
|
|
6362
|
+
return i === 0 ? `in ${mod} there is ${list2}` : `there is ${list2} in ${mod}`;
|
|
6346
6363
|
});
|
|
6347
6364
|
const extra = result.matches.length > OVERFLOW_CAP ? ` \u2026and ${result.matches.length - OVERFLOW_CAP} more` : "";
|
|
6348
6365
|
return { content: clauses.join(" and ") + extra + ".", miss: false, ambiguous: false, matches: result.matches };
|
|
@@ -9624,8 +9641,8 @@ ${bodyText}` : graphText, tier });
|
|
|
9624
9641
|
const statedGroup = (payload.objectProperties || []).find((g) => g?.prop === STATED_BY_PROP);
|
|
9625
9642
|
for (const e of statedGroup?.examples || []) {
|
|
9626
9643
|
if (!e?.subject) continue;
|
|
9627
|
-
const
|
|
9628
|
-
if (
|
|
9644
|
+
const list2 = statedByBySubject.get(e.subject);
|
|
9645
|
+
if (list2) list2.push(e.object);
|
|
9629
9646
|
else statedByBySubject.set(e.subject, [e.object]);
|
|
9630
9647
|
}
|
|
9631
9648
|
payload[MEMORY_INDEX] = { individualsById, sourcesById, statedByBySubject };
|
|
@@ -9837,9 +9854,9 @@ ${bodyText}` : graphText, tier });
|
|
|
9837
9854
|
group.examples.push({ ...edge, createdAt });
|
|
9838
9855
|
group.count = group.examples.length;
|
|
9839
9856
|
if (idx) {
|
|
9840
|
-
const
|
|
9841
|
-
if (!
|
|
9842
|
-
idx.statedByBySubject.set(edge.subject,
|
|
9857
|
+
const list2 = idx.statedByBySubject.get(edge.subject) || [];
|
|
9858
|
+
if (!list2.includes(edge.object)) list2.push(edge.object);
|
|
9859
|
+
idx.statedByBySubject.set(edge.subject, list2);
|
|
9843
9860
|
}
|
|
9844
9861
|
}
|
|
9845
9862
|
function recountClasses(payload) {
|
|
@@ -11796,6 +11813,9 @@ ${codeblock}`, options);
|
|
|
11796
11813
|
judge: {},
|
|
11797
11814
|
priest: {},
|
|
11798
11815
|
servant: {},
|
|
11816
|
+
butler: {},
|
|
11817
|
+
housekeeper: {},
|
|
11818
|
+
gardener: {},
|
|
11799
11819
|
employee: {},
|
|
11800
11820
|
boss: {},
|
|
11801
11821
|
husband: {},
|
|
@@ -11850,6 +11870,9 @@ ${codeblock}`, options);
|
|
|
11850
11870
|
dress: {},
|
|
11851
11871
|
clothing: {},
|
|
11852
11872
|
chair: {},
|
|
11873
|
+
desk: {},
|
|
11874
|
+
lamp: {},
|
|
11875
|
+
portrait: {},
|
|
11853
11876
|
bed: {},
|
|
11854
11877
|
door: {},
|
|
11855
11878
|
window: {},
|
|
@@ -21595,6 +21618,361 @@ ${codeblock}`, options);
|
|
|
21595
21618
|
}
|
|
21596
21619
|
});
|
|
21597
21620
|
|
|
21621
|
+
// src/domain/grammar/ace.mjs
|
|
21622
|
+
var PATTERN_SUB_CLASS_OF, PATTERN_TYPE_ASSERTION, PATTERN_RELATION, PATTERN_SOME_VALUES_FROM, PATTERN_CARDINALITY, PATTERN_DISJOINT_WITH, PATTERN_POSSESSIVE, PATTERN_ADJECTIVE, PATTERN_CAPABILITY, PATTERNS;
|
|
21623
|
+
var init_ace2 = __esm({
|
|
21624
|
+
"src/domain/grammar/ace.mjs"() {
|
|
21625
|
+
init_lexicon();
|
|
21626
|
+
PATTERN_SUB_CLASS_OF = "subClassOf";
|
|
21627
|
+
PATTERN_TYPE_ASSERTION = "typeAssertion";
|
|
21628
|
+
PATTERN_RELATION = "relation";
|
|
21629
|
+
PATTERN_SOME_VALUES_FROM = "someValuesFrom";
|
|
21630
|
+
PATTERN_CARDINALITY = "cardinality";
|
|
21631
|
+
PATTERN_DISJOINT_WITH = "disjointWith";
|
|
21632
|
+
PATTERN_POSSESSIVE = "possessive";
|
|
21633
|
+
PATTERN_ADJECTIVE = "adjective";
|
|
21634
|
+
PATTERN_CAPABILITY = "capability";
|
|
21635
|
+
PATTERNS = Object.freeze([
|
|
21636
|
+
PATTERN_SUB_CLASS_OF,
|
|
21637
|
+
PATTERN_TYPE_ASSERTION,
|
|
21638
|
+
PATTERN_RELATION,
|
|
21639
|
+
PATTERN_SOME_VALUES_FROM,
|
|
21640
|
+
PATTERN_CARDINALITY,
|
|
21641
|
+
PATTERN_DISJOINT_WITH,
|
|
21642
|
+
PATTERN_POSSESSIVE,
|
|
21643
|
+
PATTERN_ADJECTIVE,
|
|
21644
|
+
PATTERN_CAPABILITY
|
|
21645
|
+
]);
|
|
21646
|
+
}
|
|
21647
|
+
});
|
|
21648
|
+
|
|
21649
|
+
// src/domain/completions/injected.mjs
|
|
21650
|
+
var init_injected = __esm({
|
|
21651
|
+
"src/domain/completions/injected.mjs"() {
|
|
21652
|
+
}
|
|
21653
|
+
});
|
|
21654
|
+
|
|
21655
|
+
// src/domain/completions/graph-adapter.mjs
|
|
21656
|
+
var init_graph_adapter = __esm({
|
|
21657
|
+
"src/domain/completions/graph-adapter.mjs"() {
|
|
21658
|
+
init_codegraph();
|
|
21659
|
+
init_ask();
|
|
21660
|
+
init_injected();
|
|
21661
|
+
}
|
|
21662
|
+
});
|
|
21663
|
+
|
|
21664
|
+
// src/domain/router/registry.mjs
|
|
21665
|
+
function capability({ name, label, question, params = [], preconditions = [], add = [], del = [] }) {
|
|
21666
|
+
return Object.freeze({
|
|
21667
|
+
type: VOCAB.Capability,
|
|
21668
|
+
name,
|
|
21669
|
+
// the dispatchTool tool name — directly callable
|
|
21670
|
+
label,
|
|
21671
|
+
// human label (the slash-command verb)
|
|
21672
|
+
question,
|
|
21673
|
+
// one-line "what question does this answer"
|
|
21674
|
+
readOnly: true,
|
|
21675
|
+
// dispatching this capability performs no writes
|
|
21676
|
+
parameters: Object.freeze(params),
|
|
21677
|
+
preconditions: Object.freeze(preconditions),
|
|
21678
|
+
effects: Object.freeze({ add: Object.freeze(add), del: Object.freeze(del) })
|
|
21679
|
+
});
|
|
21680
|
+
}
|
|
21681
|
+
var PREFIXES, VOCAB, KINDS, PRECOND, param, graphLoaded, resolves, anyPresent, memoryFacts, knows, CAPABILITIES, buildIndex, list, byName, EXCLUDED_FROM_REGISTRY, REGISTRY;
|
|
21682
|
+
var init_registry = __esm({
|
|
21683
|
+
"src/domain/router/registry.mjs"() {
|
|
21684
|
+
PREFIXES = Object.freeze({
|
|
21685
|
+
cap: "urn:tmct:cap#",
|
|
21686
|
+
// the capability/operator vocabulary (this module)
|
|
21687
|
+
taught: "urn:tmct:taught#",
|
|
21688
|
+
// taught-action operators + their world-state predicates (taught.mjs)
|
|
21689
|
+
mgx: "urn:tmct:mgx#",
|
|
21690
|
+
// tmct's code-graph predicates (imports/calls/tests/…)
|
|
21691
|
+
seon: "http://se-on.org/ontologies/seon.owl#"
|
|
21692
|
+
// software-evolution ontology classes
|
|
21693
|
+
});
|
|
21694
|
+
VOCAB = Object.freeze({
|
|
21695
|
+
Capability: "cap:Capability",
|
|
21696
|
+
// rdf:type of a declared tool/operator
|
|
21697
|
+
Parameter: "cap:Parameter",
|
|
21698
|
+
Precondition: "cap:Precondition",
|
|
21699
|
+
Effect: "cap:Effect"
|
|
21700
|
+
});
|
|
21701
|
+
KINDS = Object.freeze({
|
|
21702
|
+
Symbol: "seon:CodeEntity",
|
|
21703
|
+
// any code symbol: function/method/class/module/attribute
|
|
21704
|
+
Module: "mgx:Module",
|
|
21705
|
+
// SEON has no JS-module class (its nearest are Namespace/main:File); owned
|
|
21706
|
+
Class: "seon:ClassType",
|
|
21707
|
+
// SEON's real class for a class definition
|
|
21708
|
+
Query: "cap:FreeText",
|
|
21709
|
+
// lexical search string — no resolution precondition
|
|
21710
|
+
Kind: "cap:KindFilter",
|
|
21711
|
+
// enum: function|class|method|… (search filter)
|
|
21712
|
+
Package: "cap:PackageName"
|
|
21713
|
+
// optional architecture-scope filter
|
|
21714
|
+
});
|
|
21715
|
+
PRECOND = Object.freeze({
|
|
21716
|
+
graphLoaded: "cap:graph-loaded",
|
|
21717
|
+
// a graph artifact is present + parseable
|
|
21718
|
+
resolves: "cap:resolves",
|
|
21719
|
+
// { param, as } — the slot binds to an entity of kind `as`
|
|
21720
|
+
anyPresent: "cap:any-present",
|
|
21721
|
+
// { params } — at least one of these slots is provided
|
|
21722
|
+
memoryFacts: "cap:memory-facts"
|
|
21723
|
+
// the conversational-memory store holds relation facts for the term
|
|
21724
|
+
});
|
|
21725
|
+
param = (name, kind, { arg = name, required = true, note = "" } = {}) => Object.freeze({ type: VOCAB.Parameter, name, kind, arg, required, note });
|
|
21726
|
+
graphLoaded = () => Object.freeze({ type: VOCAB.Precondition, pred: PRECOND.graphLoaded });
|
|
21727
|
+
resolves = (paramName, as) => Object.freeze({ type: VOCAB.Precondition, pred: PRECOND.resolves, param: paramName, as });
|
|
21728
|
+
anyPresent = (params) => Object.freeze({ type: VOCAB.Precondition, pred: PRECOND.anyPresent, params: Object.freeze([...params]) });
|
|
21729
|
+
memoryFacts = () => Object.freeze({ type: VOCAB.Precondition, pred: PRECOND.memoryFacts });
|
|
21730
|
+
knows = (topic, ofParam = null) => Object.freeze({ type: VOCAB.Effect, pred: "cap:knows", topic, of: ofParam ? `?${ofParam}` : null });
|
|
21731
|
+
CAPABILITIES = Object.freeze([
|
|
21732
|
+
capability({
|
|
21733
|
+
name: "tmct_search",
|
|
21734
|
+
label: "search",
|
|
21735
|
+
question: "lexical search across the graph",
|
|
21736
|
+
params: [
|
|
21737
|
+
param("query", KINDS.Query, { required: false, note: "required unless a kind filter is given" }),
|
|
21738
|
+
param("kind", KINDS.Kind, { required: false }),
|
|
21739
|
+
param("name", KINDS.Query, { required: false }),
|
|
21740
|
+
param("decorator", KINDS.Query, { required: false })
|
|
21741
|
+
],
|
|
21742
|
+
preconditions: [graphLoaded(), anyPresent(["query", "kind"])],
|
|
21743
|
+
add: [knows("matches", "query")]
|
|
21744
|
+
}),
|
|
21745
|
+
capability({
|
|
21746
|
+
name: "tmct_describe",
|
|
21747
|
+
label: "describe",
|
|
21748
|
+
question: "a symbol's definition, kind and relations",
|
|
21749
|
+
params: [param("symbol", KINDS.Symbol)],
|
|
21750
|
+
preconditions: [graphLoaded(), resolves("symbol", KINDS.Symbol)],
|
|
21751
|
+
add: [knows("description", "symbol")]
|
|
21752
|
+
}),
|
|
21753
|
+
capability({
|
|
21754
|
+
name: "tmct_signature",
|
|
21755
|
+
label: "signature",
|
|
21756
|
+
question: "a symbol's signature only",
|
|
21757
|
+
params: [param("symbol", KINDS.Symbol)],
|
|
21758
|
+
preconditions: [graphLoaded(), resolves("symbol", KINDS.Symbol)],
|
|
21759
|
+
add: [knows("signature", "symbol")]
|
|
21760
|
+
}),
|
|
21761
|
+
capability({
|
|
21762
|
+
name: "tmct_impact",
|
|
21763
|
+
label: "impact",
|
|
21764
|
+
question: "what a change to this module or symbol reaches (impact closure)",
|
|
21765
|
+
params: [param("module", KINDS.Symbol, { note: "a Module, or any sited symbol \u2014 a fine-grained seed walks callsSymbol dependents and coarsens them to module grain" })],
|
|
21766
|
+
preconditions: [graphLoaded(), resolves("module", KINDS.Symbol)],
|
|
21767
|
+
add: [knows("impact", "module")]
|
|
21768
|
+
}),
|
|
21769
|
+
capability({
|
|
21770
|
+
name: "tmct_members",
|
|
21771
|
+
label: "members",
|
|
21772
|
+
question: "the methods/attributes of a class",
|
|
21773
|
+
params: [param("class", KINDS.Class, { arg: "class" })],
|
|
21774
|
+
preconditions: [graphLoaded(), resolves("class", KINDS.Class)],
|
|
21775
|
+
add: [knows("members", "class")]
|
|
21776
|
+
}),
|
|
21777
|
+
capability({
|
|
21778
|
+
name: "tmct_subclasses",
|
|
21779
|
+
label: "subclasses",
|
|
21780
|
+
question: "the subclasses of a class",
|
|
21781
|
+
params: [param("class", KINDS.Class, { arg: "class" })],
|
|
21782
|
+
preconditions: [graphLoaded(), resolves("class", KINDS.Class)],
|
|
21783
|
+
add: [knows("subclasses", "class")]
|
|
21784
|
+
}),
|
|
21785
|
+
capability({
|
|
21786
|
+
name: "tmct_exports",
|
|
21787
|
+
label: "exports",
|
|
21788
|
+
question: "a module's public exports",
|
|
21789
|
+
params: [param("module", KINDS.Module)],
|
|
21790
|
+
preconditions: [graphLoaded(), resolves("module", KINDS.Module)],
|
|
21791
|
+
add: [knows("exports", "module")]
|
|
21792
|
+
}),
|
|
21793
|
+
capability({
|
|
21794
|
+
name: "tmct_callers",
|
|
21795
|
+
label: "callers",
|
|
21796
|
+
question: "functions that call this symbol",
|
|
21797
|
+
params: [param("symbol", KINDS.Symbol)],
|
|
21798
|
+
preconditions: [graphLoaded(), resolves("symbol", KINDS.Symbol)],
|
|
21799
|
+
add: [knows("callers", "symbol")]
|
|
21800
|
+
}),
|
|
21801
|
+
capability({
|
|
21802
|
+
name: "tmct_callees",
|
|
21803
|
+
label: "callees",
|
|
21804
|
+
question: "functions this symbol calls",
|
|
21805
|
+
params: [param("symbol", KINDS.Symbol)],
|
|
21806
|
+
preconditions: [graphLoaded(), resolves("symbol", KINDS.Symbol)],
|
|
21807
|
+
add: [knows("callees", "symbol")]
|
|
21808
|
+
}),
|
|
21809
|
+
capability({
|
|
21810
|
+
name: "tmct_calls",
|
|
21811
|
+
label: "calls",
|
|
21812
|
+
question: "the call edges out of this symbol/module",
|
|
21813
|
+
params: [param("symbol", KINDS.Symbol)],
|
|
21814
|
+
preconditions: [graphLoaded(), resolves("symbol", KINDS.Symbol)],
|
|
21815
|
+
add: [knows("calls", "symbol")]
|
|
21816
|
+
}),
|
|
21817
|
+
capability({
|
|
21818
|
+
name: "tmct_tests_for",
|
|
21819
|
+
label: "tests",
|
|
21820
|
+
question: "the tests covering this symbol",
|
|
21821
|
+
params: [param("symbol", KINDS.Symbol)],
|
|
21822
|
+
preconditions: [graphLoaded(), resolves("symbol", KINDS.Symbol)],
|
|
21823
|
+
add: [knows("tests", "symbol")]
|
|
21824
|
+
}),
|
|
21825
|
+
capability({
|
|
21826
|
+
name: "tmct_untested",
|
|
21827
|
+
label: "untested",
|
|
21828
|
+
question: "symbols with no covering test",
|
|
21829
|
+
params: [],
|
|
21830
|
+
preconditions: [graphLoaded()],
|
|
21831
|
+
add: [knows("untested", null)]
|
|
21832
|
+
}),
|
|
21833
|
+
capability({
|
|
21834
|
+
name: "tmct_history",
|
|
21835
|
+
label: "history",
|
|
21836
|
+
question: "the commit history of this symbol",
|
|
21837
|
+
params: [param("symbol", KINDS.Symbol)],
|
|
21838
|
+
preconditions: [graphLoaded(), resolves("symbol", KINDS.Symbol)],
|
|
21839
|
+
add: [knows("history", "symbol")]
|
|
21840
|
+
}),
|
|
21841
|
+
capability({
|
|
21842
|
+
name: "tmct_cochanges",
|
|
21843
|
+
label: "cochanges",
|
|
21844
|
+
question: "symbols that change together with this one",
|
|
21845
|
+
params: [param("symbol", KINDS.Symbol)],
|
|
21846
|
+
preconditions: [graphLoaded(), resolves("symbol", KINDS.Symbol)],
|
|
21847
|
+
add: [knows("cochanges", "symbol")]
|
|
21848
|
+
}),
|
|
21849
|
+
capability({
|
|
21850
|
+
name: "tmct_architecture",
|
|
21851
|
+
label: "arch",
|
|
21852
|
+
question: "the architecture overview (optional package filter)",
|
|
21853
|
+
params: [param("package", KINDS.Package, { required: false })],
|
|
21854
|
+
preconditions: [graphLoaded()],
|
|
21855
|
+
add: [knows("architecture", "package")]
|
|
21856
|
+
}),
|
|
21857
|
+
capability({
|
|
21858
|
+
name: "tmct_related",
|
|
21859
|
+
label: "related",
|
|
21860
|
+
question: "a term's synonyms and related concepts (the SKOS view over the conversational-memory graph)",
|
|
21861
|
+
params: [param("term", KINDS.Query, { note: "a concept term, matched against memory relation facts rather than resolved in the code graph" })],
|
|
21862
|
+
preconditions: [memoryFacts()],
|
|
21863
|
+
add: [knows("related", "term")]
|
|
21864
|
+
})
|
|
21865
|
+
]);
|
|
21866
|
+
buildIndex = (caps) => Object.freeze(
|
|
21867
|
+
caps.reduce((m, c) => {
|
|
21868
|
+
m[c.name] = c;
|
|
21869
|
+
return m;
|
|
21870
|
+
}, /* @__PURE__ */ Object.create(null))
|
|
21871
|
+
);
|
|
21872
|
+
list = CAPABILITIES;
|
|
21873
|
+
byName = buildIndex(list);
|
|
21874
|
+
EXCLUDED_FROM_REGISTRY = Object.freeze({
|
|
21875
|
+
tmct_context: "unbounded edit-context bundle (multi-file); needs a size/budget precondition",
|
|
21876
|
+
tmct_context_more: "unbounded context continuation; same as tmct_context",
|
|
21877
|
+
tmct_snippet: "raw source-file read (reads the filesystem); needs a file-read + span precondition"
|
|
21878
|
+
});
|
|
21879
|
+
REGISTRY = Object.freeze({
|
|
21880
|
+
prefixes: PREFIXES,
|
|
21881
|
+
vocab: VOCAB,
|
|
21882
|
+
kinds: KINDS,
|
|
21883
|
+
precond: PRECOND,
|
|
21884
|
+
get capabilities() {
|
|
21885
|
+
return list;
|
|
21886
|
+
}
|
|
21887
|
+
});
|
|
21888
|
+
}
|
|
21889
|
+
});
|
|
21890
|
+
|
|
21891
|
+
// src/domain/router/taught.mjs
|
|
21892
|
+
var init_taught = __esm({
|
|
21893
|
+
"src/domain/router/taught.mjs"() {
|
|
21894
|
+
init_registry();
|
|
21895
|
+
}
|
|
21896
|
+
});
|
|
21897
|
+
|
|
21898
|
+
// src/adapters/memory/blocks.mjs
|
|
21899
|
+
var BLOCKS_DIR_REL;
|
|
21900
|
+
var init_blocks = __esm({
|
|
21901
|
+
"src/adapters/memory/blocks.mjs"() {
|
|
21902
|
+
init_promises();
|
|
21903
|
+
init_node_path();
|
|
21904
|
+
init_prose();
|
|
21905
|
+
init_text_stats();
|
|
21906
|
+
init_trust();
|
|
21907
|
+
BLOCKS_DIR_REL = join(".tmct", "memory", "blocks");
|
|
21908
|
+
}
|
|
21909
|
+
});
|
|
21910
|
+
|
|
21911
|
+
// src/domain/completions/search.mjs
|
|
21912
|
+
var init_search = __esm({
|
|
21913
|
+
"src/domain/completions/search.mjs"() {
|
|
21914
|
+
init_injected();
|
|
21915
|
+
}
|
|
21916
|
+
});
|
|
21917
|
+
|
|
21918
|
+
// src/domain/completions/group.mjs
|
|
21919
|
+
var init_group = __esm({
|
|
21920
|
+
"src/domain/completions/group.mjs"() {
|
|
21921
|
+
init_prose();
|
|
21922
|
+
init_text_stats();
|
|
21923
|
+
init_injected();
|
|
21924
|
+
}
|
|
21925
|
+
});
|
|
21926
|
+
|
|
21927
|
+
// src/domain/completions/rank.mjs
|
|
21928
|
+
var init_rank = __esm({
|
|
21929
|
+
"src/domain/completions/rank.mjs"() {
|
|
21930
|
+
init_prose();
|
|
21931
|
+
init_text_stats();
|
|
21932
|
+
init_injected();
|
|
21933
|
+
}
|
|
21934
|
+
});
|
|
21935
|
+
|
|
21936
|
+
// src/domain/completions/infer.mjs
|
|
21937
|
+
var init_infer = __esm({
|
|
21938
|
+
"src/domain/completions/infer.mjs"() {
|
|
21939
|
+
init_rank();
|
|
21940
|
+
init_prose();
|
|
21941
|
+
init_planning();
|
|
21942
|
+
init_injected();
|
|
21943
|
+
}
|
|
21944
|
+
});
|
|
21945
|
+
|
|
21946
|
+
// src/domain/completions/prune.mjs
|
|
21947
|
+
var init_prune = __esm({
|
|
21948
|
+
"src/domain/completions/prune.mjs"() {
|
|
21949
|
+
}
|
|
21950
|
+
});
|
|
21951
|
+
|
|
21952
|
+
// src/domain/completions/complete.mjs
|
|
21953
|
+
var init_complete = __esm({
|
|
21954
|
+
"src/domain/completions/complete.mjs"() {
|
|
21955
|
+
init_search();
|
|
21956
|
+
init_group();
|
|
21957
|
+
init_rank();
|
|
21958
|
+
init_infer();
|
|
21959
|
+
init_prune();
|
|
21960
|
+
init_injected();
|
|
21961
|
+
}
|
|
21962
|
+
});
|
|
21963
|
+
|
|
21964
|
+
// src/services/completions.mjs
|
|
21965
|
+
var init_completions = __esm({
|
|
21966
|
+
"src/services/completions.mjs"() {
|
|
21967
|
+
init_blocks();
|
|
21968
|
+
init_core();
|
|
21969
|
+
init_graph_service();
|
|
21970
|
+
init_finish();
|
|
21971
|
+
init_complete();
|
|
21972
|
+
init_graph_adapter();
|
|
21973
|
+
}
|
|
21974
|
+
});
|
|
21975
|
+
|
|
21598
21976
|
// src/adapters/toml-config.mjs
|
|
21599
21977
|
var init_toml_config = __esm({
|
|
21600
21978
|
"src/adapters/toml-config.mjs"() {
|
|
@@ -21651,7 +22029,7 @@ ${codeblock}`, options);
|
|
|
21651
22029
|
});
|
|
21652
22030
|
|
|
21653
22031
|
// src/adapters/corpus/conceptnet.mjs
|
|
21654
|
-
var
|
|
22032
|
+
var import_meta7, PKG_ROOT5, SLICE_FILE, MAP_FILE, SEON_CONCEPTS_FILE, SEON_DEFINITIONS_FILE, TIER2_DIR, TIER2_MANIFEST_FILE, WORDNET_DIR, WORDNET_MANIFEST_FILE;
|
|
21655
22033
|
var init_conceptnet = __esm({
|
|
21656
22034
|
"src/adapters/corpus/conceptnet.mjs"() {
|
|
21657
22035
|
init_node_fs();
|
|
@@ -21661,15 +22039,15 @@ ${codeblock}`, options);
|
|
|
21661
22039
|
init_node_path();
|
|
21662
22040
|
init_dist();
|
|
21663
22041
|
init_core();
|
|
21664
|
-
|
|
21665
|
-
|
|
21666
|
-
SLICE_FILE = join(
|
|
21667
|
-
MAP_FILE = join(
|
|
21668
|
-
SEON_CONCEPTS_FILE = join(
|
|
21669
|
-
SEON_DEFINITIONS_FILE = join(
|
|
21670
|
-
TIER2_DIR = join(
|
|
22042
|
+
import_meta7 = {};
|
|
22043
|
+
PKG_ROOT5 = join(dirname(fileURLToPath2(import_meta7.url)), "..", "..", "..");
|
|
22044
|
+
SLICE_FILE = join(PKG_ROOT5, "corpus", "conceptnet", "slice.jsonl");
|
|
22045
|
+
MAP_FILE = join(PKG_ROOT5, "src", "adapters", "corpus", "conceptnet-map.toml");
|
|
22046
|
+
SEON_CONCEPTS_FILE = join(PKG_ROOT5, "corpus", "seon", "concepts.jsonl");
|
|
22047
|
+
SEON_DEFINITIONS_FILE = join(PKG_ROOT5, "corpus", "seon", "definitions.jsonl");
|
|
22048
|
+
TIER2_DIR = join(PKG_ROOT5, "corpus", "tier2");
|
|
21671
22049
|
TIER2_MANIFEST_FILE = join(TIER2_DIR, "manifest.json");
|
|
21672
|
-
WORDNET_DIR = join(
|
|
22050
|
+
WORDNET_DIR = join(PKG_ROOT5, "corpus", "wordnet");
|
|
21673
22051
|
WORDNET_MANIFEST_FILE = join(WORDNET_DIR, "manifest.json");
|
|
21674
22052
|
}
|
|
21675
22053
|
});
|
|
@@ -21763,7 +22141,7 @@ ${codeblock}`, options);
|
|
|
21763
22141
|
}
|
|
21764
22142
|
};
|
|
21765
22143
|
}
|
|
21766
|
-
var
|
|
22144
|
+
var import_meta8, NAMENET_DIR, EXTENSION_KINDS, CONCEPTNET_PREFER, BUILTIN_EXTENSIONS;
|
|
21767
22145
|
var init_extensions = __esm({
|
|
21768
22146
|
"src/services/extensions.mjs"() {
|
|
21769
22147
|
init_node_path();
|
|
@@ -21771,8 +22149,8 @@ ${codeblock}`, options);
|
|
|
21771
22149
|
init_node_url();
|
|
21772
22150
|
init_toml_config();
|
|
21773
22151
|
init_conceptnet();
|
|
21774
|
-
|
|
21775
|
-
NAMENET_DIR = join(dirname(fileURLToPath2(
|
|
22152
|
+
import_meta8 = {};
|
|
22153
|
+
NAMENET_DIR = join(dirname(fileURLToPath2(import_meta8.url)), "..", "..", "corpus", "namenet");
|
|
21776
22154
|
EXTENSION_KINDS = Object.freeze(["corpus", "lexicon", "templates", "pack", "ontology"]);
|
|
21777
22155
|
CONCEPTNET_PREFER = ["rdfs:subClassOf", "rdf:type", "mgx:usedFor", "mgx:partOf", "mgx:capableOf"];
|
|
21778
22156
|
BUILTIN_EXTENSIONS = Object.freeze(builtinExtensions());
|
|
@@ -21938,8 +22316,8 @@ ${codeblock}`, options);
|
|
|
21938
22316
|
{
|
|
21939
22317
|
name: "tmct_impact",
|
|
21940
22318
|
tier: "cold",
|
|
21941
|
-
summary: "Transitive reverse closure over imports/calls \u2014 what breaks if a module changes, by depth, with tests.",
|
|
21942
|
-
inputSchema: moduleArg("The module whose dependents you want."),
|
|
22319
|
+
summary: "Transitive reverse closure over imports/calls \u2014 what breaks if a module or symbol changes, by depth, with tests.",
|
|
22320
|
+
inputSchema: moduleArg("The module (or a symbol it defines) whose dependents you want."),
|
|
21943
22321
|
example: { module: "django/utils/text.py" }
|
|
21944
22322
|
},
|
|
21945
22323
|
{
|
|
@@ -22110,12 +22488,12 @@ ${codeblock}`, options);
|
|
|
22110
22488
|
return s;
|
|
22111
22489
|
}
|
|
22112
22490
|
function mergeEntityPayloads(entries) {
|
|
22113
|
-
const
|
|
22491
|
+
const list2 = (Array.isArray(entries) ? entries : []).map((e, i) => ({
|
|
22114
22492
|
file: e?.file,
|
|
22115
22493
|
payload: e?.payload || {},
|
|
22116
22494
|
name: e?.name != null && String(e.name).length ? String(e.name) : String(i)
|
|
22117
22495
|
}));
|
|
22118
|
-
const idSets =
|
|
22496
|
+
const idSets = list2.map(({ payload }) => idsOf(payload));
|
|
22119
22497
|
const seenInCount = /* @__PURE__ */ new Map();
|
|
22120
22498
|
for (const s of idSets) for (const id of s) seenInCount.set(id, (seenInCount.get(id) || 0) + 1);
|
|
22121
22499
|
const colliding = new Set([...seenInCount.entries()].filter(([, n]) => n > 1).map(([id]) => id));
|
|
@@ -22128,8 +22506,8 @@ ${codeblock}`, options);
|
|
|
22128
22506
|
proseIndex: {}
|
|
22129
22507
|
};
|
|
22130
22508
|
let latestGeneratedAt = "";
|
|
22131
|
-
let everyPayloadIsBootstrap =
|
|
22132
|
-
for (const { payload, name } of
|
|
22509
|
+
let everyPayloadIsBootstrap = list2.length > 0;
|
|
22510
|
+
for (const { payload, name } of list2) {
|
|
22133
22511
|
everyPayloadIsBootstrap = everyPayloadIsBootstrap && Boolean(payload.bootstrap);
|
|
22134
22512
|
if (typeof payload.generated_at === "string" && payload.generated_at > latestGeneratedAt) {
|
|
22135
22513
|
latestGeneratedAt = payload.generated_at;
|
|
@@ -22832,8 +23210,8 @@ ${JSON.stringify(envelope, null, 2)}`;
|
|
|
22832
23210
|
return Math.max(...ids.map((id) => biasForSourceId(id, biasByBundle)));
|
|
22833
23211
|
}
|
|
22834
23212
|
function rankByBiasThenTrust(rows, biasByBundle = {}) {
|
|
22835
|
-
const
|
|
22836
|
-
return
|
|
23213
|
+
const list2 = Array.isArray(rows) ? rows : [];
|
|
23214
|
+
return list2.map((row, index) => ({ row, index, bias: biasForRow(row, biasByBundle) })).sort((a, b) => b.bias - a.bias || (b.row?.trust ?? 0) - (a.row?.trust ?? 0) || a.index - b.index).map((x) => x.row);
|
|
22837
23215
|
}
|
|
22838
23216
|
|
|
22839
23217
|
// src/services/chat.mjs
|
|
@@ -22859,11 +23237,29 @@ ${JSON.stringify(envelope, null, 2)}`;
|
|
|
22859
23237
|
|
|
22860
23238
|
// src/adapters/corpus/reference-pack.mjs
|
|
22861
23239
|
init_node_fs();
|
|
23240
|
+
|
|
23241
|
+
// node-zlib-stub:node:zlib
|
|
23242
|
+
var gunzipSync = () => {
|
|
23243
|
+
throw new Error("gunzipSync unavailable in a browser bundle");
|
|
23244
|
+
};
|
|
23245
|
+
|
|
23246
|
+
// src/adapters/corpus/reference-pack.mjs
|
|
22862
23247
|
init_node_url();
|
|
22863
23248
|
init_node_path();
|
|
22864
23249
|
var import_meta4 = {};
|
|
22865
23250
|
var PKG_ROOT2 = join(dirname(fileURLToPath2(import_meta4.url)), "..", "..", "..");
|
|
22866
23251
|
|
|
23252
|
+
// src/domain/child-pack.mjs
|
|
23253
|
+
init_hash();
|
|
23254
|
+
|
|
23255
|
+
// src/adapters/corpus/child-pack.mjs
|
|
23256
|
+
init_node_fs();
|
|
23257
|
+
init_node_url();
|
|
23258
|
+
init_node_path();
|
|
23259
|
+
init_hash();
|
|
23260
|
+
var import_meta5 = {};
|
|
23261
|
+
var PKG_ROOT3 = join(dirname(fileURLToPath2(import_meta5.url)), "..", "..", "..");
|
|
23262
|
+
|
|
22867
23263
|
// src/domain/dialogue-acts.mjs
|
|
22868
23264
|
var DIALOGUE_ACT_DIMENSIONS = Object.freeze([
|
|
22869
23265
|
"task",
|
|
@@ -22980,6 +23376,119 @@ ${JSON.stringify(envelope, null, 2)}`;
|
|
|
22980
23376
|
"game-inform": "inform"
|
|
22981
23377
|
});
|
|
22982
23378
|
|
|
23379
|
+
// src/domain/worlds-pack.mjs
|
|
23380
|
+
var WORLD_NAME_RE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
23381
|
+
var WORLD_RULE_KINDS = Object.freeze([
|
|
23382
|
+
"action-signature",
|
|
23383
|
+
"action-precond",
|
|
23384
|
+
"action-effect",
|
|
23385
|
+
"action-constraint"
|
|
23386
|
+
]);
|
|
23387
|
+
var RULE_KIND_SET = new Set(WORLD_RULE_KINDS);
|
|
23388
|
+
var isNonEmptyString = (v) => typeof v === "string" && v.trim() !== "";
|
|
23389
|
+
function isWorldName(name) {
|
|
23390
|
+
return typeof name === "string" && WORLD_NAME_RE.test(name);
|
|
23391
|
+
}
|
|
23392
|
+
function isWorldsIndexEntry(e) {
|
|
23393
|
+
return !!e && typeof e === "object" && isNonEmptyString(e.s);
|
|
23394
|
+
}
|
|
23395
|
+
function isWorldFactRow(row) {
|
|
23396
|
+
return !!row && typeof row === "object" && row.kind === "fact" && isWorldName(row.world) && isNonEmptyString(row.subject) && isNonEmptyString(row.predicate) && isNonEmptyString(row.object);
|
|
23397
|
+
}
|
|
23398
|
+
function isWorldRuleRow(row) {
|
|
23399
|
+
if (!row || typeof row !== "object" || row.kind !== "rule") return false;
|
|
23400
|
+
if (!isWorldName(row.world) || !isNonEmptyString(row.name)) return false;
|
|
23401
|
+
if (!RULE_KIND_SET.has(row.ruleKind)) return false;
|
|
23402
|
+
if (!row.slots || typeof row.slots !== "object" || Array.isArray(row.slots)) return false;
|
|
23403
|
+
const values = Object.values(row.slots);
|
|
23404
|
+
return values.length > 0 && values.every(isNonEmptyString);
|
|
23405
|
+
}
|
|
23406
|
+
function isWorldMetaRow(row) {
|
|
23407
|
+
return !!row && typeof row === "object" && row.kind === "meta" && isWorldName(row.world) && isNonEmptyString(row.opening);
|
|
23408
|
+
}
|
|
23409
|
+
function isWorldRow(row) {
|
|
23410
|
+
return isWorldFactRow(row) || isWorldRuleRow(row) || isWorldMetaRow(row);
|
|
23411
|
+
}
|
|
23412
|
+
|
|
23413
|
+
// src/services/adventure.mjs
|
|
23414
|
+
init_ace2();
|
|
23415
|
+
init_graph_adapter();
|
|
23416
|
+
init_taught();
|
|
23417
|
+
|
|
23418
|
+
// src/adapters/corpus/worlds-pack.mjs
|
|
23419
|
+
init_node_fs();
|
|
23420
|
+
init_node_url();
|
|
23421
|
+
init_node_path();
|
|
23422
|
+
var import_meta6 = {};
|
|
23423
|
+
var PKG_ROOT4 = join(dirname(fileURLToPath2(import_meta6.url)), "..", "..", "..");
|
|
23424
|
+
function worldsPackDir(env = process.env) {
|
|
23425
|
+
return env?.TMCT_WORLDS_PACK_DIR || join(PKG_ROOT4, "corpus", "worlds");
|
|
23426
|
+
}
|
|
23427
|
+
var indexCacheByDir = /* @__PURE__ */ new Map();
|
|
23428
|
+
var worldCacheByKey = /* @__PURE__ */ new Map();
|
|
23429
|
+
function readGunzipped(file) {
|
|
23430
|
+
try {
|
|
23431
|
+
return gunzipSync(readFileSync6(file));
|
|
23432
|
+
} catch {
|
|
23433
|
+
return null;
|
|
23434
|
+
}
|
|
23435
|
+
}
|
|
23436
|
+
function loadWorldsIndex(dir) {
|
|
23437
|
+
if (indexCacheByDir.has(dir)) return indexCacheByDir.get(dir);
|
|
23438
|
+
let index = null;
|
|
23439
|
+
const body = readGunzipped(join(dir, "index.json.gz"));
|
|
23440
|
+
if (body) {
|
|
23441
|
+
try {
|
|
23442
|
+
const parsed = JSON.parse(body.toString("utf8"));
|
|
23443
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) index = parsed;
|
|
23444
|
+
} catch {
|
|
23445
|
+
}
|
|
23446
|
+
}
|
|
23447
|
+
indexCacheByDir.set(dir, index);
|
|
23448
|
+
return index;
|
|
23449
|
+
}
|
|
23450
|
+
function loadWorld(dir, worldName) {
|
|
23451
|
+
const index = loadWorldsIndex(dir);
|
|
23452
|
+
if (!index) return null;
|
|
23453
|
+
const entry = index[String(worldName ?? "")];
|
|
23454
|
+
if (!isWorldsIndexEntry(entry)) return null;
|
|
23455
|
+
const key = `${dir}\0${worldName}`;
|
|
23456
|
+
if (worldCacheByKey.has(key)) return worldCacheByKey.get(key);
|
|
23457
|
+
let payload = null;
|
|
23458
|
+
const body = readGunzipped(join(dir, "shards", `${entry.s}.jsonl.gz`));
|
|
23459
|
+
if (body) {
|
|
23460
|
+
const facts = [];
|
|
23461
|
+
const rules = [];
|
|
23462
|
+
let meta = null;
|
|
23463
|
+
for (const line of body.toString("utf8").split("\n")) {
|
|
23464
|
+
if (!line.trim()) continue;
|
|
23465
|
+
try {
|
|
23466
|
+
const row = JSON.parse(line);
|
|
23467
|
+
if (!isWorldRow(row) || row.world !== worldName) continue;
|
|
23468
|
+
if (isWorldFactRow(row)) facts.push(row);
|
|
23469
|
+
else if (isWorldRuleRow(row)) rules.push(row);
|
|
23470
|
+
else if (isWorldMetaRow(row) && !meta) meta = row;
|
|
23471
|
+
} catch {
|
|
23472
|
+
}
|
|
23473
|
+
}
|
|
23474
|
+
if (facts.length || rules.length || meta) payload = { name: worldName, facts, rules, meta };
|
|
23475
|
+
}
|
|
23476
|
+
worldCacheByKey.set(key, payload);
|
|
23477
|
+
return payload;
|
|
23478
|
+
}
|
|
23479
|
+
var fsProviderFor = (dirOf) => ({
|
|
23480
|
+
list: async () => {
|
|
23481
|
+
const index = loadWorldsIndex(dirOf());
|
|
23482
|
+
return index ? Object.keys(index).sort() : null;
|
|
23483
|
+
},
|
|
23484
|
+
load: async (worldName) => loadWorld(dirOf(), worldName)
|
|
23485
|
+
});
|
|
23486
|
+
var fsProvider = fsProviderFor(() => worldsPackDir());
|
|
23487
|
+
|
|
23488
|
+
// src/services/adventure.mjs
|
|
23489
|
+
init_core();
|
|
23490
|
+
init_completions();
|
|
23491
|
+
|
|
22983
23492
|
// src/services/chat-session.mjs
|
|
22984
23493
|
init_node_path();
|
|
22985
23494
|
init_node_fs();
|
|
@@ -23603,7 +24112,7 @@ ${JSON.stringify(envelope, null, 2)}`;
|
|
|
23603
24112
|
const last = premises[premises.length - 1];
|
|
23604
24113
|
return `${premises.map(step).join("; ")}; so ${first.subject} is a ${last.object}`;
|
|
23605
24114
|
}
|
|
23606
|
-
async function
|
|
24115
|
+
async function memoryFacts2(memoryDir) {
|
|
23607
24116
|
try {
|
|
23608
24117
|
const { loadMemory: loadMemory2 } = await Promise.resolve().then(() => (init_core(), core_exports));
|
|
23609
24118
|
const m = await loadMemory2(memoryDir);
|
|
@@ -24088,7 +24597,7 @@ ${shown.map(renderFactLine).join("\n")}`,
|
|
|
24088
24597
|
if (compAsk) {
|
|
24089
24598
|
const compWord = compAsk[2].toLowerCase().replace(/\s+/g, "-");
|
|
24090
24599
|
const compPredicate = `mgx:${compWord}-than`;
|
|
24091
|
-
const facts = await
|
|
24600
|
+
const facts = await memoryFacts2(memoryDir);
|
|
24092
24601
|
const compTerm = (raw) => {
|
|
24093
24602
|
const t = raw.replace(/^(?:an?|the)\s+/i, "").trim();
|
|
24094
24603
|
return focusLabel && IS_ADJECTIVE_PRONOUN_RE.test(t) ? focusLabel : t;
|
|
@@ -24110,7 +24619,7 @@ ${shown.map(renderFactLine).join("\n")}`,
|
|
|
24110
24619
|
for (const { predicate, phrase, re } of FORWARD_YESNO_MARKERS) {
|
|
24111
24620
|
const m = q.match(re);
|
|
24112
24621
|
if (!m) continue;
|
|
24113
|
-
const facts = await
|
|
24622
|
+
const facts = await memoryFacts2(memoryDir);
|
|
24114
24623
|
const subj = factTermVariants(normFactTerm2, m[1]);
|
|
24115
24624
|
const obj = factTermVariants(normFactTerm2, m[2]);
|
|
24116
24625
|
const hit2 = facts.find((f) => f.predicate === predicate && subj.has(f.subject) && obj.has(f.object));
|
|
@@ -24172,7 +24681,7 @@ ${shown.map(renderFactLine).join("\n")}`,
|
|
|
24172
24681
|
const subj = factTermVariants(normFactTerm2, doesHave[1]);
|
|
24173
24682
|
const obj = factTermVariants(normFactTerm2, doesHave[2]);
|
|
24174
24683
|
const HAS_PREDICATES = /* @__PURE__ */ new Set(["mgx:hasA", "tmct:has"]);
|
|
24175
|
-
const facts = await
|
|
24684
|
+
const facts = await memoryFacts2(memoryDir);
|
|
24176
24685
|
const hasHit = (subjectSet) => facts.find(
|
|
24177
24686
|
(f) => HAS_PREDICATES.has(f.predicate) && subjectSet.has(f.subject) && obj.has(f.object)
|
|
24178
24687
|
);
|