theprogrammablemind 9.6.0-beta.0 → 9.6.0-beta.10

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 CHANGED
@@ -292,7 +292,9 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
292
292
  if (rebuildingTemplate) {
293
293
  data.errors_ignore_contextual_priorities_non_existant_ops = true
294
294
  }
295
- let queries = query.split('\\n')
295
+
296
+ // '\\n' from tests of '\n' from users. the former is because newline is not a valid json character so the testfile has it encoded
297
+ let queries = query.split(/\\n|\n/)
296
298
  const summaries = [] // for error
297
299
  try {
298
300
  const response = {
@@ -1271,13 +1273,13 @@ const knowledgeModuleImpl = async ({
1271
1273
  config.stop_auto_rebuild()
1272
1274
  await config.add(...(includes || []))
1273
1275
  if (api) {
1274
- config.setApi(api)
1276
+ await config.setApi(api)
1275
1277
  }
1276
1278
  if (multiApiInitializer) {
1277
1279
  await config.setMultiApi(multiApiInitializer)
1278
1280
  }
1279
1281
  if (initializer) {
1280
- config.initializer(initializer)
1282
+ await config.initializer(initializer)
1281
1283
  }
1282
1284
  await config.restart_auto_rebuild()
1283
1285
  return config
package/package.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "@typescript-eslint/eslint-plugin": "^4.28.4",
5
5
  "@typescript-eslint/parser": "^4.28.4",
6
6
  "argparse": "^2.0.1",
7
+ "baseline-browser-mapping": "^2.9.19",
7
8
  "eslint": "^7.32.0",
8
9
  "eslint-config-standard": "^16.0.3",
9
10
  "eslint-plugin-import": "^2.23.4",
@@ -72,6 +73,6 @@
72
73
  "scriptjs": "^2.5.9",
73
74
  "uuid": "^8.3.2"
74
75
  },
75
- "version": "9.6.0-beta.0",
76
+ "version": "9.6.0-beta.10",
76
77
  "license": "UNLICENSED"
77
78
  }
@@ -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
  }