ekms 9.6.3-beta.29 → 9.6.3-beta.30
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 +66 -25
- package/common/actions.js +22 -15
- package/common/actions.test.json +36289 -0
- package/common/colors.instance.json +28 -0
- package/common/conjunction.js +2 -2
- package/common/crew.instance.json +0 -36
- package/common/dates.instance.json +84 -0
- package/common/dimension.instance.json +11 -11
- package/common/drone.instance.json +62 -34
- package/common/drone.js +1 -1
- package/common/drone.test.json +3 -0
- package/common/drone_v1.instance.json +28 -0
- package/common/edible.instance.json +56 -0
- package/common/gdefaults.js +13 -3
- package/common/pipboy.instance.json +56 -0
- package/common/reports.instance.json +1 -1
- package/common/wp.instance.json +56 -0
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"([doAction|do] ([action]))",
|
|
7
7
|
"((action) <again>)",
|
|
8
8
|
"((action) [thenAction|then] (action))",
|
|
9
|
-
"([delayTime|in] (context.unit.dimension == 'time'))"
|
|
9
|
+
"([delayTime|in,after] (context.unit.dimension == 'time'))"
|
|
10
10
|
],
|
|
11
11
|
"bridges": [
|
|
12
12
|
{
|
|
@@ -34,20 +34,24 @@
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"id": "delayTime",
|
|
37
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/actions.js:35",
|
|
37
38
|
"after": [
|
|
38
39
|
"doAction"
|
|
39
40
|
],
|
|
40
41
|
"level": 1,
|
|
41
|
-
"bridge": "{\n ...next(operator),\n operator: operator,\n checks: append(action.checks, ['action']),\n action: action,\n interpolate: [{ property: 'operator' }, { property: 'action', byPosition: true }]\n }",
|
|
42
|
+
"bridge": "{\n ...next(operator),\n operator: operator,\n checks: append(action.checks, ['action']),\n action: action,\n interpolate: [{ property: 'operator', byPosition: true }, { property: 'action', byPosition: true }]\n }",
|
|
42
43
|
"selector": {
|
|
43
44
|
"arguments": {
|
|
44
|
-
"action": "(@<= 'doAction')"
|
|
45
|
+
"action": "(@<= 'action' || @<= 'doAction')"
|
|
45
46
|
}
|
|
46
47
|
},
|
|
47
|
-
"semantic": "async ({context, fragments, e, toFinalValue, kms}) => {\n
|
|
48
|
+
"semantic": "async ({context, fragments, e, s, toFinalValue, kms}) => {\n const instantiation = await fragments(\"quantity in milliseconds\", { quantity: context.delayTime })\n const result = await e(instantiation)\n const milliseconds = toFinalValue(toFinalValue(result).amount)\n await kms.time.api.sleep(milliseconds)\n await s(context.action)\n }"
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
|
-
"id": "action"
|
|
51
|
+
"id": "action",
|
|
52
|
+
"isA": [
|
|
53
|
+
"thisAble"
|
|
54
|
+
]
|
|
51
55
|
},
|
|
52
56
|
{
|
|
53
57
|
"id": "thenAction",
|
|
@@ -62,12 +66,12 @@
|
|
|
62
66
|
"match": "same",
|
|
63
67
|
"left": [
|
|
64
68
|
{
|
|
65
|
-
"pattern": "(action))"
|
|
69
|
+
"pattern": "(@<= action || (@<=doAction && context.marker.level == 1))"
|
|
66
70
|
}
|
|
67
71
|
],
|
|
68
72
|
"right": [
|
|
69
73
|
{
|
|
70
|
-
"pattern": "(action)"
|
|
74
|
+
"pattern": "(@<= action || (@<=doAction && context.marker.level == 1))"
|
|
71
75
|
}
|
|
72
76
|
],
|
|
73
77
|
"passthrough": true
|
|
@@ -83,17 +87,27 @@
|
|
|
83
87
|
"selector": {
|
|
84
88
|
"left": [
|
|
85
89
|
{
|
|
86
|
-
"pattern": "(action)"
|
|
90
|
+
"pattern": "(@<=action || (@<=doAction && context.marker.level == 1))"
|
|
87
91
|
}
|
|
88
92
|
],
|
|
89
93
|
"passthrough": true
|
|
90
94
|
},
|
|
95
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/actions.js:92",
|
|
91
96
|
"bridge": "{ ...next(operator), value: append(before, operator.value) }",
|
|
92
|
-
"semantic": "
|
|
97
|
+
"semantic": "[object Object]"
|
|
93
98
|
},
|
|
94
99
|
{
|
|
95
100
|
"id": "again",
|
|
96
|
-
"
|
|
101
|
+
"before": [
|
|
102
|
+
"doAction"
|
|
103
|
+
],
|
|
104
|
+
"bridge": "{\n ...before[0],\n action: before[0],\n again: operator,\n interpolate: [{ property: 'action' }, { property: 'again' }]\n }",
|
|
105
|
+
"localHierarchy": [
|
|
106
|
+
[
|
|
107
|
+
"thisitthat",
|
|
108
|
+
"action"
|
|
109
|
+
]
|
|
110
|
+
]
|
|
97
111
|
},
|
|
98
112
|
{
|
|
99
113
|
"id": "doAction",
|
|
@@ -117,8 +131,14 @@
|
|
|
117
131
|
"action"
|
|
118
132
|
],
|
|
119
133
|
"bridge": "{\n ...next(operator),\n operator: operator,\n action: after[0],\n interpolate: append(default(operator.interpolate, [{ property: 'operator' }]), [{ property: 'action' }])\n }",
|
|
120
|
-
"
|
|
121
|
-
|
|
134
|
+
"localHierarchy": [
|
|
135
|
+
[
|
|
136
|
+
"thisitthat",
|
|
137
|
+
"action"
|
|
138
|
+
]
|
|
139
|
+
],
|
|
140
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/actions.js:126",
|
|
141
|
+
"semantic": "async ({context, toArray, s}) => {\n for (const action of toArray(context.action)) {\n await s(action)\n }\n }"
|
|
122
142
|
}
|
|
123
143
|
],
|
|
124
144
|
"words": {
|
|
@@ -142,8 +162,8 @@
|
|
|
142
162
|
},
|
|
143
163
|
"semantics": [
|
|
144
164
|
{
|
|
145
|
-
"match": "({context, isA}) => !context.pullFromContext && (isA(context.marker, 'action') || context.marker
|
|
146
|
-
"apply": "async ({context, _continue, testLog, g, remember}) => {\n remember(context)\n
|
|
165
|
+
"match": "({context, isA}) => !context.pullFromContext && (isA(context.marker, 'action') || isA(context.marker, 'doAction'))",
|
|
166
|
+
"apply": "async ({context, _continue, testLog, g, remember}) => {\n remember(context)\n await testLog(() => g(context))\n _continue()\n }"
|
|
147
167
|
}
|
|
148
168
|
]
|
|
149
169
|
}
|
|
@@ -156,7 +176,7 @@
|
|
|
156
176
|
"([doAction|do] ([action]))",
|
|
157
177
|
"((action) <again>)",
|
|
158
178
|
"((action) [thenAction|then] (action))",
|
|
159
|
-
"([delayTime|in] (context.unit.dimension == 'time'))"
|
|
179
|
+
"([delayTime|in,after] (context.unit.dimension == 'time'))"
|
|
160
180
|
],
|
|
161
181
|
"bridges": [
|
|
162
182
|
{
|
|
@@ -184,19 +204,23 @@
|
|
|
184
204
|
},
|
|
185
205
|
{
|
|
186
206
|
"id": "delayTime",
|
|
207
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/actions.js:35",
|
|
187
208
|
"after": [
|
|
188
209
|
"doAction"
|
|
189
210
|
],
|
|
190
211
|
"level": 1,
|
|
191
|
-
"bridge": "{\n ...next(operator),\n operator: operator,\n checks: append(action.checks, ['action']),\n action: action,\n interpolate: [{ property: 'operator' }, { property: 'action', byPosition: true }]\n }",
|
|
212
|
+
"bridge": "{\n ...next(operator),\n operator: operator,\n checks: append(action.checks, ['action']),\n action: action,\n interpolate: [{ property: 'operator', byPosition: true }, { property: 'action', byPosition: true }]\n }",
|
|
192
213
|
"selector": {
|
|
193
214
|
"arguments": {
|
|
194
|
-
"action": "(@<= 'doAction')"
|
|
215
|
+
"action": "(@<= 'action' || @<= 'doAction')"
|
|
195
216
|
}
|
|
196
217
|
}
|
|
197
218
|
},
|
|
198
219
|
{
|
|
199
|
-
"id": "action"
|
|
220
|
+
"id": "action",
|
|
221
|
+
"isA": [
|
|
222
|
+
"thisAble"
|
|
223
|
+
]
|
|
200
224
|
},
|
|
201
225
|
{
|
|
202
226
|
"id": "thenAction",
|
|
@@ -211,12 +235,12 @@
|
|
|
211
235
|
"match": "same",
|
|
212
236
|
"left": [
|
|
213
237
|
{
|
|
214
|
-
"pattern": "(action))"
|
|
238
|
+
"pattern": "(@<= action || (@<=doAction && context.marker.level == 1))"
|
|
215
239
|
}
|
|
216
240
|
],
|
|
217
241
|
"right": [
|
|
218
242
|
{
|
|
219
|
-
"pattern": "(action)"
|
|
243
|
+
"pattern": "(@<= action || (@<=doAction && context.marker.level == 1))"
|
|
220
244
|
}
|
|
221
245
|
],
|
|
222
246
|
"passthrough": true
|
|
@@ -232,16 +256,27 @@
|
|
|
232
256
|
"selector": {
|
|
233
257
|
"left": [
|
|
234
258
|
{
|
|
235
|
-
"pattern": "(action)"
|
|
259
|
+
"pattern": "(@<=action || (@<=doAction && context.marker.level == 1))"
|
|
236
260
|
}
|
|
237
261
|
],
|
|
238
262
|
"passthrough": true
|
|
239
263
|
},
|
|
240
|
-
"
|
|
264
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/actions.js:92",
|
|
265
|
+
"bridge": "{ ...next(operator), value: append(before, operator.value) }",
|
|
266
|
+
"semantic": {}
|
|
241
267
|
},
|
|
242
268
|
{
|
|
243
269
|
"id": "again",
|
|
244
|
-
"
|
|
270
|
+
"before": [
|
|
271
|
+
"doAction"
|
|
272
|
+
],
|
|
273
|
+
"bridge": "{\n ...before[0],\n action: before[0],\n again: operator,\n interpolate: [{ property: 'action' }, { property: 'again' }]\n }",
|
|
274
|
+
"localHierarchy": [
|
|
275
|
+
[
|
|
276
|
+
"thisitthat",
|
|
277
|
+
"action"
|
|
278
|
+
]
|
|
279
|
+
]
|
|
245
280
|
},
|
|
246
281
|
{
|
|
247
282
|
"id": "doAction",
|
|
@@ -265,7 +300,13 @@
|
|
|
265
300
|
"action"
|
|
266
301
|
],
|
|
267
302
|
"bridge": "{\n ...next(operator),\n operator: operator,\n action: after[0],\n interpolate: append(default(operator.interpolate, [{ property: 'operator' }]), [{ property: 'action' }])\n }",
|
|
268
|
-
"
|
|
303
|
+
"localHierarchy": [
|
|
304
|
+
[
|
|
305
|
+
"thisitthat",
|
|
306
|
+
"action"
|
|
307
|
+
]
|
|
308
|
+
],
|
|
309
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/actions.js:126"
|
|
269
310
|
}
|
|
270
311
|
],
|
|
271
312
|
"words": {
|
|
@@ -304,7 +345,7 @@
|
|
|
304
345
|
],
|
|
305
346
|
[
|
|
306
347
|
"action",
|
|
307
|
-
"
|
|
348
|
+
"thisAble",
|
|
308
349
|
false
|
|
309
350
|
],
|
|
310
351
|
[
|
package/common/actions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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")
|
|
@@ -16,7 +16,7 @@ const config = {
|
|
|
16
16
|
"([doAction|do] ([action]))",
|
|
17
17
|
"((action) <again>)",
|
|
18
18
|
"((action) [thenAction|then] (action))",
|
|
19
|
-
"([delayTime|in] (context.unit.dimension == 'time'))",
|
|
19
|
+
"([delayTime|in,after] (context.unit.dimension == 'time'))",
|
|
20
20
|
],
|
|
21
21
|
bridges: [
|
|
22
22
|
{
|
|
@@ -40,12 +40,12 @@ const config = {
|
|
|
40
40
|
operator: operator,
|
|
41
41
|
checks: append(action.checks, ['action']),
|
|
42
42
|
action: action,
|
|
43
|
-
interpolate: [{ property: 'operator' }, { property: 'action', byPosition: true }]
|
|
43
|
+
interpolate: [{ property: 'operator', byPosition: true }, { property: 'action', byPosition: true }]
|
|
44
44
|
}`,
|
|
45
45
|
selector: {
|
|
46
46
|
// loose: "action",
|
|
47
47
|
arguments: {
|
|
48
|
-
action: "(@<= 'action')",
|
|
48
|
+
action: "(@<= 'action' || @<= 'doAction')",
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
semantic: async ({context, fragments, e, s, toFinalValue, kms}) => {
|
|
@@ -58,7 +58,7 @@ const config = {
|
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
id: 'action',
|
|
61
|
-
|
|
61
|
+
isA: ['thisAble'],
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
id: "thenAction",
|
|
@@ -67,8 +67,8 @@ const config = {
|
|
|
67
67
|
before: ['doAction'],
|
|
68
68
|
selector: {
|
|
69
69
|
match: "same",
|
|
70
|
-
left: [ { pattern: '(action))' } ],
|
|
71
|
-
right: [ { pattern: '(action)' } ],
|
|
70
|
+
left: [ { pattern: '(@<= action || (@<=doAction && context.marker.level == 1))' } ],
|
|
71
|
+
right: [ { pattern: '(@<= action || (@<=doAction && context.marker.level == 1))' } ],
|
|
72
72
|
passthrough: true
|
|
73
73
|
},
|
|
74
74
|
bridge: `{
|
|
@@ -86,25 +86,31 @@ const config = {
|
|
|
86
86
|
level: 1,
|
|
87
87
|
before: ['doAction'],
|
|
88
88
|
selector: {
|
|
89
|
-
left: [ { pattern: '(action)' } ],
|
|
89
|
+
left: [ { pattern: '(@<=action || (@<=doAction && context.marker.level == 1))' } ],
|
|
90
90
|
passthrough: true
|
|
91
91
|
},
|
|
92
|
+
where: where(),
|
|
92
93
|
bridge: "{ ...next(operator), value: append(before, operator.value) }",
|
|
93
|
-
semantic:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
+
}
|
|
98
102
|
},
|
|
99
103
|
|
|
100
104
|
{
|
|
101
105
|
id: 'again',
|
|
106
|
+
before: ['doAction'],
|
|
102
107
|
bridge: `{
|
|
103
108
|
...before[0],
|
|
104
109
|
action: before[0],
|
|
105
110
|
again: operator,
|
|
106
111
|
interpolate: [{ property: 'action' }, { property: 'again' }]
|
|
107
|
-
}
|
|
112
|
+
}`,
|
|
113
|
+
localHierarchy: [['thisitthat', 'action']],
|
|
108
114
|
},
|
|
109
115
|
{
|
|
110
116
|
id: 'doAction',
|
|
@@ -116,6 +122,7 @@ const config = {
|
|
|
116
122
|
action: after[0],
|
|
117
123
|
interpolate: append(default(operator.interpolate, [{ property: 'operator' }]), [{ property: 'action' }])
|
|
118
124
|
}`,
|
|
125
|
+
localHierarchy: [['thisitthat', 'action']],
|
|
119
126
|
where: where(),
|
|
120
127
|
semantic: async ({context, toArray, s}) => {
|
|
121
128
|
for (const action of toArray(context.action)) {
|
|
@@ -132,7 +139,7 @@ const config = {
|
|
|
132
139
|
semantics: [
|
|
133
140
|
{
|
|
134
141
|
priority: -1,
|
|
135
|
-
match: ({context, isA}) => !context.pullFromContext && (isA(context.marker, 'action') || context.marker
|
|
142
|
+
match: ({context, isA}) => !context.pullFromContext && (isA(context.marker, 'action') || isA(context.marker, 'doAction')),
|
|
136
143
|
apply: async ({context, _continue, testLog, g, remember}) => {
|
|
137
144
|
remember(context)
|
|
138
145
|
await testLog(() => g(context))
|