theprogrammablemind_4wp 9.6.1-beta.3 → 9.6.1-beta.4

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
@@ -12,7 +12,7 @@ const _ = require('lodash')
12
12
  const stringify = require('json-stable-stringify')
13
13
  const Lines = require('./lines')
14
14
  const flattens = require('./src/flatten')
15
- const { sortJson, appendNoDups, updateQueries, safeNoDups, stableId, where, suggestAssociationsFix, suggestAssociationsFixFromSummaries, validProps } = require('./src/helpers')
15
+ const { sortJson, appendNoDups, InitCalls, updateQueries, safeNoDups, stableId, where, suggestAssociationsFix, suggestAssociationsFixFromSummaries, validProps } = require('./src/helpers')
16
16
  const runtime = require('./runtime')
17
17
  const db = require('./src/debug')
18
18
 
@@ -319,6 +319,13 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
319
319
 
320
320
  let startCounter = 0
321
321
  let contextIdCounter = 0
322
+ let calls
323
+ if (global.theprogrammablemind && global.theprogrammablemind.loadForTesting) {
324
+ calls = new InitCalls(Object.keys(global.theprogrammablemind.loadForTesting)[0])
325
+ } else {
326
+ calls = new InitCalls(config.getName())
327
+ }
328
+
322
329
  while (true) {
323
330
  if (queries.length === 0) {
324
331
  break
@@ -330,7 +337,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
330
337
  let resetData = false
331
338
  if (json.code === 'NOT_IN_CACHE') {
332
339
  resetData = true
333
- const setupB = setupProcessB({ config, allowDelta: false })
340
+ const setupB = setupProcessB({ config, calls, allowDelta: false })
334
341
  data = setupB.data
335
342
  hierarchy = setupB.hierarchy
336
343
  data.utterance = queries[0]
@@ -360,7 +367,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
360
367
  const summary = { summaries: json.summaries, length: json.contexts.length }
361
368
  summaries.push(summary)
362
369
  const { updatedContextIdCounter, contextsPrime, generatedPrime, paraphrasesPrime, paraphrasesParenthesizedPrime, generatedParenthesizedPrime, responsesPrime } =
363
- await processContextsB({ contextIdCounter, isTest, isProcess, isModule, rebuildingTemplate, config, hierarchy, json, commandLineArgs /*, generators, semantics */ })
370
+ await processContextsB({ contextIdCounter, calls, isTest, isProcess, isModule, rebuildingTemplate, config, hierarchy, json, commandLineArgs /*, generators, semantics */ })
364
371
  contextIdCounter = updatedContextIdCounter
365
372
  if (isTest) {
366
373
  const end = runtime.performance.performance.now()
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.6.1-beta.3",
76
+ "version": "9.6.1-beta.4",
77
77
  "license": "UNLICENSED"
78
78
  }
@@ -131,9 +131,12 @@ const setupArgs = (args, config, logs, hierarchy, uuidForScoping) => {
131
131
  hierarchy = config.getHierarchy()
132
132
  }
133
133
  // callId
134
- args.calls = new InitCalls(args.isInstance ? `${args.isInstance}#${config.getName()}` : config.getName())
135
- if (global.theprogrammablemind && global.theprogrammablemind.loadForTesting) {
136
- args.calls = new InitCalls(Object.keys(global.theprogrammablemind.loadForTesting)[0])
134
+ // debug.counter('InitCalls', { breakAt: 641 })
135
+ if (!args.calls) {
136
+ args.calls = new InitCalls(args.isInstance ? `${args.isInstance}#${config.getName()}` : config.getName())
137
+ if (global.theprogrammablemind && global.theprogrammablemind.loadForTesting) {
138
+ args.calls = new InitCalls(Object.keys(global.theprogrammablemind.loadForTesting)[0])
139
+ }
137
140
  }
138
141
  args.contextHierarchy = new ContextHierarchy()
139
142
  args.cleanAssign = cleanAssign
@@ -364,7 +367,7 @@ const setupContexts = (rawContexts) => {
364
367
  return contexts
365
368
  }
366
369
 
367
- const processContextsB = async ({ config, hierarchy, semantics, generators, json, isTest, isProcess, isModule, rebuildingTemplate, isInstance, instance, query, data, retries, url, commandLineArgs, forTemplate, contextIdCounter }) => {
370
+ const processContextsB = async ({ config, calls, hierarchy, semantics, generators, json, isTest, isProcess, isModule, rebuildingTemplate, isInstance, instance, query, data, retries, url, commandLineArgs, forTemplate, contextIdCounter }) => {
368
371
  // TODO fix this name to contextsPrime
369
372
  const contextsPrime = []
370
373
  const generatedPrime = []
@@ -375,7 +378,7 @@ const processContextsB = async ({ config, hierarchy, semantics, generators, json
375
378
  const contexts = setupContexts(json.contexts)
376
379
 
377
380
  const objects = config.get('objects')
378
- const args = { objects, isResponse: true, response: json, isTest, isInstance, getObjects: getObjects(objects), instance, contexts, isProcess, isModule }
381
+ const args = { objects, isResponse: true, response: json, isTest, isInstance, getObjects: getObjects(objects), instance, contexts, isProcess, isModule, calls }
379
382
  if (!json.logs) {
380
383
  json.logs = []
381
384
  }