tjbot-ce 3.0.1

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 (224) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +382 -0
  3. package/dist/camera/camera.d.ts +62 -0
  4. package/dist/camera/camera.d.ts.map +1 -0
  5. package/dist/camera/camera.js +155 -0
  6. package/dist/camera/camera.js.map +1 -0
  7. package/dist/camera/index.d.ts +18 -0
  8. package/dist/camera/index.d.ts.map +1 -0
  9. package/dist/camera/index.js +18 -0
  10. package/dist/camera/index.js.map +1 -0
  11. package/dist/config/config-types.d.ts +75 -0
  12. package/dist/config/config-types.d.ts.map +1 -0
  13. package/dist/config/config-types.generated.d.ts +495 -0
  14. package/dist/config/config-types.generated.d.ts.map +1 -0
  15. package/dist/config/config-types.generated.js +2 -0
  16. package/dist/config/config-types.generated.js.map +1 -0
  17. package/dist/config/config-types.js +175 -0
  18. package/dist/config/config-types.js.map +1 -0
  19. package/dist/config/index.d.ts +20 -0
  20. package/dist/config/index.d.ts.map +1 -0
  21. package/dist/config/index.js +19 -0
  22. package/dist/config/index.js.map +1 -0
  23. package/dist/config/tjbot-config.d.ts +98 -0
  24. package/dist/config/tjbot-config.d.ts.map +1 -0
  25. package/dist/config/tjbot-config.js +309 -0
  26. package/dist/config/tjbot-config.js.map +1 -0
  27. package/dist/config/vendor/colors.yaml +61 -0
  28. package/dist/config/vendor/model-registry.yaml +275 -0
  29. package/dist/config/vendor/tjbot-config.schema.yaml +792 -0
  30. package/dist/config/vendor/tjbot.default.toml +452 -0
  31. package/dist/led/index.d.ts +20 -0
  32. package/dist/led/index.d.ts.map +1 -0
  33. package/dist/led/index.js +20 -0
  34. package/dist/led/index.js.map +1 -0
  35. package/dist/led/led-common-anode.d.ts +38 -0
  36. package/dist/led/led-common-anode.d.ts.map +1 -0
  37. package/dist/led/led-common-anode.js +79 -0
  38. package/dist/led/led-common-anode.js.map +1 -0
  39. package/dist/led/led-neopixel-spi.d.ts +60 -0
  40. package/dist/led/led-neopixel-spi.d.ts.map +1 -0
  41. package/dist/led/led-neopixel-spi.js +216 -0
  42. package/dist/led/led-neopixel-spi.js.map +1 -0
  43. package/dist/led/led-neopixel-ws281x.js +186 -0
  44. package/dist/led/led-neopixel.d.ts +57 -0
  45. package/dist/led/led-neopixel.d.ts.map +1 -0
  46. package/dist/led/led-neopixel.js +235 -0
  47. package/dist/led/led-neopixel.js.map +1 -0
  48. package/dist/microphone/index.d.ts +18 -0
  49. package/dist/microphone/index.d.ts.map +1 -0
  50. package/dist/microphone/index.js +18 -0
  51. package/dist/microphone/index.js.map +1 -0
  52. package/dist/microphone/microphone.d.ts +65 -0
  53. package/dist/microphone/microphone.d.ts.map +1 -0
  54. package/dist/microphone/microphone.js +179 -0
  55. package/dist/microphone/microphone.js.map +1 -0
  56. package/dist/rpi-drivers/index.d.ts +22 -0
  57. package/dist/rpi-drivers/index.d.ts.map +1 -0
  58. package/dist/rpi-drivers/index.js +22 -0
  59. package/dist/rpi-drivers/index.js.map +1 -0
  60. package/dist/rpi-drivers/rpi-detect.d.ts +24 -0
  61. package/dist/rpi-drivers/rpi-detect.d.ts.map +1 -0
  62. package/dist/rpi-drivers/rpi-detect.js +49 -0
  63. package/dist/rpi-drivers/rpi-detect.js.map +1 -0
  64. package/dist/rpi-drivers/rpi-driver.d.ts +116 -0
  65. package/dist/rpi-drivers/rpi-driver.d.ts.map +1 -0
  66. package/dist/rpi-drivers/rpi-driver.js +261 -0
  67. package/dist/rpi-drivers/rpi-driver.js.map +1 -0
  68. package/dist/rpi-drivers/rpi3-driver.d.ts +47 -0
  69. package/dist/rpi-drivers/rpi3-driver.d.ts.map +1 -0
  70. package/dist/rpi-drivers/rpi3-driver.js +145 -0
  71. package/dist/rpi-drivers/rpi3-driver.js.map +1 -0
  72. package/dist/rpi-drivers/rpi4-driver.d.ts +35 -0
  73. package/dist/rpi-drivers/rpi4-driver.d.ts.map +1 -0
  74. package/dist/rpi-drivers/rpi4-driver.js +101 -0
  75. package/dist/rpi-drivers/rpi4-driver.js.map +1 -0
  76. package/dist/rpi-drivers/rpi5-driver.d.ts +33 -0
  77. package/dist/rpi-drivers/rpi5-driver.d.ts.map +1 -0
  78. package/dist/rpi-drivers/rpi5-driver.js +78 -0
  79. package/dist/rpi-drivers/rpi5-driver.js.map +1 -0
  80. package/dist/servo/index.d.ts +19 -0
  81. package/dist/servo/index.d.ts.map +1 -0
  82. package/dist/servo/index.js +19 -0
  83. package/dist/servo/index.js.map +1 -0
  84. package/dist/servo/servo-constants.d.ts +33 -0
  85. package/dist/servo/servo-constants.d.ts.map +1 -0
  86. package/dist/servo/servo-constants.js +34 -0
  87. package/dist/servo/servo-constants.js.map +1 -0
  88. package/dist/servo/servo-lgpio.d.ts +82 -0
  89. package/dist/servo/servo-lgpio.d.ts.map +1 -0
  90. package/dist/servo/servo-lgpio.js +178 -0
  91. package/dist/servo/servo-lgpio.js.map +1 -0
  92. package/dist/speaker/audio-player.d.ts +30 -0
  93. package/dist/speaker/audio-player.d.ts.map +1 -0
  94. package/dist/speaker/audio-player.js +68 -0
  95. package/dist/speaker/audio-player.js.map +1 -0
  96. package/dist/speaker/index.d.ts +18 -0
  97. package/dist/speaker/index.d.ts.map +1 -0
  98. package/dist/speaker/index.js +18 -0
  99. package/dist/speaker/index.js.map +1 -0
  100. package/dist/speaker/speaker.d.ts +53 -0
  101. package/dist/speaker/speaker.d.ts.map +1 -0
  102. package/dist/speaker/speaker.js +125 -0
  103. package/dist/speaker/speaker.js.map +1 -0
  104. package/dist/stt/backends/azure-stt.d.ts +32 -0
  105. package/dist/stt/backends/azure-stt.d.ts.map +1 -0
  106. package/dist/stt/backends/azure-stt.js +227 -0
  107. package/dist/stt/backends/azure-stt.js.map +1 -0
  108. package/dist/stt/backends/google-cloud-stt.d.ts +31 -0
  109. package/dist/stt/backends/google-cloud-stt.d.ts.map +1 -0
  110. package/dist/stt/backends/google-cloud-stt.js +371 -0
  111. package/dist/stt/backends/google-cloud-stt.js.map +1 -0
  112. package/dist/stt/backends/ibm-watson-stt.d.ts +32 -0
  113. package/dist/stt/backends/ibm-watson-stt.d.ts.map +1 -0
  114. package/dist/stt/backends/ibm-watson-stt.js +190 -0
  115. package/dist/stt/backends/ibm-watson-stt.js.map +1 -0
  116. package/dist/stt/backends/sherpa-onnx-stt.d.ts +117 -0
  117. package/dist/stt/backends/sherpa-onnx-stt.d.ts.map +1 -0
  118. package/dist/stt/backends/sherpa-onnx-stt.js +694 -0
  119. package/dist/stt/backends/sherpa-onnx-stt.js.map +1 -0
  120. package/dist/stt/index.d.ts +20 -0
  121. package/dist/stt/index.d.ts.map +1 -0
  122. package/dist/stt/index.js +21 -0
  123. package/dist/stt/index.js.map +1 -0
  124. package/dist/stt/stt-engine.d.ts +68 -0
  125. package/dist/stt/stt-engine.d.ts.map +1 -0
  126. package/dist/stt/stt-engine.js +99 -0
  127. package/dist/stt/stt-engine.js.map +1 -0
  128. package/dist/stt/stt-utils.d.ts +36 -0
  129. package/dist/stt/stt-utils.d.ts.map +1 -0
  130. package/dist/stt/stt-utils.js +112 -0
  131. package/dist/stt/stt-utils.js.map +1 -0
  132. package/dist/stt/stt.d.ts +52 -0
  133. package/dist/stt/stt.d.ts.map +1 -0
  134. package/dist/stt/stt.js +100 -0
  135. package/dist/stt/stt.js.map +1 -0
  136. package/dist/tjbot.d.ts +317 -0
  137. package/dist/tjbot.d.ts.map +1 -0
  138. package/dist/tjbot.js +736 -0
  139. package/dist/tjbot.js.map +1 -0
  140. package/dist/tts/backends/azure-tts.d.ts +30 -0
  141. package/dist/tts/backends/azure-tts.d.ts.map +1 -0
  142. package/dist/tts/backends/azure-tts.js +92 -0
  143. package/dist/tts/backends/azure-tts.js.map +1 -0
  144. package/dist/tts/backends/google-cloud-tts.d.ts +38 -0
  145. package/dist/tts/backends/google-cloud-tts.d.ts.map +1 -0
  146. package/dist/tts/backends/google-cloud-tts.js +116 -0
  147. package/dist/tts/backends/google-cloud-tts.js.map +1 -0
  148. package/dist/tts/backends/ibm-watson-tts.d.ts +42 -0
  149. package/dist/tts/backends/ibm-watson-tts.d.ts.map +1 -0
  150. package/dist/tts/backends/ibm-watson-tts.js +99 -0
  151. package/dist/tts/backends/ibm-watson-tts.js.map +1 -0
  152. package/dist/tts/backends/sherpa-onnx-tts.d.ts +80 -0
  153. package/dist/tts/backends/sherpa-onnx-tts.d.ts.map +1 -0
  154. package/dist/tts/backends/sherpa-onnx-tts.js +237 -0
  155. package/dist/tts/backends/sherpa-onnx-tts.js.map +1 -0
  156. package/dist/tts/index.d.ts +19 -0
  157. package/dist/tts/index.d.ts.map +1 -0
  158. package/dist/tts/index.js +20 -0
  159. package/dist/tts/index.js.map +1 -0
  160. package/dist/tts/tts-engine.d.ts +67 -0
  161. package/dist/tts/tts-engine.d.ts.map +1 -0
  162. package/dist/tts/tts-engine.js +109 -0
  163. package/dist/tts/tts-engine.js.map +1 -0
  164. package/dist/tts/tts.d.ts +47 -0
  165. package/dist/tts/tts.d.ts.map +1 -0
  166. package/dist/tts/tts.js +101 -0
  167. package/dist/tts/tts.js.map +1 -0
  168. package/dist/utils/colors.d.ts +39 -0
  169. package/dist/utils/colors.d.ts.map +1 -0
  170. package/dist/utils/colors.js +155 -0
  171. package/dist/utils/colors.js.map +1 -0
  172. package/dist/utils/constants.d.ts +41 -0
  173. package/dist/utils/constants.d.ts.map +1 -0
  174. package/dist/utils/constants.js +43 -0
  175. package/dist/utils/constants.js.map +1 -0
  176. package/dist/utils/credentials.d.ts +43 -0
  177. package/dist/utils/credentials.d.ts.map +1 -0
  178. package/dist/utils/credentials.js +121 -0
  179. package/dist/utils/credentials.js.map +1 -0
  180. package/dist/utils/errors.d.ts +26 -0
  181. package/dist/utils/errors.d.ts.map +1 -0
  182. package/dist/utils/errors.js +32 -0
  183. package/dist/utils/errors.js.map +1 -0
  184. package/dist/utils/index.d.ts +25 -0
  185. package/dist/utils/index.d.ts.map +1 -0
  186. package/dist/utils/index.js +23 -0
  187. package/dist/utils/index.js.map +1 -0
  188. package/dist/utils/logging.d.ts +44 -0
  189. package/dist/utils/logging.d.ts.map +1 -0
  190. package/dist/utils/logging.js +113 -0
  191. package/dist/utils/logging.js.map +1 -0
  192. package/dist/utils/model-registry.d.ts +142 -0
  193. package/dist/utils/model-registry.d.ts.map +1 -0
  194. package/dist/utils/model-registry.js +391 -0
  195. package/dist/utils/model-registry.js.map +1 -0
  196. package/dist/utils/utils.d.ts +33 -0
  197. package/dist/utils/utils.d.ts.map +1 -0
  198. package/dist/utils/utils.js +50 -0
  199. package/dist/utils/utils.js.map +1 -0
  200. package/dist/vision/backends/azure-vision.d.ts +33 -0
  201. package/dist/vision/backends/azure-vision.d.ts.map +1 -0
  202. package/dist/vision/backends/azure-vision.js +151 -0
  203. package/dist/vision/backends/azure-vision.js.map +1 -0
  204. package/dist/vision/backends/google-cloud-vision.d.ts +32 -0
  205. package/dist/vision/backends/google-cloud-vision.d.ts.map +1 -0
  206. package/dist/vision/backends/google-cloud-vision.js +193 -0
  207. package/dist/vision/backends/google-cloud-vision.js.map +1 -0
  208. package/dist/vision/backends/onnx.d.ts +116 -0
  209. package/dist/vision/backends/onnx.d.ts.map +1 -0
  210. package/dist/vision/backends/onnx.js +781 -0
  211. package/dist/vision/backends/onnx.js.map +1 -0
  212. package/dist/vision/index.d.ts +19 -0
  213. package/dist/vision/index.d.ts.map +1 -0
  214. package/dist/vision/index.js +20 -0
  215. package/dist/vision/index.js.map +1 -0
  216. package/dist/vision/vision-engine.d.ts +131 -0
  217. package/dist/vision/vision-engine.d.ts.map +1 -0
  218. package/dist/vision/vision-engine.js +97 -0
  219. package/dist/vision/vision-engine.js.map +1 -0
  220. package/dist/vision/vision.d.ts +48 -0
  221. package/dist/vision/vision.d.ts.map +1 -0
  222. package/dist/vision/vision.js +83 -0
  223. package/dist/vision/vision.js.map +1 -0
  224. package/package.json +124 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
