theprogrammablemind_4wp 7.4.0 → 7.4.1-beta.0

Sign up to get free protection for your applications and to get access to all the features.
package/client.js CHANGED
@@ -12,14 +12,16 @@ const { appendNoDups, InitCalls } = require('./src/helpers')
12
12
  const runtime = require('./runtime')
13
13
  const sortJson = runtime.sortJson
14
14
 
15
- const ask = (config) => (asks) => {
15
+ const getAsk = (config) => (uuid) => (asks) => {
16
16
  for (let ask of asks) {
17
17
  config.addMotivation({
18
+ uuid,
18
19
  match: (args) => ask.matchr(args),
19
20
  apply: (args) => ask.applyr(args)
20
21
  })
21
22
  }
22
23
  config.addMotivation({
24
+ uuid,
23
25
  match: ({context}) => context.marker == 'controlEnd' || context.marker == 'controlBetween',
24
26
  apply: (args) => {
25
27
  for (let ask of asks) {
@@ -100,7 +102,25 @@ const setupArgs = (args, config, logs, hierarchy) => {
100
102
  args.listable = listable(hierarchy)
101
103
  args.asList = asList
102
104
  args.retry = () => { throw new RetryError() }
103
- args.ask = ask(config)
105
+ const scopedAsk = getAsk(config)
106
+
107
+ const getAPI = (uuid) => {
108
+ if (config && config.getAPI) {
109
+ return config.getAPI(uuid)
110
+ }
111
+ }
112
+ const getAPIs = (uuid) => {
113
+ if (config && config.getAPIs) {
114
+ return config.getAPIs(uuid)
115
+ }
116
+ }
117
+ args.getUUIDScoped = (uuid) => {
118
+ return {
119
+ ask: scopedAsk(uuid),
120
+ api: getAPI(uuid),
121
+ apis: getAPIs(uuid)
122
+ }
123
+ }
104
124
  args.motivation = (m) => config.addMotivation(m)
105
125
  args.s = (c) => config.getSemantics(logs).apply(args, c)
106
126
  args.g = (c) => config.getGenerators(logs).apply(args, c)
@@ -174,11 +194,13 @@ const processContexts = (contexts, params) => {
174
194
  return { contexts: contextsPrime, generated, logs }
175
195
  }
176
196
 
177
- const getObjects = (objects) => (uuid) => {
178
- if (objects && objects.namespaced) {
179
- objects = objects.namespaced[uuid]
197
+ const getObjects = (objects) => {
198
+ return (uuid) => {
199
+ if (objects && objects.namespaced) {
200
+ return objects.namespaced[uuid]
201
+ }
202
+ return objects
180
203
  }
181
- return objects
182
204
  }
183
205
 
184
206
  const processContext = (context, { objects = {}, config, logs = [] }) => {
@@ -414,9 +436,12 @@ const processContextsB = ({ config, hierarchy, semantics, generators, json, isTe
414
436
  return { contextsPrime, generatedPrime, paraphrasesPrime, responsesPrime }
415
437
  }
416
438
 
417
- const doWithRetries = async (n, url, data) => {
439
+ const doWithRetries = async (n, url, queryParams, data) => {
440
+ if (!queryParams) {
441
+ queryParams = ''
442
+ }
418
443
  for (let i = 0; i < n; ++i) {
419
- const result = await fetch(`${url}/process`, {
444
+ const result = await fetch(`${url}/process${queryParams}`, {
420
445
  method: 'POST',
421
446
  body: JSON.stringify(data),
422
447
  timeout: 1000 * 60 * 5, // it does not respect this timeout so that's why I have the retries
@@ -484,11 +509,12 @@ const processInstance = (config, instance) => {
484
509
  global.transitoryMode = transitoryMode
485
510
  }
486
511
 
487
- const _process = async (config, query, { credentials, writeTests, isTest, saveDeveloper, testConfig, testsFN, errorHandler = defaultErrorHandler, beforeQuery } = {}) => {
512
+ const _process = async (config, query, { credentials, writeTests, isTest, saveDeveloper, testConfig, testsFN, errorHandler = defaultErrorHandler } = {}) => {
488
513
  if (credentials) {
489
514
  config.server(credentials.server, credentials.key)
490
515
  }
491
516
  const url = config._server
517
+ const queryParams = config._queryParams || ''
492
518
  const retries = 2
493
519
  writeTests = !!writeTests
494
520
 
@@ -497,7 +523,7 @@ const _process = async (config, query, { credentials, writeTests, isTest, saveDe
497
523
  if (writeTests) {
498
524
  config.rebuild()
499
525
  const objects = getObjects(config.config.objects)(config.uuid)
500
- beforeQuery({ query, isModule: false, objects })
526
+ config.beforeQuery({ query, isModule: false, objects })
501
527
  }
502
528
  } catch(error) {
503
529
  throw error
@@ -528,7 +554,7 @@ const _process = async (config, query, { credentials, writeTests, isTest, saveDe
528
554
  break;
529
555
  }
530
556
  data.utterance = queries[0]
531
- const json = await doWithRetries(retries, url, data)
557
+ const json = await doWithRetries(retries, url, queryParams, data)
532
558
  json.contexts = json.results
533
559
  delete json.results
534
560
  if (json.status !== 200) {
@@ -598,7 +624,7 @@ const getConfigForTest = (config, testConfig) => {
598
624
  return configForTest
599
625
  }
600
626
 
601
- const runTest = async (config, expected, { verbose, beforeQuery, afterTest, testConfig, debug }) => {
627
+ const runTest = async (config, expected, { verbose, afterTest, testConfig, debug }) => {
602
628
  const test = expected.query
603
629
  // initialize in between test so state is not preserved since the test was adding without state
604
630
  config.rebuild()
@@ -616,7 +642,7 @@ const runTest = async (config, expected, { verbose, beforeQuery, afterTest, test
616
642
  }
617
643
 
618
644
  const objects = getObjects(config.config.objects)(config.uuid)
619
- beforeQuery({ query: test, isModule: false, objects })
645
+ config.beforeQuery({ query: test, isModule: false, objects })
620
646
  config.resetMotivations()
621
647
  try {
622
648
  const result = await _process(config, test, { errorHandler, isTest: true })
@@ -642,8 +668,8 @@ const runTest = async (config, expected, { verbose, beforeQuery, afterTest, test
642
668
  const failed_config = !matching(actual_config, expected_config)
643
669
  let failed = failed_paraphrases || failed_responses || failed_contexts || failed_objects || failed_config
644
670
  if (!failed) {
645
- if (afterTest) {
646
- failed = afterTest({ query: test, expected, actual: result, config })
671
+ if (config.afterTest) {
672
+ failed = config.afterTest({ query: test, expected, actual: result, config })
647
673
  if (failed) {
648
674
  return {
649
675
  utterance: test,
@@ -703,21 +729,20 @@ const runTestsHelper = async (config, tests, failed, juicyBits) => {
703
729
 
704
730
  const runTests = async (config, testFile, juicyBits) => {
705
731
  const tests = JSON.parse(runtime.fs.readFileSync(testFile))
706
- const { beforeTests, afterTests } = juicyBits
707
- beforeTests()
732
+ config.beforeTests()
708
733
  if (juicyBits.verbose) {
709
734
  console.log('\n', testFile, '-----------------------------------------------', '\n')
710
735
  }
711
736
  const v = await runTestsHelper(config, [...tests], [], juicyBits)
712
- afterTests()
737
+ config.afterTests()
713
738
  return v
714
739
  }
715
740
 
716
- const saveTest = async (testFile, config, test, expected, beforeQuery, testConfig, saveDeveloper) => {
741
+ const saveTest = async (testFile, config, test, expected, testConfig, saveDeveloper) => {
717
742
  config.rebuild()
718
743
  const objects = getObjects(config.config.objects)(config.uuid)
719
744
  config.resetMotivations()
720
- beforeQuery({ query: test, isModule: false, objects })
745
+ config.beforeQuery({ query: test, isModule: false, objects })
721
746
  console.log(test)
722
747
  const result = await _process(config, test, { isTest: true })
723
748
  // const actualObjects = config.config.objects
@@ -725,23 +750,23 @@ const saveTest = async (testFile, config, test, expected, beforeQuery, testConfi
725
750
  writeTest(testFile, test, config.config.objects, result.generated, result.paraphrases, result.responses, result.contexts, result.associations, result.metadata, actualConfig, saveDeveloper)
726
751
  }
727
752
 
728
- const saveTestsHelper = async (testFile, config, tests, todo, beforeQuery, testConfig, saveDeveloper) => {
753
+ const saveTestsHelper = async (testFile, config, tests, todo, testConfig, saveDeveloper) => {
729
754
  if (todo.length === 0) {
730
755
  return
731
756
  }
732
757
  const test = todo.pop()
733
758
  config.rebuild()
734
- const result = await saveTest(testFile, config, test, tests[test], beforeQuery, testConfig, saveDeveloper)
759
+ const result = await saveTest(testFile, config, test, tests[test], testConfig, saveDeveloper)
735
760
  // initialize in between test so state is not preserved since the test was adding without state
736
761
  // config.initialize({force: true})
737
762
  config.rebuild()
738
- return saveTestsHelper(testFile, config, tests, todo, beforeQuery, testConfig, saveDeveloper)
763
+ return saveTestsHelper(testFile, config, tests, todo, testConfig, saveDeveloper)
739
764
  }
740
765
 
741
- const saveTests = (config, testFile, beforeQuery, testConfig) => {
766
+ const saveTests = (config, testFile, testConfig) => {
742
767
  const tests = JSON.parse(runtime.fs.readFileSync(testFile))
743
768
  console.log(testFile)
744
- return saveTestsHelper(testFile, config, tests, tests.map( (test) => test.query ), beforeQuery, testConfig)
769
+ return saveTestsHelper(testFile, config, tests, tests.map( (test) => test.query ), testConfig)
745
770
  }
746
771
 
747
772
  /*
@@ -962,7 +987,7 @@ entodicton.knowledgeModule( {
962
987
  `
963
988
  */
964
989
 
965
- const build = async ({ config, target, beforeQuery, template, errorHandler = defaultErrorHandler }) => {
990
+ const build = async ({ config, target, template, errorHandler = defaultErrorHandler }) => {
966
991
  const accumulators = {
967
992
  resultss: [],
968
993
  fragments: [],
@@ -1000,7 +1025,7 @@ const build = async ({ config, target, beforeQuery, template, errorHandler = def
1000
1025
  }
1001
1026
 
1002
1027
  try {
1003
- const results = await _process(config, query.query, { beforeQuery })
1028
+ const results = await _process(config, query.query, {})
1004
1029
  if (config.config.debug) {
1005
1030
  // TODO pass in the error handler like the other ones
1006
1031
  defaultInnerProcess(config, defaultErrorHandler, results)
@@ -1097,11 +1122,40 @@ const knowledgeModule = async ({
1097
1122
  afterTest = () => {}
1098
1123
  } = {}) => {
1099
1124
 
1100
- const isProcess = require.main === moduleFromJSFile
1125
+ config.beforeQuery = beforeQuery
1126
+ config.beforeTests = beforeTests
1127
+ config.afterTests = afterTests
1128
+ config.beforeTest = beforeTest
1129
+ config.afterTest = afterTest
1130
+
1101
1131
  const testConfig = test
1102
1132
 
1133
+ if (!moduleFromJSFile) {
1134
+ throw "'module' is a required parameter. The value should be either 'module' or a lambda that will be called when the file is acting as a module."
1135
+ }
1136
+ if (!config) {
1137
+ throw "'config' is a required parameter. The value should the config that defines the knowledge module."
1138
+ }
1139
+ if (!config.name) {
1140
+ throw "config must have 'name' set to the knowledge module name."
1141
+ }
1142
+ if (!description) {
1143
+ throw "'description' is a required parameter. The value should the description of the knowledge module."
1144
+ }
1145
+ if (!test) {
1146
+ throw "'test' is a required parameter. The value should the path to the file used to store the tests of the knowledge module and the contents of the file in the form { name: <filePath>, contexts: <json> }."
1147
+ }
1148
+
1149
+ const isProcess = require.main === moduleFromJSFile
1150
+ let loadForTesting = false
1151
+ if (global.theprogrammablemind) {
1152
+ if (global.theprogrammablemind.loadForTesting[config.name]) {
1153
+ loadForTesting = true
1154
+ }
1155
+ }
1156
+
1103
1157
  // remove test only stuff
1104
- if (!isProcess) {
1158
+ if (!isProcess && !loadForTesting) {
1105
1159
  config.config.operators = config.config.operators.filter( (operator) => {
1106
1160
  if (operator.development) {
1107
1161
  return false
@@ -1118,22 +1172,6 @@ const knowledgeModule = async ({
1118
1172
  })
1119
1173
  }
1120
1174
 
1121
- if (!moduleFromJSFile) {
1122
- throw "'module' is a required parameter. The value should be either 'module' or a lambda that will be called when the file is acting as a module."
1123
- }
1124
- if (!config) {
1125
- throw "'config' is a required parameter. The value should the config that defines the knowledge module."
1126
- }
1127
- if (!config.name) {
1128
- throw "config must have 'name' set to the knowledge module name."
1129
- }
1130
- if (!description) {
1131
- throw "'description' is a required parameter. The value should the description of the knowledge module."
1132
- }
1133
- if (!test) {
1134
- throw "'test' is a required parameter. The value should the path to the file used to store the tests of the knowledge module and the contents of the file in the form { name: <filePath>, contexts: <json> }."
1135
- }
1136
-
1137
1175
  let module
1138
1176
  if (_.isFunction(moduleFromJSFile)) {
1139
1177
  module = moduleFromJSFile
@@ -1172,6 +1210,7 @@ const knowledgeModule = async ({
1172
1210
  description: 'Entodicton knowledge module'
1173
1211
  })
1174
1212
 
1213
+ parser.add_argument('-tfn', '--testFileName', { help: 'Override the test file for the module when the tests are being run' })
1175
1214
  parser.add_argument('-t', '--test', { action: 'store_true', help: 'Run the tests. Create tests by running with the --query + --save flag' })
1176
1215
  parser.add_argument('-tv', '--testVerbose', { action: 'store_true', help: 'Run the tests in verbose mode. Create tests by running with the --query or --loop with the --save flag' })
1177
1216
  parser.add_argument('-tva', '--testAllVerbose', { action: 'store_true', help: 'Run the tests in verbose mode. All the tests will be run instead of stopping at first failure. Create tests by running with the --query or --loop with the --save flag' })
@@ -1185,6 +1224,7 @@ const knowledgeModule = async ({
1185
1224
  parser.add_argument('-r', '--retrain', { action: 'store_true', help: 'Get the server to retrain the neural nets' })
1186
1225
  parser.add_argument('-q', '--query', { help: 'Run the specified query' })
1187
1226
  parser.add_argument('-ip ', '--server', { help: 'Server to run against' })
1227
+ parser.add_argument('-qp ', '--queryParams', { help: 'Query params for the server call' })
1188
1228
  parser.add_argument('-qd', '--queryDelete', { help: 'Delete the specified query from the tests file' })
1189
1229
  parser.add_argument('-c', '--clean', { help: 'Remove data from the test files. a === association' })
1190
1230
  parser.add_argument('-od', '--objectDiff', { action: 'store_true', help: 'When showing the objects use a colour diff' })
@@ -1243,6 +1283,10 @@ const knowledgeModule = async ({
1243
1283
  config.server(args.server)
1244
1284
  }
1245
1285
 
1286
+ if (args.queryParams) {
1287
+ config.setQueryParams(args.queryParams)
1288
+ }
1289
+
1246
1290
  if (args.debug) {
1247
1291
  config.config.debug = true
1248
1292
  }
@@ -1366,9 +1410,8 @@ const knowledgeModule = async ({
1366
1410
 
1367
1411
  if (!args.query && !args.test && !args.info && (args.save || args.saveDeveloper)) {
1368
1412
  global.transitoryMode = true
1369
- saveTests(config, test, beforeQuery, testConfig, args.saveDeveloper)
1413
+ saveTests(config, test, testConfig, args.saveDeveloper)
1370
1414
  // } else if (args.build) {
1371
- // build({ config, target: args.build, beforeQuery, errorHandler })
1372
1415
  } else if (args.info) {
1373
1416
  showInfo(description, section, config)
1374
1417
  } else if (args.test || args.testVerbose || args.testAllVerbose) {
@@ -1381,7 +1424,7 @@ const knowledgeModule = async ({
1381
1424
  }
1382
1425
  return
1383
1426
  }
1384
- runTests(config, test, { debug: args.debug, testConfig: testConfig, verbose: args.testVerbose || args.testAllVerbose, stopAtFirstError: !args.testAllVerbose, beforeQuery, beforeTests, afterTests, beforeTest, afterTest }).then((results) => {
1427
+ runTests(config, args.testFileName ? `${args.testFileName}.test.json` : test, { debug: args.debug, testConfig: testConfig, verbose: args.testVerbose || args.testAllVerbose, stopAtFirstError: !args.testAllVerbose }).then((results) => {
1385
1428
  if (results.length > 0 && args.vimdiff) {
1386
1429
  for (const result of results) {
1387
1430
  vimdiff(result.expected, result.actual)
@@ -1454,9 +1497,9 @@ const knowledgeModule = async ({
1454
1497
  if (args.objectDiff) {
1455
1498
  global.beforeObjects = _.cloneDeep(objects)
1456
1499
  }
1457
- beforeQuery({ query: args.query, isModule: false, objects })
1500
+ config.beforeQuery({ query: args.query, isModule: false, objects })
1458
1501
  try {
1459
- processResults(_process(config, args.query, { dontAddAssociations: args.dontAddAssociations, writeTests: args.save || args.saveDeveloper, saveDeveloper: args.saveDeveloper, testConfig, testsFN: test, beforeQuery }))
1502
+ processResults(_process(config, args.query, { dontAddAssociations: args.dontAddAssociations, writeTests: args.save || args.saveDeveloper, saveDeveloper: args.saveDeveloper, testConfig, testsFN: test }))
1460
1503
  } catch( error ) {
1461
1504
  console.log('Error', error);
1462
1505
  }
package/package.json CHANGED
@@ -61,6 +61,6 @@
61
61
  "json-stable-stringify": "^1.0.1",
62
62
  "node-fetch": "^2.6.1"
63
63
  },
64
- "version": "7.4.0",
64
+ "version": "7.4.1-beta.0",
65
65
  "license": "ISC"
66
66
  }
package/src/config.js CHANGED
@@ -767,6 +767,23 @@ class Config {
767
767
  }
768
768
  }
769
769
 
770
+ getAPIs (uuid) {
771
+ let config
772
+ if (this._uuid === uuid) {
773
+ config = this
774
+ } else {
775
+ for (const km of this.configs) {
776
+ if (km._uuid === uuid) {
777
+ config = km.config
778
+ break
779
+ }
780
+ }
781
+ }
782
+ if (config && config._api && config._api.multiApi) {
783
+ return config._api.apis
784
+ }
785
+ }
786
+
770
787
  getServer() {
771
788
  return this._server
772
789
  }
@@ -775,13 +792,22 @@ class Config {
775
792
  return this._key
776
793
  }
777
794
 
778
- server (server, apiKey) {
795
+ getQueryParams() {
796
+ return this._queryParams
797
+ }
798
+
799
+ setQueryParams(queryParams) {
800
+ this._queryParams = queryParams
801
+ }
802
+
803
+ server (server, apiKey, queryParams) {
779
804
  if (server) {
780
805
  this._server = server
781
806
  }
782
807
  if (apiKey) {
783
808
  this._key = apiKey
784
809
  }
810
+ this._queryParams = queryParams
785
811
 
786
812
  if (this._api && this._api.multiApi) {
787
813
  for (const key of Object.keys(this._api.apis)) {
@@ -888,6 +914,19 @@ class Config {
888
914
  return configs;
889
915
  }
890
916
 
917
+ getConfigByUUID (uuid) {
918
+ if (this.uuid === uuid) {
919
+ return this
920
+ }
921
+ for (const config of this.configs) {
922
+ if (config.config instanceof Config) {
923
+ if (config.uuid === uuid) {
924
+ return config.config
925
+ }
926
+ }
927
+ }
928
+ }
929
+
891
930
  getConfig (name) {
892
931
  if (this.name === name) {
893
932
  return this
@@ -932,7 +971,13 @@ class Config {
932
971
  }
933
972
 
934
973
  this.addedArgss = []
935
- const isProcess = require.main === module
974
+ let isProcess = require.main === module
975
+ if (global.theprogrammablemind && config) {
976
+ if (global.theprogrammablemind.loadForTesting[config.name]) {
977
+ isProcess = true
978
+ this.loadedForTesting = true
979
+ }
980
+ }
936
981
  this.isModule = !isProcess
937
982
  if (this.isModule) {
938
983
  this.removeDevelopmentElements(config)
@@ -1198,6 +1243,9 @@ class Config {
1198
1243
 
1199
1244
  // motivation === { match, apply, uuid }
1200
1245
  addMotivation (motivation) {
1246
+ if (!motivation.uuid) {
1247
+ motivation.uuid = this.uuid
1248
+ }
1201
1249
  this.motivations.push(motivation)
1202
1250
  }
1203
1251
 
@@ -1207,11 +1255,13 @@ class Config {
1207
1255
 
1208
1256
  doMotivations (args, context) {
1209
1257
  args = Object.assign({}, args, { context })
1210
- args.objects = args.getObjects(this.uuid)
1258
+ // console.log('src/config doMotivations this.uuid', this.uuid)
1259
+ // args.objects = args.getObjects(this.uuid)
1211
1260
  const motivations = this.motivations
1212
1261
  this.motivations = []
1213
1262
  let done = false
1214
1263
  for (const motivation of motivations) {
1264
+ args.objects = args.getObjects(motivation.uuid)
1215
1265
  if (!done && motivation.match(args)) {
1216
1266
  motivation.apply(args)
1217
1267
  if (args.context.controlKeepMotivation || motivation.repeat) {
@@ -1255,6 +1305,7 @@ class Config {
1255
1305
  cp.tests = this.tests
1256
1306
  cp.motivations = this.motivations
1257
1307
  cp.isModule = this.isModule
1308
+ cp.loadedForTesting = this.loadedForTesting
1258
1309
  cp.initInstances = this.initInstances.slice()
1259
1310
  cp.instances = this.instances.slice()
1260
1311
  cp.configCounter = this.configCounter
@@ -1603,6 +1654,12 @@ class Config {
1603
1654
  // already set
1604
1655
  // this.isModule = this.isModule || mainIsModule
1605
1656
  mainIsModule = (mainIsModule === undefined) ? this.isModule : mainIsModule
1657
+ if (mainIsModule !== undefined) {
1658
+ this.isModule = mainIsModule
1659
+ }
1660
+ if (this.loadedForTesting) {
1661
+ this.isModule = false
1662
+ }
1606
1663
  this.config.objects.namespaced = {}
1607
1664
  this.resetWasInitialized()
1608
1665
 
@@ -1640,7 +1697,9 @@ class Config {
1640
1697
  if (!(config instanceof Config)) {
1641
1698
  config = this
1642
1699
  isSelf = true
1643
- isModule = mainIsModule
1700
+ isModule = config.isModule || mainIsModule
1701
+ } else {
1702
+ isModule = config.isModule
1644
1703
  }
1645
1704
  if (!isSelf) {
1646
1705
  config.config = _.cloneDeep(config.initConfig)
@@ -2011,7 +2070,7 @@ class Config {
2011
2070
  more.valid()
2012
2071
  // copy so i don't have to copy later
2013
2072
  more = more.copy()
2014
- more.server(this._server, this._key)
2073
+ more.server(this._server, this._key, this._queryParams)
2015
2074
 
2016
2075
  this.loadOrder.addList(more.configs.map((km) => km.name || km.uuid))
2017
2076
 
package/src/generators.js CHANGED
@@ -59,7 +59,7 @@ class Generator {
59
59
  api: this.getAPI(config),
60
60
  apis: this.getAPIs(config)
61
61
  }
62
- const args = Object.assign({}, baseArgs, moreArgs)
62
+ const args = Object.assign({}, baseArgs, moreArgs, (baseArgs.getUUIDScoped || (() => { return {} }))(this.uuid))
63
63
  // return this.match(args)
64
64
  const matches = this.match(args)
65
65
  if ((matches && (options.debug || {}).match)
@@ -106,7 +106,7 @@ class Generator {
106
106
  api: this.getAPI(config),
107
107
  apis: this.getAPIs(config)
108
108
  }
109
- const args = Object.assign({}, baseArgs, moreArgs)
109
+ const args = Object.assign({}, baseArgs, moreArgs, (baseArgs.getUUIDScoped || (() => { return {} }))(this.uuid))
110
110
  // if (this.callId) {
111
111
  // greg
112
112
  /*
package/src/semantics.js CHANGED
@@ -45,13 +45,16 @@ class Semantic {
45
45
  matches (baseArgs, context, options = {}) {
46
46
  const hierarchy = baseArgs.hierarchy
47
47
  const config = baseArgs.config
48
+
48
49
  const objects = baseArgs.getObjects(this.uuid)
50
+ // const ask = baseArgs.getAsk(this.uuid)
51
+
49
52
  // return this.matcher(Object.assign({}, argsBase, {args: contextArgs(context, hierarchy), objects: objects, global: objects, context: context, hierarchy: hierarchy, api: this.getAPI(config)})
50
53
  const callId = baseArgs.calls.current()
51
54
  const moreArgs = {
52
55
  uuid: this.uuid,
53
56
  args: contextArgs(context, hierarchy),
54
- objects: objects,
57
+ objects,
55
58
  global: objects,
56
59
  context: context,
57
60
  // hierarchy: hierarchy,
@@ -59,7 +62,7 @@ class Semantic {
59
62
  api: this.getAPI(config),
60
63
  apis: this.getAPIs(config)
61
64
  }
62
- const args = Object.assign({}, baseArgs, moreArgs)
65
+ const args = Object.assign({}, baseArgs, moreArgs, (baseArgs.getUUIDScoped || (() => { return {} }))(this.uuid))
63
66
 
64
67
  const matches = this.matcher(args)
65
68
  if (matches && (options.debug || {}).match
@@ -74,6 +77,7 @@ class Semantic {
74
77
  apply (baseArgs, context, s, log, options = {}) {
75
78
  const { hierarchy, config, response } = baseArgs
76
79
  const objects = baseArgs.getObjects(this.uuid)
80
+ // const ask = baseArgs.getAsk(this.uuid)
77
81
  if (!log) {
78
82
  console.trace()
79
83
  throw 'log is a required argument'
@@ -99,7 +103,7 @@ class Semantic {
99
103
  api: this.getAPI(config),
100
104
  apis: this.getAPIs(config)
101
105
  }
102
- const args = Object.assign({}, baseArgs, moreArgs)
106
+ const args = Object.assign({}, baseArgs, moreArgs, (baseArgs.getUUIDScoped || (() => { return {} }))(this.uuid))
103
107
  if ((options.debug || {}).apply
104
108
  ||
105
109
  callId == this.callId) {