theprogrammablemind 9.5.1-beta.4 → 9.5.1-beta.5

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
@@ -316,6 +316,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
316
316
  }
317
317
 
318
318
  let startCounter = 0
319
+ let contextIdCounter = 0
319
320
  while (true) {
320
321
  if (queries.length === 0) {
321
322
  break
@@ -356,8 +357,9 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
356
357
  }
357
358
  const summary = { summaries: json.summaries, length: json.contexts.length }
358
359
  summaries.push(summary)
359
- const { contextsPrime, generatedPrime, paraphrasesPrime, paraphrasesParenthesizedPrime, generatedParenthesizedPrime, responsesPrime } =
360
- await processContextsB({ isTest, isProcess, isModule, rebuildingTemplate, config, hierarchy, json, commandLineArgs /*, generators, semantics */ })
360
+ const { updatedContextIdCounter, contextsPrime, generatedPrime, paraphrasesPrime, paraphrasesParenthesizedPrime, generatedParenthesizedPrime, responsesPrime } =
361
+ await processContextsB({ contextIdCounter, isTest, isProcess, isModule, rebuildingTemplate, config, hierarchy, json, commandLineArgs /*, generators, semantics */ })
362
+ contextIdCounter = updatedContextIdCounter
361
363
  if (isTest) {
362
364
  const end = runtime.performance.performance.now()
363
365
  clientSideTime = end - start
@@ -475,6 +477,7 @@ const runTest = async (config, expected, { args, verbose, testConfig, debug, tim
475
477
  return
476
478
  }
477
479
  // initialize in between test so state is not preserved since the test was adding without state
480
+ config.testConfig.testModuleName = testConfig.testModuleName
478
481
  await config.rebuild()
479
482
  const errorHandler = (error) => {
480
483
  if (error.metadata) {
package/package.json CHANGED
@@ -71,6 +71,6 @@
71
71
  "sort-json": "^2.0.0",
72
72
  "uuid": "^8.3.2"
73
73
  },
74
- "version": "9.5.1-beta.4",
74
+ "version": "9.5.1-beta.5",
75
75
  "license": "UNLICENSED"
76
76
  }
@@ -133,6 +133,9 @@ const setupArgs = (args, config, logs, hierarchy, uuidForScoping) => {
133
133
  args.addPattern = (pattern, def) => config.addPattern(pattern, args.uuid)
134
134
  args.addGenerator = (generator) => config.addGenerator(generator, args.uuid, config.name)
135
135
 
136
+ if (config.testConfig?.testModuleName) {
137
+ args.testModuleName = config.testConfig.testModuleName
138
+ }
136
139
  args.addAssumedScoped = (args, assumed) => {
137
140
  const addAssumed = (args, ...moreAssumed) => {
138
141
  return { ...args, assumed: Object.assign({}, assumed, (args.assumed || {}), ...moreAssumed) }
@@ -291,7 +294,7 @@ const setupContexts = (rawContexts) => {
291
294
  return contexts
292
295
  }
293
296
 
294
- const processContextsB = async ({ config, hierarchy, semantics, generators, json, isTest, isProcess, isModule, rebuildingTemplate, isInstance, instance, query, data, retries, url, commandLineArgs, forTemplate }) => {
297
+ const processContextsB = async ({ config, hierarchy, semantics, generators, json, isTest, isProcess, isModule, rebuildingTemplate, isInstance, instance, query, data, retries, url, commandLineArgs, forTemplate, contextIdCounter }) => {
295
298
  // TODO fix this name to contextsPrime
296
299
  const contextsPrime = []
297
300
  const generatedPrime = []
@@ -311,14 +314,13 @@ const processContextsB = async ({ config, hierarchy, semantics, generators, json
311
314
  args.insert = (context) => toDo.unshift(context)
312
315
  let overlap, lastRange
313
316
  config.debugLoops = commandLineArgs && commandLineArgs.debugLoops
314
- let context_id_counter = 0
315
317
  while (toDo.length > 0) {
316
318
  const context = toDo.shift()
317
319
  args.calls.next()
318
320
  let contextPrime = context
319
321
  context.topLevel = true
320
- context_id_counter += 1
321
- context.context_id = context_id_counter
322
+ contextIdCounter += 1
323
+ context.context_id = contextIdCounter
322
324
  try {
323
325
  if (json.has_errors) {
324
326
  throw new Error('There are errors in the logs. Run with the -d flag and grep for Error')
@@ -328,6 +330,9 @@ const processContextsB = async ({ config, hierarchy, semantics, generators, json
328
330
  const semantics = config.getSemantics(json.logs)
329
331
  try {
330
332
  contextPrime = await semantics.apply(args, context)
333
+ // contextPrime.greg = 'yes'
334
+ // console.log("context_id", context.context_id)
335
+ // console.log("semantics.apply", JSON.stringify(contextPrime, null, 2))
331
336
  } catch (e) {
332
337
  if (e.message == 'Maximum call stack size exceeded') {
333
338
  const mostCalled = semantics.getMostCalled()
@@ -421,7 +426,7 @@ const processContextsB = async ({ config, hierarchy, semantics, generators, json
421
426
  throw e
422
427
  }
423
428
  }
424
- return { contextsPrime, generatedPrime, paraphrasesPrime, paraphrasesParenthesizedPrime, generatedParenthesizedPrime, responsesPrime }
429
+ return { contextsPrime, generatedPrime, paraphrasesPrime, paraphrasesParenthesizedPrime, generatedParenthesizedPrime, responsesPrime, updatedContextIdCounter: contextIdCounter }
425
430
  }
426
431
 
427
432
  // instance template loadTemplate
@@ -479,6 +484,9 @@ const loadInstance = async (config, instance) => {
479
484
  args.isModule = true
480
485
  args.isProcess = false
481
486
  }
487
+ if (instance.name == config.testConfig.testModuleName) {
488
+ args.isTesting = true
489
+ }
482
490
  await results.apply(args)
483
491
  } else if (results.isFragment) {
484
492
  } else {
@@ -490,6 +498,9 @@ const loadInstance = async (config, instance) => {
490
498
  args.instance = ''
491
499
  args.isProcess = !config.isModule
492
500
  args.isModule = !!config.isModule
501
+ if (instance.name == config.testConfig.testModuleName) {
502
+ args.isTesting = true
503
+ }
493
504
  await processContextsB(args)
494
505
  if (results.skipSemantics) {
495
506
  config.config.skipSemantics = null