tpmkms_4wp 9.3.0-beta.5 → 9.3.0-beta.7
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/concept.test.json +279 -193
- package/common/dialogues.js +5 -2
- package/common/events.js +1 -1
- package/common/fastfood.instance.json +69 -365
- package/common/fastfood.test.json +16291 -6597
- package/common/helpers.js +24 -7
- package/common/numbers.js +1 -1
- package/common/numbers.test.json +89 -23
- package/common/percentages.js +1 -1
- package/common/pipboy.test.json +4377 -3386
- package/common/reminders.instance.json +86 -6
- package/common/reminders.js +18 -24
- package/common/reminders.test.json +8779 -1
- package/common/reports.instance.json +2 -2
- package/common/scorekeeper.test.json +3565 -7550
- package/common/time.js +68 -30
- package/common/time.test.json +4124 -124
- package/common/ui.js +3 -1
- package/common/wp.test.json +8057 -3867
- package/package.json +2 -2
@@ -2,7 +2,11 @@
|
|
2
2
|
"configs": [
|
3
3
|
{
|
4
4
|
"operators": [
|
5
|
-
"([
|
5
|
+
"([reminderTime|])",
|
6
|
+
"([remind] (self/*) (!@<= 'onDate')*)",
|
7
|
+
"([remind:withTimeBridge] (self/*) (!@<= 'onDate')* ([onDate|on] (reminderTime)))",
|
8
|
+
"([show] ([reminders]))",
|
9
|
+
"([delete_reminders|delete,cancel] (number/*))"
|
6
10
|
],
|
7
11
|
"bridges": [
|
8
12
|
{
|
@@ -11,19 +15,60 @@
|
|
11
15
|
"verb"
|
12
16
|
],
|
13
17
|
"bridge": "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], interpolate: '${operator} ${who} ${reminder}' }",
|
14
|
-
"
|
18
|
+
"withTimeBridge": "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], when: after[2], interpolate: '${operator} ${who} ${reminder} ${when}' }",
|
19
|
+
"semantic": "async ({api, gsp, context}) => {\n const text = await gsp(context.reminder.slice(1));\n api.add({ text, when: context.when });\n }"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"id": "reminderTime",
|
23
|
+
"children": [
|
24
|
+
"day_dates",
|
25
|
+
"month_dates"
|
26
|
+
]
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"id": "onDate",
|
30
|
+
"isA": [
|
31
|
+
"preposition"
|
32
|
+
],
|
33
|
+
"bridge": "{ ...next(operator), time: after[0], onDate: operator, interpolate: '${onDate} ${time}' }"
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"id": "reminders",
|
37
|
+
"isA": [
|
38
|
+
"noun"
|
39
|
+
]
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"id": "show",
|
43
|
+
"isA": [
|
44
|
+
"verb"
|
45
|
+
],
|
46
|
+
"bridge": "{ ...next(operator), operator: operator, reminders: after[0], interpolate: '${operator} ${reminders}' }",
|
47
|
+
"semantic": "({context, api, verbatim}) => {\n verbatim(api.show())\n }"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"id": "delete_reminders",
|
51
|
+
"isA": [
|
52
|
+
"verb"
|
53
|
+
],
|
54
|
+
"bridge": "{ ...next(operator), operator: operator, reminders: after[0], interpolate: '${operator} ${reminders}' }",
|
55
|
+
"semantic": "({context, api, verbatim}) => {\n const s = api.delete_reminder(context.reminders.value)\n if (s) {\n verbatim(s)\n }\n }"
|
15
56
|
}
|
16
57
|
]
|
17
58
|
},
|
18
59
|
{
|
19
|
-
"apply": "({ask, api}) => {\n ask([\n {\n where: where(),\n oneShot: false,\n onNevermind: ({verbatim, ...args}) => {\n // this is cross km boundaries from the dialogues km to this one so the api if for dialogs.\n // i need to get the one for fastfood here.\n const api = args.kms.fastfood.api\n const needsDrink = askAbout({ args, api })\n for (const item of needsDrink) {\n api.remove(item)\n }\n },\n\n matchq: (
|
60
|
+
"apply": "({ask, api}) => {\n ask([\n {\n where: where(),\n oneShot: false,\n onNevermind: ({verbatim, ...args}) => {\n // this is cross km boundaries from the dialogues km to this one so the api if for dialogs.\n // i need to get the one for fastfood here.\n const api = args.kms.fastfood.api\n const needsDrink = askAbout({ args, api })\n for (const item of needsDrink) {\n api.remove(item)\n }\n },\n\n matchq: ({ api, context }) => api.askAbout().length > 0 && context.marker == 'controlEnd',\n applyq: ({ api, context }) => {\n context.cascade = false\n const items = api.askAbout()\n const item = items[0]\n return 'When should I remind you to ' + item.text;\n },\n\n matchr: ({ isA, api, context }) => {\n if (isA(context.marker, 'reminderTime') && api.askAbout().length > 0) {\n return true\n }\n return false\n },\n applyr: ({ context, api }) => {\n const items = api.askAbout()\n api.update({ id: items[0].id, when: context })\n // TODO check for is available for all modifications\n /*\n const needsDrink = askAbout(args)\n const { api, context } = args\n if (isMany(context)) {\n let count = getCount(context) || Number.MAX_SAFE_INTEGER\n for (const item of needsDrink) {\n if (count < 1) {\n break\n }\n count -= 1\n api.addDrink(item.item_id, { id: context.value })\n }\n } else {\n const item_id = needsDrink[0].item_id\n api.addDrink(item_id, { id: context.value })\n }\n */\n }\n },\n ])\n }"
|
20
61
|
}
|
21
62
|
],
|
22
63
|
"resultss": [
|
23
64
|
{
|
24
65
|
"extraConfig": true,
|
25
66
|
"operators": [
|
26
|
-
"([
|
67
|
+
"([reminderTime|])",
|
68
|
+
"([remind] (self/*) (!@<= 'onDate')*)",
|
69
|
+
"([remind:withTimeBridge] (self/*) (!@<= 'onDate')* ([onDate|on] (reminderTime)))",
|
70
|
+
"([show] ([reminders]))",
|
71
|
+
"([delete_reminders|delete,cancel] (number/*))"
|
27
72
|
],
|
28
73
|
"bridges": [
|
29
74
|
{
|
@@ -31,12 +76,47 @@
|
|
31
76
|
"isA": [
|
32
77
|
"verb"
|
33
78
|
],
|
34
|
-
"bridge": "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], interpolate: '${operator} ${who} ${reminder}' }"
|
79
|
+
"bridge": "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], interpolate: '${operator} ${who} ${reminder}' }",
|
80
|
+
"withTimeBridge": "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], when: after[2], interpolate: '${operator} ${who} ${reminder} ${when}' }"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"id": "reminderTime",
|
84
|
+
"children": [
|
85
|
+
"day_dates",
|
86
|
+
"month_dates"
|
87
|
+
]
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"id": "onDate",
|
91
|
+
"isA": [
|
92
|
+
"preposition"
|
93
|
+
],
|
94
|
+
"bridge": "{ ...next(operator), time: after[0], onDate: operator, interpolate: '${onDate} ${time}' }"
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"id": "reminders",
|
98
|
+
"isA": [
|
99
|
+
"noun"
|
100
|
+
]
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"id": "show",
|
104
|
+
"isA": [
|
105
|
+
"verb"
|
106
|
+
],
|
107
|
+
"bridge": "{ ...next(operator), operator: operator, reminders: after[0], interpolate: '${operator} ${reminders}' }"
|
108
|
+
},
|
109
|
+
{
|
110
|
+
"id": "delete_reminders",
|
111
|
+
"isA": [
|
112
|
+
"verb"
|
113
|
+
],
|
114
|
+
"bridge": "{ ...next(operator), operator: operator, reminders: after[0], interpolate: '${operator} ${reminders}' }"
|
35
115
|
}
|
36
116
|
]
|
37
117
|
},
|
38
118
|
{
|
39
|
-
"apply": "({ask, api}) => {\n ask([\n {\n where: where(),\n oneShot: false,\n onNevermind: ({verbatim, ...args}) => {\n // this is cross km boundaries from the dialogues km to this one so the api if for dialogs.\n // i need to get the one for fastfood here.\n const api = args.kms.fastfood.api\n const needsDrink = askAbout({ args, api })\n for (const item of needsDrink) {\n api.remove(item)\n }\n },\n\n matchq: (
|
119
|
+
"apply": "({ask, api}) => {\n ask([\n {\n where: where(),\n oneShot: false,\n onNevermind: ({verbatim, ...args}) => {\n // this is cross km boundaries from the dialogues km to this one so the api if for dialogs.\n // i need to get the one for fastfood here.\n const api = args.kms.fastfood.api\n const needsDrink = askAbout({ args, api })\n for (const item of needsDrink) {\n api.remove(item)\n }\n },\n\n matchq: ({ api, context }) => api.askAbout().length > 0 && context.marker == 'controlEnd',\n applyq: ({ api, context }) => {\n context.cascade = false\n const items = api.askAbout()\n const item = items[0]\n return 'When should I remind you to ' + item.text;\n },\n\n matchr: ({ isA, api, context }) => {\n if (isA(context.marker, 'reminderTime') && api.askAbout().length > 0) {\n return true\n }\n return false\n },\n applyr: ({ context, api }) => {\n const items = api.askAbout()\n api.update({ id: items[0].id, when: context })\n // TODO check for is available for all modifications\n /*\n const needsDrink = askAbout(args)\n const { api, context } = args\n if (isMany(context)) {\n let count = getCount(context) || Number.MAX_SAFE_INTEGER\n for (const item of needsDrink) {\n if (count < 1) {\n break\n }\n count -= 1\n api.addDrink(item.item_id, { id: context.value })\n }\n } else {\n const item_id = needsDrink[0].item_id\n api.addDrink(item_id, { id: context.value })\n }\n */\n }\n },\n ])\n }"
|
40
120
|
}
|
41
121
|
],
|
42
122
|
"fragments": [],
|
package/common/reminders.js
CHANGED
@@ -4,6 +4,7 @@ const reminders_tests = require('./reminders.test.json')
|
|
4
4
|
const reminders_instance = require('./reminders.instance.json')
|
5
5
|
const selfKM = require('./self')
|
6
6
|
const dates = require('./dates')
|
7
|
+
const time = require('./time')
|
7
8
|
const helpers = require('./helpers')
|
8
9
|
|
9
10
|
class API {
|
@@ -21,7 +22,7 @@ class API {
|
|
21
22
|
askAbout() {
|
22
23
|
const items = []
|
23
24
|
for (const item of this._objects.reminders) {
|
24
|
-
if (!item.
|
25
|
+
if (!item.date) {
|
25
26
|
items.push({ when: true, text: item.text, id: item.id })
|
26
27
|
}
|
27
28
|
}
|
@@ -67,8 +68,11 @@ const template = {
|
|
67
68
|
configs: [
|
68
69
|
{
|
69
70
|
operators: [
|
70
|
-
"([remind] (self/*) (*)*)",
|
71
71
|
"([reminderTime|])",
|
72
|
+
"([remind] (self/*) (!@<= 'onDate')*)",
|
73
|
+
"([onDate|on] (reminderTime))",
|
74
|
+
"([remind:withDateBridge] (self/*) (!@<= 'onDate')* (onDate))",
|
75
|
+
"([remind:withDateAndTimeBridge] (self/*) (!@<= 'onDate')* (onDate) (atTime))",
|
72
76
|
"([show] ([reminders]))",
|
73
77
|
"([delete_reminders|delete,cancel] (number/*))",
|
74
78
|
],
|
@@ -77,17 +81,25 @@ const template = {
|
|
77
81
|
id: 'remind',
|
78
82
|
isA: ['verb'],
|
79
83
|
bridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], interpolate: '${operator} ${who} ${reminder}' }",
|
84
|
+
withDateBridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], interpolate: '${operator} ${who} ${reminder} ${date}' }",
|
85
|
+
withDateAndTimeBridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], time: after[3], interpolate: '${operator} ${who} ${reminder} ${date} ${time}' }",
|
80
86
|
semantic: async ({api, gsp, context}) => {
|
81
87
|
const text = await gsp(context.reminder.slice(1));
|
82
|
-
api.add({ text });
|
88
|
+
api.add({ text, date: context.date, time: context.time });
|
83
89
|
},
|
84
90
|
},
|
85
91
|
{
|
86
92
|
id: 'reminderTime',
|
87
93
|
children: [
|
94
|
+
'day_dates',
|
88
95
|
'month_dates',
|
89
96
|
],
|
90
97
|
},
|
98
|
+
{
|
99
|
+
id: 'onDate',
|
100
|
+
isA: ['preposition'],
|
101
|
+
bridge: "{ ...next(operator), date: after[0], onDate: operator, interpolate: '${onDate} ${date}' }",
|
102
|
+
},
|
91
103
|
{
|
92
104
|
id: 'reminders',
|
93
105
|
isA: ['noun'],
|
@@ -144,25 +156,7 @@ const template = {
|
|
144
156
|
},
|
145
157
|
applyr: ({ context, api }) => {
|
146
158
|
const items = api.askAbout()
|
147
|
-
api.update({ id: items[0].id,
|
148
|
-
// TODO check for is available for all modifications
|
149
|
-
/*
|
150
|
-
const needsDrink = askAbout(args)
|
151
|
-
const { api, context } = args
|
152
|
-
if (isMany(context)) {
|
153
|
-
let count = getCount(context) || Number.MAX_SAFE_INTEGER
|
154
|
-
for (const item of needsDrink) {
|
155
|
-
if (count < 1) {
|
156
|
-
break
|
157
|
-
}
|
158
|
-
count -= 1
|
159
|
-
api.addDrink(item.item_id, { id: context.value })
|
160
|
-
}
|
161
|
-
} else {
|
162
|
-
const item_id = needsDrink[0].item_id
|
163
|
-
api.addDrink(item_id, { id: context.value })
|
164
|
-
}
|
165
|
-
*/
|
159
|
+
api.update({ id: items[0].id, date: context })
|
166
160
|
}
|
167
161
|
},
|
168
162
|
])
|
@@ -172,7 +166,7 @@ const template = {
|
|
172
166
|
|
173
167
|
knowledgeModule( {
|
174
168
|
config: { name: 'reminders' },
|
175
|
-
includes: [dates, selfKM],
|
169
|
+
includes: [time, dates, selfKM],
|
176
170
|
api: () => new API(),
|
177
171
|
|
178
172
|
module,
|
@@ -185,7 +179,7 @@ knowledgeModule( {
|
|
185
179
|
objects: [
|
186
180
|
{
|
187
181
|
property: 'reminders',
|
188
|
-
filter: [ 'text', '
|
182
|
+
filter: [ 'text', 'date', 'time' ],
|
189
183
|
}
|
190
184
|
],
|
191
185
|
},
|