ekms 9.6.3-beta.2 → 9.6.3-beta.21

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 (55) hide show
  1. package/common/actions.instance.json +130 -5
  2. package/common/actions.js +54 -4
  3. package/common/actions.test.json +31359 -322
  4. package/common/angle.instance.json +58 -834
  5. package/common/articles.js +1 -2
  6. package/common/compass.instance.json +3 -18
  7. package/common/concept.js +2 -1
  8. package/common/conjunction.js +11 -17
  9. package/common/dialogues.js +3 -3
  10. package/common/dimension.instance.json +4 -69
  11. package/common/dimension.js +5 -5
  12. package/common/drone.instance.json +14985 -2538
  13. package/common/drone.js +276 -61
  14. package/common/drone.test.json +412474 -28440
  15. package/common/drone_v1.instance.json +324 -44
  16. package/common/drone_v1.js +9 -9
  17. package/common/edible.instance.json +72 -0
  18. package/common/fastfood.instance.json +5 -72
  19. package/common/fastfood.js +1 -1
  20. package/common/formulas.instance.json +0 -5
  21. package/common/formulas.js +1 -1
  22. package/common/gdefaults.js +16 -5
  23. package/common/helpers/conjunction.js +2 -0
  24. package/common/helpers/formulas.js +6 -0
  25. package/common/helpers/properties.js +9 -7
  26. package/common/helpers.js +9 -5
  27. package/common/hierarchy.js +2 -0
  28. package/common/length.instance.json +555 -5686
  29. package/common/math.instance.json +10 -12
  30. package/common/math.js +6 -5
  31. package/common/menus.instance.json +0 -35
  32. package/common/meta.js +1 -1
  33. package/common/nameable.js +7 -9
  34. package/common/ordinals.js +51 -5
  35. package/common/pipboy.instance.json +0 -85
  36. package/common/pipboy.js +1 -1
  37. package/common/pressure.instance.json +28 -370
  38. package/common/properties.js +4 -3
  39. package/common/rates.instance.json +1 -1
  40. package/common/rates.js +3 -3
  41. package/common/reminders.js +1 -1
  42. package/common/reports.instance.json +9 -176
  43. package/common/reports.js +2 -2
  44. package/common/scorekeeper.js +1 -1
  45. package/common/sdefaults.js +40 -5
  46. package/common/stm.js +50 -42
  47. package/common/temperature.instance.json +648 -2303
  48. package/common/time.instance.json +7376 -1965
  49. package/common/time.js +22 -1
  50. package/common/time.test.json +13239 -0
  51. package/common/ui.instance.json +0 -5
  52. package/common/ui.js +1 -1
  53. package/common/weight.instance.json +329 -1834
  54. package/common/wp.instance.json +88 -70
  55. package/package.json +3 -3
@@ -4,12 +4,55 @@
4
4
  "name": "actions",
5
5
  "operators": [
6
6
  "([doAction|do] ([action]))",
7
- "((action) <again>)"
7
+ "((action) <again>)",
8
+ "((action) [thenAction|then] (action))"
8
9
  ],
