theprogrammablemind_4wp 9.3.0 → 9.4.1
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 +79 -69
- package/demo.js +2 -2
- package/package.json +2 -1
- package/src/config.js +135 -91
- package/src/configHelpers.js +14 -9
- package/src/debug.js +2 -2
- package/src/digraph.js +2 -2
- package/src/digraph_internal.js +2 -2
- package/src/flatten.js +1 -1
- package/src/generators.js +6 -6
- package/src/helpers.js +16 -15
- package/src/project.js +25 -2
- package/src/project2.js +54 -0
- package/src/semantics.js +4 -4
- package/src/unflatten.js +1 -1
package/client.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
const { Semantics, Semantic } = require('./src/semantics')
|
2
2
|
const { Generators, Generator } = require('./src/generators')
|
3
3
|
const { Config } = require('./src/config')
|
4
|
-
const { loadInstance,
|
5
|
-
const DigraphInternal = require('./src/digraph_internal')
|
4
|
+
const { loadInstance, setupArgs, gs, processContext, getObjects, setupProcessB, processContextsB } = require('./src/configHelpers')
|
6
5
|
const Digraph = require('./src/digraph')
|
7
6
|
const { project } = require('./src/project')
|
7
|
+
const { project:project2 } = require('./src/project2')
|
8
8
|
const fetch = require('node-fetch')
|
9
9
|
const base64 = require('base-64')
|
10
10
|
const deepEqual = require('deep-equal')
|
@@ -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 { appendNoDups,
|
15
|
+
const { appendNoDups, updateQueries, safeNoDups, stableId, where, suggestAssociationsFix, suggestAssociationsFixFromSummaries, validProps } = require('./src/helpers')
|
16
16
|
const runtime = require('./runtime')
|
17
17
|
const sortJson = runtime.sortJson
|
18
18
|
const debug = require('./src/debug')
|
@@ -50,8 +50,8 @@ const getConfig_getContextCheck = (testConfig) => {
|
|
50
50
|
return (testConfig.checks && testConfig.checks.context) || []
|
51
51
|
}
|
52
52
|
|
53
|
-
const pickContext = (
|
54
|
-
return
|
53
|
+
const pickContext = (contextChecks) => (context) => {
|
54
|
+
return project2(context, contextChecks)
|
55
55
|
}
|
56
56
|
|
57
57
|
const pickObjects = (config, testConfig, getObjects) => {
|
@@ -69,7 +69,11 @@ const pickObjects = (config, testConfig, getObjects) => {
|
|
69
69
|
if (!objects) {
|
70
70
|
throw new Error(`In the checks for ${config.name} the KM ${km} does not exist`)
|
71
71
|
}
|
72
|
-
|
72
|
+
if (checks[km] && checks[km].find((check) => check.match && check.apply)) {
|
73
|
+
projection[km] = project2(objects, checks[km])
|
74
|
+
} else {
|
75
|
+
projection[km] = project(objects, checks[km])
|
76
|
+
}
|
73
77
|
}
|
74
78
|
return projection
|
75
79
|
}
|
@@ -77,7 +81,7 @@ const pickObjects = (config, testConfig, getObjects) => {
|
|
77
81
|
const sameJSON = (json1, json2) => {
|
78
82
|
const sjson1 = sortJson(json1, { depth: 25 })
|
79
83
|
const sjson2 = sortJson(json2, { depth: 25 })
|
80
|
-
return JSON.stringify(sjson1)
|
84
|
+
return JSON.stringify(sjson1) === JSON.stringify(sjson2)
|
81
85
|
}
|
82
86
|
|
83
87
|
const vimdiff = (actualJSON, expectedJSON, title) => {
|
@@ -149,7 +153,7 @@ const convertToStable = (objects) => {
|
|
149
153
|
const writeTestFile = (fn, tests) => {
|
150
154
|
const stabilize = (tests) => {
|
151
155
|
for (const test of tests) {
|
152
|
-
for (opChoice of test.metadata.opChoices) {
|
156
|
+
for (const opChoice of test.metadata.opChoices) {
|
153
157
|
opChoice.ops.sort()
|
154
158
|
}
|
155
159
|
test.metadata.opChoices.sort()
|
@@ -185,7 +189,7 @@ const writeTest = (fn, query, objects, generated, paraphrases, responses, contex
|
|
185
189
|
}, { depth: 25 })
|
186
190
|
let wasSet = false
|
187
191
|
tests.forEach((test, index) => {
|
188
|
-
if (test.query
|
192
|
+
if (test.query === query) {
|
189
193
|
tests[index] = results
|
190
194
|
wasSet = true
|
191
195
|
}
|
@@ -261,7 +265,7 @@ const throwErrorHandler = (error) => {
|
|
261
265
|
throw error
|
262
266
|
}
|
263
267
|
|
264
|
-
const _process = async (config, query, { initializer, commandLineArgs, credentials, writeTests, isTest, saveDeveloper, rebuildingTemplate, testConfig, testsFN, errorHandler = throwErrorHandler } = {}) => {
|
268
|
+
const _process = async (config, query, { initializer, commandLineArgs, credentials, writeTests, isProcess, isModule, isTest, saveDeveloper, rebuildingTemplate, testConfig, testsFN, errorHandler = throwErrorHandler } = {}) => {
|
265
269
|
if (credentials) {
|
266
270
|
config.server(credentials.server, credentials.key)
|
267
271
|
}
|
@@ -316,12 +320,12 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
316
320
|
if (queries.length === 0) {
|
317
321
|
break
|
318
322
|
}
|
319
|
-
|
323
|
+
config.updateData(data)
|
320
324
|
data.utterance = queries[0]
|
321
325
|
data.start_counter = startCounter
|
322
326
|
let json = await doWithRetries(retries, url, queryParams, data)
|
323
327
|
let resetData = false
|
324
|
-
if (json.code
|
328
|
+
if (json.code === 'NOT_IN_CACHE') {
|
325
329
|
resetData = true
|
326
330
|
const setupB = setupProcessB({ config, allowDelta: false })
|
327
331
|
data = setupB.data
|
@@ -346,15 +350,16 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
346
350
|
throw json
|
347
351
|
} else {
|
348
352
|
let clientSideTime
|
353
|
+
let start
|
349
354
|
if (isTest) {
|
350
355
|
start = runtime.performance.performance.now()
|
351
356
|
}
|
352
357
|
const summary = { summaries: json.summaries, length: json.contexts.length }
|
353
358
|
summaries.push(summary)
|
354
359
|
const { contextsPrime, generatedPrime, paraphrasesPrime, paraphrasesParenthesizedPrime, generatedParenthesizedPrime, responsesPrime } =
|
355
|
-
await processContextsB({ isTest, rebuildingTemplate, config, hierarchy, json, commandLineArgs /*, generators, semantics */ })
|
360
|
+
await processContextsB({ isTest, isProcess, isModule, rebuildingTemplate, config, hierarchy, json, commandLineArgs /*, generators, semantics */ })
|
356
361
|
if (isTest) {
|
357
|
-
end = runtime.performance.performance.now()
|
362
|
+
const end = runtime.performance.performance.now()
|
358
363
|
clientSideTime = end - start
|
359
364
|
}
|
360
365
|
response.associations = json.associations
|
@@ -386,13 +391,13 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
386
391
|
}
|
387
392
|
|
388
393
|
if (writeTests) {
|
389
|
-
const
|
394
|
+
const actualConfig = getConfigForTest(config, testConfig)
|
390
395
|
const saveObjects = { ...config.config.objects }
|
391
396
|
saveObjects.nameToUUID = {}
|
392
397
|
for (const km of config.configs) {
|
393
398
|
saveObjects.nameToUUID[km.name] = km.uuid
|
394
399
|
}
|
395
|
-
writeTest(testsFN, query, saveObjects, response.generated, response.paraphrases, response.responses, response.contexts, response.associations, response.metadata,
|
400
|
+
writeTest(testsFN, query, saveObjects, response.generated, response.paraphrases, response.responses, response.contexts, response.associations, response.metadata, actualConfig, saveDeveloper, response.paraphrasesParenthesized, response.generatedParenthesized, response.summaries)
|
396
401
|
}
|
397
402
|
|
398
403
|
return response
|
@@ -485,7 +490,7 @@ const runTest = async (config, expected, { args, verbose, testConfig, debug, tim
|
|
485
490
|
setupArgs(args, config)
|
486
491
|
await testConfig.initializer(args)
|
487
492
|
}
|
488
|
-
const result = await _process(config, test, { errorHandler, isTest: true })
|
493
|
+
const result = await _process(config, test, { errorHandler, isTest: true, isProcess: true, isModule: false })
|
489
494
|
result.query = test
|
490
495
|
if (debug) {
|
491
496
|
defaultInnerProcess(config, errorHandler, result)
|
@@ -499,24 +504,25 @@ const runTest = async (config, expected, { args, verbose, testConfig, debug, tim
|
|
499
504
|
timings.client += result.clientSideTimes / 1000
|
500
505
|
lines.log()
|
501
506
|
}
|
502
|
-
const
|
503
|
-
delete
|
504
|
-
const
|
505
|
-
const
|
506
|
-
let
|
507
|
+
const expectedObjects = sortJson(convertToStable(expected.objects), { depth: 25 })
|
508
|
+
delete expectedObjects.nameToUUID
|
509
|
+
const actualObjects = sortJson(convertToStable(config.config.objects), { depth: 25 })
|
510
|
+
const failedParaphrases = !matching(result.paraphrases, expected.paraphrases)
|
511
|
+
let failedParaphrasesParenthesized = !matching(result.paraphrasesParenthesized, expected.paraphrasesParenthesized)
|
507
512
|
let failed_generatedParenthesized = !matching(result.generatedParenthesized, expected.generatedParenthesized)
|
508
513
|
// TODO fix the naming conventions: camelcase + use actual instead of result
|
509
|
-
const
|
510
|
-
const
|
511
|
-
const
|
514
|
+
const failedResponses = !matching(result.responses, expected.responses)
|
515
|
+
const failedContexts = !matching(result.contexts, expected.contexts)
|
516
|
+
const failedObjects = !matching(actualObjects, expectedObjects)
|
512
517
|
|
513
518
|
if (args.testNoParenthesized) {
|
514
|
-
|
519
|
+
failedParaphrasesParenthesized = false
|
515
520
|
failed_generatedParenthesized = false
|
516
521
|
}
|
517
522
|
|
518
|
-
const
|
519
|
-
const
|
523
|
+
const contextChecks = config.getContextChecks()
|
524
|
+
const pickedResultContexts = result.contexts.map(pickContext(contextChecks))
|
525
|
+
const pickedExpectedContexts = expected.contexts.map(pickContext(contextChecks))
|
520
526
|
const failedCheckedContexts = !matching(pickedResultContexts, pickedExpectedContexts)
|
521
527
|
|
522
528
|
const expectedGetObjects = (name) => {
|
@@ -525,23 +531,23 @@ const runTest = async (config, expected, { args, verbose, testConfig, debug, tim
|
|
525
531
|
}
|
526
532
|
return expected.objects.namespaced[expected.objects.nameToUUID[name]] || {}
|
527
533
|
}
|
528
|
-
const
|
534
|
+
const expectedChecked = sortJson(pickObjects(config, testConfig, expectedGetObjects), { depth: 25 })
|
529
535
|
const actualGetObjects = (name) => {
|
530
536
|
if (!name) {
|
531
537
|
name = config.name
|
532
538
|
}
|
533
|
-
const km = config.configs.find((km) => km.name
|
539
|
+
const km = config.configs.find((km) => km.name === name)
|
534
540
|
return config.config.objects.namespaced[km.uuid] || {}
|
535
541
|
}
|
536
|
-
const
|
537
|
-
const
|
542
|
+
const actualChecked = sortJson(pickObjects(config, testConfig, actualGetObjects), { depth: 25 })
|
543
|
+
const failedChecked = !matching(actualObjects, expectedObjects)
|
538
544
|
|
539
|
-
const
|
540
|
-
const
|
541
|
-
const
|
542
|
-
const
|
543
|
-
const
|
544
|
-
const failed =
|
545
|
+
const failedChecks = !matching(actualObjects, expectedObjects)
|
546
|
+
const failedChecked_objects = !matching(actualChecked, expectedChecked)
|
547
|
+
const actualConfig = sortJson(convertToStable(getConfigForTest(config, testConfig)), { depth: 25 })
|
548
|
+
const expectedConfig = sortJson(convertToStable(expected.config), { depth: 25 })
|
549
|
+
const failedConfig = !matching(actualConfig, expectedConfig)
|
550
|
+
const failed = failedChecked_objects || failedParaphrases || failedParaphrasesParenthesized || failed_generatedParenthesized || failedResponses || failedContexts || failedObjects || failedConfig || failedChecked || failedCheckedContexts
|
545
551
|
|
546
552
|
if (expected.metadata && result.metadata && failed) {
|
547
553
|
const priorities = analyzeMetaData(expected.metadata, result.metadata)
|
@@ -559,9 +565,9 @@ const runTest = async (config, expected, { args, verbose, testConfig, debug, tim
|
|
559
565
|
paraphrasesParenthesized: expected.paraphrasesParenthesized,
|
560
566
|
generatedParenthesized: expected.generatedParenthesized,
|
561
567
|
results: expected.contexts,
|
562
|
-
checked:
|
568
|
+
checked: expectedChecked,
|
563
569
|
checkedContexts: pickedExpectedContexts,
|
564
|
-
objects:
|
570
|
+
objects: expectedObjects,
|
565
571
|
config: expected.config,
|
566
572
|
summaries: expected.summaries
|
567
573
|
},
|
@@ -571,10 +577,10 @@ const runTest = async (config, expected, { args, verbose, testConfig, debug, tim
|
|
571
577
|
paraphrasesParenthesized: result.paraphrasesParenthesized,
|
572
578
|
generatedParenthesized: result.generatedParenthesized,
|
573
579
|
results: result.contexts,
|
574
|
-
checked:
|
580
|
+
checked: actualChecked,
|
575
581
|
checkedContexts: pickedResultContexts,
|
576
|
-
objects:
|
577
|
-
config:
|
582
|
+
objects: actualObjects,
|
583
|
+
config: actualConfig,
|
578
584
|
summaries: result.summaries
|
579
585
|
}
|
580
586
|
}
|
@@ -624,7 +630,7 @@ const saveTest = async (testFile, config, test, expected, testConfig, saveDevelo
|
|
624
630
|
await config.rebuild()
|
625
631
|
const objects = getObjects(config.config.objects)(config.uuid)
|
626
632
|
console.log(test)
|
627
|
-
const result = await _process(config, test, { isTest: true })
|
633
|
+
const result = await _process(config, test, { isTest: true, isProcess: true, isModule: true })
|
628
634
|
// const actualObjects = config.config.objects
|
629
635
|
const actualConfig = getConfigForTest(config, testConfig)
|
630
636
|
const args = {
|
@@ -667,6 +673,7 @@ const showInfo = (description, section, config) => {
|
|
667
673
|
console.log(JSON.stringify(config.getInfo(), null, 2))
|
668
674
|
}
|
669
675
|
|
676
|
+
/*
|
670
677
|
const submitBugToAPI = async (subscription_id, subscription_password, config) => {
|
671
678
|
console.log('********* Submitting bug *********')
|
672
679
|
const body = { description: config.config.description, config: config.config }
|
@@ -689,7 +696,6 @@ const submitBugToAPI = async (subscription_id, subscription_password, config) =>
|
|
689
696
|
})
|
690
697
|
}
|
691
698
|
|
692
|
-
/*
|
693
699
|
const submitBug = async (subscription_id, subscription_password, config, utterance, retries = 2) => {
|
694
700
|
// TODO remove these from the config
|
695
701
|
const properties = ['expected_contexts', 'expected_generated']
|
@@ -862,7 +868,7 @@ const defaultInnerProcess = (config, errorHandler, responses) => {
|
|
862
868
|
|
863
869
|
if (responses.explain_priorities) {
|
864
870
|
console.log('Explain Priorities')
|
865
|
-
for ([inputs, output, reason] of responses.explain_priorities) {
|
871
|
+
for (const [inputs, output, reason] of responses.explain_priorities) {
|
866
872
|
console.log(` inputs: ${JSON.stringify(inputs)} output: ${JSON.stringify(output)} reason: ${reason}`)
|
867
873
|
}
|
868
874
|
}
|
@@ -871,7 +877,7 @@ const defaultInnerProcess = (config, errorHandler, responses) => {
|
|
871
877
|
if (!name) {
|
872
878
|
name = config.name
|
873
879
|
}
|
874
|
-
const km = config.configs.find((km) => km.name
|
880
|
+
const km = config.configs.find((km) => km.name === name)
|
875
881
|
return config.config.objects.namespaced[km.uuid] || {}
|
876
882
|
}
|
877
883
|
const picked = sortJson(pickObjects(config, config.testConfig, actualGetObjects), { depth: 25 })
|
@@ -880,7 +886,8 @@ const defaultInnerProcess = (config, errorHandler, responses) => {
|
|
880
886
|
console.log(JSON.stringify(picked, null, 2))
|
881
887
|
}
|
882
888
|
|
883
|
-
const
|
889
|
+
const contextChecks = config.getContextChecks()
|
890
|
+
const pickedResultContexts = responses.contexts.map(pickContext(contextChecks))
|
884
891
|
if (pickedResultContexts.some((context) => Object.keys(context).length > 0)) {
|
885
892
|
console.log('--- Contexts showing only the checked values ---')
|
886
893
|
console.log(JSON.stringify(pickedResultContexts, null, 2))
|
@@ -967,7 +974,7 @@ const rebuildTemplate = async ({ config, instance, target, previousResultss, reb
|
|
967
974
|
}
|
968
975
|
config.config.skipSemantics = skipSemantics && !isFragment
|
969
976
|
const transitoryMode = global.transitoryMode
|
970
|
-
if (isFragment || property
|
977
|
+
if (isFragment || property === 'fragments') {
|
971
978
|
global.transitoryMode = true
|
972
979
|
}
|
973
980
|
if (hierarchy) {
|
@@ -991,7 +998,7 @@ const rebuildTemplate = async ({ config, instance, target, previousResultss, reb
|
|
991
998
|
console.log(getSuggestionMessage(suggestion))
|
992
999
|
}
|
993
1000
|
}
|
994
|
-
if (!rebuild && previousResults && previousResults.query
|
1001
|
+
if (!rebuild && previousResults && previousResults.query === query.query) {
|
995
1002
|
results = previousResults
|
996
1003
|
prMessage = ' Using previous results. use -rtf for a hard rebuild of everything on the server side.'
|
997
1004
|
await loadInstance(config, { resultss: [results] })
|
@@ -1139,7 +1146,7 @@ const rebuildTemplate = async ({ config, instance, target, previousResultss, reb
|
|
1139
1146
|
for (let configsIndex = 0; configsIndex < template.configs.length; ++configsIndex) {
|
1140
1147
|
const query = template.configs[configsIndex]
|
1141
1148
|
// account for things for example associations being added to the config while debugginer
|
1142
|
-
const pr = previousResultss && previousResultss.find((pr) => pr.query
|
1149
|
+
const pr = previousResultss && previousResultss.find((pr) => pr.query === query)
|
1143
1150
|
todo.push({ property: 'resultss', query, previousResults: pr, skipSemantics: false || query.skipSemantics })
|
1144
1151
|
}
|
1145
1152
|
}
|
@@ -1309,7 +1316,7 @@ const knowledgeModuleImpl = async ({
|
|
1309
1316
|
parser.add_argument('--parenthesized', { action: 'store_true', help: 'Show the generated phrases with parenthesis.' })
|
1310
1317
|
parser.add_argument('-c', '--clean', { help: 'Remove data from the test files. a === association' })
|
1311
1318
|
parser.add_argument('-od', '--objectDiff', { action: 'store_true', help: 'When showing the objects use a colour diff' })
|
1312
|
-
parser.add_argument('-p', '--print', { help: 'Print the specified elements c === config, w === words, b === bridges, o === operators d === objects (d for data), h === hierarchy, g === generators, s === semantics, l === load t=tests ordering p === priorities a
|
1319
|
+
parser.add_argument('-p', '--print', { help: 'Print the specified elements c === config, w === words, b === bridges, o === operators d === objects (d for data), h === hierarchy, g === generators, s === semantics, l === load t=tests ordering p === priorities a === associations j === JSON sent to server. for example --print wb' })
|
1313
1320
|
parser.add_argument('-s', '--save', { action: 'store_true', help: 'When running with the --query flag this will save the current run to the test file. When running without the --query flag all tests will be run and resaved.' })
|
1314
1321
|
parser.add_argument('-fr', '--failRebuild', { action: 'store_true', help: 'If a rebuild is required fail out.' })
|
1315
1322
|
parser.add_argument('-sd', '--saveDeveloper', { action: 'store_true', help: 'Same as -s but the query will not show up in the info command.' })
|
@@ -1361,10 +1368,10 @@ const knowledgeModuleImpl = async ({
|
|
1361
1368
|
if (what.length !== 2) {
|
1362
1369
|
return false
|
1363
1370
|
}
|
1364
|
-
if (!typeof what[0]
|
1371
|
+
if (!typeof what[0] === 'string') {
|
1365
1372
|
return false
|
1366
1373
|
}
|
1367
|
-
if (!typeof what[1]
|
1374
|
+
if (!typeof what[1] === 'number') {
|
1368
1375
|
return false
|
1369
1376
|
}
|
1370
1377
|
return true
|
@@ -1682,9 +1689,9 @@ const knowledgeModuleImpl = async ({
|
|
1682
1689
|
const tidy_summaries = (summaries) => {
|
1683
1690
|
const summaries_prime = []
|
1684
1691
|
for (const chunk of summaries) {
|
1685
|
-
chunk_prime = { length: chunk.length, summaries: [] }
|
1692
|
+
const chunk_prime = { length: chunk.length, summaries: [] }
|
1686
1693
|
for (const summary of chunk.summaries) {
|
1687
|
-
const summary_prime = { counter: summary.counter, operators: [] }
|
1694
|
+
const summary_prime = { counter: summary.counter, operators: [] }
|
1688
1695
|
for (const operator of summary.operators) {
|
1689
1696
|
summary_prime.operators.push(`{ marker: [${operator.marker[0]}, ${operator.marker[1]}] range: { start: ${operator.range.start}, end: ${operator.range.end} } }`)
|
1690
1697
|
}
|
@@ -1716,7 +1723,7 @@ const knowledgeModuleImpl = async ({
|
|
1716
1723
|
if (lengths > iDiff) {
|
1717
1724
|
const suggestion = suggestAssociationsFix(result.expected.summaries[iSummaries].summaries, result.actual.summaries[iSummaries].summaries)
|
1718
1725
|
if (suggestion) {
|
1719
|
-
suggestedFix = suggestion
|
1726
|
+
const suggestedFix = suggestion
|
1720
1727
|
// console.log(`Try adding this to the associations: { context: ${JSON.stringify(getSuggestion(suggestedFix))}, choose: <indexOfMainElement> },`)
|
1721
1728
|
console.log(getSuggestionMessage(suggestedFix))
|
1722
1729
|
return
|
@@ -1856,7 +1863,7 @@ const knowledgeModuleImpl = async ({
|
|
1856
1863
|
f()
|
1857
1864
|
})
|
1858
1865
|
.catch((e) => {
|
1859
|
-
if (e.errno
|
1866
|
+
if (e.errno === 'ECONNREFUSED') {
|
1860
1867
|
console.log(e)
|
1861
1868
|
readline.close()
|
1862
1869
|
} else {
|
@@ -1880,7 +1887,7 @@ const knowledgeModuleImpl = async ({
|
|
1880
1887
|
global.beforeObjects = _.cloneDeep(objects)
|
1881
1888
|
}
|
1882
1889
|
try {
|
1883
|
-
await processResults(_process(config, args.query, { commandLineArgs: args, dontAddAssociations: args.dontAddAssociations, writeTests: args.save || args.saveDeveloper, saveDeveloper: args.saveDeveloper, testConfig, testsFN: test }))
|
1890
|
+
await processResults(_process(config, args.query, { commandLineArgs: args, isProcess, isModule: !isProcess, dontAddAssociations: args.dontAddAssociations, writeTests: args.save || args.saveDeveloper, saveDeveloper: args.saveDeveloper, testConfig, testsFN: test }))
|
1884
1891
|
} catch (error) {
|
1885
1892
|
console.log('Error', error)
|
1886
1893
|
}
|
@@ -1909,8 +1916,18 @@ const knowledgeModuleImpl = async ({
|
|
1909
1916
|
loadForTesting = true
|
1910
1917
|
}
|
1911
1918
|
}
|
1919
|
+
if (template) {
|
1920
|
+
try {
|
1921
|
+
await config.load(rebuildTemplate, template.template, template.instance)
|
1922
|
+
} catch (e) {
|
1923
|
+
errorHandler(e)
|
1924
|
+
}
|
1925
|
+
}
|
1926
|
+
|
1912
1927
|
// remove test only stuff
|
1913
1928
|
if (!isProcess && !loadForTesting) {
|
1929
|
+
config.removeDevelopmentElements(config.config)
|
1930
|
+
/*
|
1914
1931
|
config.config.operators = config.config.operators.filter((operator) => {
|
1915
1932
|
if (operator.development) {
|
1916
1933
|
return false
|
@@ -1925,21 +1942,14 @@ const knowledgeModuleImpl = async ({
|
|
1925
1942
|
return true
|
1926
1943
|
}
|
1927
1944
|
})
|
1928
|
-
|
1929
|
-
|
1930
|
-
if (template) {
|
1931
|
-
try {
|
1932
|
-
await config.load(rebuildTemplate, template.template, template.instance)
|
1933
|
-
} catch (e) {
|
1934
|
-
errorHandler(e)
|
1935
|
-
}
|
1945
|
+
*/
|
1936
1946
|
}
|
1937
1947
|
}
|
1938
1948
|
|
1939
1949
|
// no cache 21 minutes + rebuild fails "node tester_rebuild -m colors"
|
1940
1950
|
// cache okay
|
1941
|
-
createConfigExport = async () => {
|
1942
|
-
if (createConfig.cached) {
|
1951
|
+
const createConfigExport = async (useCache = true) => {
|
1952
|
+
if (useCache && createConfig.cached) {
|
1943
1953
|
return createConfig.cached
|
1944
1954
|
}
|
1945
1955
|
const config = await createConfig()
|
package/demo.js
CHANGED
@@ -34,13 +34,13 @@ let config = {
|
|
34
34
|
apply: ({ context }) => context.evalue
|
35
35
|
},
|
36
36
|
{
|
37
|
-
match: ({ context }) => context.marker
|
37
|
+
match: ({ context }) => context.marker === 'unknown',
|
38
38
|
apply: ({ context }) => context.text
|
39
39
|
}
|
40
40
|
],
|
41
41
|
semantics: [
|
42
42
|
{
|
43
|
-
match: ({ context }) => context.marker
|
43
|
+
match: ({ context }) => context.marker === 'went',
|
44
44
|
apply: ({ context }) => {
|
45
45
|
// same way as kms that I wrote. you dont have to do this though
|
46
46
|
context.isResponse = true
|
package/package.json
CHANGED
@@ -53,6 +53,7 @@
|
|
53
53
|
"src/digraph_internal.js",
|
54
54
|
"src/generators.js",
|
55
55
|
"src/project.js",
|
56
|
+
"src/project2.js",
|
56
57
|
"src/semantics.js"
|
57
58
|
],
|
58
59
|
"author": "dev@thinktelligence.com",
|
@@ -69,6 +70,6 @@
|
|
69
70
|
"sort-json": "^2.0.0",
|
70
71
|
"uuid": "^8.3.2"
|
71
72
|
},
|
72
|
-
"version": "9.
|
73
|
+
"version": "9.4.1",
|
73
74
|
"license": "UNLICENSED"
|
74
75
|
}
|