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.
- package/common/actions.instance.json +130 -5
- package/common/actions.js +54 -4
- package/common/actions.test.json +31359 -322
- package/common/angle.instance.json +58 -834
- package/common/articles.js +1 -2
- package/common/compass.instance.json +3 -18
- package/common/concept.js +2 -1
- package/common/conjunction.js +11 -17
- package/common/dialogues.js +3 -3
- package/common/dimension.instance.json +4 -69
- package/common/dimension.js +5 -5
- package/common/drone.instance.json +14985 -2538
- package/common/drone.js +276 -61
- package/common/drone.test.json +412474 -28440
- package/common/drone_v1.instance.json +324 -44
- package/common/drone_v1.js +9 -9
- package/common/edible.instance.json +72 -0
- package/common/fastfood.instance.json +5 -72
- package/common/fastfood.js +1 -1
- package/common/formulas.instance.json +0 -5
- package/common/formulas.js +1 -1
- package/common/gdefaults.js +16 -5
- 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 +9 -5
- package/common/hierarchy.js +2 -0
- package/common/length.instance.json +555 -5686
- package/common/math.instance.json +10 -12
- package/common/math.js +6 -5
- package/common/menus.instance.json +0 -35
- package/common/meta.js +1 -1
- package/common/nameable.js +7 -9
- package/common/ordinals.js +51 -5
- package/common/pipboy.instance.json +0 -85
- package/common/pipboy.js +1 -1
- package/common/pressure.instance.json +28 -370
- package/common/properties.js +4 -3
- package/common/rates.instance.json +1 -1
- package/common/rates.js +3 -3
- package/common/reminders.js +1 -1
- package/common/reports.instance.json +9 -176
- package/common/reports.js +2 -2
- package/common/scorekeeper.js +1 -1
- package/common/sdefaults.js +40 -5
- package/common/stm.js +50 -42
- package/common/temperature.instance.json +648 -2303
- package/common/time.instance.json +7376 -1965
- package/common/time.js +22 -1
- package/common/time.test.json +13239 -0
- package/common/ui.instance.json +0 -5
- package/common/ui.js +1 -1
- package/common/weight.instance.json +329 -1834
- package/common/wp.instance.json +88 -70
- package/package.json +3 -3
package/common/reports.js
CHANGED
|
@@ -38,7 +38,7 @@ function compareValue(property, v1, v2) {
|
|
|
38
38
|
function newReport({km, objects}) {
|
|
39
39
|
objects.tempReportId += 1
|
|
40
40
|
const reportId = `tempReport${objects.tempReportId}`
|
|
41
|
-
km('stm').api.
|
|
41
|
+
km('stm').api.remember({ context: { marker: "report", text: reportId, types: [ "report" ], value: reportId, word: reportId } })
|
|
42
42
|
// name to listing
|
|
43
43
|
objects.listings[reportId] = {
|
|
44
44
|
columns: ['name', 'supplier'],
|
|
@@ -344,7 +344,7 @@ const config = {
|
|
|
344
344
|
const name = context.name.map((n) => n.text).join('')
|
|
345
345
|
objects.listings[name] = {...listing}
|
|
346
346
|
config.addWord(`${name}`, { id: 'report', initial: `{ value: "${name}" }` })
|
|
347
|
-
km('stm').api.
|
|
347
|
+
km('stm').api.remember({
|
|
348
348
|
context: {
|
|
349
349
|
marker: "report",
|
|
350
350
|
text: name,
|
package/common/scorekeeper.js
CHANGED
package/common/sdefaults.js
CHANGED
|
@@ -14,6 +14,33 @@ class API {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// TODO generalize this for avoiding recusive call without changing the context properties
|
|
18
|
+
|
|
19
|
+
function okay(args, condition) {
|
|
20
|
+
if (condition(args)) {
|
|
21
|
+
const { context } = args
|
|
22
|
+
|
|
23
|
+
if (!context.control) {
|
|
24
|
+
context.control = {
|
|
25
|
+
seen: [],
|
|
26
|
+
nextId: 2,
|
|
27
|
+
}
|
|
28
|
+
context.control_id = 1
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!context.control_id) {
|
|
32
|
+
context.control_id = context.control.nextId
|
|
33
|
+
context.control.nextId += 1
|
|
34
|
+
}
|
|
35
|
+
if (context.control.seen.includes(context.control_id)) {
|
|
36
|
+
return false
|
|
37
|
+
}
|
|
38
|
+
context.control.seen.push(context.control_id)
|
|
39
|
+
return true
|
|
40
|
+
}
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
43
|
+
|
|
17
44
|
const config = {
|
|
18
45
|
name: 'sdefaults',
|
|
19
46
|
semantics: [
|
|
@@ -22,13 +49,16 @@ const config = {
|
|
|
22
49
|
where: where(),
|
|
23
50
|
priority: -1,
|
|
24
51
|
// match: ({context}) => context.flatten || context.listable && context.value[0].flatten,
|
|
25
|
-
match: ({context}) => context.flatten || context.listable && context.value.some((value) => value.flatten),
|
|
52
|
+
match: (args) => okay(args, ({context}) => (context.flatten || context.listable && context.value.some((value) => value.flatten))),
|
|
26
53
|
// match: ({context}) => context.flatten || context.listable || (Array.isArray(context.value) && context.value.some((value) => value.flatten)),
|
|
27
|
-
apply: async ({config, km, context, s}) => {
|
|
54
|
+
apply: async ({config, km, context, s, _continue}) => {
|
|
28
55
|
const [flats, wf] = flatten(['list'], context)
|
|
29
56
|
const evalues = []
|
|
30
57
|
for (const flat of flats) {
|
|
31
|
-
|
|
58
|
+
if (!flat.control) {
|
|
59
|
+
flat.control = context.control
|
|
60
|
+
}
|
|
61
|
+
const result = await s(flat)
|
|
32
62
|
if (result.evalue) {
|
|
33
63
|
evalues.push(result.evalue)
|
|
34
64
|
}
|
|
@@ -37,17 +67,22 @@ const config = {
|
|
|
37
67
|
context.evalue = concats(evalues)
|
|
38
68
|
context.isResponse = true
|
|
39
69
|
}
|
|
70
|
+
context.control.seen.length = 0
|
|
40
71
|
}
|
|
41
72
|
},
|
|
42
73
|
{
|
|
43
74
|
notes: 'flatten relation',
|
|
44
75
|
where: where(),
|
|
45
76
|
priority: -1,
|
|
46
|
-
match: ({context}) => context.flatten && context.relation,
|
|
77
|
+
// match: ({context}) => context.flatten && context.relation,
|
|
78
|
+
match: (args) => okay(args, ({context}) => (context.flatten && context.relation)),
|
|
47
79
|
apply: async ({config, km, context, s}) => {
|
|
48
80
|
const [flats, wf] = flatten(['list'], context)
|
|
49
81
|
for (const flat of flats) {
|
|
50
|
-
|
|
82
|
+
if (!flat.control) {
|
|
83
|
+
flat.control = context.control
|
|
84
|
+
}
|
|
85
|
+
await s(flat)
|
|
51
86
|
}
|
|
52
87
|
}
|
|
53
88
|
},
|
package/common/stm.js
CHANGED
|
@@ -41,7 +41,7 @@ class API {
|
|
|
41
41
|
return this._objects.mentioned.filter( (context) => this.isA(context.marker, type) )
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
remember(args) {
|
|
45
45
|
let concept, value, frameOfReference
|
|
46
46
|
if (!args.context) {
|
|
47
47
|
concept = args
|
|
@@ -51,6 +51,10 @@ class API {
|
|
|
51
51
|
frameOfReference = args.frameOfReference
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
if (concept.pullFromContext) {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
if (!frameOfReference) {
|
|
55
59
|
frameOfReference = this._objects
|
|
56
60
|
}
|
|
@@ -76,7 +80,7 @@ class API {
|
|
|
76
80
|
helpers.unshiftL(frameOfReference.mentioned, concept, this.maximumMentioned)
|
|
77
81
|
}
|
|
78
82
|
|
|
79
|
-
|
|
83
|
+
recall({ context, frameOfReference, useHierarchy=true, all, stopCondition = (() => false), condition = (() => true), filter = ((result) => result) } = {}) {
|
|
80
84
|
let mentioned = this._objects.mentioned
|
|
81
85
|
let reversed = false
|
|
82
86
|
if (frameOfReference) {
|
|
@@ -112,7 +116,7 @@ class API {
|
|
|
112
116
|
// care about value first
|
|
113
117
|
let findCounter = 0
|
|
114
118
|
for (const m of mentioned) {
|
|
115
|
-
if (
|
|
119
|
+
if (stopCondition(m)) {
|
|
116
120
|
break
|
|
117
121
|
}
|
|
118
122
|
if (context.value && (context.value == m.marker || context.value == m.value)) {
|
|
@@ -124,20 +128,17 @@ class API {
|
|
|
124
128
|
continue
|
|
125
129
|
}
|
|
126
130
|
if (condition(m)) {
|
|
127
|
-
if (all
|
|
131
|
+
if (all) {
|
|
128
132
|
addForAll(m)
|
|
129
|
-
if (lastN) {
|
|
130
|
-
lastN -= 1
|
|
131
|
-
}
|
|
132
133
|
} else {
|
|
133
|
-
return m
|
|
134
|
+
return filter(m)
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
if (
|
|
140
|
-
return forAll
|
|
140
|
+
if (forAll.length > 0) {
|
|
141
|
+
return filter(forAll)
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
if (!useHierarchy) {
|
|
@@ -147,7 +148,7 @@ class API {
|
|
|
147
148
|
// care about marker second
|
|
148
149
|
findCounter = 0
|
|
149
150
|
for (const m of mentioned) {
|
|
150
|
-
if (
|
|
151
|
+
if (stopCondition(m)) {
|
|
151
152
|
break
|
|
152
153
|
}
|
|
153
154
|
if (context.marker != 'unknown' && this.isA(m.marker, context.marker)) {
|
|
@@ -159,19 +160,19 @@ class API {
|
|
|
159
160
|
continue
|
|
160
161
|
}
|
|
161
162
|
if (condition(m)) {
|
|
162
|
-
if (all
|
|
163
|
+
if (all) {
|
|
163
164
|
addForAll(m)
|
|
164
|
-
if (lastN) {
|
|
165
|
-
lastN -= 1
|
|
166
|
-
}
|
|
167
165
|
} else {
|
|
168
|
-
return m
|
|
166
|
+
return filter(m)
|
|
169
167
|
}
|
|
170
168
|
}
|
|
171
169
|
}
|
|
172
170
|
// if (context.types && context.types.includes(m.marker)) {
|
|
173
171
|
if (context.types) {
|
|
174
172
|
for (const parent of context.types) {
|
|
173
|
+
if (stopCondition(m)) {
|
|
174
|
+
break
|
|
175
|
+
}
|
|
175
176
|
if (parent != 'unknown' && this.isA(m.marker, parent)) {
|
|
176
177
|
findCounter += 1
|
|
177
178
|
if (findPrevious && findCounter < 2) {
|
|
@@ -181,13 +182,10 @@ class API {
|
|
|
181
182
|
continue
|
|
182
183
|
}
|
|
183
184
|
if (condition(m)) {
|
|
184
|
-
if (all
|
|
185
|
-
if (lastN) {
|
|
186
|
-
lastN -= 1
|
|
187
|
-
}
|
|
185
|
+
if (all) {
|
|
188
186
|
addForAll(m)
|
|
189
187
|
} else {
|
|
190
|
-
return m
|
|
188
|
+
return filter(m)
|
|
191
189
|
}
|
|
192
190
|
}
|
|
193
191
|
}
|
|
@@ -195,37 +193,34 @@ class API {
|
|
|
195
193
|
}
|
|
196
194
|
}
|
|
197
195
|
|
|
198
|
-
if (
|
|
199
|
-
return forAll
|
|
196
|
+
if (forAll.length > 0) {
|
|
197
|
+
return filter(forAll)
|
|
200
198
|
}
|
|
201
199
|
|
|
202
200
|
findCounter = 0
|
|
203
201
|
if (context.types && context.types.length == 1) {
|
|
204
202
|
for (const m of mentioned) {
|
|
205
|
-
if (lastN === 0) {
|
|
206
|
-
break
|
|
207
|
-
}
|
|
208
203
|
if (context.unknown) {
|
|
209
204
|
findCounter += 1
|
|
210
205
|
if (findPrevious && findCounter < 2) {
|
|
211
206
|
continue
|
|
212
207
|
}
|
|
208
|
+
if (stopCondition(m)) {
|
|
209
|
+
break
|
|
210
|
+
}
|
|
213
211
|
if (condition(m)) {
|
|
214
|
-
if (all
|
|
212
|
+
if (all) {
|
|
215
213
|
addForAll(m)
|
|
216
|
-
if (lastN) {
|
|
217
|
-
lastN -= 1
|
|
218
|
-
}
|
|
219
214
|
} else {
|
|
220
|
-
return m
|
|
215
|
+
return filter(m)
|
|
221
216
|
}
|
|
222
217
|
}
|
|
223
218
|
}
|
|
224
219
|
}
|
|
225
220
|
}
|
|
226
221
|
|
|
227
|
-
if (
|
|
228
|
-
return forAll
|
|
222
|
+
if (forAll.length > 0) {
|
|
223
|
+
return filter(forAll)
|
|
229
224
|
}
|
|
230
225
|
}
|
|
231
226
|
|
|
@@ -233,7 +228,7 @@ class API {
|
|
|
233
228
|
if (!context || context.marker == 'mentions') {
|
|
234
229
|
return
|
|
235
230
|
}
|
|
236
|
-
let valueNew = this.
|
|
231
|
+
let valueNew = this.recall({ context, useHierarchy: false, condition: (context) => context.isVariable })
|
|
237
232
|
if (valueNew && valueNew.value) {
|
|
238
233
|
valueNew = valueNew.value
|
|
239
234
|
}
|
|
@@ -241,7 +236,7 @@ class API {
|
|
|
241
236
|
}
|
|
242
237
|
|
|
243
238
|
setVariable(variableName, value) {
|
|
244
|
-
this.
|
|
239
|
+
this.remember({ context: { marker: variableName, isVariable: true }, value })
|
|
245
240
|
}
|
|
246
241
|
}
|
|
247
242
|
|
|
@@ -276,7 +271,7 @@ const config = {
|
|
|
276
271
|
if (value == context.rememberee.value) {
|
|
277
272
|
value = context.rememberee
|
|
278
273
|
}
|
|
279
|
-
api.
|
|
274
|
+
api.remember({ context: value })
|
|
280
275
|
},
|
|
281
276
|
},
|
|
282
277
|
{
|
|
@@ -296,11 +291,24 @@ const config = {
|
|
|
296
291
|
},
|
|
297
292
|
],
|
|
298
293
|
semantics: [
|
|
294
|
+
{
|
|
295
|
+
where: where(),
|
|
296
|
+
match: ({context}) => context.marker == 'mentions' && context.evaluate && context.args?.context?.distributer,
|
|
297
|
+
apply: async ({callId, _continue, toList, context, kms, e, log, toArray, retry}) => {
|
|
298
|
+
context.args.filter ??= (r) => r
|
|
299
|
+
context.args.all = true
|
|
300
|
+
const oldFilter = context.args.filter
|
|
301
|
+
context.args.filter = (result) => {
|
|
302
|
+
return oldFilter(result)
|
|
303
|
+
}
|
|
304
|
+
_continue()
|
|
305
|
+
}
|
|
306
|
+
},
|
|
299
307
|
{
|
|
300
308
|
where: where(),
|
|
301
309
|
match: ({context}) => context.marker == 'mentions' && context.evaluate,
|
|
302
310
|
apply: ({context, kms, toList, resolveEvaluate}) => {
|
|
303
|
-
resolveEvaluate(context, kms.stm.api.
|
|
311
|
+
resolveEvaluate(context, kms.stm.api.recall(context.args))
|
|
304
312
|
}
|
|
305
313
|
},
|
|
306
314
|
{
|
|
@@ -308,8 +316,8 @@ const config = {
|
|
|
308
316
|
notes: 'pull from context',
|
|
309
317
|
// match: ({context}) => context.marker == 'it' && context.pullFromContext, // && context.value,
|
|
310
318
|
match: ({context, callId}) => context.pullFromContext && !context.same, // && context.value,
|
|
311
|
-
apply: async ({callId,
|
|
312
|
-
context.value = (await
|
|
319
|
+
apply: async ({callId, recall, toList, context, kms, e, log, retry}) => {
|
|
320
|
+
context.value = (await recall({ context }))
|
|
313
321
|
if (Array.isArray(context.value)) {
|
|
314
322
|
context.value = toList(context.value)
|
|
315
323
|
}
|
|
@@ -334,8 +342,8 @@ const config = {
|
|
|
334
342
|
|
|
335
343
|
function initializer({config}) {
|
|
336
344
|
config.addArgs(({kms, e, toList}) => ({
|
|
337
|
-
|
|
338
|
-
kms.stm.api.
|
|
345
|
+
remember: (args) => {
|
|
346
|
+
kms.stm.api.remember(args)
|
|
339
347
|
},
|
|
340
348
|
|
|
341
349
|
frameOfReference: (context, { mentioned, reversed } = {}) => {
|
|
@@ -349,7 +357,7 @@ function initializer({config}) {
|
|
|
349
357
|
}
|
|
350
358
|
},
|
|
351
359
|
|
|
352
|
-
|
|
360
|
+
recall: async (args) => {
|
|
353
361
|
if (args.frameOfReference?.nameable_named) {
|
|
354
362
|
const result = await e(args.frameOfReference)
|
|
355
363
|
if (result.evalue) {
|