@fugood/bricks-project 2.24.0-beta.3 → 2.24.0-beta.30

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 (112) hide show
  1. package/compile/action-name-map.ts +36 -0
  2. package/compile/index.ts +400 -146
  3. package/compile/util.ts +2 -0
  4. package/package.json +8 -3
  5. package/skills/bricks-project/rules/architecture-patterns.md +7 -0
  6. package/skills/bricks-project/rules/automations.md +74 -28
  7. package/skills/bricks-project/rules/buttress.md +9 -6
  8. package/tools/deploy.ts +66 -12
  9. package/tools/mcp-server.ts +10 -877
  10. package/tools/mcp-tools/compile.ts +91 -0
  11. package/tools/mcp-tools/huggingface.ts +762 -0
  12. package/tools/mcp-tools/icons.ts +60 -0
  13. package/tools/mcp-tools/lottie.ts +102 -0
  14. package/tools/mcp-tools/media.ts +110 -0
  15. package/tools/postinstall.ts +121 -33
  16. package/tools/preview-main.mjs +12 -8
  17. package/tools/pull.ts +37 -19
  18. package/tsconfig.json +16 -0
  19. package/types/animation.ts +4 -0
  20. package/types/automation.ts +3 -0
  21. package/types/brick-base.ts +1 -1
  22. package/types/bricks/Camera.ts +34 -7
  23. package/types/bricks/Chart.ts +1 -1
  24. package/types/bricks/GenerativeMedia.ts +6 -6
  25. package/types/bricks/Icon.ts +3 -3
  26. package/types/bricks/Image.ts +4 -4
  27. package/types/bricks/Items.ts +7 -7
  28. package/types/bricks/Lottie.ts +4 -4
  29. package/types/bricks/Maps.ts +4 -4
  30. package/types/bricks/QrCode.ts +4 -4
  31. package/types/bricks/Rect.ts +4 -4
  32. package/types/bricks/RichText.ts +3 -3
  33. package/types/bricks/Rive.ts +1 -1
  34. package/types/bricks/Slideshow.ts +4 -4
  35. package/types/bricks/Svg.ts +3 -3
  36. package/types/bricks/Text.ts +4 -4
  37. package/types/bricks/TextInput.ts +11 -7
  38. package/types/bricks/Video.ts +4 -4
  39. package/types/bricks/VideoStreaming.ts +3 -3
  40. package/types/bricks/WebRtcStream.ts +1 -1
  41. package/types/bricks/WebView.ts +4 -4
  42. package/types/canvas.ts +4 -2
  43. package/types/common.ts +9 -4
  44. package/types/data-calc-command.ts +2 -0
  45. package/types/data-calc.ts +1 -0
  46. package/types/data.ts +2 -0
  47. package/types/generators/AlarmClock.ts +5 -5
  48. package/types/generators/Assistant.ts +57 -12
  49. package/types/generators/BleCentral.ts +12 -4
  50. package/types/generators/BlePeripheral.ts +5 -5
  51. package/types/generators/CanvasMap.ts +4 -4
  52. package/types/generators/CastlesPay.ts +3 -3
  53. package/types/generators/DataBank.ts +31 -4
  54. package/types/generators/File.ts +63 -14
  55. package/types/generators/GraphQl.ts +3 -3
  56. package/types/generators/Http.ts +27 -8
  57. package/types/generators/HttpServer.ts +9 -9
  58. package/types/generators/Information.ts +2 -2
  59. package/types/generators/Intent.ts +8 -2
  60. package/types/generators/Iterator.ts +6 -6
  61. package/types/generators/Keyboard.ts +18 -8
  62. package/types/generators/LlmAnthropicCompat.ts +12 -6
  63. package/types/generators/LlmAppleBuiltin.ts +6 -6
  64. package/types/generators/LlmGgml.ts +101 -25
  65. package/types/generators/LlmMediaTekNeuroPilot.ts +225 -0
  66. package/types/generators/LlmMlx.ts +210 -0
  67. package/types/generators/LlmOnnx.ts +18 -9
  68. package/types/generators/LlmOpenAiCompat.ts +22 -6
  69. package/types/generators/LlmQualcommAiEngine.ts +32 -8
  70. package/types/generators/Mcp.ts +332 -17
  71. package/types/generators/McpServer.ts +38 -11
  72. package/types/generators/MediaFlow.ts +26 -8
  73. package/types/generators/MqttBroker.ts +10 -4
  74. package/types/generators/MqttClient.ts +11 -5
  75. package/types/generators/Question.ts +6 -6
  76. package/types/generators/RealtimeTranscription.ts +82 -11
  77. package/types/generators/RerankerGgml.ts +23 -9
  78. package/types/generators/SerialPort.ts +6 -6
  79. package/types/generators/SoundPlayer.ts +2 -2
  80. package/types/generators/SoundRecorder.ts +17 -6
  81. package/types/generators/SpeechToTextGgml.ts +34 -14
  82. package/types/generators/SpeechToTextOnnx.ts +8 -8
  83. package/types/generators/SpeechToTextPlatform.ts +4 -4
  84. package/types/generators/SqLite.ts +10 -6
  85. package/types/generators/Step.ts +3 -3
  86. package/types/generators/SttAppleBuiltin.ts +6 -6
  87. package/types/generators/Tcp.ts +5 -5
  88. package/types/generators/TcpServer.ts +7 -7
  89. package/types/generators/TextToSpeechApple.ts +1 -1
  90. package/types/generators/TextToSpeechAppleBuiltin.ts +5 -5
  91. package/types/generators/TextToSpeechGgml.ts +8 -8
  92. package/types/generators/TextToSpeechOnnx.ts +9 -9
  93. package/types/generators/TextToSpeechOpenAiLike.ts +5 -5
  94. package/types/generators/ThermalPrinter.ts +6 -6
  95. package/types/generators/Tick.ts +3 -3
  96. package/types/generators/Udp.ts +9 -4
  97. package/types/generators/VadGgml.ts +39 -10
  98. package/types/generators/VadOnnx.ts +31 -8
  99. package/types/generators/VadTraditional.ts +15 -9
  100. package/types/generators/VectorStore.ts +26 -9
  101. package/types/generators/Watchdog.ts +11 -6
  102. package/types/generators/WebCrawler.ts +5 -5
  103. package/types/generators/WebRtc.ts +17 -11
  104. package/types/generators/WebSocket.ts +5 -5
  105. package/types/generators/index.ts +2 -0
  106. package/types/subspace.ts +3 -0
  107. package/types/system.ts +1 -1
  108. package/utils/calc.ts +12 -8
  109. package/utils/event-props.ts +124 -87
  110. package/utils/id.ts +4 -0
  111. package/api/index.ts +0 -1
  112. package/api/instance.ts +0 -213
