@fugood/bricks-project 2.24.0-beta.4 → 2.24.0-beta.40

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 (125) hide show
  1. package/compile/action-name-map.ts +38 -0
  2. package/compile/index.ts +429 -160
  3. package/compile/util.ts +2 -0
  4. package/package.json +7 -3
  5. package/package.json.bak +27 -0
  6. package/skills/bricks-design/LICENSE.txt +180 -0
  7. package/skills/bricks-design/SKILL.md +66 -0
  8. package/skills/bricks-project/SKILL.md +2 -2
  9. package/skills/bricks-project/rules/animation.md +1 -1
  10. package/skills/bricks-project/rules/architecture-patterns.md +7 -0
  11. package/skills/bricks-project/rules/automations.md +74 -28
  12. package/skills/bricks-project/rules/buttress.md +10 -7
  13. package/skills/bricks-project/rules/data-calculation.md +1 -1
  14. package/skills/bricks-project/rules/local-sync.md +2 -2
  15. package/skills/bricks-project/rules/media-flow.md +3 -3
  16. package/skills/bricks-project/rules/remote-data-bank.md +6 -6
  17. package/skills/bricks-project/rules/standby-transition.md +1 -1
  18. package/tools/deploy.ts +66 -12
  19. package/tools/icons/fa6pro-meta.json +3669 -26125
  20. package/tools/mcp-server.ts +11 -878
  21. package/tools/mcp-tools/compile.ts +91 -0
  22. package/tools/mcp-tools/huggingface.ts +762 -0
  23. package/tools/mcp-tools/icons.ts +70 -0
  24. package/tools/mcp-tools/lottie.ts +102 -0
  25. package/tools/mcp-tools/media.ts +110 -0
  26. package/tools/postinstall.ts +137 -40
  27. package/tools/preview-main.mjs +146 -9
  28. package/tools/preview.ts +30 -2
  29. package/tools/pull.ts +37 -19
  30. package/tsconfig.json +16 -0
  31. package/types/animation.ts +4 -0
  32. package/types/automation.ts +4 -1
  33. package/types/brick-base.ts +1 -1
  34. package/types/bricks/Camera.ts +48 -13
  35. package/types/bricks/Chart.ts +10 -4
  36. package/types/bricks/GenerativeMedia.ts +30 -14
  37. package/types/bricks/Icon.ts +9 -5
  38. package/types/bricks/Image.ts +10 -6
  39. package/types/bricks/Items.ts +29 -15
  40. package/types/bricks/Lottie.ts +15 -7
  41. package/types/bricks/Maps.ts +16 -8
  42. package/types/bricks/QrCode.ts +9 -5
  43. package/types/bricks/Rect.ts +45 -6
  44. package/types/bricks/RichText.ts +9 -5
  45. package/types/bricks/Rive.ts +21 -11
  46. package/types/bricks/Slideshow.ts +20 -10
  47. package/types/bricks/Svg.ts +8 -4
  48. package/types/bricks/Text.ts +9 -5
  49. package/types/bricks/TextInput.ts +23 -13
  50. package/types/bricks/Video.ts +11 -7
  51. package/types/bricks/VideoStreaming.ts +8 -4
  52. package/types/bricks/WebRtcStream.ts +7 -3
  53. package/types/bricks/WebView.ts +12 -8
  54. package/types/canvas.ts +4 -2
  55. package/types/common.ts +19 -12
  56. package/types/data-calc-command.ts +2 -0
  57. package/types/data-calc.ts +1 -0
  58. package/types/data.ts +2 -0
  59. package/types/generators/AlarmClock.ts +17 -11
  60. package/types/generators/Assistant.ts +69 -18
  61. package/types/generators/BleCentral.ts +31 -11
  62. package/types/generators/BlePeripheral.ts +11 -7
  63. package/types/generators/CanvasMap.ts +10 -6
  64. package/types/generators/CastlesPay.ts +15 -7
  65. package/types/generators/DataBank.ts +44 -9
  66. package/types/generators/File.ts +109 -30
  67. package/types/generators/GraphQl.ts +12 -6
  68. package/types/generators/Http.ts +33 -10
  69. package/types/generators/HttpServer.ts +23 -15
  70. package/types/generators/Information.ts +9 -5
  71. package/types/generators/Intent.ts +15 -5
  72. package/types/generators/Iterator.ts +15 -11
  73. package/types/generators/Keyboard.ts +27 -13
  74. package/types/generators/LlmAnthropicCompat.ts +33 -11
  75. package/types/generators/LlmAppleBuiltin.ts +25 -10
  76. package/types/generators/LlmGgml.ts +140 -31
  77. package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
  78. package/types/generators/LlmMlx.ts +227 -0
  79. package/types/generators/LlmOnnx.ts +34 -14
  80. package/types/generators/LlmOpenAiCompat.ts +47 -11
  81. package/types/generators/LlmQualcommAiEngine.ts +45 -13
  82. package/types/generators/Mcp.ts +375 -34
  83. package/types/generators/McpServer.ts +58 -19
  84. package/types/generators/MediaFlow.ts +38 -12
  85. package/types/generators/MqttBroker.ts +29 -11
  86. package/types/generators/MqttClient.ts +19 -9
  87. package/types/generators/Question.ts +13 -9
  88. package/types/generators/RealtimeTranscription.ts +108 -19
  89. package/types/generators/RerankerGgml.ts +43 -12
  90. package/types/generators/SerialPort.ts +18 -10
  91. package/types/generators/SoundPlayer.ts +10 -4
  92. package/types/generators/SoundRecorder.ts +24 -9
  93. package/types/generators/SpeechToTextGgml.ts +52 -18
  94. package/types/generators/SpeechToTextOnnx.ts +18 -11
  95. package/types/generators/SpeechToTextPlatform.ts +15 -7
  96. package/types/generators/SqLite.ts +20 -10
  97. package/types/generators/Step.ts +9 -5
  98. package/types/generators/SttAppleBuiltin.ts +22 -9
  99. package/types/generators/Tcp.ts +13 -9
  100. package/types/generators/TcpServer.ts +20 -14
  101. package/types/generators/TextToSpeechAppleBuiltin.ts +21 -8
  102. package/types/generators/TextToSpeechGgml.ts +29 -11
  103. package/types/generators/TextToSpeechOnnx.ts +19 -12
  104. package/types/generators/TextToSpeechOpenAiLike.ts +14 -8
  105. package/types/generators/ThermalPrinter.ts +13 -9
  106. package/types/generators/Tick.ts +11 -7
  107. package/types/generators/Udp.ts +17 -8
  108. package/types/generators/VadGgml.ts +51 -14
  109. package/types/generators/VadOnnx.ts +42 -12
  110. package/types/generators/VadTraditional.ts +28 -13
  111. package/types/generators/VectorStore.ts +33 -12
  112. package/types/generators/Watchdog.ts +19 -10
  113. package/types/generators/WebCrawler.ts +11 -7
  114. package/types/generators/WebRtc.ts +30 -16
  115. package/types/generators/WebSocket.ts +11 -7
  116. package/types/generators/index.ts +2 -0
  117. package/types/subspace.ts +3 -0
  118. package/types/system.ts +1 -1
  119. package/utils/calc.ts +12 -8
  120. package/utils/event-props.ts +833 -1022
  121. package/utils/id.ts +4 -0
  122. package/api/index.ts +0 -1
  123. package/api/instance.ts +0 -213
  124. package/types/generators/TextToSpeechApple.ts +0 -113
  125. package/types/generators/TtsAppleBuiltin.ts +0 -105
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Embedded MQTT broker server with client authentication, publish/subscribe messaging, keepalive, and retry support
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Start MQTT broker server */
15
19
  export type GeneratorMQTTBrokerActionStart = Action & {
@@ -80,31 +84,45 @@ Default property:
80
84
  /* Event of MQTT server is ready */
81
85
  onReady?: Array<EventAction>
82
86
  /* Event of server or connection error */
83
- onError?: Array<EventAction>
87
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['MqttBroker']['onError']>>
84
88
  /* Event of client connected */
85
- onClientConnected?: Array<EventAction>
89
+ onClientConnected?: Array<
90
+ EventAction<string & keyof TemplateEventPropsMap['MqttBroker']['onClientConnected']>
91
+ >
86
92
  /* Event of client disconnected */
87
- onClientDisconnected?: Array<EventAction>
93
+ onClientDisconnected?: Array<
94
+ EventAction<string & keyof TemplateEventPropsMap['MqttBroker']['onClientDisconnected']>
95
+ >
88
96
  /* Event of message received */
89
- onMessageReceived?: Array<EventAction>
97
+ onMessageReceived?: Array<
98
+ EventAction<string & keyof TemplateEventPropsMap['MqttBroker']['onMessageReceived']>
99
+ >
90
100
  /* Event of message published */
91
- onMessagePublished?: Array<EventAction>
101
+ onMessagePublished?: Array<
102
+ EventAction<string & keyof TemplateEventPropsMap['MqttBroker']['onMessagePublished']>
103
+ >
92
104
  }
