tpmkms_4wp 7.12.7-beta.0 → 7.12.8-beta.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5926,28 +5926,6 @@
5926
5926
  1
5927
5927
  ]
5928
5928
  ],
5929
- [
5930
- [
5931
- "bird",
5932
- 0
5933
- ],
5934
- [
5935
- "is",
5936
- 0
5937
- ],
5938
- [
5939
- "list",
5940
- 0
5941
- ],
5942
- [
5943
- "unknown",
5944
- 0
5945
- ],
5946
- [
5947
- "unknown",
5948
- 1
5949
- ]
5950
- ],
5951
5929
  [
5952
5930
  [
5953
5931
  "bird",
@@ -8774,28 +8752,6 @@
8774
8752
  1
8775
8753
  ]
8776
8754
  ],
8777
- [
8778
- [
8779
- "bird",
8780
- 0
8781
- ],
8782
- [
8783
- "is",
8784
- 0
8785
- ],
8786
- [
8787
- "list",
8788
- 0
8789
- ],
8790
- [
8791
- "unknown",
8792
- 0
8793
- ],
8794
- [
8795
- "unknown",
8796
- 1
8797
- ]
8798
- ],
8799
8755
  [
8800
8756
  [
8801
8757
  "bird",
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { Config, knowledgeModule, where, stableId } = require('./runtime').theprogrammablemind
2
2
  const meta = require('./meta.js')
3
3
  const gdefaults = require('./gdefaults.js')
4
4
  const sdefaults = require('./sdefaults.js')
@@ -893,6 +893,105 @@ let configStruct = {
893
893
  ],
894
894
  };
895
895
 
896
+ // move ask to the KM's since verbatim is called probably in dialogues?
897
+ const getAsk = (config) => (uuid) => {
898
+ // if (!uuid) {
899
+ // debugger
900
+ //}
901
+ return (asks) => {
902
+ const ask = (ask) => {
903
+ let oneShot = true // default
904
+ if (ask.oneShot === false) {
905
+ oneShot = false
906
+ }
907
+
908
+ const id_q = stableId('semantic')
909
+ const id_rs = []
910
+ let wasAsked = false
911
+ let wasApplied = false
912
+ const getWasAsked = () => {
913
+ return wasAsked
914
+ }
915
+ const setWasAsked = (value) => {
916
+ wasAsked = value
917
+ }
918
+ const getWasApplied = () => {
919
+ return wasApplied
920
+ }
921
+ const setWasApplied = (value) => {
922
+ wasApplied = value
923
+ }
924
+
925
+ const semanticsr = ask.semanticsr || []
926
+ if (semanticsr.length == 0) {
927
+ semanticsr.push({ match: ask.matchr, apply: ask.applyr })
928
+ }
929
+ for (const semantic of semanticsr) {
930
+ const id_r = stableId('semantic')
931
+ id_rs.push(id_r)
932
+ config.addSemantic({
933
+ uuid,
934
+ id: id_r,
935
+ tied_ids: [id_q],
936
+ oneShot,
937
+ where: semantic.where || ask.where || where(2),
938
+ source: 'response',
939
+ match: (args) => semantic.match(args),
940
+ apply: (args) => {
941
+ setWasApplied(true)
942
+ semantic.apply(args)
943
+ },
944
+ })
945
+ }
946
+
947
+ config.addSemantic({
948
+ uuid,
949
+ oneShot,
950
+ id: id_q,
951
+ tied_ids: id_rs,
952
+ where: ask.where,
953
+ isQuestion: true, // do one question at a time
954
+ getWasAsked,
955
+ getWasApplied,
956
+ onNevermind: ask.onNevermind,
957
+ source: 'question',
958
+ match: ({ context }) => context.marker == 'controlEnd' || context.marker == 'controlBetween',
959
+ apply: (args) => {
960
+ let matchq = ask.matchq
961
+ let applyq = ask.applyq
962
+ if (!matchq) {
963
+ let wasAsked = false
964
+ matchq = () => !wasAsked,
965
+ applyq = (args) => {
966
+ wasAsked = true
967
+ return ask.applyq(args)
968
+ }
969
+ }
970
+ if (matchq(args)) {
971
+ setWasAsked(true)
972
+ setWasApplied(false)
973
+ // args.context.motivationKeep = true
974
+ args.verbatim(applyq(args))
975
+ /*
976
+ args.context.verbatim = applyq(args)
977
+ args.context.isResponse = true;
978
+ delete args.context.controlRemove;
979
+ */
980
+ args.context.controlKeepMotivation = true
981
+ }
982
+ args.context.cascade = true
983
+ }
984
+ })
985
+ }
986
+ if (!Array.isArray(asks)) {
987
+ asks = [asks]
988
+ }
989
+
990
+ [...asks].reverse().forEach( (a) => ask(a) )
991
+ }
992
+ }
993
+
994
+
896
995
  const createConfig = () => {
897
996
  const config = new Config(configStruct, module)
898
997
  config.stop_auto_rebuild()
@@ -904,7 +1003,7 @@ const createConfig = () => {
904
1003
  e: (context) => config.api.getEvaluator(args.s, args.log, context),
905
1004
  }))
906
1005
  */
