theprogrammablemind 8.9.0-beta.14 → 8.9.0-beta.15
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/client.js +2 -0
- package/package.json +1 -1
- package/src/configHelpers.js +3 -31
- package/src/digraph_internal.js +24 -2
package/client.js
CHANGED
@@ -1654,11 +1654,13 @@ const knowledgeModuleImpl = async ({
|
|
1654
1654
|
}
|
1655
1655
|
}
|
1656
1656
|
} else {
|
1657
|
+
/*
|
1657
1658
|
if (results.length > 0 && args.vimdiff) {
|
1658
1659
|
for (const result of results) {
|
1659
1660
|
vimdiff(result.actual, result.expected)
|
1660
1661
|
}
|
1661
1662
|
}
|
1663
|
+
*/
|
1662
1664
|
}
|
1663
1665
|
if (hasError) {
|
1664
1666
|
if (!headerShown) {
|
package/package.json
CHANGED
package/src/configHelpers.js
CHANGED
@@ -29,17 +29,6 @@ const gs = (g) => async (contexts, separator, lastSeparator) => {
|
|
29
29
|
return s
|
30
30
|
}
|
31
31
|
|
32
|
-
const asList = (context) => {
|
33
|
-
if (context.marker === 'list') {
|
34
|
-
return context
|
35
|
-
}
|
36
|
-
return {
|
37
|
-
marker: 'list',
|
38
|
-
types: [context.marker],
|
39
|
-
value: [context]
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
32
|
const isA = (hierarchy) => (child, parent, { strict=false } = {}) => {
|
44
33
|
if (!child || !parent) {
|
45
34
|
return false
|
@@ -75,23 +64,6 @@ class ErrorReason extends Error {
|
|
75
64
|
}
|
76
65
|
}
|
77
66
|
|
78
|
-
const listable = (hierarchy) => (c, type) => {
|
79
|
-
if (!c) {
|
80
|
-
return false
|
81
|
-
}
|
82
|
-
if (hierarchy.isA(c.marker, type)) {
|
83
|
-
return true
|
84
|
-
}
|
85
|
-
if (c.marker === 'list') {
|
86
|
-
for (const t of c.types) {
|
87
|
-
if (hierarchy.isA(t, type)) {
|
88
|
-
return true
|
89
|
-
}
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return false
|
93
|
-
}
|
94
|
-
|
95
67
|
const cleanAssign = (dest, ...srcs) => {
|
96
68
|
for (const key in dest) {
|
97
69
|
let found = false
|
@@ -125,8 +97,8 @@ const setupArgs = (args, config, logs, hierarchy, uuidForScoping) => {
|
|
125
97
|
args.config = config
|
126
98
|
args.hierarchy = hierarchy
|
127
99
|
args.isA = isA(hierarchy)
|
128
|
-
args.listable = listable(hierarchy)
|
129
|
-
args.asList = asList
|
100
|
+
// args.listable = listable(hierarchy)
|
101
|
+
// args.asList = asList
|
130
102
|
args.retry = () => { throw new RetryError() }
|
131
103
|
args.fragments = (query) => {
|
132
104
|
return config.fragment(args, query)
|
@@ -461,7 +433,7 @@ const loadInstance = async (config, instance) => {
|
|
461
433
|
module.exports = {
|
462
434
|
setupProcessB,
|
463
435
|
ErrorReason,
|
464
|
-
listable,
|
436
|
+
// listable,
|
465
437
|
setupArgs,
|
466
438
|
processContext,
|
467
439
|
getObjects,
|
package/src/digraph_internal.js
CHANGED
@@ -86,8 +86,13 @@ class DigraphInternal {
|
|
86
86
|
return this.acdcs(s, 1, 0)
|
87
87
|
}
|
88
88
|
|
89
|
-
ancestors (s) {
|
90
|
-
|
89
|
+
ancestors (s, { includeSelf } = {}) {
|
90
|
+
const ancestors = this.acdcs(s, 0, 1)
|
91
|
+
if (includeSelf) {
|
92
|
+
ancestors.add(s)
|
93
|
+
}
|
94
|
+
return ancestors
|
95
|
+
|
91
96
|
}
|
92
97
|
|
93
98
|
minima (nodes) {
|
@@ -115,6 +120,23 @@ class DigraphInternal {
|
|
115
120
|
return minima
|
116
121
|
}
|
117
122
|
|
123
|
+
lub (nodes) {
|
124
|
+
if (nodes.length === 0) {
|
125
|
+
return new Set([])
|
126
|
+
}
|
127
|
+
nodes = Array.from(nodes);
|
128
|
+
let common = this.ancestors(nodes[0], { includeSelf: true })
|
129
|
+
|
130
|
+
for (let i = 1; i < nodes.length; i++) {
|
131
|
+
const ancestors = this.ancestors(nodes[i], { includeSelf: true })
|
132
|
+
common = new Set([...common].filter(x => ancestors.has(x)))
|
133
|
+
if (common.size === 0) {
|
134
|
+
break;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
return this.minima(common);
|
138
|
+
}
|
139
|
+
|
118
140
|
/*
|
119
141
|
maxima (nodes) {
|
120
142
|
const maxima = new Set(nodes)
|