tpmkms_4wp 9.2.0-beta.0 → 9.2.0-beta.2
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/animals.instance.json +8 -8
- package/common/colors.instance.json +18 -46
- package/common/comparable.js +2 -2
- package/common/crew.instance.json +4643 -969
- package/common/crew.test.json +1904 -0
- package/common/dates.instance.json +28562 -0
- package/common/dates.js +152 -0
- package/common/dates.test.json +10239 -0
- package/common/dialogues.js +28 -9
- package/common/dimension.instance.json +2 -2
- package/common/edible.instance.json +1442 -759
- package/common/emotions.instance.json +6 -14
- package/common/emotions.js +4 -5
- package/common/fastfood.instance.json +3976 -1175
- package/common/gdefaults.js +14 -0
- package/common/helpers/concept.js +1 -0
- package/common/helpers/dialogues.js +3 -0
- package/common/helpers/properties.js +2 -27
- package/common/helpers.js +41 -0
- package/common/hierarchy.js +4 -3
- package/common/kirk.instance.json +155 -10
- package/common/length.instance.json +2 -2
- package/common/menus.js +1 -0
- package/common/menus.test.json +2418 -1355
- package/common/meta.js +3 -3
- package/common/ordering.instance.json +2 -2
- package/common/pipboy.instance.json +12 -68
- package/common/pokemon.instance.json +10 -2
- package/common/pressure.instance.json +2 -2
- package/common/properties.js +19 -5
- package/common/punctuation.js +3 -0
- package/common/reports.instance.json +22 -14
- package/common/reports.js +2 -2
- package/common/spock.instance.json +155 -10
- package/common/temperature.instance.json +146 -2
- package/common/wp.instance.json +379 -151
- package/common/wp.js +10 -0
- package/main.js +2 -0
- package/package.json +6 -2
package/common/gdefaults.js
CHANGED
@@ -4,6 +4,7 @@ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
|
4
4
|
const tokenize = require('./tokenize.js')
|
5
5
|
const gdefaults_tests = require('./gdefaults.test.json')
|
6
6
|
const { getValue, isMany } = require('./helpers.js')
|
7
|
+
const helpers = require('./helpers')
|
7
8
|
|
8
9
|
const config = {
|
9
10
|
name: 'gdefaults',
|
@@ -29,6 +30,13 @@ const config = {
|
|
29
30
|
apply: ({context, gp}) => gp(context.response),
|
30
31
|
},
|
31
32
|
|
33
|
+
{
|
34
|
+
where: where(),
|
35
|
+
match: ({context}) => context.paraphrase && context.interpolate,
|
36
|
+
apply: async ({interpolate, context}) => {
|
37
|
+
return interpolate(context.interpolate, context)
|
38
|
+
}
|
39
|
+
},
|
32
40
|
{
|
33
41
|
where: where(),
|
34
42
|
match: ({context}) => context.generate,
|
@@ -232,6 +240,12 @@ const initializer = ({config}) => {
|
|
232
240
|
verbatim: (text) => {
|
233
241
|
args.insert({ marker: 'verbatim', verbatim: text, isResponse: true })
|
234
242
|
},
|
243
|
+
interpolate: async (interpolate, context) => {
|
244
|
+
const evaluator = async (key) => {
|
245
|
+
return args.gp(context[key])
|
246
|
+
}
|
247
|
+
return await helpers.processTemplateString(interpolate, evaluator)
|
248
|
+
}
|
235
249
|
}
|
236
250
|
})
|
237
251
|
}
|
@@ -106,6 +106,7 @@ class API {
|
|
106
106
|
level: 0,
|
107
107
|
convolution: true,
|
108
108
|
isA: [{ parent: 'adjective', instance: true }],
|
109
|
+
associator_return_type: [modifiersObjectId, 0],
|
109
110
|
// isA: ['adjective'],
|
110
111
|
before: ['verb'],
|
111
112
|
bridge: `{ ...after[0], ${modifierProperties}, atomic: true, dead: true, marker: next(operator('${modifiersObjectId}')), value: '${modifiersObjectId}', modifiers: append([${modifierList}], after[0].modifiers)}`,
|
@@ -548,8 +548,7 @@ class API {
|
|
548
548
|
|
549
549
|
makeObject(args) {
|
550
550
|
const types = [ 'hierarchyAble', 'object', 'property' ];
|
551
|
-
|
552
|
-
return this._km("dialogues").api.makeObject({ ...args, types });
|
551
|
+
return args.km("dialogues").api.makeObject({ ...args, types: (args.types || []).concat(types) });
|
553
552
|
}
|
554
553
|
|
555
554
|
relation_add (relations) {
|
@@ -704,6 +703,7 @@ class API {
|
|
704
703
|
}
|
705
704
|
|
706
705
|
setProperty(object, property, value, has, skipHandler) {
|
706
|
+
// debugger
|
707
707
|
if (!skipHandler) {
|
708
708
|
const handler = this.propertiesFH.getHandler([object, property])
|
709
709
|
if (handler) {
|
@@ -794,31 +794,6 @@ class API {
|
|
794
794
|
|
795
795
|
learnWords(config, context) {
|
796
796
|
}
|
797
|
-
/*
|
798
|
-
ensureDefault(map, key, default) {
|
799
|
-
if (!this._objects[map][key]) {
|
800
|
-
this._objects[map][key] = default
|
801
|
-
}
|
802
|
-
return this._objects[map][key]
|
803
|
-
}
|
804
|
-
|
805
|
-
pushListNoDups(list, value) {
|
806
|
-
if (list.includes(value)) {
|
807
|
-
return
|
808
|
-
}
|
809
|
-
list.push(value)
|
810
|
-
}
|
811
|
-
|
812
|
-
ensureConcept(concept) {
|
813
|
-
ensureDefault(this.properties, concept, {})
|
814
|
-
ensureDefault(this.concepts, concept, [])
|
815
|
-
}
|
816
|
-
|
817
|
-
canDo(object, ability) {
|
818
|
-
this.ensureConcept(object)
|
819
|
-
this.pushListNoDups(this.ensureList('abilities', object), ability)
|
820
|
-
}
|
821
|
-
*/
|
822
797
|
isA(child, ancestor) {
|
823
798
|
// return this._objects.parents[child].includes(parent);
|
824
799
|
const todo = [child];
|
package/common/helpers.js
CHANGED
@@ -220,7 +220,48 @@ const getValue = (propertyPath, object) => {
|
|
220
220
|
return value
|
221
221
|
}
|
222
222
|
|
223
|
+
const processTemplateString = async (template, evaluate) => {
|
224
|
+
async function resolveWithCallback(strings, ...keys) {
|
225
|
+
// const resolvedValues = await Promise.all(keys.map(key => lookupVariable(key)));
|
226
|
+
const resolvedValues = await Promise.all(keys.map(async (key) => {
|
227
|
+
return await evaluate(key)
|
228
|
+
}))
|
229
|
+
|
230
|
+
let result = strings[0];
|
231
|
+
for (let i = 0; i < resolvedValues.length; i++) {
|
232
|
+
result += resolvedValues[i] + strings[(i + 1)*2];
|
233
|
+
}
|
234
|
+
return result;
|
235
|
+
}
|
236
|
+
|
237
|
+
async function processTemplateString(template) {
|
238
|
+
// Split the template into strings and keys
|
239
|
+
const parts = template.split(/(\${[^}]+})/g);
|
240
|
+
const strings = [];
|
241
|
+
const keys = [];
|
242
|
+
for (const part of parts) {
|
243
|
+
if (part.startsWith("${") && part.endsWith("}")) {
|
244
|
+
keys.push(part.slice(2, -1)); // Extract key (e.g., "name" from "${name}")
|
245
|
+
strings.push(""); // Placeholder for interpolation
|
246
|
+
} else {
|
247
|
+
strings.push(part);
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
// Ensure the strings array has one more element than keys
|
252
|
+
if (strings.length === keys.length) {
|
253
|
+
strings.push("");
|
254
|
+
}
|
255
|
+
|
256
|
+
// Pass to the tagged template function
|
257
|
+
return resolveWithCallback(strings, ...keys);
|
258
|
+
}
|
259
|
+
|
260
|
+
return await processTemplateString(template)
|
261
|
+
}
|
262
|
+
|
223
263
|
module.exports = {
|
264
|
+
processTemplateString,
|
224
265
|
unshiftL,
|
225
266
|
pushL,
|
226
267
|
getValue,
|
package/common/hierarchy.js
CHANGED
@@ -246,14 +246,15 @@ const config = {
|
|
246
246
|
|
247
247
|
return listable(context, 'hierarchyAble') && context.same && context.same.concept && !context.query
|
248
248
|
},
|
249
|
-
apply: (
|
249
|
+
apply: (args) => {
|
250
|
+
const {callId, config, objects, km, context, asList, listable} = args
|
250
251
|
const api = km('properties').api
|
251
252
|
const oneConcepts = asList(context);
|
252
253
|
const twoConcepts = asList(context.same);
|
253
254
|
for (const oneConcept of oneConcepts.value) {
|
254
255
|
for (const twoConcept of twoConcepts.value) {
|
255
|
-
oneConceptId = api.makeObject({
|
256
|
-
twoConceptId = api.makeObject({
|
256
|
+
oneConceptId = api.makeObject({...args, context: oneConcept})
|
257
|
+
twoConceptId = api.makeObject({...args, context: twoConcept})
|
257
258
|
api.rememberIsA(oneConceptId, twoConceptId)
|
258
259
|
context.sameWasProcessed = true
|
259
260
|
}
|
@@ -400,6 +400,11 @@
|
|
400
400
|
"queryable",
|
401
401
|
false
|
402
402
|
],
|
403
|
+
[
|
404
|
+
"doctor",
|
405
|
+
"rank",
|
406
|
+
false
|
407
|
+
],
|
403
408
|
[
|
404
409
|
"doctor",
|
405
410
|
"theAble",
|
@@ -495,11 +500,6 @@
|
|
495
500
|
"theAble",
|
496
501
|
false
|
497
502
|
],
|
498
|
-
[
|
499
|
-
"emotion",
|
500
|
-
"unknown",
|
501
|
-
false
|
502
|
-
],
|
503
503
|
[
|
504
504
|
"evaluate",
|
505
505
|
"verb",
|
@@ -510,6 +510,41 @@
|
|
510
510
|
"article",
|
511
511
|
false
|
512
512
|
],
|
513
|
+
[
|
514
|
+
"eye",
|
515
|
+
"hierarchyAble",
|
516
|
+
false
|
517
|
+
],
|
518
|
+
[
|
519
|
+
"eye",
|
520
|
+
"isEdee",
|
521
|
+
false
|
522
|
+
],
|
523
|
+
[
|
524
|
+
"eye",
|
525
|
+
"isEder",
|
526
|
+
false
|
527
|
+
],
|
528
|
+
[
|
529
|
+
"eye",
|
530
|
+
"object",
|
531
|
+
false
|
532
|
+
],
|
533
|
+
[
|
534
|
+
"eye",
|
535
|
+
"property",
|
536
|
+
false
|
537
|
+
],
|
538
|
+
[
|
539
|
+
"eye",
|
540
|
+
"queryable",
|
541
|
+
false
|
542
|
+
],
|
543
|
+
[
|
544
|
+
"eye",
|
545
|
+
"theAble",
|
546
|
+
false
|
547
|
+
],
|
513
548
|
[
|
514
549
|
"feel",
|
515
550
|
"canBeDoQuestion",
|
@@ -790,6 +825,11 @@
|
|
790
825
|
"isEder",
|
791
826
|
false
|
792
827
|
],
|
828
|
+
[
|
829
|
+
"mccoy",
|
830
|
+
"name",
|
831
|
+
false
|
832
|
+
],
|
793
833
|
[
|
794
834
|
"mccoy",
|
795
835
|
"object",
|
@@ -865,6 +905,41 @@
|
|
865
905
|
"verb",
|
866
906
|
false
|
867
907
|
],
|
908
|
+
[
|
909
|
+
"name",
|
910
|
+
"hierarchyAble",
|
911
|
+
false
|
912
|
+
],
|
913
|
+
[
|
914
|
+
"name",
|
915
|
+
"isEdee",
|
916
|
+
false
|
917
|
+
],
|
918
|
+
[
|
919
|
+
"name",
|
920
|
+
"isEder",
|
921
|
+
false
|
922
|
+
],
|
923
|
+
[
|
924
|
+
"name",
|
925
|
+
"object",
|
926
|
+
false
|
927
|
+
],
|
928
|
+
[
|
929
|
+
"name",
|
930
|
+
"property",
|
931
|
+
false
|
932
|
+
],
|
933
|
+
[
|
934
|
+
"name",
|
935
|
+
"queryable",
|
936
|
+
false
|
937
|
+
],
|
938
|
+
[
|
939
|
+
"name",
|
940
|
+
"theAble",
|
941
|
+
false
|
942
|
+
],
|
868
943
|
[
|
869
944
|
"negatable",
|
870
945
|
"queryable",
|
@@ -1185,6 +1260,41 @@
|
|
1185
1260
|
"punctuation",
|
1186
1261
|
false
|
1187
1262
|
],
|
1263
|
+
[
|
1264
|
+
"rank",
|
1265
|
+
"hierarchyAble",
|
1266
|
+
false
|
1267
|
+
],
|
1268
|
+
[
|
1269
|
+
"rank",
|
1270
|
+
"isEdee",
|
1271
|
+
false
|
1272
|
+
],
|
1273
|
+
[
|
1274
|
+
"rank",
|
1275
|
+
"isEder",
|
1276
|
+
false
|
1277
|
+
],
|
1278
|
+
[
|
1279
|
+
"rank",
|
1280
|
+
"object",
|
1281
|
+
false
|
1282
|
+
],
|
1283
|
+
[
|
1284
|
+
"rank",
|
1285
|
+
"property",
|
1286
|
+
false
|
1287
|
+
],
|
1288
|
+
[
|
1289
|
+
"rank",
|
1290
|
+
"queryable",
|
1291
|
+
false
|
1292
|
+
],
|
1293
|
+
[
|
1294
|
+
"rank",
|
1295
|
+
"theAble",
|
1296
|
+
false
|
1297
|
+
],
|
1188
1298
|
[
|
1189
1299
|
"readonly",
|
1190
1300
|
"queryable",
|
@@ -1210,11 +1320,6 @@
|
|
1210
1320
|
"queryable",
|
1211
1321
|
false
|
1212
1322
|
],
|
1213
|
-
[
|
1214
|
-
"sentientBeing",
|
1215
|
-
"unknown",
|
1216
|
-
false
|
1217
|
-
],
|
1218
1323
|
[
|
1219
1324
|
"spock",
|
1220
1325
|
"crew_member",
|
@@ -1240,6 +1345,11 @@
|
|
1240
1345
|
"isEder",
|
1241
1346
|
false
|
1242
1347
|
],
|
1348
|
+
[
|
1349
|
+
"spock",
|
1350
|
+
"name",
|
1351
|
+
false
|
1352
|
+
],
|
1243
1353
|
[
|
1244
1354
|
"spock",
|
1245
1355
|
"object",
|
@@ -1260,6 +1370,41 @@
|
|
1260
1370
|
"theAble",
|
1261
1371
|
false
|
1262
1372
|
],
|
1373
|
+
[
|
1374
|
+
"status",
|
1375
|
+
"hierarchyAble",
|
1376
|
+
false
|
1377
|
+
],
|
1378
|
+
[
|
1379
|
+
"status",
|
1380
|
+
"isEdee",
|
1381
|
+
false
|
1382
|
+
],
|
1383
|
+
[
|
1384
|
+
"status",
|
1385
|
+
"isEder",
|
1386
|
+
false
|
1387
|
+
],
|
1388
|
+
[
|
1389
|
+
"status",
|
1390
|
+
"object",
|
1391
|
+
false
|
1392
|
+
],
|
1393
|
+
[
|
1394
|
+
"status",
|
1395
|
+
"property",
|
1396
|
+
false
|
1397
|
+
],
|
1398
|
+
[
|
1399
|
+
"status",
|
1400
|
+
"queryable",
|
1401
|
+
false
|
1402
|
+
],
|
1403
|
+
[
|
1404
|
+
"status",
|
1405
|
+
"theAble",
|
1406
|
+
false
|
1407
|
+
],
|
1263
1408
|
[
|
1264
1409
|
"stm_before",
|
1265
1410
|
"adjective",
|
@@ -2816,10 +2816,10 @@
|
|
2816
2816
|
"start": 17,
|
2817
2817
|
"end": 20
|
2818
2818
|
},
|
2819
|
+
"dead": true,
|
2819
2820
|
"types": [
|
2820
2821
|
"unknown"
|
2821
2822
|
],
|
2822
|
-
"dead": true,
|
2823
2823
|
"level": 0
|
2824
2824
|
},
|
2825
2825
|
{
|
@@ -2832,10 +2832,10 @@
|
|
2832
2832
|
"start": 26,
|
2833
2833
|
"end": 29
|
2834
2834
|
},
|
2835
|
+
"dead": true,
|
2835
2836
|
"types": [
|
2836
2837
|
"unknown"
|
2837
2838
|
],
|
2838
|
-
"dead": true,
|
2839
2839
|
"level": 0
|
2840
2840
|
}
|
2841
2841
|
],
|
package/common/menus.js
CHANGED
@@ -220,6 +220,7 @@ const fixtures = async ({api, fragment, s, config, objects, kms, isModule}) => {
|
|
220
220
|
|
221
221
|
api.addMenuItem(fileMenuId, 'fileOpen', 'open')
|
222
222
|
api.addMenuItem(fileMenuId, 'fileOpenRemote', 'open remote')
|
223
|
+
api.addMenuItem(fileMenuId, 'fileShow', 'show')
|
223
224
|
api.addMenuItem(fileMenuId, 'fileClose', 'close')
|
224
225
|
|
225
226
|
api.addMenuItem(objectMenuId, 'objectOpen', 'open')
|