@fugood/bricks-ctor 2.25.0-beta.6 → 2.25.0-beta.61

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 (133) hide show
  1. package/package.json +4 -24
  2. package/tools/deploy.ts +19 -165
  3. package/tools/mcp-server.ts +17 -26
  4. package/tools/postinstall.ts +21 -235
  5. package/tools/pull.ts +18 -121
  6. package/tools/push-config.ts +19 -0
  7. package/tools/simulator.ts +21 -0
  8. package/compile/action-name-map.ts +0 -1015
  9. package/compile/index.ts +0 -1278
  10. package/compile/util.ts +0 -358
  11. package/index.ts +0 -6
  12. package/skills/bricks-ctor/SKILL.md +0 -32
  13. package/skills/bricks-ctor/rules/animation.md +0 -159
  14. package/skills/bricks-ctor/rules/architecture-patterns.md +0 -69
  15. package/skills/bricks-ctor/rules/automations.md +0 -221
  16. package/skills/bricks-ctor/rules/buttress.md +0 -156
  17. package/skills/bricks-ctor/rules/data-calculation.md +0 -209
  18. package/skills/bricks-ctor/rules/local-sync.md +0 -129
  19. package/skills/bricks-ctor/rules/media-flow.md +0 -158
  20. package/skills/bricks-ctor/rules/remote-data-bank.md +0 -196
  21. package/skills/bricks-ctor/rules/standby-transition.md +0 -124
  22. package/skills/bricks-design/LICENSE.txt +0 -180
  23. package/skills/bricks-design/SKILL.md +0 -66
  24. package/skills/rive-marketplace/SKILL.md +0 -99
  25. package/tools/_git-author.ts +0 -29
  26. package/tools/_shell.ts +0 -173
  27. package/tools/icons/.gitattributes +0 -1
  28. package/tools/icons/fa6pro-glyphmap.json +0 -4686
  29. package/tools/icons/fa6pro-meta.json +0 -1
  30. package/tools/mcp-tools/compile.ts +0 -92
  31. package/tools/mcp-tools/huggingface.ts +0 -762
  32. package/tools/mcp-tools/icons.ts +0 -81
  33. package/tools/mcp-tools/lottie.ts +0 -102
  34. package/tools/mcp-tools/media.ts +0 -110
  35. package/tools/preview-main.mjs +0 -293
  36. package/tools/preview.ts +0 -150
  37. package/types/animation.ts +0 -100
  38. package/types/automation.ts +0 -235
  39. package/types/brick-base.ts +0 -80
  40. package/types/bricks/Camera.ts +0 -246
  41. package/types/bricks/Chart.ts +0 -372
  42. package/types/bricks/GenerativeMedia.ts +0 -290
  43. package/types/bricks/Icon.ts +0 -98
  44. package/types/bricks/Image.ts +0 -114
  45. package/types/bricks/Items.ts +0 -476
  46. package/types/bricks/Lottie.ts +0 -168
  47. package/types/bricks/Maps.ts +0 -262
  48. package/types/bricks/QrCode.ts +0 -117
  49. package/types/bricks/Rect.ts +0 -150
  50. package/types/bricks/RichText.ts +0 -128
  51. package/types/bricks/Rive.ts +0 -220
  52. package/types/bricks/Sketch.ts +0 -254
  53. package/types/bricks/Slideshow.ts +0 -201
  54. package/types/bricks/Svg.ts +0 -99
  55. package/types/bricks/Text.ts +0 -148
  56. package/types/bricks/TextInput.ts +0 -242
  57. package/types/bricks/Video.ts +0 -175
  58. package/types/bricks/VideoStreaming.ts +0 -112
  59. package/types/bricks/WebRtcStream.ts +0 -65
  60. package/types/bricks/WebView.ts +0 -168
  61. package/types/bricks/index.ts +0 -22
  62. package/types/canvas.ts +0 -82
  63. package/types/common.ts +0 -144
  64. package/types/data-calc-command.ts +0 -7005
  65. package/types/data-calc-script.ts +0 -21
  66. package/types/data-calc.ts +0 -11
  67. package/types/data.ts +0 -95
  68. package/types/generators/AlarmClock.ts +0 -110
  69. package/types/generators/Assistant.ts +0 -621
  70. package/types/generators/BleCentral.ts +0 -247
  71. package/types/generators/BlePeripheral.ts +0 -208
  72. package/types/generators/CanvasMap.ts +0 -74
  73. package/types/generators/CastlesPay.ts +0 -87
  74. package/types/generators/DataBank.ts +0 -160
  75. package/types/generators/File.ts +0 -432
  76. package/types/generators/GraphQl.ts +0 -132
  77. package/types/generators/Http.ts +0 -222
  78. package/types/generators/HttpServer.ts +0 -176
  79. package/types/generators/Information.ts +0 -103
  80. package/types/generators/Intent.ts +0 -168
  81. package/types/generators/Iterator.ts +0 -108
  82. package/types/generators/Keyboard.ts +0 -105
  83. package/types/generators/LlmAnthropicCompat.ts +0 -212
  84. package/types/generators/LlmAppleBuiltin.ts +0 -159
  85. package/types/generators/LlmGgml.ts +0 -861
  86. package/types/generators/LlmMediaTekNeuroPilot.ts +0 -235
  87. package/types/generators/LlmMlx.ts +0 -227
  88. package/types/generators/LlmOnnx.ts +0 -213
  89. package/types/generators/LlmOpenAiCompat.ts +0 -312
  90. package/types/generators/LlmQualcommAiEngine.ts +0 -247
  91. package/types/generators/Mcp.ts +0 -637
  92. package/types/generators/McpServer.ts +0 -289
  93. package/types/generators/MediaFlow.ts +0 -170
  94. package/types/generators/MqttBroker.ts +0 -141
  95. package/types/generators/MqttClient.ts +0 -141
  96. package/types/generators/Question.ts +0 -408
  97. package/types/generators/RealtimeTranscription.ts +0 -287
  98. package/types/generators/RerankerGgml.ts +0 -191
  99. package/types/generators/SerialPort.ts +0 -151
  100. package/types/generators/SoundPlayer.ts +0 -94
  101. package/types/generators/SoundRecorder.ts +0 -130
  102. package/types/generators/SpeechToTextGgml.ts +0 -419
  103. package/types/generators/SpeechToTextOnnx.ts +0 -236
  104. package/types/generators/SpeechToTextPlatform.ts +0 -85
  105. package/types/generators/SqLite.ts +0 -159
  106. package/types/generators/Step.ts +0 -107
  107. package/types/generators/SttAppleBuiltin.ts +0 -130
  108. package/types/generators/Tcp.ts +0 -126
  109. package/types/generators/TcpServer.ts +0 -147
  110. package/types/generators/TextToSpeechAppleBuiltin.ts +0 -127
  111. package/types/generators/TextToSpeechGgml.ts +0 -221
  112. package/types/generators/TextToSpeechOnnx.ts +0 -178
  113. package/types/generators/TextToSpeechOpenAiLike.ts +0 -121
  114. package/types/generators/ThermalPrinter.ts +0 -191
  115. package/types/generators/Tick.ts +0 -83
  116. package/types/generators/Udp.ts +0 -120
  117. package/types/generators/VadGgml.ts +0 -250
  118. package/types/generators/VadOnnx.ts +0 -231
  119. package/types/generators/VadTraditional.ts +0 -138
  120. package/types/generators/VectorStore.ts +0 -257
  121. package/types/generators/Watchdog.ts +0 -107
  122. package/types/generators/WebCrawler.ts +0 -103
  123. package/types/generators/WebRtc.ts +0 -181
  124. package/types/generators/WebSocket.ts +0 -148
  125. package/types/generators/index.ts +0 -57
  126. package/types/index.ts +0 -13
  127. package/types/subspace.ts +0 -60
  128. package/types/switch.ts +0 -51
  129. package/types/system.ts +0 -707
  130. package/utils/calc.ts +0 -126
  131. package/utils/data.ts +0 -497
  132. package/utils/event-props.ts +0 -886
  133. package/utils/id.ts +0 -80