@@ -31,6 +31,11 @@ export type GeneratorRealtimeTranscriptionActionReset = Action & {
31
31
  __actionName: 'GENERATOR_REALTIME_TRANSCRIPTION_RESET'
32
32
  }
33
33
 
34
+ /* List available microphone devices (Web / Desktop only) */
35
+ export type GeneratorRealtimeTranscriptionActionListDevices = Action & {
36
+ __actionName: 'GENERATOR_REALTIME_TRANSCRIPTION_LIST_DEVICES'
37
+ }
38
+
34
39
  interface GeneratorRealtimeTranscriptionDef {
35
40
  /*
36
41
  Default property:
@@ -57,6 +62,10 @@ Default property:
57
62
  }
58
63
  */
59
64
  property?: {
65
+ /* Specifies the device ID to use for audio input.
66
+ Web / Desktop: device ID string from enumerateDevices
67
+ Android: audio source name - DEFAULT, MIC, VOICE_UPLINK, VOICE_DOWNLINK, VOICE_CALL, CAMCORDER, VOICE_RECOGNITION, VOICE_COMMUNICATION, UNPROCESSED */
68
+ deviceId?: string | DataLink
60
69
  /* STT Generator for Whisper context */
61
70
  sttGeneratorId?: string | DataLink | (() => Generator)
62
71
  /* STT Live Policy. If the policy is `only-in-use`, the STT context will be released when not in use. */
@@ -135,25 +144,86 @@ Default property:
135
144
  }
136
145
  outlets?: {
137
146
  /* Is realtime transcription currently active */
138
- isActive?: () => Data
147
+ isActive?: () => Data<boolean>
139
148
  /* Is currently transcribing audio */
140
- isTranscribing?: () => Data
149
+ isTranscribing?: () => Data<boolean>
141
150
  /* Current transcription results */
142
- results?: () => Data
151
+ results?: () => Data<
152
+ Array<{
153
+ transcribeEvent?: {
154
+ type?: string
155
+ sliceIndex?: number
156
+ isCapturing?: boolean
157
+ data?: {
158
+ result?: string
159
+ [key: string]: any
160
+ }
161
+ vadEvent?: {
162
+ type?: string
163
+ confidence?: number
164
+ duration?: number
165
+ sliceIndex?: number
166
+ timestamp?: number
167
+ [key: string]: any
168
+ }
169
+ [key: string]: any
170
+ }
171
+ vadEvent?: {
172
+ type?: string
173
+ confidence?: number
174
+ duration?: number
175
+ sliceIndex?: number
176
+ timestamp?: number
177
+ [key: string]: any
178
+ }
179
+ [key: string]: any
180
+ }>
181
+ >
143
182
  /* Current transcription result text */
144
- resultText?: () => Data
183
+ resultText?: () => Data<string>
145
184
  /* Last stabilized transcription result segment */
146
- lastStabilizedSegment?: () => Data
185
+ lastStabilizedSegment?: () => Data<string>
147
186
  /* Current statistics */
148
- statistics?: () => Data
187
+ statistics?: () => Data<{
188
+ type?: string
189
+ timestamp?: number
190
+ data?: { [key: string]: any }
191
+ [key: string]: any
192
+ }>
149
193
  /* Latest transcribe event */
150
- lastTranscribeEvent?: () => Data
194
+ lastTranscribeEvent?: () => Data<{
195
+ type?: string
196
+ sliceIndex?: number
197
+ isCapturing?: boolean
198
+ data?: {
199
+ result?: string
200
+ [key: string]: any
201
+ }
202
+ vadEvent?: {
203
+ type?: string
204
+ confidence?: number
205
+ duration?: number
206
+ sliceIndex?: number
207
+ timestamp?: number
208
+ [key: string]: any
209
+ }
210
+ [key: string]: any
211
+ }>
151
212
  /* Latest VAD event */
152
- lastVadEvent?: () => Data
213
+ lastVadEvent?: () => Data<{
214
+ type?: string
215
+ confidence?: number
216
+ duration?: number
217
+ sliceIndex?: number
218
+ timestamp?: number
219
+ [key: string]: any
220
+ }>
153
221
  /* Stabilized transcription text from completed slices */
154
- stabilizedText?: () => Data
222
+ stabilizedText?: () => Data<string>
155
223
  /* Audio output file path (auto-generated when saving audio) */
156
- audioOutputPath?: () => Data
224
+ audioOutputPath?: () => Data<string>
225
+ /* Available microphone devices (Web / Desktop only) */
226
+ devices?: () => Data<Array<any>>
157
227
  }
158
228
  }
