theprogrammablemind 8.0.0-beta.47 → 8.0.0-beta.49

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
@@ -888,6 +888,7 @@ const rebuildTemplate = async ({ config, target, previousResultss, startOfChange
888
888
  associations: [],
889
889
  learned_contextual_priorities: []
890
890
  }
891
+ config.fragmentsBeingBuilt = []
891
892
  const looper = async (configs) => {
892
893
  if (configs.length === 0) {
893
894
  finish()
@@ -895,14 +896,15 @@ const rebuildTemplate = async ({ config, target, previousResultss, startOfChange
895
896
  }
896
897
  const { property, hierarchy, query: queryOrExtraConfig, previousResults, initializer, skipSemantics } = configs.shift()
897
898
  // queries are strings or { query: "blah", development: true/false }
898
- if (typeof queryOrExtraConfig === 'string' || queryOrExtraConfig.query) {
899
+ if (typeof queryOrExtraConfig === 'string' || queryOrExtraConfig.query || queryOrExtraConfig.isFragment) {
899
900
  let query = queryOrExtraConfig
901
+ let isFragment = queryOrExtraConfig.isFragment
900
902
  if (typeof queryOrExtraConfig === 'string') {
901
903
  query = { query }
902
904
  }
903
- config.config.skipSemantics = skipSemantics
905
+ config.config.skipSemantics = skipSemantics && !isFragment
904
906
  const transitoryMode = global.transitoryMode
905
- if (property == 'fragments') {
907
+ if (isFragment || property == 'fragments') {
906
908
  global.transitoryMode = true
907
909
  }
908
910
  if (hierarchy) {
@@ -939,10 +941,14 @@ const rebuildTemplate = async ({ config, target, previousResultss, startOfChange
939
941
  global.transitoryMode = transitoryMode
940
942
  config.config.skipSemantics = null
941
943
  results.query = query.query
944
+ results.isFragment = isFragment
942
945
  results.skipSemantics = skipSemantics
943
946
  results.development = query.development
944
947
  results.key = { query: query.query, hierarchy }
945
948
  accumulators[property].push(results)
949
+ if (isFragment) {
950
+ config.fragmentsBeingBuilt.push({ query: query.query, contexts: results.contexts })
951
+ }
946
952
  accumulators.associations = accumulators.associations.concat(results.associations)
947
953
  accumulators.learned_contextual_priorities = accumulators.learned_contextual_priorities.concat(results.learned_contextual_priorities)
948
954
  await looper(configs)
@@ -956,7 +962,7 @@ const rebuildTemplate = async ({ config, target, previousResultss, startOfChange
956
962
  const initFunction = queryOrExtraConfig
957
963
  const objects = config.get('objects')
958
964
  const args = { objects, getObjects: getObjects(objects) }
959
- setupArgs(args, config, config.logs, hierarchy)
965
+ setupArgs(args, config, config.logs, config.hierarchy)
960
966
  initFunction(args)
961
967
  accumulators[property].push({ apply: queryOrExtraConfig })
962
968
  await looper(configs)
@@ -981,6 +987,7 @@ const rebuildTemplate = async ({ config, target, previousResultss, startOfChange
981
987
  }
982
988
 
983
989
  const finish = () => {
990
+ config.fragmentsBeingBuilt = []
984
991
  const instanceName = `${target}.instance.json`
985
992
  console.log(`Writing instance file ${instanceName}`)
986
993
  const stabilizeAssociations = (associations) => {
@@ -1358,7 +1365,7 @@ const knowledgeModuleImpl = async ({
1358
1365
  // { literals: Object, patterns: Array(2), hierarchy: Array(97) }
1359
1366
  console.log('literals')
1360
1367
  for (const word in config.config.words.literals) {
1361
- console.log(' ' + word.concat(' ', ...config.config.words.literals[word].map((def) => JSON.stringify(def))))
1368
+ console.log(' ' + word.concat(...config.config.words.literals[word].map((def, i) => ((i > 0) ? ' '.repeat(4+word.length) : ' ') + JSON.stringify(def) + '\n')))
1362
1369
  }
1363
1370
  console.log('patterns')
1364
1371
  for (const pattern of config.config.words.patterns) {
package/package.json CHANGED
@@ -65,6 +65,6 @@
65
65
  "sort-json": "^2.0.0",
66
66
  "uuid": "^8.3.2"
67
67
  },
68
- "version": "8.0.0-beta.47",
68
+ "version": "8.0.0-beta.49",
69
69
  "license": "UNLICENSED"
70
70
  }
package/src/config.js CHANGED
@@ -255,6 +255,9 @@ const priority_valid = (cp) => {
255
255
  const handleBridgeProps = (config, bridge, { addFirst, uuid } = {}) => {
256
256
  ecatch(`While processing the bridge for ${bridge.id}#${bridge.level}`,
257
257
  () => {
258
+ if (bridge.development && config.isModule) {
259
+ return
260
+ }
258
261
  if (!bridge.bridge) {
259
262
  bridge.bridge = '{ ...next(operator) }'
260
263
  }
@@ -1047,6 +1050,16 @@ class Config {
1047
1050
  return this.fragmentInstantiator(fragment.contexts)
1048
1051
  }
1049
1052
  }
1053
+ for (const fragment of (instance.resultss || [])) {
1054
+ if (fragment.isFragment && fragment.query === query) {
1055
+ return this.fragmentInstantiator(fragment.contexts)
1056
+ }
1057
+ }
1058
+ for (const fragment of (this.fragmentsBeingBuilt || [])) {
1059
+ if (fragment.query === query) {
1060
+ return this.fragmentInstantiator(fragment.contexts)
1061
+ }
1062
+ }
1050
1063
  }
1051
1064
  }
1052
1065
 
@@ -381,7 +381,6 @@ const loadInstance = async (config, instance) => {
381
381
  }
382
382
 
383
383
  const { /* data, generators, semantics, */ hierarchy } = setupProcessB({ config })
384
- // for (const results of (instance.resultss || [])) {
385
384
  for (const i in (instance.resultss || [])) {
386
385
  const results = instance.resultss[i]
387
386
  if (results.extraConfig) {
@@ -400,6 +399,7 @@ const loadInstance = async (config, instance) => {
400
399
  const uuid = config.nameToUUID(instance.name)
401
400
  setupArgs(args, config, config.logs, hierarchy, uuid)
402
401
  await results.apply(args)
402
+ } else if (results.isFragment) {
403
403
  } else {
404
404
  if (results.skipSemantics) {
405
405
  config.config.skipSemantics = results.skipSemantics