tpmkms_4wp 9.3.0-beta.6 → 9.3.0-beta.8
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/crew.instance.json +72 -0
- package/common/dialogues.js +5 -2
- package/common/events.js +1 -1
- package/common/fastfood.instance.json +296 -108
- 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 +24 -4
- package/common/reminders.js +38 -27
- package/common/reminders.test.json +7070 -6
- package/common/reports.instance.json +2 -2
- package/common/scorekeeper.test.json +3565 -7550
- package/common/time.js +55 -30
- package/common/time.test.json +4124 -124
- package/common/ui.js +3 -1
- package/common/weight.instance.json +0 -52
- package/common/wp.test.json +8057 -3867
- package/package.json +2 -2
@@ -2,8 +2,9 @@
|
|
2
2
|
"configs": [
|
3
3
|
{
|
4
4
|
"operators": [
|
5
|
-
"([remind] (self/*) (*)*)",
|
6
5
|
"([reminderTime|])",
|
6
|
+
"([remind] (self/*) (!@<= 'onDate')*)",
|
7
|
+
"([remind:withTimeBridge] (self/*) (!@<= 'onDate')* ([onDate|on] (reminderTime)))",
|
7
8
|
"([show] ([reminders]))",
|
8
9
|
"([delete_reminders|delete,cancel] (number/*))"
|
9
10
|
],
|
@@ -14,14 +15,23 @@
|
|
14
15
|
"verb"
|
15
16
|
],
|
16
17
|
"bridge": "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], interpolate: '${operator} ${who} ${reminder}' }",
|
17
|
-
"
|
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 }"
|
18
20
|
},
|
19
21
|
{
|
20
22
|
"id": "reminderTime",
|
21
23
|
"children": [
|
24
|
+
"day_dates",
|
22
25
|
"month_dates"
|
23
26
|
]
|
24
27
|
},
|
28
|
+
{
|
29
|
+
"id": "onDate",
|
30
|
+
"isA": [
|
31
|
+
"preposition"
|
32
|
+
],
|
33
|
+
"bridge": "{ ...next(operator), time: after[0], onDate: operator, interpolate: '${onDate} ${time}' }"
|
34
|
+
},
|
25
35
|
{
|
26
36
|
"id": "reminders",
|
27
37
|
"isA": [
|
@@ -54,8 +64,9 @@
|
|
54
64
|
{
|
55
65
|
"extraConfig": true,
|
56
66
|
"operators": [
|
57
|
-
"([remind] (self/*) (*)*)",
|
58
67
|
"([reminderTime|])",
|
68
|
+
"([remind] (self/*) (!@<= 'onDate')*)",
|
69
|
+
"([remind:withTimeBridge] (self/*) (!@<= 'onDate')* ([onDate|on] (reminderTime)))",
|
59
70
|
"([show] ([reminders]))",
|
60
71
|
"([delete_reminders|delete,cancel] (number/*))"
|
61
72
|
],
|
@@ -65,14 +76,23 @@
|
|
65
76
|
"isA": [
|
66
77
|
"verb"
|
67
78
|
],
|
68
|
-
"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}' }"
|
69
81
|
},
|
70
82
|
{
|
71
83
|
"id": "reminderTime",
|
72
84
|
"children": [
|
85
|
+
"day_dates",
|
73
86
|
"month_dates"
|
74
87
|
]
|
75
88
|
},
|
89
|
+
{
|
90
|
+
"id": "onDate",
|
91
|
+
"isA": [
|
92
|
+
"preposition"
|
93
|
+
],
|
94
|
+
"bridge": "{ ...next(operator), time: after[0], onDate: operator, interpolate: '${onDate} ${time}' }"
|
95
|
+
},
|
76
96
|
{
|
77
97
|
"id": "reminders",
|
78
98
|
"isA": [
|
package/common/reminders.js
CHANGED
@@ -4,6 +4,8 @@ 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')
|
8
|
+
const reminders_helpers = require('./helpers/reminders')
|
7
9
|
const helpers = require('./helpers')
|
8
10
|
|
9
11
|
class API {
|
@@ -15,13 +17,30 @@ class API {
|
|
15
17
|
|
16
18
|
add(reminder) {
|
17
19
|
const id = ++this._objects.id
|
18
|
-
|
20
|
+
reminder.id = id
|
21
|
+
this._objects.reminders.push(reminder)
|
22
|
+
this.args.mentioned({ context: reminder })
|
23
|
+
}
|
24
|
+
|
25
|
+
instantiate(reminder) {
|
26
|
+
let now;
|
27
|
+
if (this.args.isProcess) {
|
28
|
+
// so the unit tests work consistently
|
29
|
+
now = new Date(2025, 6, 29, 14, 52, 0)
|
30
|
+
} else {
|
31
|
+
now = new Date()
|
32
|
+
}
|
33
|
+
reminder.nextISODate = reminders_helpers.instantiate(now, reminder)
|
34
|
+
}
|
35
|
+
|
36
|
+
// the user of the KM can override this. this can be used to sync the GUI and the LUI
|
37
|
+
getCurrent() {
|
19
38
|
}
|
20
39
|
|
21
40
|
askAbout() {
|
22
41
|
const items = []
|
23
42
|
for (const item of this._objects.reminders) {
|
24
|
-
if (!item.
|
43
|
+
if (!item.date) {
|
25
44
|
items.push({ when: true, text: item.text, id: item.id })
|
26
45
|
}
|
27
46
|
}
|
@@ -67,8 +86,11 @@ const template = {
|
|
67
86
|
configs: [
|
68
87
|
{
|
69
88
|
operators: [
|
70
|
-
"([remind] (self/*) (*)*)",
|
71
89
|
"([reminderTime|])",
|
90
|
+
"([remind] (self/*) (!@<= 'onDate')*)",
|
91
|
+
"([onDate|on] (reminderTime))",
|
92
|
+
"([remind:withDateBridge] (self/*) (!@<= 'onDate')* (onDate))",
|
93
|
+
"([remind:withDateAndTimeBridge] (self/*) (!@<= 'onDate')* (onDate) (atTime))",
|
72
94
|
"([show] ([reminders]))",
|
73
95
|
"([delete_reminders|delete,cancel] (number/*))",
|
74
96
|
],
|
@@ -77,9 +99,13 @@ const template = {
|
|
77
99
|
id: 'remind',
|
78
100
|
isA: ['verb'],
|
79
101
|
bridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], interpolate: '${operator} ${who} ${reminder}' }",
|
102
|
+
withDateBridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], interpolate: '${operator} ${who} ${reminder} ${date}' }",
|
103
|
+
withDateAndTimeBridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], time: after[3], interpolate: '${operator} ${who} ${reminder} ${date} ${time}' }",
|
80
104
|
semantic: async ({api, gsp, context}) => {
|
81
105
|
const text = await gsp(context.reminder.slice(1));
|
82
|
-
|
106
|
+
const reminder = { text, date: context.date, time: context.time }
|
107
|
+
api.instantiate(reminder)
|
108
|
+
api.add(reminder)
|
83
109
|
},
|
84
110
|
},
|
85
111
|
{
|
@@ -89,6 +115,11 @@ const template = {
|
|
89
115
|
'month_dates',
|
90
116
|
],
|
91
117
|
},
|
118
|
+
{
|
119
|
+
id: 'onDate',
|
120
|
+
isA: ['preposition'],
|
121
|
+
bridge: "{ ...next(operator), date: after[0], onDate: operator, interpolate: '${onDate} ${date}' }",
|
122
|
+
},
|
92
123
|
{
|
93
124
|
id: 'reminders',
|
94
125
|
isA: ['noun'],
|
@@ -138,7 +169,6 @@ const template = {
|
|
138
169
|
},
|
139
170
|
|
140
171
|
matchr: ({ isA, api, context }) => {
|
141
|
-
debugger
|
142
172
|
if (isA(context.marker, 'reminderTime') && api.askAbout().length > 0) {
|
143
173
|
return true
|
144
174
|
}
|
@@ -146,26 +176,7 @@ const template = {
|
|
146
176
|
},
|
147
177
|
applyr: ({ context, api }) => {
|
148
178
|
const items = api.askAbout()
|
149
|
-
|
150
|
-
api.update({ id: items[0].id, when: context })
|
151
|
-
// TODO check for is available for all modifications
|
152
|
-
/*
|
153
|
-
const needsDrink = askAbout(args)
|
154
|
-
const { api, context } = args
|
155
|
-
if (isMany(context)) {
|
156
|
-
let count = getCount(context) || Number.MAX_SAFE_INTEGER
|
157
|
-
for (const item of needsDrink) {
|
158
|
-
if (count < 1) {
|
159
|
-
break
|
160
|
-
}
|
161
|
-
count -= 1
|
162
|
-
api.addDrink(item.item_id, { id: context.value })
|
163
|
-
}
|
164
|
-
} else {
|
165
|
-
const item_id = needsDrink[0].item_id
|
166
|
-
api.addDrink(item_id, { id: context.value })
|
167
|
-
}
|
168
|
-
*/
|
179
|
+
api.update({ id: items[0].id, date: context })
|
169
180
|
}
|
170
181
|
},
|
171
182
|
])
|
@@ -175,7 +186,7 @@ const template = {
|
|
175
186
|
|
176
187
|
knowledgeModule( {
|
177
188
|
config: { name: 'reminders' },
|
178
|
-
includes: [dates, selfKM],
|
189
|
+
includes: [time, dates, selfKM],
|
179
190
|
api: () => new API(),
|
180
191
|
|
181
192
|
module,
|
@@ -188,7 +199,7 @@ knowledgeModule( {
|
|
188
199
|
objects: [
|
189
200
|
{
|
190
201
|
property: 'reminders',
|
191
|
-
filter: [ 'text', '
|
202
|
+
filter: [ 'text', 'date', 'time', 'nextISODate', 'stm' ],
|
192
203
|
}
|
193
204
|
],
|
194
205
|
},
|