ekms 9.6.3-beta.9 → 9.7.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.
- package/common/actions.instance.json +2767 -13
- package/common/actions.js +112 -5
- package/common/actions.test.json +79138 -384
- package/common/angle.instance.json +138 -834
- package/common/angle.test.json +172 -127
- package/common/animals.instance.json +260 -0
- package/common/articles.js +1 -2
- package/common/avatar.test.json +173 -33
- package/common/can.instance.json +40 -0
- package/common/colors.instance.json +280 -0
- package/common/comparable.instance.json +120 -0
- package/common/compass.instance.json +63 -18
- package/common/concept.js +2 -1
- package/common/conjunction.js +11 -17
- package/common/control.js +42 -0
- package/common/control.test.json +2 -0
- package/common/crew.instance.json +520 -0
- package/common/dates.instance.json +100 -0
- package/common/dimension.instance.json +264 -69
- package/common/dimension.js +2 -2
- package/common/dimension.test.json +545 -441
- package/common/drone.instance.json +9101 -794
- package/common/drone.js +257 -68
- package/common/drone.test.json +415672 -38730
- package/common/drone_v1.instance.json +462 -57
- package/common/edible.instance.json +640 -0
- package/common/emotions.instance.json +20 -0
- package/common/evaluate.js +1 -1
- package/common/fastfood.instance.json +1310 -176
- package/common/formulas.instance.json +20 -5
- package/common/formulas.js +1 -1
- package/common/gdefaults.js +19 -3
- package/common/help.test.json +23 -3
- package/common/helpers/conjunction.js +2 -0
- package/common/helpers/formulas.js +6 -0
- package/common/helpers/properties.js +9 -7
- package/common/helpers.js +11 -6
- package/common/hierarchy.js +2 -0
- package/common/kirk.instance.json +20 -0
- package/common/length.instance.json +1117 -5708
- package/common/length.test.json +29761 -12488
- package/common/logging.js +41 -0
- package/common/logging.test.json +2 -0
- package/common/math.instance.json +30 -12
- package/common/math.js +6 -5
- package/common/menus.instance.json +140 -35
- package/common/meta.js +1 -1
- package/common/nameable.js +0 -2
- package/common/nameable.test.json +252 -150
- package/common/ordering.instance.json +40 -0
- package/common/people.instance.json +160 -0
- package/common/pipboy.instance.json +340 -85
- package/common/pokemon.instance.json +260 -0
- package/common/pressure.instance.json +108 -370
- package/common/properties.instance.json +20 -0
- package/common/properties.js +2 -1
- package/common/properties.test.json +2754 -2142
- package/common/rates.test.json +6914 -2428
- package/common/reports.instance.json +49 -176
- package/common/sdefaults.js +18 -5
- package/common/spock.instance.json +20 -0
- package/common/stm.js +95 -12
- package/common/stm.test.json +2670 -54
- package/common/temperature.instance.json +709 -2284
- package/common/time.instance.json +14241 -2228
- package/common/time.js +30 -3
- package/common/time.test.json +9914 -0
- package/common/tokenize.js +2 -0
- package/common/ui.instance.json +20 -5
- package/common/ui.js +1 -1
- package/common/weight.instance.json +621 -1886
- package/common/wp.instance.json +280 -70
- package/main.js +4 -0
- package/package.json +11 -5
package/common/actions.js
CHANGED
|
@@ -1,28 +1,116 @@
|
|
|
1
|
-
const { knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
|
|
1
|
+
const { knowledgeModule, where, Digraph, debug } = require('./runtime').theprogrammablemind
|
|
2
2
|
const { defaultContextCheckProperties, defaultContextCheck } = require('./helpers')
|
|
3
3
|
const dialogues = require("./dialogues")
|
|
4
4
|
const time = require("./time")
|
|
5
5
|
const tests = require('./actions.test.json')
|
|
6
6
|
const instance = require('./actions.instance.json')
|
|
7
7
|
|
|
8
|
+
/*
|
|
9
|
+
do patrol 1 then patrol 2 then patrol 3
|
|
10
|
+
do patrol 1 patrol 2 and then patrol 3
|
|
11
|
+
*/
|
|
12
|
+
|
|
8
13
|
const config = {
|
|
9
14
|
name: 'actions',
|
|
10
15
|
operators: [
|
|
11
16
|
"([doAction|do] ([action]))",
|
|
12
17
|
"((action) <again>)",
|
|
18
|
+
"((action) [thenAction|then] (action))",
|
|
19
|
+
"([delayTime|in,after] (context.unit.dimension == 'time'))",
|
|
13
20
|
],
|
|
14
21
|
bridges: [
|
|
22
|
+
{
|
|
23
|
+
id: 'delayTime',
|
|
24
|
+
isA: ['preposition', 'action'],
|
|
25
|
+
bridge: `{
|
|
26
|
+
...next(operator),
|
|
27
|
+
operator: operator,
|
|
28
|
+
delayTime: after[0],
|
|
29
|
+
interpolate: [ { property: 'operator' }, { property: 'delayTime' } ]
|
|
30
|
+
}`,
|
|
31
|
+
check: defaultContextCheckProperties(['delayTime'])
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'delayTime',
|
|
35
|
+
where: where(),
|
|
36
|
+
after: ['doAction'],
|
|
37
|
+
level: 1,
|
|
38
|
+
bridge: `{
|
|
39
|
+
...next(operator),
|
|
40
|
+
operator: operator,
|
|
41
|
+
checks: append(action.checks, ['action']),
|
|
42
|
+
action: action,
|
|
43
|
+
interpolate: [{ property: 'operator', byPosition: true }, { property: 'action', byPosition: true }]
|
|
44
|
+
}`,
|
|
45
|
+
selector: {
|
|
46
|
+
// loose: "action",
|
|
47
|
+
arguments: {
|
|
48
|
+
action: "(@<= 'action' || @<= 'doAction')",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
semantic: async ({context, fragments, e, s, toFinalValue, kms}) => {
|
|
52
|
+
const instantiation = await fragments("quantity in milliseconds", { quantity: context.delayTime })
|
|
53
|
+
const result = await e(instantiation)
|
|
54
|
+
const milliseconds = toFinalValue(toFinalValue(result).amount)
|
|
55
|
+
await kms.time.api.sleep(milliseconds)
|
|
56
|
+
await s(context.action)
|
|
57
|
+
}
|
|
58
|
+
},
|
|
15
59
|
{
|
|
16
60
|
id: 'action',
|
|
61
|
+
isA: ['thisAble'],
|
|
17
62
|
},
|
|
63
|
+
{
|
|
64
|
+
id: "thenAction",
|
|
65
|
+
level: 0,
|
|
66
|
+
isA: ['action'],
|
|
67
|
+
before: ['doAction'],
|
|
68
|
+
selector: {
|
|
69
|
+
match: "same",
|
|
70
|
+
left: [ { pattern: '(@<= action || (@<=doAction && context.marker.level == 1))' } ],
|
|
71
|
+
right: [ { pattern: '(@<= action || (@<=doAction && context.marker.level == 1))' } ],
|
|
72
|
+
passthrough: true
|
|
73
|
+
},
|
|
74
|
+
bridge: `{
|
|
75
|
+
...next(operator),
|
|
76
|
+
operator: operator,
|
|
77
|
+
listable: true,
|
|
78
|
+
isList: true,
|
|
79
|
+
before: before,
|
|
80
|
+
after: after,
|
|
81
|
+
value: append(before, after)
|
|
82
|
+
}`
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "thenAction",
|
|
86
|
+
level: 1,
|
|
87
|
+
before: ['doAction'],
|
|
88
|
+
selector: {
|
|
89
|
+
left: [ { pattern: '(@<=action || (@<=doAction && context.marker.level == 1))' } ],
|
|
90
|
+
passthrough: true
|
|
91
|
+
},
|
|
92
|
+
where: where(),
|
|
93
|
+
bridge: "{ ...next(operator), value: append(before, operator.value) }",
|
|
94
|
+
semantic: {
|
|
95
|
+
match: ({context}) => context.isList,
|
|
96
|
+
apply: async ({context, toArray, s}) => {
|
|
97
|
+
for (const action of toArray(context)) {
|
|
98
|
+
await s(action)
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
|
|
18
104
|
{
|
|
19
105
|
id: 'again',
|
|
106
|
+
before: ['doAction'],
|
|
20
107
|
bridge: `{
|
|
21
108
|
...before[0],
|
|
22
109
|
action: before[0],
|
|
23
110
|
again: operator,
|
|
24
111
|
interpolate: [{ property: 'action' }, { property: 'again' }]
|
|
25
|
-
}
|
|
112
|
+
}`,
|
|
113
|
+
localHierarchy: [['thisitthat', 'action']],
|
|
26
114
|
},
|
|
27
115
|
{
|
|
28
116
|
id: 'doAction',
|
|
@@ -32,16 +120,29 @@ const config = {
|
|
|
32
120
|
...next(operator),
|
|
33
121
|
operator: operator,
|
|
34
122
|
action: after[0],
|
|
35
|
-
interpolate: [{ property: 'operator' }, { property: 'action' }]
|
|
123
|
+
interpolate: append(default(operator.interpolate, [{ property: 'operator' }]), [{ property: 'action' }])
|
|
36
124
|
}`,
|
|
125
|
+
localHierarchy: [['thisitthat', 'action']],
|
|
126
|
+
where: where(),
|
|
127
|
+
semantic: async ({context, toArray, s}) => {
|
|
128
|
+
for (const action of toArray(context.action)) {
|
|
129
|
+
await s(action)
|
|
130
|
+
}
|
|
131
|
+
},
|
|
37
132
|
},
|
|
38
133
|
],
|
|
134
|
+
words: {
|
|
135
|
+
patterns: [
|
|
136
|
+
{ "pattern": ["action", { type: 'digit' }], allow_partial_matches: false, defs: [{id: "action", initial: "{ value: text, instance: true, dead: true }" }]},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
39
139
|
semantics: [
|
|
40
140
|
{
|
|
41
141
|
priority: -1,
|
|
42
|
-
match: ({context, isA}) => isA(context.marker, 'action'),
|
|
43
|
-
apply: ({context, _continue, remember}) => {
|
|
142
|
+
match: ({context, isA}) => !context.pullFromContext && (isA(context.marker, 'action') || isA(context.marker, 'doAction')),
|
|
143
|
+
apply: async ({context, _continue, testLog, g, remember}) => {
|
|
44
144
|
remember(context)
|
|
145
|
+
await testLog(() => g(context))
|
|
45
146
|
_continue()
|
|
46
147
|
}
|
|
47
148
|
},
|
|
@@ -49,6 +150,9 @@ const config = {
|
|
|
49
150
|
};
|
|
50
151
|
|
|
51
152
|
const template = {
|
|
153
|
+
fragments: [
|
|
154
|
+
"quantity in milliseconds",
|
|
155
|
+
],
|
|
52
156
|
configs: [
|
|
53
157
|
config,
|
|
54
158
|
],
|
|
@@ -64,5 +168,8 @@ knowledgeModule({
|
|
|
64
168
|
test: {
|
|
65
169
|
name: './actions.test.json',
|
|
66
170
|
contents: tests,
|
|
171
|
+
checks: {
|
|
172
|
+
objects: [ { km: 'logging' } ],
|
|
173
|
+
},
|
|
67
174
|
},
|
|
68
175
|
})
|