93
105
  outlets?: {
94
106
  /* Is server started */
95
- started?: () => Data
107
+ started?: () => Data<boolean>
96
108
  /* Last received message */
97
- lastMessage?: () => Data
109
+ lastMessage?: () => Data<{
110
+ topic?: string
111
+ payload?: any
112
+ qos?: number
113
+ retain?: boolean
114
+ [key: string]: any
115
+ }>
98
116
  /* Error message */
99
- errorMessage?: () => Data
117
+ errorMessage?: () => Data<string>
100
118
  }
101
119
  }
102
120
 
103
- /* MQTT Broker server */
121
+ /* Embedded MQTT broker server with client authentication, publish/subscribe messaging, keepalive, and retry support */
104
122
  export type GeneratorMQTTBroker = Generator &
105
123
  GeneratorMQTTBrokerDef & {
106
124
  templateKey: 'GENERATOR_MQTT_BROKER'
107
- switches: Array<
125
+ switches?: Array<
108
126
  SwitchDef &
109
127
  GeneratorMQTTBrokerDef & {
110
128
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * MQTT client with topic subscribe/publish, QoS levels (0/1/2), auto-reconnect, and auth support. Connects via mqtt:// or wss://
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Connect to MQTT broker */
15
19
  export type GeneratorMQTTActionConnect = Action & {
@@ -92,27 +96,33 @@ Default property:
92
96
  /* When disconnected from MQTT broker */
93
97
  onDisconnected?: Array<EventAction>
94
98
  /* When error occurred */
95
- onError?: Array<EventAction>
99
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Mqtt']['onError']>>
96
100
  /* When received message from MQTT broker within subscribe topic */
97
- onMessage?: Array<EventAction>
101
+ onMessage?: Array<EventAction<string & keyof TemplateEventPropsMap['Mqtt']['onMessage']>>
98
102
  }
99
103
  outlets?: {
100
104
  /* Connected or not */
101
- connected?: () => Data
105
+ connected?: () => Data<boolean>
102
106
  /* Error Message */
103
- error?: () => Data
107
+ error?: () => Data<string>
104
108
  /* The receive message */
105
- message?: () => Data
109
+ message?: () => Data<{
110
+ topic?: string
111
+ payload?: any
112
+ qos?: number
113
+ retain?: boolean
114
+ [key: string]: any
115
+ }>
106
116
  /* The receive message (payload only) */
107
- messagePayload?: () => Data
117
+ messagePayload?: () => Data<any>
108
118
  }
109
119
  }
110
120
 
111
- /* MQTT protocol messaging */
121
+ /* MQTT client with topic subscribe/publish, QoS levels (0/1/2), auto-reconnect, and auth support. Connects via mqtt:// or wss:// */
112
122
  export type GeneratorMQTT = Generator &
113
123
  GeneratorMQTTDef & {
114
124
  templateKey: 'GENERATOR_MQTT'
115
- switches: Array<
125
+ switches?: Array<
116
126
  SwitchDef &
117
127
  GeneratorMQTTDef & {
118
128
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Prompt user for input via dialog and return the response
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Start inquire */
15
19
  export type GeneratorQuestionActionStart = Action & {
@@ -60,7 +64,7 @@ Default property:
60
64
  property?: {
61
65
  /* Modal mode */
62
66
  modalMode?: 'root' | 'in-subspace' | DataLink
63
- /* Inquirer schema
67
+ /* Inquirer schema
64
68
  `key`: Field key (unique, required)
65
69
  `kind`: Field type (required)
66
70
  `title`: Field or message title
@@ -367,25 +371,25 @@ Default property:
367
371
  /* Event of completed inquire */
368
372
  onCompleted?: Array<EventAction>
369
373
  /* Event of error occured */
370
- onError?: Array<EventAction>
374
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Question']['onError']>>
371
375
  }
372
376
  outlets?: {
373
377
  /* Result data */
374
- data?: () => Data
378
+ data?: () => Data<{ [key: string]: any }>
375
379
  /* Currnet question */
376
- currectKey?: () => Data
380
+ currectKey?: () => Data<string>
377
381
  /* Currnet input value */
378
- currectValue?: () => Data
382
+ currectValue?: () => Data<any>
379
383
  /* Error message */
380
- errorMessage?: () => Data
384
+ errorMessage?: () => Data<string>
381
385
  }
382
386
  }
383
387
 
384
- /* Question inquirer */
388
+ /* Prompt user for input via dialog and return the response */
385
389
  export type GeneratorQuestion = Generator &
386
390
  GeneratorQuestionDef & {
387
391
  templateKey: 'GENERATOR_QUESTION'
388
- switches: Array<
392
+ switches?: Array<
389
393
  SwitchDef &
390
394
  GeneratorQuestionDef & {
391
395
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Realtime speech-to-text transcription using Whisper and VAD with live audio streaming
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Start realtime transcription */
15
19
  export type GeneratorRealtimeTranscriptionActionStart = Action & {
@@ -31,6 +35,11 @@ export type GeneratorRealtimeTranscriptionActionReset = Action & {
31
35
  __actionName: 'GENERATOR_REALTIME_TRANSCRIPTION_RESET'
32
36
  }
33
37
 
38
+ /* List available microphone devices (Web / Desktop only) */
39
+ export type GeneratorRealtimeTranscriptionActionListDevices = Action & {
40
+ __actionName: 'GENERATOR_REALTIME_TRANSCRIPTION_LIST_DEVICES'
41
+ }
42
+
34
43
  interface GeneratorRealtimeTranscriptionDef {
35
44
  /*
36
45
  Default property:
@@ -57,6 +66,10 @@ Default property:
57
66
  }
58
67
  */
59
68
  property?: {
69
+ /* Specifies the device ID to use for audio input.
70
+ Web / Desktop: device ID string from enumerateDevices
71
+ Android: audio source name - DEFAULT, MIC, VOICE_UPLINK, VOICE_DOWNLINK, VOICE_CALL, CAMCORDER, VOICE_RECOGNITION, VOICE_COMMUNICATION, UNPROCESSED */
72
+ deviceId?: string | DataLink
60
73
  /* STT Generator for Whisper context */
61
74
  sttGeneratorId?: string | DataLink | (() => Generator)
62
75
  /* STT Live Policy. If the policy is `only-in-use`, the STT context will be released when not in use. */
@@ -119,41 +132,116 @@ Default property:
119
132
  }
120
133
  events?: {
121
134
  /* Event triggered when transcription starts, processes, or ends */
122
- onTranscribe?: Array<EventAction>
135
+ onTranscribe?: Array<
136
+ EventAction<string & keyof TemplateEventPropsMap['RealtimeTranscription']['onTranscribe']>
137
+ >
123
138
  /* Event triggered on VAD (Voice Activity Detection) events */
124
- onVad?: Array<EventAction>
139
+ onVad?: Array<
140
+ EventAction<string & keyof TemplateEventPropsMap['RealtimeTranscription']['onVad']>
141
+ >
125
142
  /* Event triggered when error occurs */
126
- onError?: Array<EventAction>
143
+ onError?: Array<
144
+ EventAction<string & keyof TemplateEventPropsMap['RealtimeTranscription']['onError']>
145
+ >
127
146
  /* Event triggered when status changes */
128
- onStatusChange?: Array<EventAction>
147
+ onStatusChange?: Array<
148
+ EventAction<string & keyof TemplateEventPropsMap['RealtimeTranscription']['onStatusChange']>
149
+ >
129
150
  /* Event triggered when statistics update */
130
- onStatsUpdate?: Array<EventAction>
151
+ onStatsUpdate?: Array<
152
+ EventAction<string & keyof TemplateEventPropsMap['RealtimeTranscription']['onStatsUpdate']>
153
+ >
131
154
  /* Event triggered when slice transcription is stabilized */
132
- onStabilized?: Array<EventAction>
155
+ onStabilized?: Array<
156
+ EventAction<string & keyof TemplateEventPropsMap['RealtimeTranscription']['onStabilized']>
157
+ >
133
158
  /* Event triggered when transcription ends */
134
- onEnd?: Array<EventAction>
159
+ onEnd?: Array<
160
+ EventAction<string & keyof TemplateEventPropsMap['RealtimeTranscription']['onEnd']>
161
+ >
135
162
  }
136
163
  outlets?: {
137
164
  /* Is realtime transcription currently active */
138
- isActive?: () => Data
165
+ isActive?: () => Data<boolean>
139
166
  /* Is currently transcribing audio */
140
- isTranscribing?: () => Data
167
+ isTranscribing?: () => Data<boolean>
141
168
  /* Current transcription results */
142
- results?: () => Data
169
+ results?: () => Data<
170
+ Array<{
171
+ transcribeEvent?: {
172
+ type?: string
173
+ sliceIndex?: number
174
+ isCapturing?: boolean
175
+ data?: {
176
+ result?: string
177
+ [key: string]: any
178
+ }
179
+ vadEvent?: {
180
+ type?: string
181
+ confidence?: number
182
+ duration?: number
183
+ sliceIndex?: number
184
+ timestamp?: number
185
+ [key: string]: any
186
+ }
187
+ [key: string]: any
188
+ }
189
+ vadEvent?: {
190
+ type?: string
191
+ confidence?: number
192
+ duration?: number
193
+ sliceIndex?: number
194
+ timestamp?: number
195
+ [key: string]: any
196
+ }
197
+ [key: string]: any
198
+ }>
199
+ >
143
200
  /* Current transcription result text */
144
- resultText?: () => Data
201
+ resultText?: () => Data<string>
145
202
  /* Last stabilized transcription result segment */
146
- lastStabilizedSegment?: () => Data
203
+ lastStabilizedSegment?: () => Data<string>
147
204
  /* Current statistics */
148
- statistics?: () => Data
205
+ statistics?: () => Data<{
206
+ type?: string
207
+ timestamp?: number
208
+ data?: { [key: string]: any }
209
+ [key: string]: any
210
+ }>
149
211
  /* Latest transcribe event */
150
- lastTranscribeEvent?: () => Data
212
+ lastTranscribeEvent?: () => Data<{
213
+ type?: string
214
+ sliceIndex?: number
215
+ isCapturing?: boolean
216
+ data?: {
217
+ result?: string
218
+ [key: string]: any
219
+ }
220
+ vadEvent?: {
221
+ type?: string
222
+ confidence?: number
223
+ duration?: number
224
+ sliceIndex?: number
225
+ timestamp?: number
226
+ [key: string]: any
227
+ }
228
+ [key: string]: any
229
+ }>
151
230
  /* Latest VAD event */
152
- lastVadEvent?: () => Data
231
+ lastVadEvent?: () => Data<{
232
+ type?: string
233
+ confidence?: number
234
+ duration?: number
235
+ sliceIndex?: number
236
+ timestamp?: number
237
+ [key: string]: any
238
+ }>
153
239
  /* Stabilized transcription text from completed slices */
154
- stabilizedText?: () => Data
240
+ stabilizedText?: () => Data<string>
155
241
  /* Audio output file path (auto-generated when saving audio) */
156
- audioOutputPath?: () => Data
242
+ audioOutputPath?: () => Data<string>
243
+ /* Available microphone devices (Web / Desktop only) */
244
+ devices?: () => Data<Array<any>>
157
245
  }
158
246
  }
159
247
 
@@ -161,7 +249,7 @@ Default property:
161
249
  export type GeneratorRealtimeTranscription = Generator &
162
250
  GeneratorRealtimeTranscriptionDef & {
163
251
  templateKey: 'GENERATOR_REALTIME_TRANSCRIPTION'
164
- switches: Array<
252
+ switches?: Array<
165
253
  SwitchDef &
166
254
  GeneratorRealtimeTranscriptionDef & {
167
255
  conds?: Array<{
@@ -182,6 +270,7 @@ export type GeneratorRealtimeTranscription = Generator &
182
270
  | 'lastVadEvent'
183
271
  | 'stabilizedText'
184
272
  | 'audioOutputPath'
273
+ | 'devices'
185
274
  value: any
186
275
  }
187
276
  }>
@@ -1,4 +1,18 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Local rerank based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
4
+ *
5
+ * ## Notice
6
+ * - The device RAM must be larger than 8GB
7
+ * - iOS: Recommended use M1+ / A17+ chip device. Supported GPU acceleration by Metal.
8
+ * - macOS: Recommended use M1+ chip device. Supported GPU acceleration by Metal.
9
+ * - Android: Recommended use Android 13+ system.
10
+ * - Supported GPU acceleration by OpenCL, currently only for Qualcomm Adreno 700+ GPUs, other GPUs are not supported.
11
+ * - Supported Hexagon NPU for Qualcomm Snapdragon 8 Gen 2+ GPUs.
12
+ * - Linux / Windows
13
+ * - Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property
14
+ * - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux)
15
+ */
2
16
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
17
  import type { Data, DataLink } from '../data'
4
18
  import type {
@@ -10,6 +24,7 @@ import type {
10
24
  Action,
11
25
  EventProperty,
12
26
  } from '../common'
27
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
28
 
14
29
  /* Load the model */
15
30
  export type GeneratorRerankerActionLoadModel = Action & {
@@ -69,13 +84,13 @@ Default property:
69
84
  batchSize?: number | DataLink
70
85
  /* Physical maximum batch size (default: 512) */
71
86
  uBatchSize?: number | DataLink
72
- /* GGML accelerator variant (Only for desktop)
87
+ /* GGML accelerator variant (Only for desktop)
73
88
  `default` - CPU / Metal (macOS)
74
89
  `vulkan` - Use Vulkan
75
90
  `cuda` - Use CUDA
76
91
  `snapdragon` - Use OpenCL/Hexagon of Qualcomm Snapdragon */
77
92
  accelVariant?: 'default' | 'vulkan' | 'cuda' | 'snapdragon' | DataLink
78
- /* Devices. For example:
93
+ /* Devices. For example:
79
94
 
80
95
  Metal or CPU for iOS/tvOS/MacOS
81
96
  OpenCL or CPU for Android
@@ -103,25 +118,41 @@ Default property:
103
118
  }
104
119
  events?: {
105
120
  /* Event triggered when the reranker context state changes (loading, ready, error, released) */
106
- onContextStateChange?: Array<EventAction>
121
+ onContextStateChange?: Array<
122
+ EventAction<string & keyof TemplateEventPropsMap['Reranker']['onContextStateChange']>
123
+ >
107
124
  /* Event triggered when an error occurs during reranker operations */
108
- onError?: Array<EventAction>
125
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Reranker']['onError']>>
109
126
  }
110
127
  outlets?: {
111
128
  /* Current state of the reranker context (loading, ready, error, released) */
112
- contextState?: () => Data
129
+ contextState?: () => Data<string>
113
130
  /* Loading progress of the reranker model (0-100) */
114
- contextLoadProgress?: () => Data
131
+ contextLoadProgress?: () => Data<number>
115
132
  /* Detailed information about the reranker context including instance ID and processing status */
116
- contextDetails?: () => Data
133
+ contextDetails?: () => Data<{
134
+ state?: string
135
+ contextId?: string
136
+ gpu?: string
137
+ reasonNoGPU?: string
138
+ [key: string]: any
139
+ }>
117
140
  /* Result of the reranking operation containing scored and ranked documents */
118
- rerankResult?: () => Data
141
+ rerankResult?: () => Data<
142
+ Array<{
143
+ index?: number
144
+ score?: number
145
+ text?: string
146
+ payload?: { [key: string]: any }
147
+ [key: string]: any
148
+ }>
149
+ >
119
150
  /* Boolean indicating whether the reranker is currently processing a request */
120
- isProcessing?: () => Data
151
+ isProcessing?: () => Data<boolean>
121
152
  }
122
153
  }
123
154
 
124
- /* Local rerank based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
155
+ /* Local rerank based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
125
156
 
126
157
  ## Notice
127
158
  - The device RAM must be larger than 8GB
@@ -136,7 +167,7 @@ Default property:
136
167
  export type GeneratorReranker = Generator &
137
168
  GeneratorRerankerDef & {
138
169
  templateKey: 'GENERATOR_RERANKER'
139
- switches: Array<
170
+ switches?: Array<
140
171
  SwitchDef &
141
172
  GeneratorRerankerDef & {
142
173
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Serial port communication for USB/UART devices (Android, Desktop only)
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Get available serial devices */
15
19
  export type GeneratorSerialPortActionGeneratorSerialGetDeviceList = Action & {
@@ -97,29 +101,33 @@ Default property:
97
101
  /* Event for detach the device */
98
102
  generatorSerialOnDetach?: Array<EventAction>
99
103
  /* Event on error */
100
- generatorSerialOnError?: Array<EventAction>
104
+ generatorSerialOnError?: Array<
105
+ EventAction<string & keyof TemplateEventPropsMap['SerialPort']['generatorSerialOnError']>
106
+ >
101
107
  /* Event for receive data */
102
- generatorSerialOnData?: Array<EventAction>
108
+ generatorSerialOnData?: Array<
109
+ EventAction<string & keyof TemplateEventPropsMap['SerialPort']['generatorSerialOnData']>
110
+ >
103
111
  }
104
112
  outlets?: {
105
113
  /* Available serial devices */
106
- generatorSerialDeviceList?: () => Data
114
+ generatorSerialDeviceList?: () => Data<Array<{ [key: string]: any }>>
107
115
  /* Is serial open */
108
- generatorSerialIsOpen?: () => Data
116
+ generatorSerialIsOpen?: () => Data<boolean>
109
117
  /* Last rerceive data (Base64) */
110
- generatorSerialLastDataBase64?: () => Data
118
+ generatorSerialLastDataBase64?: () => Data<string>
111
119
  /* Last rerceive plain text */
112
- generatorSerialLastDataString?: () => Data
120
+ generatorSerialLastDataString?: () => Data<string>
113
121
  /* Error message */
114
- generatorSerialErrorMessage?: () => Data
122
+ generatorSerialErrorMessage?: () => Data<string>
115
123
  }
116
124
  }
117
125
 
118
- /* Serial Port Generator (Unsupported iOS) */
126
+ /* Serial port communication for USB/UART devices (Android, Desktop only) */
119
127
  export type GeneratorSerialPort = Generator &
120
128
  GeneratorSerialPortDef & {
121
129
  templateKey: 'GENERATOR_SERIAL_PORT'
122
- switches: Array<
130
+ switches?: Array<
123
131
  SwitchDef &
124
132
  GeneratorSerialPortDef & {
125
133
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Play sound, see supported formats at https://developer.android.com/guide/topics/media/media-formats
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Start playing sound */
15
19
  export type GeneratorSoundPlayerActionPlay = Action & {
@@ -53,7 +57,9 @@ Default property:
53
57
  /* Sound file loaded successfully */
54
58
  onLoad?: Array<EventAction>
55
59
  /* Sound file load error */
56
- onLoadError?: Array<EventAction>
60
+ onLoadError?: Array<
61
+ EventAction<string & keyof TemplateEventPropsMap['SoundPlayer']['onLoadError']>
62
+ >
57
63
  /* Sound playback complete */
58
64
  onPlay?: Array<EventAction>
59
65
  /* Sound file playback end */
@@ -61,7 +67,7 @@ Default property:
61
67
  }
62
68
  outlets?: {
63
69
  /* Whether the sound is playing */
64
- isPlaying?: () => Data
70
+ isPlaying?: () => Data<any>
65
71
  }
66
72
  }
67
73
 
@@ -69,7 +75,7 @@ Default property:
69
75
  export type GeneratorSoundPlayer = Generator &
70
76
  GeneratorSoundPlayerDef & {
71
77
  templateKey: 'GENERATOR_SOUND_PLAYER'
72
- switches: Array<
78
+ switches?: Array<
73
79
  SwitchDef &
74
80
  GeneratorSoundPlayerDef & {
75
81
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Record audio (Microphone)
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Start record */
15
19
  export type GeneratorSoundRecorderActionStart = Action & {
@@ -31,6 +35,11 @@ export type GeneratorSoundRecorderActionStop = Action & {
31
35
  __actionName: 'GENERATOR_SOUND_RECORDER_STOP'
32
36
  }
33
37
 
38
+ /* List available microphone devices (Web / Desktop only) */
39
+ export type GeneratorSoundRecorderActionListDevices = Action & {
40
+ __actionName: 'GENERATOR_SOUND_RECORDER_LIST_DEVICES'
41
+ }
42
+
34
43
  interface GeneratorSoundRecorderDef {
35
44
  /*
36
45
  Default property:
@@ -51,6 +60,10 @@ Default property:
51
60
  property?: {
52
61
  /* Start record on init (Need user trigger on Web) */
53
62
  init?: boolean | DataLink
63
+ /* Specifies the device ID to use for audio input.
64
+ Web / Desktop: device ID string from enumerateDevices
65
+ Android: audio source name - DEFAULT, MIC, VOICE_UPLINK, VOICE_DOWNLINK, VOICE_CALL, CAMCORDER, VOICE_RECOGNITION, VOICE_COMMUNICATION, UNPROCESSED */
66
+ deviceId?: string | DataLink
54
67
  /* Record sample rate */
55
68
  sampleRate?: number | DataLink
56
69
  /* PCM bit depth */
@@ -76,19 +89,21 @@ Default property:
76
89
  }
77
90
  events?: {
78
91
  /* Event for chunk data (Base64 encoded PCM) */
79
- chunk?: Array<EventAction>
92
+ chunk?: Array<EventAction<string & keyof TemplateEventPropsMap['SoundRecorder']['chunk']>>
80
93
  /* Event for recorded file */
81
- recorded?: Array<EventAction>
94
+ recorded?: Array<EventAction<string & keyof TemplateEventPropsMap['SoundRecorder']['recorded']>>
82
95
  }
83
96
  outlets?: {
84
97
  /* Is recording */
85
- isRecording?: () => Data
98
+ isRecording?: () => Data<boolean>
86
99
  /* Recorded file path */
87
- recordedPath?: () => Data
100
+ recordedPath?: () => Data<string>
88
101
  /* Current auto-cutting detected volume */
89
- volume?: () => Data
102
+ volume?: () => Data<number>
90
103
  /* Error message */
91
- errorMessage?: () => Data
104
+ errorMessage?: () => Data<string>
105
+ /* Available microphone devices (Web / Desktop only) */
106
+ devices?: () => Data<Array<any>>
92
107
  }
93
108
  }
94
109
 
@@ -96,7 +111,7 @@ Default property:
96
111
  export type GeneratorSoundRecorder = Generator &
97
112
  GeneratorSoundRecorderDef & {
98
113
  templateKey: 'GENERATOR_SOUND_RECORDER'
99
- switches: Array<
114
+ switches?: Array<
100
115
  SwitchDef &
101
116
  GeneratorSoundRecorderDef & {
102
117
  conds?: Array<{
@@ -106,7 +121,7 @@ export type GeneratorSoundRecorder = Generator &
106
121
  | SwitchCondData
107
122
  | {
108
123
  __typename: 'SwitchCondInnerStateOutlet'
109
- outlet: 'isRecording' | 'recordedPath' | 'volume' | 'errorMessage'
124
+ outlet: 'isRecording' | 'recordedPath' | 'volume' | 'errorMessage' | 'devices'
110
125
  value: any
111
126
  }
112
127
  }>