theprogrammablemind_4wp 9.7.1-beta.16 → 9.7.1-beta.18

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
@@ -298,11 +298,12 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
298
298
  // '\\n' from tests of '\n' from users. the former is because newline is not a valid json character so the testfile has it encoded
299
299
  let queries = query.split(/\\n|\n/)
300
300
  const summaries = [] // for error
301
+ logs = logs || []
301
302
  try {
302
303
  const response = {
303
304
  hierarchy: [],
304
305
  load_cache_time: 0.0,
305
- logs: logs || [],
306
+ logs: logs,
306
307
  metadata: {
307
308
  opChoices: []
308
309
  },
@@ -336,7 +337,9 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
336
337
  data.utterance = queries[0]
337
338
  data.start_counter = startCounter
338
339
  let json = await doWithRetries(retries, url, queryParams, data)
339
- logs.push(...json.logs)
340
+ if (json.logs) {
341
+ logs.push(...json.logs)
342
+ }
340
343
  let resetData = false
341
344
  if (json.code === 'NOT_IN_CACHE') {
342
345
  resetData = true
@@ -387,6 +390,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
387
390
  response.trace = response.trace.concat(json.trace)
388
391
  response.version = json.version
389
392
  response.explain_priorities = json.explain_priorities
393
+ response.explain_associations = json.explain_associations
390
394
  response.contextual_priorities_ambiguities = json.contextual_priorities_ambiguities
391
395
  // response.rtf_associations = json.rtf_associations
392
396
 
@@ -888,6 +892,11 @@ const defaultInnerProcess = (config, errorHandler, responses) => {
888
892
  console.log(` inputs: ${JSON.stringify(inputs)} output: ${JSON.stringify(output)} reason: ${reason}`)
889
893
  }
890
894
  }
895
+
896
+ if (responses.explain_associations) {
897
+ console.log(responses.explain_associations)
898
+ }
899
+
891
900
  // const objects = config.get('objects').namespaced[config.uuid]
892
901
  const actualGetObjects = (name) => {
893
902
  if (!name) {
@@ -1136,7 +1145,6 @@ const rebuildTemplate = async ({ config, instance, target, previousResultss, reb
1136
1145
  delete result.memory_free_percent
1137
1146
  delete result.logs
1138
1147
  delete result.version
1139
- result.hierarchy.sort()
1140
1148
  // stabilizeAssociations(result.associations)
1141
1149
  result.learned_contextual_priorities = safeNoDups(result.learned_contextual_priorities)
1142
1150
  }
@@ -1374,6 +1382,7 @@ const knowledgeModuleImpl = async ({
1374
1382
  parser.add_argument('-dcp', '--debugContextualPriority', { action: 'store_true', help: helpDebugContextualPriority })
1375
1383
  parser.add_argument('-db', '--debugBridge', { action: 'store_true', help: helpDebugBridge })
1376
1384
  parser.add_argument('-do', '--debugOperator', { action: 'store_true', help: helpDebugOperator })
1385
+ parser.add_argument('-ea', '--explainAssociations', { action: 'store_true', help: 'The server will return information about the associations used to decide on the interpretation.' })
1377
1386
  parser.add_argument('-ep', '--explainPriorities', { action: 'store_true', help: 'The server will return all priorities including the generated one along with an explanation of there they came from' })
1378
1387
  parser.add_argument('-dic', '--debugIncludeConvolutions', { nargs: '?', help: 'When running with the --debugIncludeConvolutions flag the logs will include convolutions which are somewhat annoyingly verbose. Default is false' })
1379
1388
  parser.add_argument('-bc', '--bypassCache', { action: 'store_true', help: 'Bypass the cache on the server side and rebuild' })
@@ -1512,6 +1521,10 @@ const knowledgeModuleImpl = async ({
1512
1521
  config.config.explain_priorities = true
1513
1522
  }
1514
1523
 
1524
+ if (args.explainAssociations) {
1525
+ config.config.explain_associations = true
1526
+ }
1527
+
1515
1528
  config.config.debugIncludeConvolutions = args.debugIncludeConvolutions || process.argv.includes('--debugIncludeConvolutions') || process.argv.includes('-dic')
1516
1529
 
1517
1530
  let configPrinted = false
@@ -1544,7 +1557,10 @@ const knowledgeModuleImpl = async ({
1544
1557
  if (hasArg('c')) {
1545
1558
  const { data } = setupProcessB({ config })
1546
1559
  console.log('Config as sent to server')
1547
- console.log(JSON.stringify(data, null, 2))
1560
+ const toPrint = { ...data }
1561
+ toPrint['priorities'] = toPrint['priorities'].map((value) => JSON.stringify(value).replace(/\\"/g, '"'))
1562
+ toPrint['associations']['positive'] = toPrint['associations']['positive'].map((value) => JSON.stringify(value).replace(/\\"/g, '"'))
1563
+ console.log(JSON.stringify(toPrint, null, 2).replace(/\\"/g, '"'))
1548
1564
  }
1549
1565
  if (hasArg('l')) {
1550
1566
  console.log('Module load ordering')
package/package.json CHANGED
@@ -73,6 +73,6 @@
73
73
  "scriptjs": "^2.5.9",
74
74
  "uuid": "^8.3.2"
75
75
  },
76
- "version": "9.7.1-beta.16",
76
+ "version": "9.7.1-beta.18",
77
77
  "license": "UNLICENSED"
78
78
  }
package/src/generators.js CHANGED
@@ -195,7 +195,7 @@ class Generators {
195
195
  console.error("TPMKMS_TRACE", debug.counter("TPMKMS_TRACE"))
196
196
  console.error(generator.toLabel())
197
197
  console.error(generator.toString())
198
- console.log(`To debug this use debug.breakAt('${args.calls.current()}')`)
198
+ console.log(`To debug this use debug.breakAt('${args.calls.current()}. Check the 'callId' arg to see this value.')`)
199
199
  }
200
200
 
201
201
  try {
@@ -232,7 +232,7 @@ class Generators {
232
232
  lines.setElement(0, 2, stack)
233
233
  lines.newRow()
234
234
  lines.setElement(0, 1, 'DEBUG')
235
- lines.setElement(0, 2, `To debug this use debug.breakAt('${args.calls.current()}')`)
235
+ lines.setElement(0, 2, `To debug this use debug.breakAt('${args.calls.current()}. Check the 'callId' arg to see this value.')`)
236
236
  lines.newRow()
237
237
  lines.setElement(0, 1, 'ERROR')
238
238
  lines.setElement(0, 2, errorMessage)
@@ -264,7 +264,7 @@ class Generators {
264
264
  lines.setElement(0, 2, stack)
265
265
  lines.newRow()
266
266
  lines.setElement(0, 1, 'DEBUG')
267
- lines.setElement(0, 2, `To debug this use debug.breakAt('${args.calls.current()}')`)
267
+ lines.setElement(0, 2, `To debug this use debug.breakAt('${args.calls.current()}. Check the 'callId' arg to see this value.')`)
268
268
  lines.newRow()
269
269
  lines.setElement(0, 1, 'TO')
270
270
  lines.setElement(0, 2, `context_id: ${context.context_id}`)
package/src/semantics.js CHANGED
@@ -260,7 +260,7 @@ class Semantics {
260
260
  lines.setElement(0, 2, semantic.toString())
261
261
  lines.newRow()
262
262
  lines.setElement(0, 1, 'DEBUG')
263
- lines.setElement(0, 2, `To debug this use debug.breakAt('${args.calls.current()}')`)
263
+ lines.setElement(0, 2, `To debug this use debug.breakAt('${args.calls.current()}. Check the 'callId' arg to see this value.')`)
264
264
  lines.newRow()
265
265
  lines.setElement(0, 1, 'TO')
266
266
  lines.setElement(0, 2, `context_id: ${context.context_id}`)
@@ -295,7 +295,7 @@ class Semantics {
295
295
  lines.setElement(0, 2, semantic.toString())
296
296
  lines.newRow()
297
297
  lines.setElement(0, 1, 'DEBUG')
298
- lines.setElement(0, 2, `To debug this use debug.breakAt('${args.calls.current()}')`)
298
+ lines.setElement(0, 2, `To debug this use debug.breakAt('${args.calls.current()}. Check the 'callId' arg to see this value.')`)
299
299
  lines.newRow()
300
300
  lines.setElement(0, 1, 'TO')
301
301
  lines.setElement(0, 2, `context_id: ${context.context_id}`)