tpmkms_4wp 7.4.3 → 7.5.0

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.

Potentially problematic release.


This version of tpmkms_4wp might be problematic. Click here for more details.

@@ -0,0 +1,2 @@
1
+ {
2
+ }
package/common/ui.js ADDED
@@ -0,0 +1,105 @@
1
+ const { Config, knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
2
+ const dialogues = require('./dialogues')
3
+ const ui_tests = require('./ui.test.json')
4
+
5
+ class API {
6
+ move(direction) {
7
+ this.objects.move = direction
8
+ }
9
+
10
+ select(direction) {
11
+ this.objects.select = true
12
+ }
13
+
14
+ cancel(direction) {
15
+ this.objects.cancel = true
16
+ }
17
+ }
18
+ const api = new API()
19
+
20
+ let config = {
21
+ name: 'ui',
22
+ operators: [
23
+ "([select])",
24
+ "([cancel])",
25
+ "([move] ([direction]))",
26
+ "([down])",
27
+ "([up])",
28
+ "([left])",
29
+ "([right])",
30
+ ],
31
+ bridges: [
32
+ {
33
+ id: "select",
34
+ isA: ['verby'],
35
+ level: 0,
36
+ bridge: "{ ...next(operator) }",
37
+ semantic: ({api, context}) => {
38
+ api.select()
39
+ }
40
+ },
41
+ {
42
+ id: "cancel",
43
+ isA: ['verby'],
44
+ level: 0,
45
+ words: ['close'],
46
+ bridge: "{ ...next(operator) }",
47
+ semantic: ({api, context}) => {
48
+ api.cancel()
49
+ }
50
+ },
51
+ {
52
+ id: "move",
53
+ isA: ['verby'],
54
+ level: 0,
55
+ bridge: "{ ...next(operator), direction: after[0] }",
56
+ generatorp: ({context, g}) => `move ${g(context.direction)}`,
57
+ semantic: ({api, context}) => {
58
+ api.move(context.direction)
59
+ }
60
+ },
61
+ {
62
+ id: "direction",
63
+ level: 0,
64
+ bridge: "{ ...next(operator) }"
65
+ },
66
+ {
67
+ id: "up",
68
+ level: 0,
69
+ isA: ['direction'],
70
+ bridge: "{ ...next(operator) }"
71
+ },
72
+ {
73
+ id: "down",
74
+ level: 0,
75
+ isA: ['direction'],
76
+ bridge: "{ ...next(operator) }"
77
+ },
78
+ {
79
+ id: "left",
80
+ level: 0,
81
+ isA: ['direction'],
82
+ bridge: "{ ...next(operator) }"
83
+ },
84
+ {
85
+ id: "right",
86
+ level: 0,
87
+ isA: ['direction'],
88
+ bridge: "{ ...next(operator) }"
89
+ },
90
+ ],
91
+ };
92
+
93
+ config = new Config(config, module)
94
+ config.add(dialogues)
95
+ config.api = api
96
+
97
+ knowledgeModule({
98
+ module,
99
+ description: 'Control a ui with speech',
100
+ config,
101
+ test: {
102
+ name: './ui.test.json',
103
+ contents: ui_tests
104
+ },
105
+ })