159
229
 
@@ -161,7 +231,7 @@ Default property:
161
231
  export type GeneratorRealtimeTranscription = Generator &
162
232
  GeneratorRealtimeTranscriptionDef & {
163
233
  templateKey: 'GENERATOR_REALTIME_TRANSCRIPTION'
164
- switches: Array<
234
+ switches?: Array<
165
235
  SwitchDef &
166
236
  GeneratorRealtimeTranscriptionDef & {
167
237
  conds?: Array<{
@@ -182,6 +252,7 @@ export type GeneratorRealtimeTranscription = Generator &
182
252
  | 'lastVadEvent'
183
253
  | 'stabilizedText'
184
254
  | 'audioOutputPath'
255
+ | 'devices'
185
256
  value: any
186
257
  }
187
258
  }>
@@ -69,13 +69,13 @@ Default property:
69
69
  batchSize?: number | DataLink
70
70
  /* Physical maximum batch size (default: 512) */
71
71
  uBatchSize?: number | DataLink
72
- /* GGML accelerator variant (Only for desktop)
72
+ /* GGML accelerator variant (Only for desktop)
73
73
  `default` - CPU / Metal (macOS)
74
74
  `vulkan` - Use Vulkan
75
75
  `cuda` - Use CUDA
76
76
  `snapdragon` - Use OpenCL/Hexagon of Qualcomm Snapdragon */
77
77
  accelVariant?: 'default' | 'vulkan' | 'cuda' | 'snapdragon' | DataLink
78
- /* Devices. For example:
78
+ /* Devices. For example:
79
79
 
80
80
  Metal or CPU for iOS/tvOS/MacOS
81
81
  OpenCL or CPU for Android
@@ -109,19 +109,33 @@ Default property:
109
109
  }
110
110
  outlets?: {
111
111
  /* Current state of the reranker context (loading, ready, error, released) */
112
- contextState?: () => Data
112
+ contextState?: () => Data<string>
113
113
  /* Loading progress of the reranker model (0-100) */
114
- contextLoadProgress?: () => Data
114
+ contextLoadProgress?: () => Data<number>
115
115
  /* Detailed information about the reranker context including instance ID and processing status */
116
- contextDetails?: () => Data
116
+ contextDetails?: () => Data<{
117
+ state?: string
118
+ contextId?: string
119
+ gpu?: string
120
+ reasonNoGPU?: string
121
+ [key: string]: any
122
+ }>
117
123
  /* Result of the reranking operation containing scored and ranked documents */
118
- rerankResult?: () => Data
124
+ rerankResult?: () => Data<
125
+ Array<{
126
+ index?: number
127
+ score?: number
128
+ text?: string
129
+ payload?: { [key: string]: any }
130
+ [key: string]: any
131
+ }>
132
+ >
119
133
  /* Boolean indicating whether the reranker is currently processing a request */
120
- isProcessing?: () => Data
134
+ isProcessing?: () => Data<boolean>
121
135
  }