@@ -1,191 +0,0 @@
1
- /* Auto generated by build script
2
- *
3
- * ESC/POS thermal receipt printer control via Bluetooth or USB
4
- */
5
- import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
- import type { Data, DataLink } from '../data'
7
- import type {
8
- Brick,
9
- Generator,
10
- EventAction,
11
- ActionWithDataParams,
12
- ActionWithParams,
13
- Action,
14
- EventProperty,
15
- } from '../common'
16
- import type { TemplateEventPropsMap } from '../../utils/event-props'
17
-
18
- /* Init thermal printer connection */
19
- export type GeneratorThermalPrinterActionInit = Action & {
20
- __actionName: 'GENERATOR_THERMAL_PRINTER_INIT'
21
- }
22
-
23
- /* Scan thermal printer */
24
- export type GeneratorThermalPrinterActionScan = Action & {
25
- __actionName: 'GENERATOR_THERMAL_PRINTER_SCAN'
26
- }
27
-
28
- /* Dispose thermal printer connection */
29
- export type GeneratorThermalPrinterActionDispose = Action & {
30
- __actionName: 'GENERATOR_THERMAL_PRINTER_DISPOSE'
31
- }
32
-
33
- /* Start print */
34
- export type GeneratorThermalPrinterActionPrint = ActionWithParams & {
35
- __actionName: 'GENERATOR_THERMAL_PRINTER_PRINT'
36
- params?: Array<
37
- | {
38
- input: 'options'
39
- value?: {} | DataLink | EventProperty
40
- mapping?: string
41
- }
42
- | {
43
- input: 'payload'
44
- value?: Array<any> | DataLink | EventProperty
45
- mapping?: string
46
- }
47
- | {
48
- input: 'rawCommands'
49
- value?: string | DataLink | EventProperty
50
- mapping?: string
51
- }
52
- >
53
- }
54
-
55
- /* Check thermal printer status */
56
- export type GeneratorThermalPrinterActionCheckStatus = Action & {
57
- __actionName: 'GENERATOR_THERMAL_PRINTER_CHECK_STATUS'
58
- }
59
-
60
- interface GeneratorThermalPrinterDef {
61
- /*
62
- Default property:
63
- {
64
- "init": false,
65
- "lang": "ANK",
66
- "scanTimeout": 5000,
67
- "stateUpdateInterval": 5000,
68
- "cutMode": "PARTIAL"
69
- }
70
- */
71
- property?: {
72
- /* Connect printer on generator initialized */
73
- init?: boolean | DataLink
74
- /* Connection driver */
75
- driver?: 'escpos' | 'star' | 'tsc' | DataLink
76
- /* The address of the printer */
77
- connectString?: string | DataLink
78
- /* The language of the printer (only for EPSON) */
79
- lang?: 'ANK' | 'CHINESE' | 'TAIWAN' | 'KOREAN' | 'THAI' | 'SOUTHASIA' | DataLink
80
- /* The timeout of scanning */
81
- scanTimeout?: number | DataLink
82
- /* State update interval, 0 means no update automatically */
83
- stateUpdateInterval?: number | DataLink
84
- /* Enable page mode on printing */
85
- pageMode?: boolean | DataLink
86
- /* Printable page area width */
87
- pageWidth?: number | DataLink
88
- /* Printable page area height */
89
- pageHeight?: number | DataLink
90
- /* Cut mode at the end of printing */
91
- cutMode?: 'NONE' | 'FULL' | 'PARTIAL' | DataLink
92
- /* Print payload
93
- example:
94
- { type: 'text', content: 'Hello, World!' }
95
- { type: 'feed', feedLines: 1 }
96
- { type: 'reverse-feed', feedLines: 1 }
97
- { type: 'image', content: '/path/to/file' }
98
- { type: 'line-space', lineSpace: 1 }
99
- { type: 'barcode', content: '1234567890', barcodeType: 'CODE128' }
100
- { type: 'symbol', content: '1234567890', symbolType: 'QRCODE' }
101
- Notes:
102
- - `reverse-feed` only works on ESC/POS driver
103
- - `width` and `height` in Star driver is magnification factor
104
- - `y` position in ESC/POS is use feed lines to offset
105
- - `textFont` only works on TSC driver */
106
- payload?:
107
- | Array<
108
- | DataLink
109
- | {
110
- type?:
111
- | 'text'
112
- | 'image'
113
- | 'barcode'
114
- | 'qrcode'
115
- | 'line-space'
116
- | 'feed'
117
- | 'reverse-feed'
118
- | DataLink
119
- content?: string | DataLink
120
- width?: number | DataLink
121
- height?: number | DataLink
122
- x?: number | DataLink
123
- y?: number | DataLink
124
- align?: 'LEFT' | 'CENTER' | 'RIGHT' | DataLink
125
- textSmooth?: boolean | DataLink
126
- textEmphasize?: boolean | DataLink
127
- textUnderline?: boolean | DataLink
128
- textLang?: 'EN' | 'JA' | 'ZH_CN' | 'ZH_TW' | 'KO' | 'TH' | 'VI' | 'MULTI' | DataLink
129
- textFont?: string | DataLink
130
- barcodeType?:
131
- | 'CODE39'
132
- | 'CODE93'
133
- | 'CODE128'
134
- | 'EAN13'
135
- | 'JAN13'
136
- | 'EAN8'
137
- | 'JAN8'
138
- | 'UPC_A'
139
- | 'UPC_E'
140
- | 'ITF'
141
- | DataLink
142
- barcodeHRI?: 'OFF' | 'ABOVE' | 'BELOW' | 'BOTH' | DataLink
143
- qrcodeModel?: '1' | '2' | DataLink
144
- qrcodeSize?: number | DataLink
145
- qrcodeLevel?: 'L' | 'M' | 'Q' | 'H' | DataLink
146
- qrcodeMask?: 'S0' | 'S1' | 'S2' | 'S3' | 'S4' | 'S5' | 'S6' | 'S7' | DataLink
147
- feedLines?: number | DataLink
148
- lineSpace?: number | DataLink
149
- }
150
- >
151
- | DataLink
152
- /* Raw ASCII commands to print */
153
- rawCommands?: string | DataLink
154
- }
155
- events?: {
156
- /* Event of connection error */
157
- onError?: Array<EventAction<string & keyof TemplateEventPropsMap['ThermalPrinter']['onError']>>
158
- }
159
- outlets?: {
160
- /* Is thermal printer initialized */
161
- initialized?: () => Data<boolean>
162
- /* Thermal printer status */
163
- status?: () => Data<{ [key: string]: any }>
164
- /* Discovered devices */
165
- discoveredDevices?: () => Data<Array<{ [key: string]: any }>>
166
- /* Last error message */
167
- lastError?: () => Data<string>
168
- }
169
- }
170
-
171
- /* ESC/POS thermal receipt printer control via Bluetooth or USB */
172
- export type GeneratorThermalPrinter = Generator &
173
- GeneratorThermalPrinterDef & {
174
- templateKey: 'GENERATOR_THERMAL_PRINTER'
175
- switches?: Array<
176
- SwitchDef &
177
- GeneratorThermalPrinterDef & {
178
- conds?: Array<{
179
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
180
- cond:
181
- | SwitchCondInnerStateCurrentCanvas
182
- | SwitchCondData
183
- | {
184
- __typename: 'SwitchCondInnerStateOutlet'
185
- outlet: 'initialized' | 'status' | 'discoveredDevices' | 'lastError'
186
- value: any
187
- }
188
- }>
189
- }
190
- >
191
- }
@@ -1,83 +0,0 @@
1
- /* Auto generated by build script
2
- *
3
- * Periodic timer that triggers events at a configurable interval
4
- */
5
- import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
- import type { Data, DataLink } from '../data'
7
- import type {
8
- Brick,
9
- Generator,
10
- EventAction,
11
- ActionWithDataParams,
12
- ActionWithParams,
13
- Action,
14
- EventProperty,
15
- } from '../common'
16
- import type { TemplateEventPropsMap } from '../../utils/event-props'
17
-
18
- /* Start the tick */
19
- export type GeneratorTickAction_ = Action & {
20
- __actionName: 'GENERATOR_TICK'
21
- }
22
-
23
- /* Cancel the tick */
24
- export type GeneratorTickActionCancel = Action & {
25
- __actionName: 'GENERATOR_TICK_CANCEL'
26
- }
27
-
28
- interface GeneratorTickDef {
29
- /*
30
- Default property:
31
- {}
32
- */
33
- property?: {
34
- /* Start tick on generator initialized */
35
- init?: boolean | DataLink
36
- /* Interval of second for countdown */
37
- interval?: number | DataLink
38
- /* Initial value of countdown */
39
- countdownStartValue?: number | DataLink
40
- /* Interval of value for countdown */
41
- countdownInterval?: number | DataLink
42
- /* Make countdown repeatable */
43
- repeat?: boolean | DataLink
44
- /* Map for PROPERTY_BANK_RESULT */
45
- map?: {} | DataLink
46
- /* Fallback of MAP_OBJECT */
47
- mapFallback?: any
48
- }
49
- events?: {
50
- /* Event for each tick start */
51
- ticking?: Array<EventAction<string & keyof TemplateEventPropsMap['Tick']['ticking']>>
52
- /* Event for tick completed */
53
- completed?: Array<EventAction<string & keyof TemplateEventPropsMap['Tick']['completed']>>
54
- }
55
- outlets?: {
56
- /* Countdown step value */
57
- countdown?: () => Data<string | number>
58
- /* Is tick running? */
59
- running?: () => Data<boolean | string | number>
60
- }
61
- }
62
-
63
- /* Periodic timer that triggers events at a configurable interval */
64
- export type GeneratorTick = Generator &
65
- GeneratorTickDef & {
66
- templateKey: 'GENERATOR_TICK'
67
- switches?: Array<
68
- SwitchDef &
69
- GeneratorTickDef & {
70
- conds?: Array<{
71
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
72
- cond:
73
- | SwitchCondInnerStateCurrentCanvas
74
- | SwitchCondData
75
- | {
76
- __typename: 'SwitchCondInnerStateOutlet'
77
- outlet: 'countdown' | 'running'
78
- value: any
79
- }
80
- }>
81
- }
82
- >
83
- }
@@ -1,120 +0,0 @@
1
- /* Auto generated by build script
2
- *
3
- * UDP socket communication
4
- */
5
- import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
- import type { Data, DataLink } from '../data'
7
- import type {
8
- Brick,
9
- Generator,
10
- EventAction,
11
- ActionWithDataParams,
12
- ActionWithParams,
13
- Action,
14
- EventProperty,
15
- } from '../common'
16
- import type { TemplateEventPropsMap } from '../../utils/event-props'
17
-
18
- /* Bind UDP port */
19
- export type GeneratorUDPActionBind = Action & {
20
- __actionName: 'GENERATOR_UDP_BIND'
21
- }
22
-
23
- /* Send data to target */
24
- export type GeneratorUDPActionSend = ActionWithParams & {
25
- __actionName: 'GENERATOR_UDP_SEND'
26
- params?: Array<
27
- | {
28
- input: 'targetHost'
29
- value?: string | DataLink | EventProperty
30
- mapping?: string
31
- }
32
- | {
33
- input: 'targetPort'
34
- value?: number | DataLink | EventProperty
35
- mapping?: string
36
- }
37
- | {
38
- input: 'sendData'
39
- value?: string | DataLink | EventProperty
40
- mapping?: string
41
- }
42
- >
43
- }
44
-
45
- /* Close UDP */
46
- export type GeneratorUDPActionClose = Action & {
47
- __actionName: 'GENERATOR_UDP_CLOSE'
48
- }
49
-
50
- interface GeneratorUDPDef {
51
- /*
52
- Default property:
53
- {
54
- "init": false,
55
- "type": "udp4",
56
- "encoding": "base64",
57
- "broadcast": false,
58
- "multicast": ""
59
- }
60
- */
61
- property?: {
62
- /* Bind port on generator initialized */
63
- init?: boolean | DataLink
64
- /* The family of socket */
65
- type?: 'udp4' | 'udp6' | DataLink
66
- /* Encoding of data */
67
- encoding?: 'base64' | 'utf8' | 'ascii' | DataLink
68
- /* Local bind port of UDP (0 or empty is random) */
69
- localPort?: number | DataLink
70
- /* Enable receive broadcast packets */
71
- broadcast?: boolean | DataLink
72
- /* Join multicast group (Multicast address) */
73
- multicast?: string | DataLink
74
- }
75
- events?: {
76
- /* Event of UDP port is binded */
77
- onReady?: Array<EventAction>
78
- /* Event of receive data */
79
- onData?: Array<EventAction<string & keyof TemplateEventPropsMap['Udp']['onData']>>
80
- /* Event of socket closeed */
81
- onClose?: Array<EventAction>
82
- /* Event of socket error */
83
- onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Udp']['onError']>>
84
- }
85
- outlets?: {
86
- /* Local UDP binded port */
87
- port?: () => Data<number>
88
- /* Last received packet */
89
- lastReceive?: () => Data<{
90
- address?: string
91
- port?: number
92
- data?: any
93
- [key: string]: any
94
- }>
95
- /* Error message */
96
- errorMessage?: () => Data<string>
97
- }
98
- }
99
-
100
- /* UDP socket communication */
101
- export type GeneratorUDP = Generator &
102
- GeneratorUDPDef & {
103
- templateKey: 'GENERATOR_UDP'
104
- switches?: Array<
105
- SwitchDef &
106
- GeneratorUDPDef & {
107
- conds?: Array<{
108
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
109
- cond:
110
- | SwitchCondInnerStateCurrentCanvas
111
- | SwitchCondData
112
- | {
113
- __typename: 'SwitchCondInnerStateOutlet'
114
- outlet: 'port' | 'lastReceive' | 'errorMessage'
115
- value: any
116
- }
117
- }>
118
- }
119
- >
120
- }
@@ -1,250 +0,0 @@
1
- /* Auto generated by build script
2
- *
3
- * Local Voice Activity Detection (VAD) inference based on GGML and [whisper.rn](https://github.com/mybigday/whisper.rn)
4
- */
5
- import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
- import type { Data, DataLink } from '../data'
7
- import type {
8
- Brick,
9
- Generator,
10
- EventAction,
11
- ActionWithDataParams,
12
- ActionWithParams,
13
- Action,
14
- EventProperty,
15
- } from '../common'
16
- import type { TemplateEventPropsMap } from '../../utils/event-props'
17
-
18
- /* Load the model */
19
- export type GeneratorVadInferenceActionLoadModel = Action & {
20
- __actionName: 'GENERATOR_VAD_INFERENCE_LOAD_MODEL'
21
- }
22
-
23
- /* Detect speech in audio file. You can provide `File URL` property, if not provided, it will use the default `File URL` */
24
- export type GeneratorVadInferenceActionDetectFile = ActionWithParams & {
25
- __actionName: 'GENERATOR_VAD_INFERENCE_DETECT_FILE'
26
- params?: Array<
27
- | {
28
- input: 'fileUrl'
29
- value?: string | DataLink | EventProperty
30
- mapping?: string
31
- }
32
- | {
33
- input: 'threshold'
34
- value?: number | DataLink | EventProperty
35
- mapping?: string
36
- }
37
- | {
38
- input: 'minSpeechDurationMs'
39
- value?: number | DataLink | EventProperty
40
- mapping?: string
41
- }
42
- | {
43
- input: 'minSilenceDurationMs'
44
- value?: number | DataLink | EventProperty
45
- mapping?: string
46
- }
47
- | {
48
- input: 'maxSpeechDurationS'
49
- value?: number | DataLink | EventProperty
50
- mapping?: string
51
- }
52
- | {
53
- input: 'speechPadMs'
54
- value?: number | DataLink | EventProperty
55
- mapping?: string
56
- }
57
- | {
58
- input: 'samplesOverlap'
59
- value?: number | DataLink | EventProperty
60
- mapping?: string
61
- }
62
- >
63
- }
64
-
65
- /* Detect speech in audio data. Currently only support base64 encoded audio data (16-bit PCM, mono, 16kHz) */
66
- export type GeneratorVadInferenceActionDetectData = ActionWithParams & {
67
- __actionName: 'GENERATOR_VAD_INFERENCE_DETECT_DATA'
68
- params?: Array<
69
- | {
70
- input: 'data'
71
- value?: any | EventProperty
72
- mapping?: string
73
- }
74
- | {
75
- input: 'threshold'
76
- value?: number | DataLink | EventProperty
77
- mapping?: string
78
- }
79
- | {
80
- input: 'minSpeechDurationMs'
81
- value?: number | DataLink | EventProperty
82
- mapping?: string
83
- }
84
- | {
85
- input: 'minSilenceDurationMs'
86
- value?: number | DataLink | EventProperty
87
- mapping?: string
88
- }
89
- | {
90
- input: 'maxSpeechDurationS'
91
- value?: number | DataLink | EventProperty
92
- mapping?: string
93
- }
94
- | {
95
- input: 'speechPadMs'
96
- value?: number | DataLink | EventProperty
97
- mapping?: string
98
- }
99
- | {
100
- input: 'samplesOverlap'
101
- value?: number | DataLink | EventProperty
102
- mapping?: string
103
- }
104
- >
105
- }
106
-
107
- /* Clear downloaded files (model, audio) & current jobs */
108
- export type GeneratorVadInferenceActionClearDownload = Action & {
109
- __actionName: 'GENERATOR_VAD_INFERENCE_CLEAR_DOWNLOAD'
110
- }
111
-
112
- /* Release context */
113
- export type GeneratorVadInferenceActionReleaseContext = Action & {
114
- __actionName: 'GENERATOR_VAD_INFERENCE_RELEASE_CONTEXT'
115
- }
116
-
117
- interface GeneratorVadInferenceDef {
118
- /*
119
- Default property:
120
- {
121
- "init": false,
122
- "modelName": "silero-v6.2.0",
123
- "modelUseGPU": true,
124
- "modelThreads": 4,
125
- "detectThreshold": 0.5,
126
- "detectMinSpeechDurationMs": 250,
127
- "detectMinSilenceDurationMs": 100,
128
- "detectMaxSpeechDurationS": 30,
129
- "detectSpeechPadMs": 30,
130
- "detectSamplesOverlap": 0.1
131
- }
132
- */
133
- property?: {
134
- /* Initialize the VAD context on generator initialization
135
- Please note that it will take some RAM depending on the model size */
136
- init?: boolean | DataLink
137
- /* Use model name, currently only supports the Silero VAD model.
138
- The model download progress will be done in preload stage or the generator initialization stage.
139
- You can also choose `custom` option and set `Model URL` and `Model SHA1` to use your own model */
140
- modelName?: 'custom' | 'silero-v6.2.0' | 'silero-v5.1.2' | DataLink
141
- /* The URL or path of model
142
- We used `ggml` format model, please refer to https://huggingface.co/ggml-org/whisper-vad */
143
- modelUrl?: string | DataLink
144
- /* Hash type of model */
145
- modelHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
146
- /* Hash of model */
147
- modelHash?: string | DataLink
148
- /* Use GPU Acceleration for inference. Currently iOS only. */
149
- modelUseGPU?: boolean | DataLink
150
- /* Number of threads to use for processing */
151
- modelThreads?: number | DataLink
152
- /* Speech probability threshold (0.0-1.0) */
153
- detectThreshold?: number | DataLink
154
- /* Minimum speech duration in milliseconds */
155
- detectMinSpeechDurationMs?: number | DataLink
156
- /* Minimum silence duration in milliseconds */
157
- detectMinSilenceDurationMs?: number | DataLink
158
- /* Maximum speech duration in seconds */
159
- detectMaxSpeechDurationS?: number | DataLink
160
- /* Padding around speech segments in milliseconds */
161
- detectSpeechPadMs?: number | DataLink
162
- /* Overlap between analysis windows (0.0-1.0) */
163
- detectSamplesOverlap?: number | DataLink
164
- /* The file URL or path to be analyzed.
165
- It only supported `wav` format with 16kHz sample rate & single (mono) channel */
166
- detectFileUrl?: string | DataLink
167
- /* MD5 of file to be analyzed */
168
- detectFileMd5?: string | DataLink
169
- }
170
- events?: {
171
- /* Event triggered when context state changes */
172
- onContextStateChange?: Array<
173
- EventAction<string & keyof TemplateEventPropsMap['VadInference']['onContextStateChange']>
174
- >
175
- /* Event triggered when error occurs */
176
- onError?: Array<EventAction<string & keyof TemplateEventPropsMap['VadInference']['onError']>>
177
- /* Event triggered when got detection result */
178
- onDetected?: Array<
179
- EventAction<string & keyof TemplateEventPropsMap['VadInference']['onDetected']>
180
- >
181
- }
182
- outlets?: {
183
- /* Context state */
184
- contextState?: () => Data<string>
185
- /* Context details */
186
- contextDetails?: () => Data<{
187
- state?: string
188
- contextId?: string
189
- gpu?: string
190
- reasonNoGPU?: string
191
- [key: string]: any
192
- }>
193
- /* Is detecting */
194
- isDetecting?: () => Data<boolean>
195
- /* Detection segments result */
196
- detectionSegments?: () => Data<
197
- Array<{
198
- start?: number
199
- end?: number
200
- confidence?: number
201
- t0?: number
202
- t1?: number
203
- [key: string]: any
204
- }>
205
- >
206
- /* Detection details */
207
- detectionDetails?: () => Data<{
208
- result?: string
209
- segments?: Array<{
210
- start?: number
211
- end?: number
212
- confidence?: number
213
- t0?: number
214
- t1?: number
215
- [key: string]: any
216
- }>
217
- time?: number
218
- startTime?: number
219
- endTime?: number
220
- [key: string]: any
221
- }>
222
- }
223
- }
224
-
225
- /* Local Voice Activity Detection (VAD) inference based on GGML and [whisper.rn](https://github.com/mybigday/whisper.rn) */
226
- export type GeneratorVadInference = Generator &
227
- GeneratorVadInferenceDef & {
228
- templateKey: 'GENERATOR_VAD_INFERENCE'
229
- switches?: Array<
230
- SwitchDef &
231
- GeneratorVadInferenceDef & {
232
- conds?: Array<{
233
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
234
- cond:
235
- | SwitchCondInnerStateCurrentCanvas
236
- | SwitchCondData
237
- | {
238
- __typename: 'SwitchCondInnerStateOutlet'
239
- outlet:
240
- | 'contextState'
241
- | 'contextDetails'
242
- | 'isDetecting'
243
- | 'detectionSegments'
244
- | 'detectionDetails'
245
- value: any
246
- }
247
- }>
248
- }
249
- >
250
- }