theprogrammablemind 7.5.8-beta.4 → 7.5.8-beta.41

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/src/flatten.js CHANGED
@@ -89,7 +89,15 @@ const flatten = (markers, value) => {
89
89
  const split = markers.includes(marker)
90
90
  if (split) {
91
91
  if ('value' in properties) {
92
- return [properties.value, true]
92
+ flattenedValues = []
93
+ for (let v of properties.value) {
94
+ if (v.flatten) {
95
+ flattenedValues = flattenedValues.concat(flatten(markers, v)[0])
96
+ } else {
97
+ flattenedValues.push(v)
98
+ }
99
+ }
100
+ return [flattenedValues, true]
93
101
  } else {
94
102
  return [[value], false]
95
103
  }
package/src/helpers.js CHANGED
@@ -320,7 +320,7 @@ const ecatch = (where, call) => {
320
320
  try {
321
321
  return call()
322
322
  } catch( e ) {
323
- throw new Error(`${where} ${e}`)
323
+ throw new Error(`${where} ${e.stack}`)
324
324
  }
325
325
  }
326
326
 
package/src/semantics.js CHANGED
@@ -6,7 +6,7 @@ class Semantic {
6
6
  // constructor ({match, apply, uuid, index, km, notes}) {
7
7
  constructor (semantic) {
8
8
  semantic = normalizeSemantic(semantic)
9
- const { match, apply, uuid, index, km, notes, priority, debug, where, applyWrapped, property } = semantic
9
+ const { match, apply, uuid, index, km, notes, priority, debug, where, applyWrapped, property, oneShot, id } = semantic
10
10
  this.matcher = match
11
11
  this._apply = apply
12
12
  this._applyWrapped = applyWrapped
@@ -18,6 +18,8 @@ class Semantic {
18
18
  this.notes = notes
19
19
  this.callId = debug
20
20
  this.where = where
21
+ this.oneShot = oneShot
22
+ this.id = id
21
23
  }
22
24
 
23
25
  toLabel () {
@@ -197,6 +199,9 @@ class Semantics {
197
199
  const log = (message) => { this.logs.push(message) }
198
200
  try {
199
201
  contextPrime = semantic.apply(args, context, s, log, options)
202
+ if (!contextPrime.controlKeepMotivation && semantic.oneShot) {
203
+ args.config.removeSemantic(semantic)
204
+ }
200
205
  } catch( e ) {
201
206
  contextPrime = null
202
207
  let errorMessage