tpmkms_4wp 9.5.1 → 9.6.0-beta.0

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.
Files changed (135) hide show
  1. package/common/animals.instance.json +151 -61
  2. package/common/animals.js +3 -5
  3. package/common/asking.js +116 -106
  4. package/common/avatar.test.json +1001 -860
  5. package/common/can.instance.json +2194 -0
  6. package/common/can.js +251 -0
  7. package/common/can.test.json +51307 -0
  8. package/common/characters.js +5 -5
  9. package/common/colors.instance.json +152 -12
  10. package/common/colors.js +3 -6
  11. package/common/comparable.instance.json +33 -3
  12. package/common/comparable.js +3 -6
  13. package/common/concept.js +25 -27
  14. package/common/concept.test.json +180 -144
  15. package/common/conjunction.js +13 -5
  16. package/common/conjunction.test.json +32 -42
  17. package/common/crew.instance.json +433 -173
  18. package/common/crew.js +4 -7
  19. package/common/crew.test.json +4148 -3324
  20. package/common/currency.js +1 -1
  21. package/common/dateTimeSelectors.instance.json +2 -2
  22. package/common/dateTimeSelectors.js +6 -9
  23. package/common/dateTimeSelectors.test.json +76935 -35739
  24. package/common/dates.instance.json +53 -3
  25. package/common/dates.js +3 -6
  26. package/common/dates.test.json +284 -287
  27. package/common/dialogues.js +43 -122
  28. package/common/dialogues.test.json +1248 -1152
  29. package/common/dimension.instance.json +21493 -561
  30. package/common/dimension.js +150 -55
  31. package/common/dimension.test.json +10979 -4625
  32. package/common/drone.instance.json +24709 -0
  33. package/common/drone.js +662 -0
  34. package/common/drone.test.json +30522 -0
  35. package/common/drone_v1.instance.json +24703 -0
  36. package/common/drone_v1.js +596 -0
  37. package/common/drone_v1.test.json +115538 -0
  38. package/common/edible.instance.json +388 -32
  39. package/common/edible.js +3 -5
  40. package/common/emotions.instance.json +85 -76
  41. package/common/emotions.js +4 -7
  42. package/common/emotions.test.json +242 -174
  43. package/common/english_helpers.js +336 -0
  44. package/common/errors.js +6 -6
  45. package/common/evaluate.js +2 -2
  46. package/common/events.js +8 -8
  47. package/common/fastfood.instance.json +1071 -393
  48. package/common/fastfood.js +14 -16
  49. package/common/fastfood.test.json +6970 -6829
  50. package/common/formulas.instance.json +11 -1
  51. package/common/formulas.js +3 -2
  52. package/common/gdefaults.js +111 -17
  53. package/common/help.js +12 -12
  54. package/common/help.test.json +65 -11
  55. package/common/helpers/concept.js +1 -1
  56. package/common/helpers/conjunction.js +54 -44
  57. package/common/helpers/dateTimeSelectors.js +2 -2
  58. package/common/helpers/dialogues.js +10 -2
  59. package/common/helpers/formulas.js +13 -11
  60. package/common/helpers/menus.js +12 -12
  61. package/common/helpers/meta.js +9 -9
  62. package/common/helpers/properties.js +186 -64
  63. package/common/helpers.js +167 -48
  64. package/common/hierarchy.js +12 -10
  65. package/common/kirk.instance.json +11 -1
  66. package/common/kirk.js +4 -6
  67. package/common/kirk.test.json +600 -424
  68. package/common/latin.instance.json +12 -12
  69. package/common/latin.js +12 -14
  70. package/common/length.instance.json +34660 -3158
  71. package/common/length.js +11 -6
  72. package/common/length.test.json +54357 -2557
  73. package/common/math.instance.json +39 -29
  74. package/common/math.js +49 -47
  75. package/common/menus.instance.json +77 -10
  76. package/common/menus.js +4 -13
  77. package/common/meta.js +80 -65
  78. package/common/nameable.js +36 -22
  79. package/common/nameable.test.json +436 -0
  80. package/common/numbers.js +1 -1
  81. package/common/ordering.instance.json +107 -19
  82. package/common/ordering.js +4 -6
  83. package/common/ordering.test.json +835 -417
  84. package/common/people.instance.json +176 -348
  85. package/common/people.js +9 -9
  86. package/common/people.test.json +4135 -3606
  87. package/common/pipboy.instance.json +187 -17
  88. package/common/pipboy.js +4 -4
  89. package/common/pokemon.instance.json +143 -13
  90. package/common/pokemon.js +4 -6
  91. package/common/pressure.instance.json +3610 -1601
  92. package/common/pressure.js +3 -5
  93. package/common/pressure.test.json +433 -477
  94. package/common/properties.instance.json +16 -17
  95. package/common/properties.js +32 -13
  96. package/common/properties.test.json +9565 -6951
  97. package/common/rates.instance.json +59 -0
  98. package/common/rates.js +95 -0
  99. package/common/rates.test.json +27702 -0
  100. package/common/reminders.instance.json +4 -4
  101. package/common/reminders.js +8 -11
  102. package/common/reminders.test.json +64635 -25787
  103. package/common/reports.instance.json +23 -3
  104. package/common/reports.js +21 -21
  105. package/common/scorekeeper.js +9 -12
  106. package/common/sdefaults.js +22 -2
  107. package/common/spock.instance.json +11 -1
  108. package/common/spock.js +4 -7
  109. package/common/spock.test.json +606 -430
  110. package/common/stgame.js +1 -1
  111. package/common/stm.js +41 -24
  112. package/common/tell.js +1 -1
  113. package/common/temperature.instance.json +3163 -1154
  114. package/common/temperature.js +3 -5
  115. package/common/temperature.test.json +433 -477
  116. package/common/tester.js +3 -3
  117. package/common/time.instance.json +24852 -0
  118. package/common/time.js +138 -141
  119. package/common/time.test.json +31876 -3757
  120. package/common/tokenize.js +5 -2
  121. package/common/ui.instance.json +12 -5
  122. package/common/ui.js +4 -13
  123. package/common/weight.instance.json +10501 -4099
  124. package/common/weight.js +3 -5
  125. package/common/weight.test.json +2601 -2263
  126. package/common/words.instance.json +9 -0
  127. package/common/words.js +50 -0
  128. package/common/words.test.json +2 -0
  129. package/common/wp.instance.json +548 -8
  130. package/common/wp.js +10 -8
  131. package/common/wp.test.json +7385 -6906
  132. package/main.js +6 -2
  133. package/package.json +25 -6
  134. package/common/listener.js +0 -50
  135. package/common/listener.test.json +0 -142
