@willwade/aac-processors 0.0.29 → 0.1.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.
Files changed (92) hide show
  1. package/README.md +52 -852
  2. package/dist/browser/core/baseProcessor.js +241 -0
  3. package/dist/browser/core/stringCasing.js +179 -0
  4. package/dist/browser/core/treeStructure.js +255 -0
  5. package/dist/browser/index.browser.js +73 -0
  6. package/dist/browser/processors/applePanelsProcessor.js +582 -0
  7. package/dist/browser/processors/astericsGridProcessor.js +1509 -0
  8. package/dist/browser/processors/dotProcessor.js +221 -0
  9. package/dist/browser/processors/gridset/commands.js +962 -0
  10. package/dist/browser/processors/gridset/crypto.js +53 -0
  11. package/dist/browser/processors/gridset/password.js +43 -0
  12. package/dist/browser/processors/gridset/pluginTypes.js +277 -0
  13. package/dist/browser/processors/gridset/resolver.js +137 -0
  14. package/dist/browser/processors/gridset/symbolAlignment.js +276 -0
  15. package/dist/browser/processors/gridset/symbols.js +421 -0
  16. package/dist/browser/processors/gridsetProcessor.js +2002 -0
  17. package/dist/browser/processors/obfProcessor.js +705 -0
  18. package/dist/browser/processors/opmlProcessor.js +274 -0
  19. package/dist/browser/types/aac.js +38 -0
  20. package/dist/browser/utilities/analytics/utils/idGenerator.js +89 -0
  21. package/dist/browser/utilities/translation/translationProcessor.js +200 -0
  22. package/dist/browser/utils/io.js +95 -0
  23. package/dist/browser/validation/baseValidator.js +156 -0
  24. package/dist/browser/validation/gridsetValidator.js +355 -0
  25. package/dist/browser/validation/obfValidator.js +500 -0
  26. package/dist/browser/validation/validationTypes.js +46 -0
  27. package/dist/cli/index.js +5 -5
  28. package/dist/core/analyze.d.ts +2 -2
  29. package/dist/core/analyze.js +2 -2
  30. package/dist/core/baseProcessor.d.ts +5 -4
  31. package/dist/core/baseProcessor.js +22 -27
  32. package/dist/core/treeStructure.d.ts +5 -5
  33. package/dist/core/treeStructure.js +1 -4
  34. package/dist/index.browser.d.ts +37 -0
  35. package/dist/index.browser.js +99 -0
  36. package/dist/index.d.ts +1 -48
  37. package/dist/index.js +1 -136
  38. package/dist/index.node.d.ts +48 -0
  39. package/dist/index.node.js +152 -0
  40. package/dist/processors/applePanelsProcessor.d.ts +5 -4
  41. package/dist/processors/applePanelsProcessor.js +58 -62
  42. package/dist/processors/astericsGridProcessor.d.ts +7 -6
  43. package/dist/processors/astericsGridProcessor.js +31 -42
  44. package/dist/processors/dotProcessor.d.ts +5 -4
  45. package/dist/processors/dotProcessor.js +25 -33
  46. package/dist/processors/excelProcessor.d.ts +4 -3
  47. package/dist/processors/excelProcessor.js +6 -3
  48. package/dist/processors/gridset/crypto.d.ts +18 -0
  49. package/dist/processors/gridset/crypto.js +57 -0
  50. package/dist/processors/gridset/helpers.d.ts +1 -1
  51. package/dist/processors/gridset/helpers.js +18 -8
  52. package/dist/processors/gridset/password.d.ts +20 -3
  53. package/dist/processors/gridset/password.js +17 -3
  54. package/dist/processors/gridset/wordlistHelpers.d.ts +3 -3
  55. package/dist/processors/gridset/wordlistHelpers.js +21 -20
  56. package/dist/processors/gridsetProcessor.d.ts +7 -12
  57. package/dist/processors/gridsetProcessor.js +118 -77
  58. package/dist/processors/obfProcessor.d.ts +9 -7
  59. package/dist/processors/obfProcessor.js +131 -56
  60. package/dist/processors/obfsetProcessor.d.ts +5 -4
  61. package/dist/processors/obfsetProcessor.js +10 -16
  62. package/dist/processors/opmlProcessor.d.ts +5 -4
  63. package/dist/processors/opmlProcessor.js +27 -34
  64. package/dist/processors/snapProcessor.d.ts +8 -7
  65. package/dist/processors/snapProcessor.js +15 -12
  66. package/dist/processors/touchchatProcessor.d.ts +8 -7
  67. package/dist/processors/touchchatProcessor.js +22 -17
  68. package/dist/types/aac.d.ts +0 -2
  69. package/dist/types/aac.js +2 -0
  70. package/dist/utils/io.d.ts +12 -0
  71. package/dist/utils/io.js +107 -0
  72. package/dist/validation/gridsetValidator.js +7 -7
  73. package/dist/validation/snapValidator.js +28 -35
  74. package/docs/BROWSER_USAGE.md +618 -0
  75. package/examples/README.md +77 -0
  76. package/examples/browser-test-server.js +81 -0
  77. package/examples/browser-test.html +331 -0
  78. package/examples/vitedemo/QUICKSTART.md +74 -0
  79. package/examples/vitedemo/README.md +157 -0
  80. package/examples/vitedemo/index.html +376 -0
  81. package/examples/vitedemo/package-lock.json +1221 -0
  82. package/examples/vitedemo/package.json +18 -0
  83. package/examples/vitedemo/src/main.ts +519 -0
  84. package/examples/vitedemo/test-files/example.dot +14 -0
  85. package/examples/vitedemo/test-files/example.grd +1 -0
  86. package/examples/vitedemo/test-files/example.gridset +0 -0
  87. package/examples/vitedemo/test-files/example.obz +0 -0
  88. package/examples/vitedemo/test-files/example.opml +18 -0
  89. package/examples/vitedemo/test-files/simple.obf +53 -0
  90. package/examples/vitedemo/tsconfig.json +24 -0
  91. package/examples/vitedemo/vite.config.ts +34 -0
  92. package/package.json +20 -4