122
136
  }
123
137
 
124
- /* Local rerank based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
138
+ /* Local rerank based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
125
139
 
126
140
  ## Notice
127
141
  - The device RAM must be larger than 8GB
@@ -136,7 +150,7 @@ Default property:
136
150
  export type GeneratorReranker = Generator &
137
151
  GeneratorRerankerDef & {
138
152
  templateKey: 'GENERATOR_RERANKER'
139
- switches: Array<
153
+ switches?: Array<
140
154
  SwitchDef &
141
155
  GeneratorRerankerDef & {
142
156
  conds?: Array<{
@@ -103,15 +103,15 @@ Default property:
103
103
  }
104
104
  outlets?: {
105
105
  /* Available serial devices */
106
- generatorSerialDeviceList?: () => Data
106
+ generatorSerialDeviceList?: () => Data<Array<{ [key: string]: any }>>
107
107
  /* Is serial open */
108
- generatorSerialIsOpen?: () => Data
108
+ generatorSerialIsOpen?: () => Data<boolean>
109
109
  /* Last rerceive data (Base64) */
110
- generatorSerialLastDataBase64?: () => Data
110
+ generatorSerialLastDataBase64?: () => Data<string>
111
111
  /* Last rerceive plain text */
112
- generatorSerialLastDataString?: () => Data
112
+ generatorSerialLastDataString?: () => Data<string>
113
113
  /* Error message */
114
- generatorSerialErrorMessage?: () => Data
114
+ generatorSerialErrorMessage?: () => Data<string>
115
115
  }
116
116
  }
117
117
 
@@ -119,7 +119,7 @@ Default property:
119
119
  export type GeneratorSerialPort = Generator &