9
10
  "bridges": [
10
11
  {
11
12
  "id": "action"
12
13
  },
14
+ {
15
+ "id": "thenAction",
16
+ "level": 0,
17
+ "isA": [
18
+ "action"
19
+ ],
20
+ "before": [
21
+ "doAction"
22
+ ],
23
+ "selector": {
24
+ "match": "same",
25
+ "left": [
26
+ {
27
+ "pattern": "(action))"
28
+ }
29
+ ],
30
+ "right": [
31
+ {
32
+ "pattern": "(action)"
33
+ }
34
+ ],
35
+ "passthrough": true
36
+ },
37
+ "bridge": "{ \n ...next(operator),\n operator: operator, \n listable: true, \n isList: true, \n before: before, \n after: after, \n value: append(before, after)\n }"
38
+ },
39
+ {
40
+ "id": "thenAction",
41
+ "level": 1,
42
+ "before": [
43
+ "doAction"
44
+ ],
45
+ "selector": {
46
+ "left": [
47
+ {
48
+ "pattern": "(action)"
49
+ }
50
+ ],
51
+ "passthrough": true
52
+ },
53
+ "bridge": "{ ...next(operator), value: append(before, operator.value) }",
54
+ "semantic": "async ({context, toArray, s}) => {\n for (const action of toArray(context)) {\n await s(action)\n }\n }"
55
+ },
13
56
  {
14
57
  "id": "again",
15
58
  "bridge": "{\n ...before[0],\n action: before[0],\n again: operator,\n interpolate: [{ property: 'action' }, { property: 'again' }]\n }"
@@ -17,7 +60,8 @@
17
60
  {
18
61
  "id": "doAction",
19
62
  "isA": [
20
- "verb"
63
+ "verb",
64
+ "repeatable"
21
65
  ],
22
66
  "check": [
23
67
  "marker",
@@ -37,10 +81,29 @@
37
81
  "bridge": "{\n ...next(operator),\n operator: operator,\n action: after[0],\n interpolate: [{ property: 'operator' }, { property: 'action' }]\n }"
38
82
  }
39
83
  ],
84
+ "words": {
85
+ "patterns": [
86
+ {
87
+ "pattern": [
88
+ "action",
89
+ {
90
+ "type": "digit"
91
+ }
92
+ ],
93
+ "allow_partial_matches": false,
94
+ "defs": [
95
+ {
96
+ "id": "action",
97
+ "initial": "{ value: text, instance: true, dead: true }"
98
+ }
99
+ ]
100
+ }
101
+ ]
102
+ },
40
103
  "semantics": [
41
104
  {
42
105
  "match": "({context, isA}) => isA(context.marker, 'action')",
43
- "apply": "({context, _continue, mentioned}) => {\n mentioned(context)\n _continue()\n }"
106
+ "apply": "({context, _continue, remember}) => {\n remember(context)\n _continue()\n }"
44
107
  }
45
108
  ]
46
109
  }
@@ -51,12 +114,54 @@
51
114
  "name": "actions",
52
115
  "operators": [
53
116
  "([doAction|do] ([action]))",
54
- "((action) <again>)"
117
+ "((action) <again>)",
118
+ "((action) [thenAction|then] (action))"
55
119
  ],
56
120
  "bridges": [
57
121
  {
58
122
  "id": "action"
59
123
  },
124
+ {
125
+ "id": "thenAction",
126
+ "level": 0,
127
+ "isA": [
128
+ "action"
129
+ ],
130
+ "before": [
131
+ "doAction"
132
+ ],
133
+ "selector": {
134
+ "match": "same",
135
+ "left": [
136
+ {
137
+ "pattern": "(action))"
138
+ }
139
+ ],
140
+ "right": [
141
+ {
142
+ "pattern": "(action)"
143
+ }
144
+ ],
145
+ "passthrough": true
146
+ },
147
+ "bridge": "{ \n ...next(operator),\n operator: operator, \n listable: true, \n isList: true, \n before: before, \n after: after, \n value: append(before, after)\n }"
148
+ },
149
+ {
150
+ "id": "thenAction",
151
+ "level": 1,
152
+ "before": [
153
+ "doAction"
154
+ ],
155
+ "selector": {
156
+ "left": [
157
+ {
158
+ "pattern": "(action)"
159
+ }
160
+ ],
161
+ "passthrough": true
162
+ },
163
+ "bridge": "{ ...next(operator), value: append(before, operator.value) }"
164
+ },
60
165
  {
61
166
  "id": "again",
62
167
  "bridge": "{\n ...before[0],\n action: before[0],\n again: operator,\n interpolate: [{ property: 'action' }, { property: 'again' }]\n }"
@@ -64,7 +169,8 @@
64
169
  {
65
170
  "id": "doAction",
66
171
  "isA": [
67
- "verb"
172
+ "verb",
173
+ "repeatable"
68
174
  ],
69
175
  "check": [
70
176
  "marker",
@@ -84,6 +190,25 @@
84
190
  "bridge": "{\n ...next(operator),\n operator: operator,\n action: after[0],\n interpolate: [{ property: 'operator' }, { property: 'action' }]\n }"
85
191
  }
86
192
  ],
193
+ "words": {
194
+ "patterns": [
195
+ {
196
+ "pattern": [
197
+ "action",
198
+ {
199
+ "type": "digit"
200
+ }
201
+ ],
202
+ "allow_partial_matches": false,
203
+ "defs": [
204
+ {
205
+ "id": "action",
206
+ "initial": "{ value: text, instance: true, dead: true }"
207
+ }
208
+ ]
209
+ }
210
+ ]
211
+ },
87
212
  "semantics": [
88
213
  {
89
214
  "priority": -1
package/common/actions.js CHANGED
@@ -1,19 +1,64 @@
1
1
  const { knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheckProperties, defaultContextCheck } = require('./helpers')
3
3
  const dialogues = require("./dialogues")
4
+ const time = require("./time")
4
5
  const tests = require('./actions.test.json')
5
6
  const instance = require('./actions.instance.json')
6
7
 
8
+ /*
9
+ do patrol 1 then patrol 2 then patrol 3
10
+ do patrol 1 patrol 2 and then patrol 3
11
+ */
12
+
7
13
  const config = {
8
14
  name: 'actions',
9
15
  operators: [
10
16
  "([doAction|do] ([action]))",
11
17
  "((action) <again>)",
18
+ "((action) [thenAction|then] (action))",
12
19
  ],
13
20
  bridges: [
14
21
  {
15
22
  id: 'action',
23
+ // isA: ['thisitthat'],
24
+ },
25
+ {
26
+ id: "thenAction",
27
+ level: 0,
28
+ isA: ['action'],
29
+ before: ['doAction'],
30
+ selector: {
31
+ match: "same",
32
+ left: [ { pattern: '(action))' } ],
33
+ right: [ { pattern: '(action)' } ],
34
+ passthrough: true
35
+ },
36
+ bridge: `{
37
+ ...next(operator),
38
+ operator: operator,
39
+ listable: true,
40
+ isList: true,
41
+ before: before,
42
+ after: after,
43
+ value: append(before, after)
44
+ }`
16
45
  },
46
+ {
47
+ id: "thenAction",
48
+ level: 1,
49
+ before: ['doAction'],
50
+ selector: {
51
+ left: [ { pattern: '(action)' } ],
52
+ passthrough: true
53
+ },
54
+ bridge: "{ ...next(operator), value: append(before, operator.value) }",
55
+ semantic: async ({context, toArray, s}) => {
56
+ for (const action of toArray(context)) {
57
+ await s(action)
58
+ }
59
+ },
60
+ },
61
+
17
62
  {
18
63
  id: 'again',
19
64
  bridge: `{
@@ -25,7 +70,7 @@ const config = {
25
70
  },
26
71
  {
27
72
  id: 'doAction',
28
- isA: ['verb'],
73
+ isA: ['verb', 'repeatable'],
29
74
  check: defaultContextCheckProperties(['action']),
30
75
  bridge: `{
31
76
  ...next(operator),
@@ -35,12 +80,17 @@ const config = {
35
80
  }`,
36
81
  },
37
82
  ],
83
+ words: {
84
+ patterns: [
85
+ { "pattern": ["action", { type: 'digit' }], allow_partial_matches: false, defs: [{id: "action", initial: "{ value: text, instance: true, dead: true }" }]},
86
+ ],
87
+ },
38
88
  semantics: [
39
89
  {
40
90
  priority: -1,
41
91
  match: ({context, isA}) => isA(context.marker, 'action'),
42
- apply: ({context, _continue, mentioned}) => {
43
- mentioned(context)
92
+ apply: ({context, _continue, remember}) => {
93
+ remember(context)
44
94
  _continue()
45
95
  }
46
96
  },
@@ -55,7 +105,7 @@ const template = {
55
105
 
56
106
  knowledgeModule({
57
107
  config: { name: 'actions' },
58
- includes: [dialogues],
108
+ includes: [dialogues, time],
59
109
  instance,
60
110
  template,
61
111
  module,