907
- config.addArgs(({isA}) => ({
1006
+ config.addArgs(({config, isA}) => ({
908
1007
  isAListable: (context, type) => {
909
1008
  if (context.marker == 'list' || context.listable) {
910
1009
  return context.value.every( (element) => isA(element.marker, type) )
@@ -912,7 +1011,7 @@ const createConfig = () => {
912
1011
  return isA(context.marker, type)
913
1012
  }
914
1013
  },
915
- toContext(v) {
1014
+ toContext: (v) => {
916
1015
  if (Array.isArray(v)) {
917
1016
  return { marker: 'list', level: 1, value: v }
918
1017
  }
@@ -921,6 +1020,10 @@ const createConfig = () => {
921
1020
  }
922
1021
  return v
923
1022
  },
1023
+ getUUIDScoped: (uuid) => { return {
1024
+ ask: getAsk(config)(uuid),
1025
+ }
1026
+ },
924
1027
  }))
925
1028
  objects.mentioned = []
926
1029
  objects.variables = {
@@ -2293,11 +2293,11 @@
2293
2293
  0
2294
2294
  ],
2295
2295
  [
2296
- "chicken_nugget",
2296
+ "chicken_strip",
2297
2297
  0
2298
2298
  ],
2299
2299
  [
2300
- "chicken_strip",
2300
+ "chicken_nugget",
2301
2301
  0
2302
2302
  ]
2303
2303
  ],
@@ -4456,38 +4456,6 @@
4456
4456
  "list",
4457
4457
  0
4458
4458
  ],
4459
- [
4460
- "unknown",
4461
- 0
4462
- ],
4463
- [
4464
- "unknown",
4465
- 1
4466
- ]
4467
- ],
4468
- [
4469
- [
4470
- "is",
4471
- 0
4472
- ],
4473
- [
4474
- "list",
4475
- 0
4476
- ],
4477
- [
4478
- "unknown",
4479
- 1
4480
- ]
4481
- ],
4482
- [
4483
- [
4484
- "is",
4485
- 0
4486
- ],
4487
- [
4488
- "list",
4489
- 1
4490
- ],
4491
4459
  [
4492
4460
  "unknown",
4493
4461
  1
@@ -17635,28 +17603,6 @@
17635
17603
  1
17636
17604
  ]
17637
17605
  ],
17638
- [
17639
- [
17640
- "comma",
17641
- 0
17642
- ],
17643
- [
17644
- "is",
17645
- 0
17646
- ],
17647
- [
17648
- "list",
17649
- 0
17650
- ],
17651
- [
17652
- "unknown",
17653
- 0
17654
- ],
17655
- [
17656
- "unknown",
17657
- 1
17658
- ]
17659
- ],
17660
17606
  [
17661
17607
  [
17662
17608
  "comma",
@@ -17689,20 +17635,6 @@
17689
17635
  1
17690
17636
  ]
17691
17637
  ],
17692
- [
17693
- [
17694
- "is",
17695
- 0
17696
- ],
17697
- [
17698
- "list",
17699
- 1
17700
- ],
17701
- [
17702
- "unknown",
17703
- 1
17704
- ]
17705
- ],
17706
17638
  [
17707
17639
  [
17708
17640
  "is",
@@ -41002,32 +40934,6 @@
41002
40934
  1
41003
40935
  ]
41004
40936
  ],
41005
- [
41006
- [
41007
- "comma",
41008
- 0
41009
- ],
41010
- [
41011
- "drink",
41012
- 0
41013
- ],
41014
- [
41015
- "is",
41016
- 0
41017
- ],
41018
- [
41019
- "list",
41020
- 0
41021
- ],
41022
- [
41023
- "unknown",
41024
- 0
41025
- ],
41026
- [
41027
- "unknown",
41028
- 1
41029
- ]
41030
- ],
41031
40937
  [
41032
40938
  [
41033
40939
  "comma",
@@ -48701,32 +48607,6 @@
48701
48607
  1
48702
48608
  ]
48703
48609
  ],
48704
- [
48705
- [
48706
- "comma",
48707
- 0
48708
- ],
48709
- [
48710
- "drink",
48711
- 0
48712
- ],
48713
- [
48714
- "is",
48715
- 0
48716
- ],
48717
- [
48718
- "list",
48719
- 0
48720
- ],
48721
- [
48722
- "unknown",
48723
- 0
48724
- ],
48725
- [
48726
- "unknown",
48727
- 1
48728
- ]
48729
- ],
48730
48610
  [
48731
48611
  [
48732
48612
  "comma",
@@ -48789,28 +48669,6 @@
48789
48669
  1
48790
48670
  ]
48791
48671
  ],
48792
- [
48793
- [
48794
- "comma",
48795
- 0
48796
- ],
48797
- [
48798
- "is",
48799
- 0
48800
- ],
48801
- [
48802
- "list",
48803
- 0
48804
- ],
48805
- [
48806
- "unknown",
48807
- 0
48808
- ],
48809
- [
48810
- "unknown",
48811
- 1
48812
- ]
48813
- ],
48814
48672
  [
48815
48673
  [
48816
48674
  "comma",
@@ -49387,24 +49245,6 @@
49387
49245
  1
49388
49246
  ]
49389
49247
  ],
49390
- [
49391
- [
49392
- "is",
49393
- 0
49394
- ],
49395
- [
49396
- "list",
49397
- 0
49398
- ],
49399
- [
49400
- "unknown",
49401
- 0
49402
- ],
49403
- [
49404
- "unknown",
49405
- 1
49406
- ]
49407
- ],
49408
49248
  [
49409
49249
  [
49410
49250
  "is",
@@ -49539,34 +49379,6 @@
49539
49379
  1
49540
49380
  ]
49541
49381
  ],
49542
- [
49543
- [
49544
- "is",
49545
- 0
49546
- ],
49547
- [
49548
- "list",
49549
- 1
49550
- ],
49551
- [
49552
- "unknown",
49553
- 1
49554
- ]
49555
- ],
49556
- [
49557
- [
49558
- "is",
49559
- 0
49560
- ],
49561
- [
49562
- "list",
49563
- 1
49564
- ],
49565
- [
49566
- "unknown",
49567
- 1
49568
- ]
49569
- ],
49570
49382
  [
49571
49383
  [
49572
49384
  "is",