@@ -16,9 +16,7 @@ const dialogues_tests = require('./dialogues.test.json')
16
16
  const { defaultObjectCheck, defaultContextCheck, indent, focus } = require('./helpers')
17
17
  const pluralize = require('pluralize')
18
18
 
19
- const api = new API()
20
-
21
- const warningIsANotImplemented = (log, context) => {
19
+ function warningIsANotImplemented(log, context) {
22
20
  const description = 'WARNING from Dialogues KM: For semantics in order to handle sentences of type "x is y?", set the response to what you like.'
23
21
  const match = `({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.query && <other conditions as you like>`
24
22
  const apply = `({context}) => <do stuff...>; context.evalue = <value>`
@@ -27,7 +25,7 @@ const warningIsANotImplemented = (log, context) => {
27
25
  log(indent(message, 4))
28
26
  }
29
27
 
30
- const warningSameNotEvaluated = (log, one) => {
28
+ function warningSameNotEvaluated(log, one) {
31
29
  const description = 'WARNING from Dialogues KM: For the "X is Y" type phrase implement a same handler.'
32
30
  const match = `({context}) => context.marker == '${one.marker}' && context.same && <other conditions as you like>`
33
31
  const apply = '({context}) => <do stuff... context.same is the other value>; context.sameWasProcessed = true'
@@ -36,7 +34,7 @@ const warningSameNotEvaluated = (log, one) => {
36
34
  log(indent(message, 4))
37
35
  }
38
36
 
39
- const listorama = (type) => {
37
+ function listorama(type) {
40
38
  return [
41
39
  { context: [[type, 0], ['list', 0], [type, 0]], choose: 0 },
42
40
  { context: [[type, 1], ['list', 0], [type, 0]], choose: 0 },
@@ -56,38 +54,23 @@ const config = {
56
54
 
57
55
  "(([queryable]) [is|] ([queryable|]))",
58
56
  "([isQuery|] ([queryable]) ([queryable]))",
59
- // "(([queryable]) [is:isEdBridge|is,are] ([isEdAble|]))",
60
57
  // who is the car owned by
61
58
  "(([queryable]) [(<isEd|> ([isEdAble|]))])",
62
59
 
63
- /* TODO investigate this:
64
- {"pattern":"(([ownee])^ <owned|owned> ([by] ([owner])?))","uuid":"people1"}
65
- {"pattern":"(([isEdee])^ <isEdAble|> ([by] ([isEder])?))","uuid":"dialogues2"}
66
- */
67
60
  "(([isEdee])^ <isEdAble|> ([by] ([isEder])?))",
68
61
  "([isEdee|])",
69
62
  "([isEder|])",
70
63
 
71
- // "([nevermind])",
72
- // { pattern: "([nevermindTestSetup] (allowed))", development: true },
73
64
  "([why])",
74
65
  "([reason])",
75
- // "([thisitthat|])",
76
- // "([it])",
77
- // "([this])",
78
- // "([that])",
79
66
 
80
67
  "(<what> ([whatAble|]))",
81
68
  "([what:optional])",
82
- // "(<the|> ([theAble|]))",
83
- // "(<a|a,an> ([theAble|]))",
84
- // "([unknown])",
85
69
 
86
70
  "([be] ([briefOrWordy|]))",
87
71
 
88
72
  "([([canBeQuestion])])",
89
73
  "(([canBeQuestion/1,2]) <questionMark|>)",
90
- // "(([is/2]) <questionMark|>)",
91
74
 
92
75
  "(([what]) [(<does|> ([doesAble|]))])",
93
76
  "([canBeDoQuestion])",
@@ -101,46 +84,29 @@ const config = {
101
84
 
102
85
  "([to] ([toAble|]))",
103
86
  ],
104
- associations: {
105
- positive: [
106
- { context: [['unknown', 0], ['isEdAble', 0]], choose: 1 },
107
- { context: [['isQuery', 0], ['a', 0], ['unknown', 0], ['a', 0], ['unknown', 0]], choose: { index: 0, increment: true } },
108
-
109
- { context: [["unknown",0],["isEd",0],["isEdAble",0],["by",0],["unknown",0]], choose: { index: 0, increment: true } },
110
- { context: [["unknown",0],["isEd",0],["isEdAble",0],["by",1]], choose: { index: 0, increment: true } },
111
- { context: [["unknown",0],["isEd",0],["isEdAble",0]], choose: { index: 0, increment: true } },
112
-
113
-
114
- // ...listorama('unknown'),
115
- // ...listorama('queryable'),
116
- { context: [['unknown', 0], ['list', 0], ['unknown', 0]], choose: 0 },
117
- { context: [['unknown', 0], ['list', 0], ['unknown', 1]], choose: 0 },
118
- { context: [['unknown', 1], ['list', 0], ['unknown', 0]], choose: 0 },
119
- { context: [['unknown', 1], ['list', 0], ['unknown', 1]], choose: 0 },
120
-
121
- { context: [['queryable', 0], ['list', 0], ['unknown', 0]], choose: 1 },
122
- { context: [['queryable', 0], ['list', 0], ['unknown', 1]], choose: 1 },
123
- { context: [['queryable', 1], ['list', 0], ['unknown', 0]], choose: 1 },
124
- { context: [['queryable', 1], ['list', 0], ['unknown', 1]], choose: 1 },
125
-
126
- { context: [['unknown', 0], ['list', 0], ['queryable', 0]], choose: 2 },
127
- { context: [['unknown', 0], ['list', 0], ['queryable', 1]], choose: 2 },
128
- { context: [['unknown', 1], ['list', 0], ['queryable', 0]], choose: 2 },
129
- { context: [['unknown', 1], ['list', 0], ['queryable', 1]], choose: 2 },
130
-
131
- { context: [['queryable', 0], ['list', 0], ['queryable', 0]], choose: 0 },
132
- { context: [['queryable', 0], ['list', 0], ['queryable', 1]], choose: 0 },
133
- { context: [['queryable', 1], ['list', 0], ['queryable', 0]], choose: 0 },
134
- { context: [['queryable', 1], ['list', 0], ['queryable', 1]], choose: 0 },
135
- ]
136
- },
137
87
  bridges: [
138
88
  {
139
89
  id: 'thatVerb',
140
90
  before: ['verb'],
141
- // bridge: "{ ...after[0], verb: after[0], that: operator, generate: ['that', 'verb'], localPriorities: { before: [\"verb\"] }, bridge_override: { operator: after[0].marker, bridge: '{ ...bridge.subject, postModifiers: [\"conditions\"], generate: append(before[0].generate, concatm(\"thatClause.\", operator.generate)), thatClause: bridge, conditions: append(after[0].conditions, [bridge]) }' } }",
142
- // bridge: "{ ...after[0], verb: after[0], that: operator, generate: ['that', 'verb'], localPriorities: { before: [\"verb\"] }, bridge_override: { operator: after[0].marker, bridge: '{ ...bridge.subject, postModifiers: [\"conditions\"], generate: concatm(\"thatClause.\", bridge.generate), thatClause: bridge, conditions: append(bridge.subject.conditions, [bridge]) }' } }",
143
- bridge: "{ ...after[0], verb: after[0], that: operator, generate: ['that', 'verb'], localPriorities: { actLike: [\"subordinatedVerb\", 0] }, bridge_override: { operator: after[0].marker, bridge: '{ ...bridge.subject, postModifiers: [\"conditions\"], modifiers: [], generate: concatm(\"thatClause.\", bridge.generate), thatClause: bridge, conditions: append(bridge.subject.conditions, [bridge]) }' } }",
91
+ bridge: `
92
+ {
93
+ ...after[0],
94
+ verb: after[0],
95
+ that: operator,
96
+ generate: ['that', 'verb'],
97
+ localPriorities: { actLike: ["subordinatedVerb", 0] },
98
+ bridge_override: {
99
+ operator: after[0].marker,
100
+ bridge: '{
101
+ ...bridge.subject,
102
+ postModifiers: ["conditions"],
103
+ modifiers: [],
104
+ generate: concatm("thatClause.", bridge.generate),
105
+ thatClause: bridge,
106
+ conditions: append(bridge.subject.conditions, [bridge])
107
+ }'
108
+ }
109
+ }`,
144
110
  },
145
111
 
146
112
  {
@@ -203,7 +169,16 @@ const config = {
203
169
  },
204
170
  { id: "toAble" },
205
171
 
206
- { id: "be", level: 0, bridge: "{ ...next(operator), type: after[0] }" },
172
+ {
173
+ id: "be",
174
+ level: 0,
175
+ bridge: `{
176
+ ...next(operator),
177
+ form: 'infinitive',
178
+ type: after[0]
179
+ }`
180
+ },
181
+
207
182
  { id: "briefOrWordy" },
208
183
 
209
184
  { id: "yesno" },
@@ -246,38 +221,6 @@ const config = {
246
221
  { id: "doesAble", level: 0, bridge: "{ ...next(operator) }" },
247
222
  { id: "doesAble", level: 1, bridge: "{ ...next(operator), before: before[0] }" },
248
223
  { id: "does", level: 0, bridge: "{ query: true, what: operator.marker, ...context, number: operator.number, object.number: operator.number }*" },
249
-
250
- /*
251
- {
252
- id: 'the',
253
- level: 0,
254
- bridge: '{ ...after[0], focusableForPhrase: true, pullFromContext: true, concept: true, wantsValue: true, determiner: "the", modifiers: append(["determiner"], after[0].modifiers)}'
255
- },
256
- {
257
- id: "a",
258
- level: 0,
259
- // bridge: "{ ...after[0], pullFromContext: false, instance: true, concept: true, number: 'one', wantsValue: true, determiner: operator, modifiers: append(['determiner'], after[0].modifiers) }"
260
- bridge: "{ ...after[0], pullFromContext: false, concept: true, number: 'one', wantsValue: true, determiner: operator, modifiers: append(['determiner'], after[0].modifiers) }"
261
- },
262
- */
263
- /*
264
- {
265
- id: "theAble",
266
- children: ['noun'],
267
- bridge: "{ ...next(operator) }"
268
- },
269
- */
270
-
271
- // TODO make this hierarchy thing work
272
- /*
273
- {
274
- id: "thisitthat",
275
- level: 0,
276
- isA: ['queryable'],
277
- before: ['verby'],
278
- bridge: "{ ...next(operator) }"
279
- },
280
- */
281
224
  {
282
225
  id: "why",
283
226
  level: 0,
@@ -287,31 +230,10 @@ const config = {
287
230
  id: "reason",
288
231
  isA: ['theAble', 'queryable'],
289
232
  },
290
- /*
291
- {
292
- id: "it",
293
- level: 0,
294
- isA: ['thisitthat'],
295
- bridge: "{ ...next(operator), pullFromContext: true, unknown: true, determined: true }"
296
- },
297
- {
298
- id: "this",
299
- level: 0,
300
- isA: ['thisitthat'],
301
- bridge: "{ ...next(operator), unknown: true, pullFromContext: true }"
302
- },
303
- {
304
- id: "that",
305
- level: 0,
306
- isA: ['thisitthat'],
307
- bridge: "{ ...next(operator), unknown: true, pullFromContext: true }"
308
- },
309
- */
310
233
  ],
311
234
  words: {
312
235
  "literals": {
313
236
  "?": [{"id": "questionMark", "initial": "{}" }],
314
- // "the": [{"id": "the", "initial": "{ modifiers: [] }" }],
315
237
  "who": [{"id": "what", "initial": "{ modifiers: [], query: true }" }],
316
238
  "yes": [{"id": "yesno", "initial": "{ value: true }" }],
317
239
  "no": [{"id": "yesno", "initial": "{ value: false }" }],
@@ -320,6 +242,7 @@ const config = {
320
242
  "does": [{"id": "does", "initial": "{ number: 'one' }" }],
321
243
  "do": [{"id": "does", "initial": "{ number: 'many' }" }],
322
244
  "is": [
245
+ {"id": "be", "initial": "{ form: 'infinitive' }" },
323
246
  {"id": "is", "initial": "{ number: 'one' }" },
324
247
  {"id": "isQuery", "initial": "{ number: 'one' }" },
325
248
  {"id": "isEd", "initial": "{ number: 'one' }" }
@@ -347,12 +270,9 @@ const config = {
347
270
  ['it', 'pronoun'],
348
271
  ['this', 'pronoun'],
349
272
  ['questionMark', 'punctuation'],
350
- // ['questionMark', 'isEd'],
351
273
  ['a', 'article'],
352
274
  ['the', 'article'],
353
- // ['unknown', 'theAble'],
354
275
  ['theAble', 'queryable'],
355
- // ['unknown', 'queryable'],
356
276
  ['it', 'queryable'],
357
277
  ['what', 'queryable'],
358
278
  ['whatAble', 'queryable'],
@@ -369,11 +289,13 @@ const config = {
369
289
  {
370
290
  where: where(),
371
291
  notes: "handle making responses brief",
372
- match: ({context, objects}) => (context.topLevel || context.isResponse) && objects.brief && !context.briefWasRun,
292
+ match: ({context, objects, callId}) => (context.topLevel || context.isResponse) && objects.brief && !context.briefWasRun,
373
293
  apply: async ({context, g}) => {
374
294
  const focussed = focus(context)
375
295
  context.briefWasRun = true
376
- return await g(focussed)
296
+ const result = await g(focussed)
297
+ context.briefWasRun = false
298
+ return result
377
299
  },
378
300
  priority: -2,
379
301
  },
@@ -393,7 +315,7 @@ const config = {
393
315
  where: where(),
394
316
  notes: "be brief or wordy",
395
317
  match: ({context}) => context.marker == 'be',
396
- apply: ({context}) => `be ${context.type.word}`,
318
+ apply: ({context}) => `be ${context.type?.word}`,
397
319
  },
398
320
  /*
399
321
  {
@@ -528,7 +450,7 @@ const config = {
528
450
  return `${await gp(context.one)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await g(context.two)}`
529
451
  }
530
452
 
531
- const hasFocus = (property) => {
453
+ function hasFocus(property) {
532
454
  if (context.focusableForPhrase) {
533
455
  return true
534
456
  }
@@ -554,7 +476,7 @@ const config = {
554
476
  } else {
555
477
  // TODO fix this using the assumed and that whole mess. change isResponse to useValue
556
478
  if (context.isResponse) {
557
- return `${await gp(context.one, { responding: true })} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await g(context.two)}`
479
+ return `${await gp(context.one, { assumed: { responding: true } })} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await g(context.two)}`
558
480
  } else {
559
481
  return `${await gp(context.one)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await gr(context.two)}`
560
482
  }
@@ -772,13 +694,12 @@ const config = {
772
694
  {
773
695
  where: where(),
774
696
  notes: 'get variable from stm',
775
- // match: ({context, kms}) => !context.determiner && context.evaluate && kms.stm.api.getVariable(context.value) != context.value,
776
- match: ({context, kms}) => context.evaluate && kms.stm.api.getVariable(context.value) != context.value,
697
+ match: ({context, kms}) => context.evaluate && kms.stm.api.getVariable(context),
777
698
  // match: ({context, kms}) => context.evaluate,
778
699
  priority: -1,
779
700
  apply: async ({context, kms, e}) => {
780
701
  const api = kms.stm.api
781
- context.value = api.getVariable(context.value)
702
+ context.value = api.getVariable(context)
782
703
  if (context.value && context.value.marker) {
783
704
  context.evalue = await e(context.value)
784
705
  }
@@ -788,7 +709,7 @@ const config = {
788
709
  ],
789
710
  };
790
711
 
791
- const initializer = ({objects, config, isModule}) => {
712
+ function initializer({objects, config, isModule}) {
792
713
  /* TODO add this beck in. some stuff from config needs to be here
793
714
  config.addArgs((args) => ({
794
715
  e: (context) => config.api.getEvaluator(args.s, args.log, context),