120
120
  GeneratorSerialPortDef & {
121
121
  templateKey: 'GENERATOR_SERIAL_PORT'
122
- switches: Array<
122
+ switches?: Array<
123
123
  SwitchDef &
124
124
  GeneratorSerialPortDef & {
125
125
  conds?: Array<{
@@ -61,7 +61,7 @@ Default property:
61
61
  }
62
62
  outlets?: {
63
63
  /* Whether the sound is playing */
64
- isPlaying?: () => Data
64
+ isPlaying?: () => Data<any>
65
65
  }
66
66
  }
67
67
 
@@ -69,7 +69,7 @@ Default property:
69
69
  export type GeneratorSoundPlayer = Generator &
70
70
  GeneratorSoundPlayerDef & {
71
71
  templateKey: 'GENERATOR_SOUND_PLAYER'
72
- switches: Array<
72
+ switches?: Array<
73
73
  SwitchDef &
74
74
  GeneratorSoundPlayerDef & {
75
75
  conds?: Array<{
@@ -31,6 +31,11 @@ export type GeneratorSoundRecorderActionStop = Action & {
31
31
  __actionName: 'GENERATOR_SOUND_RECORDER_STOP'
32
32
  }
33
33
 
34
+ /* List available microphone devices (Web / Desktop only) */
35
+ export type GeneratorSoundRecorderActionListDevices = Action & {
36
+ __actionName: 'GENERATOR_SOUND_RECORDER_LIST_DEVICES'
37
+ }
38
+
34
39
  interface GeneratorSoundRecorderDef {
35
40
  /*
36
41
  Default property:
@@ -51,6 +56,10 @@ Default property:
51
56
  property?: {
52
57
  /* Start record on init (Need user trigger on Web) */
53
58
  init?: boolean | DataLink
59
+ /* Specifies the device ID to use for audio input.
60
+ Web / Desktop: device ID string from enumerateDevices
61
+ Android: audio source name - DEFAULT, MIC, VOICE_UPLINK, VOICE_DOWNLINK, VOICE_CALL, CAMCORDER, VOICE_RECOGNITION, VOICE_COMMUNICATION, UNPROCESSED */
62
+ deviceId?: string | DataLink
54
63
  /* Record sample rate */
55
64
  sampleRate?: number | DataLink
56
65
  /* PCM bit depth */
@@ -82,13 +91,15 @@ Default property:
82
91
  }
83
92
  outlets?: {
84
93
  /* Is recording */
85
- isRecording?: () => Data
94
+ isRecording?: () => Data<boolean>
86
95
  /* Recorded file path */
87
- recordedPath?: () => Data
96
+ recordedPath?: () => Data<string>
88
97
  /* Current auto-cutting detected volume */
89
- volume?: () => Data
98
+ volume?: () => Data<number>
90
99
  /* Error message */
91
- errorMessage?: () => Data
100
+ errorMessage?: () => Data<string>
101
+ /* Available microphone devices (Web / Desktop only) */
102
+ devices?: () => Data<Array<any>>
92
103
  }
93
104
  }
94
105
 
@@ -96,7 +107,7 @@ Default property:
96
107
  export type GeneratorSoundRecorder = Generator &
97
108
  GeneratorSoundRecorderDef & {
98
109
  templateKey: 'GENERATOR_SOUND_RECORDER'
99
- switches: Array<
110
+ switches?: Array<
100
111
  SwitchDef &
101
112
  GeneratorSoundRecorderDef & {
102
113
  conds?: Array<{
@@ -106,7 +117,7 @@ export type GeneratorSoundRecorder = Generator &
106
117
  | SwitchCondData
107
118
  | {
108
119
  __typename: 'SwitchCondInnerStateOutlet'
109
- outlet: 'isRecording' | 'recordedPath' | 'volume' | 'errorMessage'
120
+ outlet: 'isRecording' | 'recordedPath' | 'volume' | 'errorMessage' | 'devices'
110
121
  value: any
111
122
  }
112
123
  }>
@@ -109,15 +109,15 @@ Default property:
109
109
  }
110
110
  */
111
111
  property?: {
112
- /* Initialize the Whisper context on generator initialization
112
+ /* Initialize the Whisper context on generator initialization
113
113
  Please note that it will take some RAM depending on the model size */
114
114
  init?: boolean | DataLink
115
- /* Accelerator variant (Only for desktop)
115
+ /* Accelerator variant (Only for desktop)
116
116
  `default` - CPU / Metal (macOS)
117
117
  `vulkan` - Use Vulkan
118
118
  `cuda` - Use CUDA */
119
119
  accelVariant?: 'default' | 'vulkan' | 'cuda' | DataLink
120
- /* Use model name, the model download progress will be done in preload stage or the generator initialization stage.
120
+ /* Use model name, the model download progress will be done in preload stage or the generator initialization stage.
121
121
  We used `ggml` format model, please refer to https://huggingface.co/BricksDisplay/whisper-ggml
122
122
  You can also choose `custom` option and set `Model URL` and `Model MD5` to use your own model */
123
123
  modelName?:
@@ -168,7 +168,7 @@ Default property:
168
168
  | 'distil-large-v3-q5_0'
169
169
  | 'distil-large-v3-q8_0'
170
170
  | DataLink
171
- /* The URL or path of model
171
+ /* The URL or path of model
172
172
  We used `ggml` format model, please refer to https://github.com/ggerganov/whisper.cpp/tree/master/models */
173
173
  modelUrl?: string | DataLink
174
174
  /* Hash type of model */
@@ -302,7 +302,7 @@ Default property:
302
302
  inferOffset?: number | DataLink
303
303
  /* Audio duration of audio to process in milliseconds */
304
304
  inferDuration?: number | DataLink
305
- /* The file URL or path to be inferred.
305
+ /* The file URL or path to be inferred.
306
306
  It only supported `wav` format with 16kHz sample rate & single (mono) channel */
307
307
  inferFileUrl?: string | DataLink
308
308
  /* MD5 of file to be inferred */
@@ -329,23 +329,43 @@ Default property:
329
329
  }
330
330
  outlets?: {
331
331
  /* Context state */
332
- contextState?: () => Data
332
+ contextState?: () => Data<string>
333
333
  /* Context details */
334
- contextDetails?: () => Data
334
+ contextDetails?: () => Data<{
335
+ state?: string
336
+ contextId?: string
337
+ gpu?: string
338
+ reasonNoGPU?: string
339
+ [key: string]: any
340
+ }>
335
341
  /* Is transcribing */
336
- isTranscribing?: () => Data
342
+ isTranscribing?: () => Data<boolean>
337
343
  /* Progress of transcribe audio (0-100) */
338
- transcribeProgress?: () => Data
344
+ transcribeProgress?: () => Data<number>
339
345
  /* Inference result */
340
- transcribeResult?: () => Data
346
+ transcribeResult?: () => Data<string>
341
347
  /* Inference result details */
342
- transcribeDetails?: () => Data
348
+ transcribeDetails?: () => Data<{
349
+ result?: string
350
+ segments?: Array<{
351
+ start?: number
352
+ end?: number
353
+ confidence?: number
354
+ t0?: number
355
+ t1?: number
356
+ [key: string]: any
357
+ }>
358
+ time?: number
359
+ startTime?: number
360
+ endTime?: number
361
+ [key: string]: any
362
+ }>
343
363
  /* Recorded audio file path of transcribe realtime (if `Save Audio` is enabled) */
344
- recordedPath?: () => Data
364
+ recordedPath?: () => Data<string>
345
365
  }
346
366
  }
347
367
 
348
- /* Local Speech-to-Text (STT) inference based on GGML and [whisper.cpp](https://github.com/ggerganov/whisper.cpp)
368
+ /* Local Speech-to-Text (STT) inference based on GGML and [whisper.cpp](https://github.com/ggerganov/whisper.cpp)
349
369
 
350
370
  ## Notice
351
371
  - iOS: Supported GPU acceleration, recommended use M1+ / A17+ chip device
@@ -355,7 +375,7 @@ Default property:
355
375
  export type GeneratorSpeechInference = Generator &
356
376
  GeneratorSpeechInferenceDef & {
357
377
  templateKey: 'GENERATOR_SPEECH_INFERENCE'
358
- switches: Array<
378
+ switches?: Array<
359
379
  SwitchDef &
360
380
  GeneratorSpeechInferenceDef & {
361
381
  conds?: Array<{
@@ -67,7 +67,7 @@ Default property:
67
67
  | DataLink
68
68
  /* Return timestamps */
69
69
  returnTimestamps?: 'none' | 'enable' | 'word' | DataLink
70
- /* Transcription language
70
+ /* Transcription language
71
71
  Not specifying the language will auto detect the language. */
72
72
  language?:
73
73
  | 'English'
@@ -174,12 +174,12 @@ Default property:
174
174
  task?: 'transcribe' | 'translate' | DataLink
175
175
  /* Inferencing chunk length */
176
176
  chunkLength?: number | DataLink
177
- /* Executor candidates, descending order of priority
177
+ /* Executor candidates, descending order of priority
178
178
  Default will be xnnpack, wasm, cpu */
179
179
  executors?:
180
180
  | Array<'qnn' | 'dml' | 'nnapi' | 'xnnpack' | 'coreml' | 'cpu' | 'wasm' | 'webgpu' | DataLink>
181
181
  | DataLink
182
- /* Execution mode
182
+ /* Execution mode
183
183
  Usually when the model has many branches, setting this option to `parallel` will give you better performance. */
184
184
  executionMode?: 'sequential' | 'parallel' | DataLink
185
185
  /* QNN backend */
@@ -197,20 +197,20 @@ Default property:
197
197
  }
198
198
  outlets?: {
199
199
  /* Context state */
200
- contextState?: () => Data
200
+ contextState?: () => Data<string>
201
201
  /* Inference result */
202
- result?: () => Data
202
+ result?: () => Data<string>
203
203
  /* Inference result detail */
204
- resultDetail?: () => Data
204
+ resultDetail?: () => Data<{ [key: string]: any }>
205
205
  }
206
206
  }
207
207
 
208
- /* Local STT inference based on [transformers.js](https://huggingface.co/docs/transformers.js)
208
+ /* Local STT inference based on [transformers.js](https://huggingface.co/docs/transformers.js)
209
209
  You can use any converted model on HuggingFace. */
210
210
  export type GeneratorOnnxSTT = Generator &
211
211
  GeneratorOnnxSTTDef & {
212
212
  templateKey: 'GENERATOR_ONNX_STT'
213
- switches: Array<
213
+ switches?: Array<
214
214
  SwitchDef &
215
215
  GeneratorOnnxSTTDef & {
216
216
  conds?: Array<{
@@ -46,11 +46,11 @@ Default property:
46
46
  }
47
47
  outlets?: {
48
48
  /* Recognized speech text */
49
- recognizedText?: () => Data
49
+ recognizedText?: () => Data<string>
50
50
  /* Error message */
51
- errorMessage?: () => Data
51
+ errorMessage?: () => Data<string>
52
52
  /* Listening status */
53
- listening?: () => Data
53
+ listening?: () => Data<boolean>
54
54
  }
55
55
  }
56
56
 
@@ -58,7 +58,7 @@ Default property:
58
58
  export type GeneratorPlatformSTT = Generator &
59
59
  GeneratorPlatformSTTDef & {
60
60
  templateKey: 'GENERATOR_PLATFORM_STT'
61
- switches: Array<
61
+ switches?: Array<
62
62
  SwitchDef &
63
63
  GeneratorPlatformSTTDef & {
64
64
  conds?: Array<{
@@ -114,15 +114,19 @@ Default property:
114
114
  }
115
115
  outlets?: {
116
116
  /* Whether the database is ready */
117
- isReady?: () => Data
117
+ isReady?: () => Data<boolean>
118
118
  /* Database path */
119
- dbPath?: () => Data
119
+ dbPath?: () => Data<string>
120
120
  /* Error message */
121
- error?: () => Data
121
+ error?: () => Data<string>
122
122
  /* Last query result */
123
- lastResult?: () => Data
123
+ lastResult?: () => Data<Array<{ [key: string]: any }>>
124
124
  /* Last execute result with metadata */
125
- lastExecuteResult?: () => Data
125
+ lastExecuteResult?: () => Data<{
126
+ rowsAffected?: number
127
+ insertId?: number
128
+ [key: string]: any
129
+ }>
126
130
  }
127
131
  }
128
132
 
@@ -130,7 +134,7 @@ Default property:
130
134
  export type GeneratorSqlite = Generator &
131
135
  GeneratorSqliteDef & {
132
136
  templateKey: 'GENERATOR_SQLITE'
133
- switches: Array<
137
+ switches?: Array<
134
138
  SwitchDef &
135
139
  GeneratorSqliteDef & {
136
140
  conds?: Array<{
@@ -74,9 +74,9 @@ Default property:
74
74
  }
75
75
  outlets?: {
76
76
  /* Result of step payload (If action is `outlet`) */
77
- payload?: () => Data
77
+ payload?: () => Data<string>
78
78
  /* Result of step index (If action is `outlet`) */
79
- index?: () => Data
79
+ index?: () => Data<number>
80
80
  }
81
81
  }
82
82
 
@@ -84,7 +84,7 @@ Default property:
84
84
  export type GeneratorStep = Generator &
85
85
  GeneratorStepDef & {
86
86
  templateKey: 'GENERATOR_STEP'
87
- switches: Array<
87
+ switches?: Array<
88
88
  SwitchDef &
89
89
  GeneratorStepDef & {
90
90
  conds?: Array<{
@@ -77,17 +77,17 @@ Default property:
77
77
  }
78
78
  outlets?: {
79
79
  /* State outlet (loading, ready, error) */
80
- state?: () => Data
80
+ state?: () => Data<string>
81
81
  /* Is transcribing */
82
- isTranscribing?: () => Data
82
+ isTranscribing?: () => Data<boolean>
83
83
  /* Transcribe result */
84
- transcribeResult?: () => Data
84
+ transcribeResult?: () => Data<string>
85
85
  /* Transcribe result details (result, segments, time, startTime, endTime, duration) */
86
- transcribeDetails?: () => Data
86
+ transcribeDetails?: () => Data<{ [key: string]: any }>
87
87
  }
88
88
  }
89
89
 
90
- /* Speech recognition on iOS 26+ (Not supported on tvOS)
90
+ /* Speech recognition on iOS 26+ (Not supported on tvOS)
91
91
 
92
92
  ## Features
93
93
  - Native Apple speech recognition
@@ -98,7 +98,7 @@ Default property:
98
98
  export type GeneratorAppleSTT = Generator &
99
99
  GeneratorAppleSTTDef & {
100
100
  templateKey: 'GENERATOR_APPLE_STT'
101
- switches: Array<
101
+ switches?: Array<
102
102
  SwitchDef &
103
103
  GeneratorAppleSTTDef & {
104
104
  conds?: Array<{
@@ -57,7 +57,7 @@ Default property:
57
57
  host?: string | DataLink
58
58
  /* Connection target port */
59
59
  port?: number | DataLink
60
- /* Data mode
60
+ /* Data mode
61
61
  CRLF: Receive until CRLF
62
62
  LF: Receive until LF
63
63
  raw: Raw packet */
@@ -91,11 +91,11 @@ Default property:
91
91
  }
92
92
  outlets?: {
93
93
  /* Connection status */
94
- status?: () => Data
94
+ status?: () => Data<string>
95
95
  /* Last received data */
96
- lastData?: () => Data
96
+ lastData?: () => Data<string>
97
97
  /* Error message */
98
- errorMessage?: () => Data
98
+ errorMessage?: () => Data<string>
99
99
  }
100
100
  }
101
101
 
@@ -103,7 +103,7 @@ Default property:
103
103
  export type GeneratorTCP = Generator &
104
104
  GeneratorTCPDef & {
105
105
  templateKey: 'GENERATOR_TCP'
106
- switches: Array<
106
+ switches?: Array<
107
107
  SwitchDef &
108
108
  GeneratorTCPDef & {
109
109
  conds?: Array<{
@@ -72,7 +72,7 @@ Default property:
72
72
  init?: boolean | DataLink
73
73
  /* Bind port of TCP server */
74
74
  port?: number | DataLink
75
- /* Data mode
75
+ /* Data mode
76
76
  CRLF: Receive until CRLF
77
77
  LF: Receive until LF
78
78
  raw: Raw packet */
@@ -106,15 +106,15 @@ Default property:
106
106
  }
107
107
  outlets?: {
108
108
  /* Server is listening */
109
- isListening?: () => Data
109
+ isListening?: () => Data<boolean>
110
110
  /* Is server started */
111
- started?: () => Data
111
+ started?: () => Data<boolean>
112
112
  /* Accepted connections */
113
- connections?: () => Data
113
+ connections?: () => Data<Array<string>>
114
114
  /* Last received data */
115
- lastData?: () => Data
115
+ lastData?: () => Data<string>
116
116
  /* Error message */
117
- errorMessage?: () => Data
117
+ errorMessage?: () => Data<string>
118
118
  }
119
119
  }
120
120
 
@@ -122,7 +122,7 @@ Default property:
122
122
  export type GeneratorTCPServer = Generator &
123
123
  GeneratorTCPServerDef & {
124
124
  templateKey: 'GENERATOR_TCP_SERVER'
125
- switches: Array<
125
+ switches?: Array<
126
126
  SwitchDef &
127
127
  GeneratorTCPServerDef & {
128
128
  conds?: Array<{
@@ -83,7 +83,7 @@ Default property:
83
83
  }
84
84
  }
85
85
 
86
- /* Text-to-speech synthesis using Apple's native speech synthesis
86
+ /* Text-to-speech synthesis using Apple's native speech synthesis
87
87
 
88
88
  ## Features
89
89
  - Native Apple speech synthesis