@@ -0,0 +1,962 @@
1
+ /**
2
+ * Grid 3 Command Definitions and Detection System
3
+ *
4
+ * This module provides comprehensive metadata for all Grid 3 commands,
5
+ * organized by plugin/category. It enables:
6
+ * - Command detection and classification
7
+ * - Parameter extraction
8
+ * - Future extensibility for command execution
9
+ * - Semantic action mapping
10
+ *
11
+ * Grid 3 has 33+ plugins with 200+ commands. This catalog captures
12
+ * the most commonly used and important commands.
13
+ */
14
+ /**
15
+ * Command categories in Grid 3
16
+ */
17
+ export var Grid3CommandCategory;
18
+ (function (Grid3CommandCategory) {
19
+ Grid3CommandCategory["NAVIGATION"] = "navigation";
20
+ Grid3CommandCategory["COMMUNICATION"] = "communication";
21
+ Grid3CommandCategory["TEXT_EDITING"] = "text_editing";
22
+ Grid3CommandCategory["COMPUTER_CONTROL"] = "computer_control";
23
+ Grid3CommandCategory["WEB_BROWSER"] = "web_browser";
24
+ Grid3CommandCategory["EMAIL"] = "email";
25
+ Grid3CommandCategory["PHONE"] = "phone";
26
+ Grid3CommandCategory["SMS"] = "sms";
27
+ Grid3CommandCategory["SYSTEM"] = "system";
28
+ Grid3CommandCategory["SETTINGS"] = "settings";
29
+ Grid3CommandCategory["SPEECH"] = "speech";
30
+ Grid3CommandCategory["AUTO_CONTENT"] = "auto_content";
31
+ Grid3CommandCategory["ENVIRONMENT_CONTROL"] = "environment_control";
32
+ Grid3CommandCategory["MOUSE"] = "mouse";
33
+ Grid3CommandCategory["WINDOW"] = "window";
34
+ Grid3CommandCategory["MEDIA"] = "media";
35
+ Grid3CommandCategory["CUSTOM"] = "custom";
36
+ })(Grid3CommandCategory || (Grid3CommandCategory = {}));
37
+ /**
38
+ * Registry of all Grid 3 commands
39
+ * Key is command ID (e.g., 'Jump.To', 'Action.InsertText')
40
+ */
41
+ export const GRID3_COMMANDS = {
42
+ // ========================================
43
+ // NAVIGATION COMMANDS
44
+ // ========================================
45
+ 'Jump.To': {
46
+ id: 'Jump.To',
47
+ category: Grid3CommandCategory.NAVIGATION,
48
+ pluginId: 'navigation',
49
+ displayName: 'Jump To',
50
+ description: 'Navigate to a specific grid',
51
+ parameters: [
52
+ {
53
+ key: 'grid',
54
+ type: 'grid',
55
+ required: true,
56
+ description: 'Target grid name',
57
+ },
58
+ ],
59
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
60
+ },
61
+ 'Jump.Back': {
62
+ id: 'Jump.Back',
63
+ category: Grid3CommandCategory.NAVIGATION,
64
+ pluginId: 'navigation',
65
+ displayName: 'Jump Back',
66
+ description: 'Navigate to the previous grid',
67
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
68
+ },
69
+ 'Jump.Home': {
70
+ id: 'Jump.Home',
71
+ category: Grid3CommandCategory.NAVIGATION,
72
+ pluginId: 'navigation',
73
+ displayName: 'Jump Home',
74
+ description: 'Navigate to the home/start grid',
75
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
76
+ },
77
+ 'Jump.Favorite': {
78
+ id: 'Jump.Favorite',
79
+ category: Grid3CommandCategory.NAVIGATION,
80
+ pluginId: 'navigation',
81
+ displayName: 'Jump To Favorite',
82
+ description: 'Navigate to a favorite grid',
83
+ parameters: [
84
+ {
85
+ key: 'favorite',
86
+ type: 'number',
87
+ required: true,
88
+ description: 'Favorite slot number',
89
+ },
90
+ ],
91
+ },
92
+ // ========================================
93
+ // COMMUNICATION COMMANDS
94
+ // ========================================
95
+ 'Action.Speak': {
96
+ id: 'Action.Speak',
97
+ category: Grid3CommandCategory.COMMUNICATION,
98
+ pluginId: 'speech',
99
+ displayName: 'Speak',
100
+ description: 'Speak the current message bar contents',
101
+ parameters: [
102
+ {
103
+ key: 'unit',
104
+ type: 'string',
105
+ required: false,
106
+ description: 'Speaking unit (sentence/word/character)',
107
+ },
108
+ {
109
+ key: 'movecaret',
110
+ type: 'boolean',
111
+ required: false,
112
+ description: 'Move caret after speaking',
113
+ },
114
+ ],
115
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
116
+ },
117
+ 'Action.InsertText': {
118
+ id: 'Action.InsertText',
119
+ category: Grid3CommandCategory.COMMUNICATION,
120
+ pluginId: 'core',
121
+ displayName: 'Insert Text',
122
+ description: 'Insert text into the message bar',
123
+ parameters: [
124
+ {
125
+ key: 'text',
126
+ type: 'string',
127
+ required: true,
128
+ description: 'Text to insert',
129
+ },
130
+ ],
131
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
132
+ },
133
+ 'Action.InsertTextAndSpeak': {
134
+ id: 'Action.InsertTextAndSpeak',
135
+ category: Grid3CommandCategory.COMMUNICATION,
136
+ pluginId: 'core',
137
+ displayName: 'Insert Text and Speak',
138
+ description: 'Insert text and speak immediately',
139
+ parameters: [
140
+ {
141
+ key: 'text',
142
+ type: 'string',
143
+ required: true,
144
+ description: 'Text to insert and speak',
145
+ },
146
+ ],
147
+ },
148
+ // ========================================
149
+ // TEXT EDITING COMMANDS
150
+ // ========================================
151
+ 'Action.DeleteWord': {
152
+ id: 'Action.DeleteWord',
153
+ category: Grid3CommandCategory.TEXT_EDITING,
154
+ pluginId: 'core',
155
+ displayName: 'Delete Word',
156
+ description: 'Delete the last word in the message bar',
157
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
158
+ },
159
+ 'Action.DeleteLetter': {
160
+ id: 'Action.DeleteLetter',
161
+ category: Grid3CommandCategory.TEXT_EDITING,
162
+ pluginId: 'core',
163
+ displayName: 'Delete Letter',
164
+ description: 'Delete the last character in the message bar',
165
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
166
+ },
167
+ 'Action.Clear': {
168
+ id: 'Action.Clear',
169
+ category: Grid3CommandCategory.TEXT_EDITING,
170
+ pluginId: 'core',
171
+ displayName: 'Clear',
172
+ description: 'Clear the message bar',
173
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
174
+ },
175
+ 'Action.Letter': {
176
+ id: 'Action.Letter',
177
+ category: Grid3CommandCategory.TEXT_EDITING,
178
+ pluginId: 'core',
179
+ displayName: 'Insert Letter',
180
+ description: 'Insert a single letter',
181
+ parameters: [
182
+ {
183
+ key: 'letter',
184
+ type: 'string',
185
+ required: true,
186
+ description: 'Letter to insert',
187
+ },
188
+ ],
189
+ },
190
+ 'Action.Space': {
191
+ id: 'Action.Space',
192
+ category: Grid3CommandCategory.TEXT_EDITING,
193
+ pluginId: 'core',
194
+ displayName: 'Space',
195
+ description: 'Insert a space',
196
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
197
+ },
198
+ 'Action.Backspace': {
199
+ id: 'Action.Backspace',
200
+ category: Grid3CommandCategory.TEXT_EDITING,
201
+ pluginId: 'core',
202
+ displayName: 'Backspace',
203
+ description: 'Delete character before cursor',
204
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
205
+ },
206
+ // ========================================
207
+ // SPEECH COMMANDS
208
+ // ========================================
209
+ 'Speech.ChangePublicVoice': {
210
+ id: 'Speech.ChangePublicVoice',
211
+ category: Grid3CommandCategory.SPEECH,
212
+ pluginId: 'speech',
213
+ displayName: 'Change Voice',
214
+ description: 'Change the public speaking voice',
215
+ parameters: [
216
+ {
217
+ key: 'voice',
218
+ type: 'string',
219
+ required: true,
220
+ description: 'Voice name or ID',
221
+ },
222
+ ],
223
+ },
224
+ 'Speech.ChangePublicSpeed': {
225
+ id: 'Speech.ChangePublicSpeed',
226
+ category: Grid3CommandCategory.SPEECH,
227
+ pluginId: 'speech',
228
+ displayName: 'Change Speech Speed',
229
+ description: 'Change the speaking speed',
230
+ parameters: [
231
+ {
232
+ key: 'speed',
233
+ type: 'number',
234
+ required: true,
235
+ description: 'Speed percentage (50-200)',
236
+ },
237
+ ],
238
+ },
239
+ 'Speech.ChangePublicPitch': {
240
+ id: 'Speech.ChangePublicPitch',
241
+ category: Grid3CommandCategory.SPEECH,
242
+ pluginId: 'speech',
243
+ displayName: 'Change Speech Pitch',
244
+ description: 'Change the voice pitch',
245
+ parameters: [
246
+ {
247
+ key: 'pitch',
248
+ type: 'number',
249
+ required: true,
250
+ description: 'Pitch value',
251
+ },
252
+ ],
253
+ },
254
+ 'Speech.ChangePublicVolume': {
255
+ id: 'Speech.ChangePublicVolume',
256
+ category: Grid3CommandCategory.SPEECH,
257
+ pluginId: 'speech',
258
+ displayName: 'Change Speech Volume',
259
+ description: 'Change the speech volume',
260
+ parameters: [
261
+ {
262
+ key: 'volume',
263
+ type: 'number',
264
+ required: true,
265
+ description: 'Volume percentage (0-100)',
266
+ },
267
+ ],
268
+ },
269
+ 'Speech.SpeakNothing': {
270
+ id: 'Action.SpeakNothing',
271
+ category: Grid3CommandCategory.SPEECH,
272
+ pluginId: 'speech',
273
+ displayName: 'Speak Nothing',
274
+ description: 'Speak without inserting text',
275
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
276
+ },
277
+ // ========================================
278
+ // COMPUTER CONTROL COMMANDS
279
+ // ========================================
280
+ 'ComputerControl.LeftClick': {
281
+ id: 'ComputerControl.LeftClick',
282
+ category: Grid3CommandCategory.COMPUTER_CONTROL,
283
+ pluginId: 'computercontrol',
284
+ displayName: 'Left Click',
285
+ description: 'Perform left mouse click',
286
+ platforms: ['desktop', 'medicareBionics'],
287
+ },
288
+ 'ComputerControl.RightClick': {
289
+ id: 'ComputerControl.RightClick',
290
+ category: Grid3CommandCategory.COMPUTER_CONTROL,
291
+ pluginId: 'computercontrol',
292
+ displayName: 'Right Click',
293
+ description: 'Perform right mouse click',
294
+ platforms: ['desktop', 'medicareBionics'],
295
+ },
296
+ 'ComputerControl.DoubleClick': {
297
+ id: 'ComputerControl.DoubleClick',
298
+ category: Grid3CommandCategory.COMPUTER_CONTROL,
299
+ pluginId: 'computercontrol',
300
+ displayName: 'Double Click',
301
+ description: 'Perform double mouse click',
302
+ platforms: ['desktop', 'medicareBionics'],
303
+ },
304
+ 'ComputerControl.MouseMove': {
305
+ id: 'ComputerControl.MouseMove',
306
+ category: Grid3CommandCategory.COMPUTER_CONTROL,
307
+ pluginId: 'computercontrol',
308
+ displayName: 'Move Mouse',
309
+ description: 'Move mouse pointer',
310
+ parameters: [
311
+ { key: 'x', type: 'number', required: true, description: 'X coordinate' },
312
+ { key: 'y', type: 'number', required: true, description: 'Y coordinate' },
313
+ ],
314
+ platforms: ['desktop', 'medicareBionics'],
315
+ },
316
+ 'ComputerControl.SendKeys': {
317
+ id: 'ComputerControl.SendKeys',
318
+ category: Grid3CommandCategory.COMPUTER_CONTROL,
319
+ pluginId: 'computercontrol',
320
+ displayName: 'Send Keys',
321
+ description: 'Send keyboard input',
322
+ parameters: [
323
+ {
324
+ key: 'keys',
325
+ type: 'string',
326
+ required: true,
327
+ description: 'Key sequence to send',
328
+ },
329
+ ],
330
+ platforms: ['desktop', 'medicareBionics'],
331
+ },
332
+ 'ComputerControl.WindowsKey': {
333
+ id: 'ComputerControl.WindowsKey',
334
+ category: Grid3CommandCategory.COMPUTER_CONTROL,
335
+ pluginId: 'computercontrol',
336
+ displayName: 'Windows Key',
337
+ description: 'Press Windows key',
338
+ platforms: ['desktop'],
339
+ },
340
+ 'ComputerControl.MenuKey': {
341
+ id: 'ComputerControl.MenuKey',
342
+ category: Grid3CommandCategory.COMPUTER_CONTROL,
343
+ pluginId: 'computercontrol',
344
+ displayName: 'Menu Key',
345
+ description: 'Press context menu key',
346
+ platforms: ['desktop'],
347
+ },
348
+ // ========================================
349
+ // WEB BROWSER COMMANDS
350
+ // ========================================
351
+ 'WebBrowser.Navigate': {
352
+ id: 'WebBrowser.Navigate',
353
+ category: Grid3CommandCategory.WEB_BROWSER,
354
+ pluginId: 'webbrowser',
355
+ displayName: 'Navigate to URL',
356
+ description: 'Open a URL in the web browser',
357
+ parameters: [
358
+ {
359
+ key: 'url',
360
+ type: 'string',
361
+ required: true,
362
+ description: 'URL to navigate to',
363
+ },
364
+ ],
365
+ platforms: ['desktop', 'ios'],
366
+ },
367
+ 'WebBrowser.Back': {
368
+ id: 'WebBrowser.Back',
369
+ category: Grid3CommandCategory.WEB_BROWSER,
370
+ pluginId: 'webbrowser',
371
+ displayName: 'Browser Back',
372
+ description: 'Go back in browser history',
373
+ platforms: ['desktop', 'ios'],
374
+ },
375
+ 'WebBrowser.Forward': {
376
+ id: 'WebBrowser.Forward',
377
+ category: Grid3CommandCategory.WEB_BROWSER,
378
+ pluginId: 'webbrowser',
379
+ displayName: 'Browser Forward',
380
+ description: 'Go forward in browser history',
381
+ platforms: ['desktop', 'ios'],
382
+ },
383
+ 'WebBrowser.Refresh': {
384
+ id: 'WebBrowser.Refresh',
385
+ category: Grid3CommandCategory.WEB_BROWSER,
386
+ pluginId: 'webbrowser',
387
+ displayName: 'Refresh Page',
388
+ description: 'Refresh the current page',
389
+ platforms: ['desktop', 'ios'],
390
+ },
391
+ 'WebBrowser.Home': {
392
+ id: 'WebBrowser.Home',
393
+ category: Grid3CommandCategory.WEB_BROWSER,
394
+ pluginId: 'webbrowser',
395
+ displayName: 'Browser Home',
396
+ description: 'Navigate to browser home page',
397
+ platforms: ['desktop', 'ios'],
398
+ },
399
+ 'WebBrowser.FavoriteAdd': {
400
+ id: 'WebBrowser.FavoriteAdd',
401
+ category: Grid3CommandCategory.WEB_BROWSER,
402
+ pluginId: 'webbrowser',
403
+ displayName: 'Add Favorite',
404
+ description: 'Add current page to favorites',
405
+ platforms: ['desktop', 'ios'],
406
+ },
407
+ 'WebBrowser.ZoomIn': {
408
+ id: 'WebBrowser.ZoomIn',
409
+ category: Grid3CommandCategory.WEB_BROWSER,
410
+ pluginId: 'webbrowser',
411
+ displayName: 'Zoom In',
412
+ description: 'Zoom in the page',
413
+ platforms: ['desktop', 'ios'],
414
+ },
415
+ 'WebBrowser.ZoomOut': {
416
+ id: 'WebBrowser.ZoomOut',
417
+ category: Grid3CommandCategory.WEB_BROWSER,
418
+ pluginId: 'webbrowser',
419
+ displayName: 'Zoom Out',
420
+ description: 'Zoom out the page',
421
+ platforms: ['desktop', 'ios'],
422
+ },
423
+ // ========================================
424
+ // EMAIL COMMANDS
425
+ // ========================================
426
+ 'Email.SendTo': {
427
+ id: 'Email.SendTo',
428
+ category: Grid3CommandCategory.EMAIL,
429
+ pluginId: 'email',
430
+ displayName: 'Send Email To',
431
+ description: 'Send email to a recipient',
432
+ parameters: [
433
+ {
434
+ key: 'recipient',
435
+ type: 'string',
436
+ required: true,
437
+ description: 'Recipient email address',
438
+ },
439
+ {
440
+ key: 'subject',
441
+ type: 'string',
442
+ required: false,
443
+ description: 'Email subject',
444
+ },
445
+ ],
446
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
447
+ },
448
+ 'Email.AddRecipient': {
449
+ id: 'Email.AddRecipient',
450
+ category: Grid3CommandCategory.EMAIL,
451
+ pluginId: 'email',
452
+ displayName: 'Add Recipient',
453
+ description: 'Add a recipient to the email',
454
+ parameters: [
455
+ {
456
+ key: 'recipient',
457
+ type: 'string',
458
+ required: true,
459
+ description: 'Recipient email address',
460
+ },
461
+ ],
462
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
463
+ },
464
+ 'Email.SetSubject': {
465
+ id: 'Email.SetSubject',
466
+ category: Grid3CommandCategory.EMAIL,
467
+ pluginId: 'email',
468
+ displayName: 'Set Subject',
469
+ description: 'Set the email subject',
470
+ parameters: [
471
+ {
472
+ key: 'subject',
473
+ type: 'string',
474
+ required: true,
475
+ description: 'Email subject',
476
+ },
477
+ ],
478
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
479
+ },
480
+ 'Email.AttachFile': {
481
+ id: 'Email.AttachFile',
482
+ category: Grid3CommandCategory.EMAIL,
483
+ pluginId: 'email',
484
+ displayName: 'Attach File',
485
+ description: 'Attach a file to the email',
486
+ parameters: [
487
+ {
488
+ key: 'filepath',
489
+ type: 'string',
490
+ required: true,
491
+ description: 'Path to file',
492
+ },
493
+ ],
494
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
495
+ },
496
+ // ========================================
497
+ // PHONE COMMANDS
498
+ // ========================================
499
+ 'Phone.Call': {
500
+ id: 'Phone.Call',
501
+ category: Grid3CommandCategory.PHONE,
502
+ pluginId: 'phone',
503
+ displayName: 'Make Call',
504
+ description: 'Initiate a phone call',
505
+ parameters: [
506
+ {
507
+ key: 'number',
508
+ type: 'string',
509
+ required: true,
510
+ description: 'Phone number to call',
511
+ },
512
+ ],
513
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
514
+ },
515
+ 'Phone.Answer': {
516
+ id: 'Phone.Answer',
517
+ category: Grid3CommandCategory.PHONE,
518
+ pluginId: 'phone',
519
+ displayName: 'Answer Call',
520
+ description: 'Answer incoming call',
521
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
522
+ },
523
+ 'Phone.Hangup': {
524
+ id: 'Phone.Hangup',
525
+ category: Grid3CommandCategory.PHONE,
526
+ pluginId: 'phone',
527
+ displayName: 'End Call',
528
+ description: 'End current call',
529
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
530
+ },
531
+ // ========================================
532
+ // SMS COMMANDS
533
+ // ========================================
534
+ 'Sms.SendTo': {
535
+ id: 'Sms.SendTo',
536
+ category: Grid3CommandCategory.SMS,
537
+ pluginId: 'sms',
538
+ displayName: 'Send SMS To',
539
+ description: 'Send text message to a recipient',
540
+ parameters: [
541
+ {
542
+ key: 'recipient',
543
+ type: 'string',
544
+ required: true,
545
+ description: 'Phone number',
546
+ },
547
+ {
548
+ key: 'message',
549
+ type: 'string',
550
+ required: false,
551
+ description: 'Message text',
552
+ },
553
+ ],
554
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
555
+ },
556
+ 'Sms.AddRecipient': {
557
+ id: 'Sms.AddRecipient',
558
+ category: Grid3CommandCategory.SMS,
559
+ pluginId: 'sms',
560
+ displayName: 'Add SMS Recipient',
561
+ description: 'Add a recipient to the SMS',
562
+ parameters: [
563
+ {
564
+ key: 'recipient',
565
+ type: 'string',
566
+ required: true,
567
+ description: 'Phone number',
568
+ },
569
+ ],
570
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
571
+ },
572
+ // ========================================
573
+ // SYSTEM COMMANDS
574
+ // ========================================
575
+ 'System.LogOff': {
576
+ id: 'System.LogOff',
577
+ category: Grid3CommandCategory.SYSTEM,
578
+ pluginId: 'computersession',
579
+ displayName: 'Log Off',
580
+ description: 'Log off from Windows',
581
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
582
+ },
583
+ 'System.Lock': {
584
+ id: 'System.Lock',
585
+ category: Grid3CommandCategory.SYSTEM,
586
+ pluginId: 'computersession',
587
+ displayName: 'Lock Computer',
588
+ description: 'Lock the computer',
589
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
590
+ },
591
+ 'System.Sleep': {
592
+ id: 'System.Sleep',
593
+ category: Grid3CommandCategory.SYSTEM,
594
+ pluginId: 'computersession',
595
+ displayName: 'Sleep',
596
+ description: 'Put computer to sleep',
597
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
598
+ },
599
+ 'System.Restart': {
600
+ id: 'System.Restart',
601
+ category: Grid3CommandCategory.SYSTEM,
602
+ pluginId: 'computersession',
603
+ displayName: 'Restart',
604
+ description: 'Restart the computer',
605
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
606
+ },
607
+ 'System.ShutDown': {
608
+ id: 'System.ShutDown',
609
+ category: Grid3CommandCategory.SYSTEM,
610
+ pluginId: 'computersession',
611
+ displayName: 'Shut Down',
612
+ description: 'Shut down the computer',
613
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
614
+ },
615
+ // ========================================
616
+ // SETTINGS COMMANDS
617
+ // ========================================
618
+ 'Settings.RestoreAll': {
619
+ id: 'Settings.RestoreAll',
620
+ category: Grid3CommandCategory.SETTINGS,
621
+ pluginId: 'settings',
622
+ displayName: 'Restore All Settings',
623
+ description: 'Restore all settings to defaults',
624
+ parameters: [
625
+ {
626
+ key: 'indicatorenabled',
627
+ type: 'boolean',
628
+ required: false,
629
+ description: 'Show indicator',
630
+ },
631
+ {
632
+ key: 'action',
633
+ type: 'string',
634
+ required: false,
635
+ description: 'Action to perform',
636
+ },
637
+ ],
638
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
639
+ },
640
+ 'Settings.Open': {
641
+ id: 'Settings.Open',
642
+ category: Grid3CommandCategory.SETTINGS,
643
+ pluginId: 'settings',
644
+ displayName: 'Open Settings',
645
+ description: 'Open the settings window',
646
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
647
+ },
648
+ 'Scanning.Start': {
649
+ id: 'Scanning.Start',
650
+ category: Grid3CommandCategory.SETTINGS,
651
+ pluginId: 'access',
652
+ displayName: 'Start Scanning',
653
+ description: 'Start scanning access method',
654
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
655
+ },
656
+ 'Scanning.Stop': {
657
+ id: 'Scanning.Stop',
658
+ category: Grid3CommandCategory.SETTINGS,
659
+ pluginId: 'access',
660
+ displayName: 'Stop Scanning',
661
+ description: 'Stop scanning access method',
662
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
663
+ },
664
+ // ========================================
665
+ // AUTO CONTENT COMMANDS
666
+ // ========================================
667
+ 'AutoContent.Activate': {
668
+ id: 'AutoContent.Activate',
669
+ category: Grid3CommandCategory.AUTO_CONTENT,
670
+ pluginId: 'autocontent',
671
+ displayName: 'Activate Auto Content',
672
+ description: 'Activate an auto content cell',
673
+ parameters: [
674
+ {
675
+ key: 'autocontenttype',
676
+ type: 'string',
677
+ required: true,
678
+ description: 'Type of auto content',
679
+ },
680
+ ],
681
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
682
+ },
683
+ 'Prediction.Clear': {
684
+ id: 'Prediction.Clear',
685
+ category: Grid3CommandCategory.AUTO_CONTENT,
686
+ pluginId: 'prediction',
687
+ displayName: 'Clear Prediction',
688
+ description: 'Clear word prediction buffer',
689
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
690
+ },
691
+ 'Prediction.PredictThis': {
692
+ id: 'Prediction.PredictThis',
693
+ category: Grid3CommandCategory.AUTO_CONTENT,
694
+ pluginId: 'prediction',
695
+ displayName: 'Predict This',
696
+ description: 'Provide suggestions based on word list',
697
+ parameters: [
698
+ {
699
+ key: 'wordlist',
700
+ type: 'string', // Actually highly structured, but string type is a placeholder
701
+ required: true,
702
+ description: 'Word list for prediction',
703
+ },
704
+ ],
705
+ },
706
+ 'Grammar.Change': {
707
+ id: 'Grammar.Change',
708
+ category: Grid3CommandCategory.AUTO_CONTENT,
709
+ pluginId: 'grammar',
710
+ displayName: 'Change Grammar',
711
+ description: 'Change grammar context',
712
+ parameters: [
713
+ {
714
+ key: 'context',
715
+ type: 'string',
716
+ required: true,
717
+ description: 'Grammar context',
718
+ },
719
+ ],
720
+ platforms: ['desktop', 'ios', 'medicare', 'medicareBionics'],
721
+ },
722
+ // ========================================
723
+ // ENVIRONMENT CONTROL COMMANDS
724
+ // ========================================
725
+ 'EnvControl.Send': {
726
+ id: 'EnvControl.Send',
727
+ category: Grid3CommandCategory.ENVIRONMENT_CONTROL,
728
+ pluginId: 'environmentcontrol',
729
+ displayName: 'Send Environment Control',
730
+ description: 'Send environment control command',
731
+ parameters: [
732
+ {
733
+ key: 'code',
734
+ type: 'string',
735
+ required: true,
736
+ description: 'IR/EC code to send',
737
+ },
738
+ ],
739
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
740
+ },
741
+ 'EnvControl.Learn': {
742
+ id: 'EnvControl.Learn',
743
+ category: Grid3CommandCategory.ENVIRONMENT_CONTROL,
744
+ pluginId: 'environmentcontrol',
745
+ displayName: 'Learn Environment Control',
746
+ description: 'Learn environment control code',
747
+ platforms: ['desktop', 'medicare', 'medicareBionics'],
748
+ },
749
+ // ========================================
750
+ // MOUSE COMMANDS
751
+ // ========================================
752
+ 'Mouse.LeftClick': {
753
+ id: 'Mouse.LeftClick',
754
+ category: Grid3CommandCategory.MOUSE,
755
+ pluginId: 'computercontrol',
756
+ displayName: 'Mouse Left Click',
757
+ description: 'Left mouse click',
758
+ platforms: ['desktop', 'medicareBionics'],
759
+ },
760
+ 'Mouse.RightClick': {
761
+ id: 'Mouse.RightClick',
762
+ category: Grid3CommandCategory.MOUSE,
763
+ pluginId: 'computercontrol',
764
+ displayName: 'Mouse Right Click',
765
+ description: 'Right mouse click',
766
+ platforms: ['desktop', 'medicareBionics'],
767
+ },
768
+ 'Mouse.DoubleClick': {
769
+ id: 'Mouse.DoubleClick',
770
+ category: Grid3CommandCategory.MOUSE,
771
+ pluginId: 'computercontrol',
772
+ displayName: 'Mouse Double Click',
773
+ description: 'Double mouse click',
774
+ platforms: ['desktop', 'medicareBionics'],
775
+ },
776
+ 'Mouse.Move': {
777
+ id: 'Mouse.Move',
778
+ category: Grid3CommandCategory.MOUSE,
779
+ pluginId: 'computercontrol',
780
+ displayName: 'Move Mouse',
781
+ description: 'Move mouse pointer',
782
+ parameters: [
783
+ { key: 'x', type: 'number', required: true, description: 'X coordinate' },
784
+ { key: 'y', type: 'number', required: true, description: 'Y coordinate' },
785
+ ],
786
+ platforms: ['desktop', 'medicareBionics'],
787
+ },
788
+ // ========================================
789
+ // WINDOW COMMANDS
790
+ // ========================================
791
+ 'Window.Minimize': {
792
+ id: 'Window.Minimize',
793
+ category: Grid3CommandCategory.WINDOW,
794
+ pluginId: 'computercontrol',
795
+ displayName: 'Minimize Window',
796
+ description: 'Minimize active window',
797
+ platforms: ['desktop', 'medicareBionics'],
798
+ },
799
+ 'Window.Maximize': {
800
+ id: 'Window.Maximize',
801
+ category: Grid3CommandCategory.WINDOW,
802
+ pluginId: 'computercontrol',
803
+ displayName: 'Maximize Window',
804
+ description: 'Maximize active window',
805
+ platforms: ['desktop', 'medicareBionics'],
806
+ },
807
+ 'Window.Close': {
808
+ id: 'Window.Close',
809
+ category: Grid3CommandCategory.WINDOW,
810
+ pluginId: 'computercontrol',
811
+ displayName: 'Close Window',
812
+ description: 'Close active window',
813
+ platforms: ['desktop', 'medicareBionics'],
814
+ },
815
+ 'Window.Switch': {
816
+ id: 'Window.Switch',
817
+ category: Grid3CommandCategory.WINDOW,
818
+ pluginId: 'computercontrol',
819
+ displayName: 'Switch Window',
820
+ description: 'Switch to next window',
821
+ platforms: ['desktop', 'medicareBionics'],
822
+ },
823
+ // ========================================
824
+ // MEDIA COMMANDS
825
+ // ========================================
826
+ 'Media.PlayPause': {
827
+ id: 'Media.PlayPause',
828
+ category: Grid3CommandCategory.MEDIA,
829
+ pluginId: 'musicvideo',
830
+ displayName: 'Play/Pause',
831
+ description: 'Toggle play/pause media',
832
+ platforms: ['desktop', 'ios'],
833
+ },
834
+ 'Media.Next': {
835
+ id: 'Media.Next',
836
+ category: Grid3CommandCategory.MEDIA,
837
+ pluginId: 'musicvideo',
838
+ displayName: 'Next Track',
839
+ description: 'Skip to next track',
840
+ platforms: ['desktop', 'ios'],
841
+ },
842
+ 'Media.Previous': {
843
+ id: 'Media.Previous',
844
+ category: Grid3CommandCategory.MEDIA,
845
+ pluginId: 'musicvideo',
846
+ displayName: 'Previous Track',
847
+ description: 'Go to previous track',
848
+ platforms: ['desktop', 'ios'],
849
+ },
850
+ 'Media.Stop': {
851
+ id: 'Media.Stop',
852
+ category: Grid3CommandCategory.MEDIA,
853
+ pluginId: 'musicvideo',
854
+ displayName: 'Stop',
855
+ description: 'Stop media playback',
856
+ platforms: ['desktop', 'ios'],
857
+ },
858
+ 'Media.VolumeUp': {
859
+ id: 'Media.VolumeUp',
860
+ category: Grid3CommandCategory.MEDIA,
861
+ pluginId: 'musicvideo',
862
+ displayName: 'Volume Up',
863
+ description: 'Increase volume',
864
+ platforms: ['desktop', 'ios'],
865
+ },
866
+ 'Media.VolumeDown': {
867
+ id: 'Media.VolumeDown',
868
+ category: Grid3CommandCategory.MEDIA,
869
+ pluginId: 'musicvideo',
870
+ displayName: 'Volume Down',
871
+ description: 'Decrease volume',
872
+ platforms: ['desktop', 'ios'],
873
+ },
874
+ };
875
+ /**
876
+ * Get command definition by ID
877
+ */
878
+ export function getCommandDefinition(commandId) {
879
+ return GRID3_COMMANDS[commandId];
880
+ }
881
+ /**
882
+ * Check if a command ID is known
883
+ */
884
+ export function isKnownCommand(commandId) {
885
+ return commandId in GRID3_COMMANDS;
886
+ }
887
+ /**
888
+ * Get all commands for a specific plugin
889
+ */
890
+ export function getCommandsByPlugin(pluginId) {
891
+ return Object.values(GRID3_COMMANDS).filter((cmd) => cmd.pluginId === pluginId);
892
+ }
893
+ /**
894
+ * Get all commands in a category
895
+ */
896
+ export function getCommandsByCategory(category) {
897
+ return Object.values(GRID3_COMMANDS).filter((cmd) => cmd.category === category);
898
+ }
899
+ /**
900
+ * Get all command IDs
901
+ */
902
+ export function getAllCommandIds() {
903
+ return Object.keys(GRID3_COMMANDS);
904
+ }
905
+ /**
906
+ * Get all plugin IDs that have commands
907
+ */
908
+ export function getAllPluginIds() {
909
+ const plugins = new Set(Object.values(GRID3_COMMANDS).map((cmd) => cmd.pluginId));
910
+ return Array.from(plugins).sort();
911
+ }
912
+ export function extractCommandParameters(command) {
913
+ const parameters = {};
914
+ const params = command.Parameter || command.parameter;
915
+ if (!params)
916
+ return parameters;
917
+ const paramArray = Array.isArray(params) ? params : [params];
918
+ for (const param of paramArray) {
919
+ const key = param['@_Key'] || param.Key || param.key;
920
+ let value = param['#text'] ?? param.text ?? param.value;
921
+ if (key && value !== undefined) {
922
+ // Try to convert to number if it looks numeric
923
+ if (typeof value === 'string' && /^\d+$/.test(value)) {
924
+ value = parseInt(value, 10);
925
+ }
926
+ else if (typeof value === 'string' && /^\d+\.\d+$/.test(value)) {
927
+ value = parseFloat(value);
928
+ }
929
+ else if (value === 'true') {
930
+ value = true;
931
+ }
932
+ else if (value === 'false') {
933
+ value = false;
934
+ }
935
+ parameters[key] = value;
936
+ }
937
+ }
938
+ return parameters;
939
+ }
940
+ /**
941
+ * Detect and categorize a command from Grid 3
942
+ */
943
+ export function detectCommand(commandObj) {
944
+ const commandId = String(commandObj['@_ID'] || commandObj.ID || commandObj.id || '');
945
+ if (!commandId) {
946
+ return {
947
+ id: 'unknown',
948
+ parameters: {},
949
+ category: 'unknown',
950
+ pluginId: 'unknown',
951
+ };
952
+ }
953
+ const definition = getCommandDefinition(commandId);
954
+ const parameters = extractCommandParameters(commandObj);
955
+ return {
956
+ id: commandId,
957
+ definition,
958
+ parameters,
959
+ category: definition?.category || 'unknown',
960
+ pluginId: definition?.pluginId || 'unknown',
961
+ };
962
+ }