package/README.md ADDED
@@ -0,0 +1,382 @@
1
+ # TJBot Library (Node.js)
2
+
3
+ [![Raspberry Pi](https://img.shields.io/badge/Raspberry%20Pi-3B+-cc342d)](https://www.raspberrypi.org/)
4
+ [![Node.js](https://img.shields.io/badge/Node.js-20%2B-yellow)](https://nodejs.org/)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=flat&logo=typescript&logoColor=white)](https://typescriptlang.org/)
6
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
7
+
8
+ ## What is TJBot?
9
+
10
+ [TJBot](https://tjbot-ce.github.io) is an open-source robot created by IBM for learning how to program artificial intelligence applications. This library provides a simple, high-level interface to control TJBot running on a Raspberry Pi.
11
+
12
+ ## What Can TJBot Do?
13
+
14
+ TJBot's core capabilities are:
15
+
16
+ - **Listen** – Capture and transcribe speech with Speech-to-Text
17
+ - **See** – Recognize objects, faces, and image classes (and describe images with Azure Vision)
18
+ - **Shine** – Control an RGB LED in various colors and effects
19
+ - **Speak** – Play audio and synthesize speech with Text-to-Speech
20
+ - **Wave** – Move its arm using a servo motor
21
+
22
+ This library supports **local AI backends** ([sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) for speech, [ONNX
23
+ runtime](https://onnxruntime.ai) for vision) and **cloud services** for speech and vision, including IBM
24
+ Watson (speech), Google Cloud (speech + vision), and Microsoft Azure (speech +
25
+ vision).
26
+
27
+ ## System Dependencies
28
+
29
+ Install additional system packages:
30
+
31
+ ```bash
32
+ sudo apt-get install libgpiod-dev liblgpiod-dev rpicam-apps-lite
33
+ ```
34
+
35
+ > [!TIP]
36
+ > These packages are installed as part of TJBot's setup script.
37
+
38
+ ## Installation
39
+
40
+ Install the library from npm:
41
+
42
+ ```bash
43
+ npm install --save tjbot-ce
44
+ ```
45
+
46
+ > [!TIP]
47
+ > The easiest way to create a new Node.js-based TJBot recipe is using the `tjbot` command: `tjbot create [recipe-name]`, which will automatically set up `node-tjbotlib` as a dependency.
48
+
49
+ ## Quick Start
50
+
51
+ ### Importing & Instantiating TJBot
52
+
53
+ Use ES6 module syntax to import the TJBot class in your recipe. This example initializes TJBot's LED and servo motor.
54
+
55
+ ```ts
56
+ import TJBot from 'tjbot-ce';
57
+
58
+ tj = TJBot.getInstance().initialize({
59
+ hardware: {
60
+ led: true,
61
+ servo: true
62
+ }
63
+ });
64
+ ```
65
+
66
+ > [!NOTE] TJBot uses a singleton pattern since there is only a single TJBot.
67
+
68
+ ### Example 1: Control an LED
69
+
70
+ This example initializes a NeoPixel LED on the GPIO 18 pin and sets it to various colors:
71
+
72
+ ```ts
73
+ import TJBot from 'tjbot-ce';
74
+
75
+ const tj = TJBot.getInstance().initialize({
76
+ hardware: {
77
+ led: true
78
+ },
79
+ shine: {
80
+ hasNeopixelLED: true,
81
+ neopixel: {
82
+ gpioPin: 18
83
+ }
84
+ }
85
+ });
86
+
87
+ // Set LED to red
88
+ await tj.shine('red');
89
+
90
+ // Set LED to green (using hexadecimal)
91
+ await tj.shine('#00FF00');
92
+
93
+ // Pulse the LED blue
94
+ await tj.pulse('blue');
95
+ ```
96
+
97
+ ### Example 2: Speak Text using Text-to-Speech (TTS)
98
+
99
+ This example demonstrates how to make TJBot speak using on-device Text-to-Speech.
100
+
101
+ > [!NOTE]
102
+ > The text-to-speech backend used by TJBot is set in TJBot's configuration file, located at `~/.tjbot/tjbot.toml`. By default, TJBot uses the `sherpa-onnx` text-to-speech backend.
103
+
104
+ ```ts
105
+ import TJBot from 'tjbot-ce';
106
+
107
+ const tj = TJBot.getInstance().initialize({
108
+ hardware: {
109
+ speaker: true
110
+ },
111
+ speak: {
112
+ backend: {
113
+ type: "local"
114
+ }
115
+ }
116
+ });
117
+
118
+ await tj.speak('Hello, I am T J Bot!');
119
+ ```
120
+
121
+ > [!IMPORTANT]
122
+ > Many Text-to-Speech models are not trained to pronounce "TJBot" the way it is written. Writing it out as "T J Bot" makes it easier for these models to pronounce it correctly.
123
+
124
+
125
+ ### Example 3: Change TJBot's Configuration
126
+
127
+ TJBot uses a cascading configuration system that loads settings from multiple
128
+ sources in order of priority. First, default configuration settings are loaded from the `tjbot.default.toml` file that is bundled within `node-tjbotlib`. Next, user-specific configuration is loaded from your `~/.tjbot/tjbot.toml` configuration file. Finally, recipe-specific configuration is loaded from the `recipe.toml` file in your recipe's directory (if present).
129
+
130
+ **User configuration (`~/.tjbot/tjbot.toml`):**
131
+
132
+ This file contains configuration settings for the hardware components of your TJBot, such as which pins the LED and servo are connected to, which audio devices to use for recording & playback, and which STT/TTS/Vision backends to use. Example:
133
+
134
+ ```toml
135
+ [log]
136
+ level = 'debug' # TJBot will print a lot of detail about its operations to the console
137
+
138
+ [shine.neopixel]
139
+ gpioPin = 18 # GPIO 18 / Physical Pin 12
140
+
141
+ ...
142
+ ```
143
+
144
+ > [!TIP]
145
+ > You can either use the `tjbot config` command to edit TJBot's configuration or you can edit the `~/.tjbot/tjbot.toml` file directly.
146
+
147
+ **Recipe-specific configuration (`recipe.toml`):**
148
+
149
+ This file contains configuration settings for your recipe. It is placed in
150
+ your project directory.
151
+
152
+ ```toml
153
+ tjbot_name = "tinker"
154
+ favorite_color = "blue"
155
+ cloud_api_key = "xyzabc"
156
+ ```
157
+
158
+ Recipe-specific settings are loaded using the `TJBot.getRecipeConfig()` class method.
159
+
160
+ ```ts
161
+ import TJBot from 'tjbot-ce';
162
+
163
+ // read recipe-specific config
164
+ const config = TJBot.getRecipeConfig();
165
+
166
+ const tj = TJBot.getInstance().initialize({
167
+ hardware: {
168
+ led: true
169
+ }
170
+ });
171
+
172
+ const favorite_color = config.favorite_color as string;
173
+ tj.shine(favorite_color);
174
+ ```
175
+
176
+ ### Using `override_config` for Runtime Configuration
177
+
178
+ You can also pass specific configuration requirements directly to the `TJBot.initialize()` method using the `overrideConfig` parameter. This configuration **merges with** the cascaded defaults (not replaces them):
179
+
180
+ ```ts
181
+ import TJBot from 'tjbot-ce';
182
+
183
+ const config = {
184
+ shine: {
185
+ hasNeopixelLED: true,
186
+ neopixel: {gpioPin: 18}
187
+ }
188
+ };
189
+
190
+ tj = TJBot.getInstance().initialize(config);
191
+
192
+ // The final config is: defaults + ~/.tjbot/tjbot.toml + override_config
193
+ ```
194
+
195
+ > [!TIP]
196
+ > You can use `overrideConfig` to explicitly enable any specific hardware required for your recipe.
197
+
198
+ ## Configuration Reference
199
+
200
+ TJBot uses [TOML](https://toml.io/en/) for its configuration. The canonical default configuration lives in [vendor/tjbot-config/tjbot.default.toml](vendor/tjbot-config/tjbot.default.toml) and follows the schema specified in [vendor/tjbot-config/tjbot-config.schema.yaml](vendor/tjbot-config/tjbot-config.schema.yaml).
201
+
202
+ These files are synced into `src/config/` during builds. They can be synced manually by running this command:
203
+
204
+ ```bash
205
+ npm run sync:config-schema
206
+ ```
207
+
208
+ ### Custom Models & Model Registry
209
+
210
+ TJBot ships with a built-in model registry in `vendor/tjbot-config/model-registry.yaml`. The registry is synced into `src/config/model-registry.yaml` during builds for local development and packaging. You can register additional ML models in your `~/.tjbot/tjbot.toml` file. Search for the section titled "On-Device ML Models".
211
+
212
+ Example: register a custom vision classification model and use it locally:
213
+
214
+ ```toml
215
+ [[models]]
216
+ type = 'vision.classification'
217
+ key = 'my-classifier'
218
+ label = 'My Classifier'
219
+ url = 'file:///home/pi/models/my-classifier.zip'
220
+ folder = 'my-classifier'
221
+ kind = 'classification'
222
+ required = ['model.onnx', 'labels.txt']
223
+ labelUrl = 'file:///home/pi/models/labels.txt'
224
+ inputShape = [1, 3, 224, 224]
225
+
226
+ [see.backend]
227
+ type = 'local'
228
+
229
+ [see.backend.local]
230
+ imageClassificationModel = 'my-classifier'
231
+ ```
232
+
233
+ You can register custom speech models in the same way.
234
+
235
+ ## API Documentation
236
+
237
+ For detailed API documentation, method signatures, and advanced usage, visit
238
+ the [TJBot Node.js SDK Reference](https://tjbot-ce.github.io/docs/node-tjbotlib/3.0.0/).
239
+
240
+ ## Testing
241
+
242
+ The library uses [Vitest](https://vitest.dev/) for testing with two tiers of
243
+ tests:
244
+
245
+ ### Automated Tests (Core Tests)
246
+
247
+ TJBot ships with a number of unit tests that verify the library's core functionality.
248
+
249
+ ```bash
250
+ # Run all automated tests
251
+ npm run test
252
+
253
+ # Run tests with coverage report
254
+ npm run test:coverage
255
+ ```
256
+
257
+ These tests run on a Raspberry Pi but do not require any specific TJBot
258
+ hardware.
259
+
260
+ > [!WARNING]
261
+ > TJBot's software has not been tested on operating systems or hardware
262
+ > other than Raspian OS on Raspberry Pi.
263
+
264
+ ### Interactive Hardware Tests (Live Tests)
265
+
266
+ TJBot also ships with a number of interactive tests meant to test (and debug) your Raspberry Pi hardware setup. These tests validate each of these components:
267
+
268
+ ```bash
269
+ # Test the camera
270
+ npm run test-camera
271
+
272
+ # Test the LED
273
+ npm run test-led
274
+
275
+ # Test the microphone
276
+ npm run test-microphone
277
+
278
+ # Test the servo
279
+ npm run test-servo
280
+
281
+ # Test the speaker
282
+ npm run test-speaker
283
+
284
+ # Test the STT service (allows you to choose which backend to use)
285
+ npm run test-stt
286
+
287
+ # Test the TTS service (allows you to choose which backend to use)
288
+ npm run test-tts
289
+
290
+ # Test the Vision service (allows you to choose which backend to use and which vision task to perform)
291
+ npm run test-vision
292
+ ```
293
+
294
+ > [!WARNING]
295
+ > These tests must be run on a Raspberry Pi with properly connected hardware components.
296
+
297
+ ## Development
298
+
299
+ To set up a local development environment, you will first need to check out `node-tjbotlib` from GitHub. Then you will create a new recipe and point it to your locally-checked out copy of `node-tjbotlib`.
300
+
301
+ ### Clone `node-tjbotlib`
302
+
303
+ 1. **Clone the repository**
304
+
305
+ ```bash
306
+ git clone --recurse-submodules https://github.com/tjbot-ce/node-tjbotlib.git
307
+ cd node-tjbotlib
308
+ ```
309
+
310
+ If you already cloned the repo without submodules, run:
311
+
312
+ ```bash
313
+ git submodule update --init --recursive
314
+ ```
315
+
316
+ This initializes the shared TJBot configuration assets submodule at `vendor/tjbot-config`.
317
+
318
+ 2. **Install dependencies**
319
+
320
+ ```bash
321
+ npm install
322
+ ```
323
+
324
+ 3. **Build the TypeScript code**
325
+
326
+ ```bash
327
+ npm run build
328
+ ```
329
+
330
+ 4. **Link the repository for npm**
331
+
332
+ ```bash
333
+ npm link
334
+ ```
335
+
336
+ 5. **Run tests**
337
+
338
+ ```bash
339
+ npm run test
340
+ ```
341
+
342
+ 6. **Lint and format code**
343
+
344
+ ```bash
345
+ npm run lint
346
+ npm run format
347
+ ```
348
+
349
+ ### Create a Recipe
350
+
351
+ Create a new recipe using `tjbot create <recipe>`, then link it to the local version of `node-tjbotlib`.
352
+
353
+ 1. **Create a new recipe**
354
+
355
+ ```bash
356
+ tjbot create my_recipe
357
+ ```
358
+
359
+ 2. **Link the recipe to the local `node-tjbotlib`**
360
+
361
+ ```bash
362
+ cd my_recipe
363
+ npm link tjbot
364
+ ```
365
+
366
+ 3. **Install dependencies**
367
+
368
+ ```bash
369
+ npm install
370
+ ```
371
+
372
+ ## Troubleshoot
373
+
374
+ If you are having difficulties in making your TJBot work, please see the [troubleshooting guide](https://github.com/tjbot-ce/tjbot/wiki/Troubleshooting-TJBot).
375
+
376
+ ## Contribute
377
+
378
+ If you would like to contribute to TJBot, please see the [contributor's guide](https://github.com/tjbot-ce/tjbot/wiki/Contributing-to-TJBot).
379
+
380
+ ## License
381
+
382
+ This project is licensed under Apache 2.0. Full license text is available in [LICENSE](LICENSE).
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Copyright 2025 IBM Corp. All Rights Reserved.
3
+ * Copyright 2026-present TJBot Contributors. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Camera controller for TJBot
19
+ * Handles camera initialization and photo capture using rpi-cam-lib
20
+ */
21
+ export declare class CameraController {
22
+ private resolution;
23
+ private verticalFlip;
24
+ private horizontalFlip;
25
+ private captureTimeout;
26
+ private zeroShutterLag;
27
+ constructor();
28
+ /**
29
+ * Initialize the camera with configuration
30
+ * @param resolution Camera resolution as [width, height]
31
+ * @param verticalFlip Whether to vertically flip the image
32
+ * @param horizontalFlip Whether to horizontally flip the image
33
+ * @param captureTimeout Timeout in milliseconds before capturing (default: 500)
34
+ * @param zeroShutterLag Enable zero shutter lag mode (default: false)
35
+ */
36
+ initialize(resolution: [number, number], verticalFlip: boolean, horizontalFlip: boolean, captureTimeout?: number, zeroShutterLag?: boolean): void;
37
+ /**
38
+ * Build rpicam-still command arguments
39
+ * @param outputPath Output path or '-' for stdout
40
+ * @param encoding Optional encoding format (e.g., 'jpg')
41
+ * @returns Array of command-line arguments
42
+ */
43
+ private buildCameraArgs;
44
+ /**
45
+ * Capture a photo by invoking rpicam-still via child_process
46
+ * @param atPath Optional path to save the photo. If not provided, a temporary file will be used.
47
+ * @returns Path to the saved photo
48
+ * @throws TJBotError if the camera command fails
49
+ */
50
+ capturePhoto(atPath?: string): Promise<string>;
51
+ /**
52
+ * Capture a photo and return it as a Buffer
53
+ * @returns Promise that resolves to a Buffer containing the photo data
54
+ * @throws TJBotError if the camera capture fails
55
+ */
56
+ capturePhotoBuffer(): Promise<Buffer>;
57
+ /**
58
+ * Clean up resources (no-op for direct process invocation)
59
+ */
60
+ cleanup(): void;
61
+ }
62
+ //# sourceMappingURL=camera.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../src/camera/camera.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH;;;GAGG;AAEH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,UAAU,CAAmB;IACrC,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,cAAc,CAAU;;IAUhC;;;;;;;OAOG;IACH,UAAU,CACN,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,YAAY,EAAE,OAAO,EACrB,cAAc,EAAE,OAAO,EACvB,cAAc,GAAE,MAAY,EAC5B,cAAc,GAAE,OAAe,GAChC,IAAI;IAeP;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAsCvB;;;;;OAKG;IACG,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAwBpD;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAsB3C;;OAEG;IACH,OAAO,IAAI,IAAI;CAGlB"}