theprogrammablemind 9.6.0-beta.6 → 9.6.0-beta.8
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 -2
- package/package.json +1 -1
- package/src/configHelpers.js +13 -0
- package/src/helpers.js +27 -0
package/client.js
CHANGED
|
@@ -1273,13 +1273,13 @@ const knowledgeModuleImpl = async ({
|
|
|
1273
1273
|
config.stop_auto_rebuild()
|
|
1274
1274
|
await config.add(...(includes || []))
|
|
1275
1275
|
if (api) {
|
|
1276
|
-
config.setApi(api)
|
|
1276
|
+
await config.setApi(api)
|
|
1277
1277
|
}
|
|
1278
1278
|
if (multiApiInitializer) {
|
|
1279
1279
|
await config.setMultiApi(multiApiInitializer)
|
|
1280
1280
|
}
|
|
1281
1281
|
if (initializer) {
|
|
1282
|
-
config.initializer(initializer)
|
|
1282
|
+
await config.initializer(initializer)
|
|
1283
1283
|
}
|
|
1284
1284
|
await config.restart_auto_rebuild()
|
|
1285
1285
|
return config
|
package/package.json
CHANGED
package/src/configHelpers.js
CHANGED
|
@@ -151,12 +151,22 @@ const setupArgs = (args, config, logs, hierarchy, uuidForScoping) => {
|
|
|
151
151
|
// debugger
|
|
152
152
|
// }
|
|
153
153
|
const { assumed = {}, options = {} } = rest
|
|
154
|
+
// have it default to paraphrase
|
|
155
|
+
if (['number', 'string', 'boolean'].includes(typeof c)) {
|
|
156
|
+
return `${c}`
|
|
157
|
+
}
|
|
158
|
+
if (false && !(assumed.isResponse && assumed.response)) {
|
|
159
|
+
assumed.paraphrase = true
|
|
160
|
+
}
|
|
154
161
|
return config.getGenerators(logs).apply(addAssumed(args, assumed), c, assumed, options)
|
|
155
162
|
}
|
|
156
163
|
args.gp = (c, rest = {}) => {
|
|
157
164
|
// if (JSON.stringify(rest) !== '{}' && !(rest.assumed || rest.options)) {
|
|
158
165
|
// debugger
|
|
159
166
|
// }
|
|
167
|
+
if (['number', 'string', 'boolean'].includes(typeof c)) {
|
|
168
|
+
return `${c}`
|
|
169
|
+
}
|
|
160
170
|
const { assumed = {}, options = {} } = rest
|
|
161
171
|
return config.getGenerators(logs).apply(addAssumed(args, assumed, { paraphrase: true, isResponse: false, response: false }), c, { paraphrase: true, isResponse: false, response: false }, options)
|
|
162
172
|
}
|
|
@@ -164,6 +174,9 @@ const setupArgs = (args, config, logs, hierarchy, uuidForScoping) => {
|
|
|
164
174
|
// if (JSON.stringify(rest) !== '{}' && !(rest.assumed || rest.options)) {
|
|
165
175
|
// debugger
|
|
166
176
|
// }
|
|
177
|
+
if (['number', 'string', 'boolean'].includes(typeof c)) {
|
|
178
|
+
return `${c}`
|
|
179
|
+
}
|
|
167
180
|
const { assumed = {}, options = {} } = rest
|
|
168
181
|
return config.getGenerators(logs).apply(addAssumed(args, assumed, { paraphrase: false, isResponse: true }), { ...c, paraphrase: false, isResponse: true }, options)
|
|
169
182
|
}
|
package/src/helpers.js
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
const deepEqual = require('deep-equal')
|
|
2
2
|
const stringify = require('json-stable-stringify')
|
|
3
3
|
|
|
4
|
+
function watchProperty(obj, propName) {
|
|
5
|
+
let value = obj[propName];
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(obj, propName, {
|
|
8
|
+
get() {
|
|
9
|
+
return value;
|
|
10
|
+
},
|
|
11
|
+
set(newValue) {
|
|
12
|
+
console.log(`%c${propName} changed →`, 'color: #e83', newValue);
|
|
13
|
+
debugger; // ← Chrome/Firefox will pause here automatically
|
|
14
|
+
value = newValue;
|
|
15
|
+
},
|
|
16
|
+
configurable: true // allows us to delete/restore later if needed
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function assignAssumed(object, assumed) {
|
|
21
|
+
for (const key in assumed) {
|
|
22
|
+
if (object[key] == null) {
|
|
23
|
+
object[key] = assumed[key]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return object
|
|
27
|
+
}
|
|
28
|
+
|
|
4
29
|
function where (goUp = 2) {
|
|
5
30
|
const e = new Error()
|
|
6
31
|
const regexForm1 = /\((.*):(\d+):(\d+)\)$/
|
|
@@ -567,4 +592,6 @@ module.exports = {
|
|
|
567
592
|
suggestAssociationsFixFromSummaries,
|
|
568
593
|
getByPath,
|
|
569
594
|
setByPath,
|
|
595
|
+
assignAssumed,
|
|
596
|
+
watchProperty,
|
|
570
597
|
}
|