@fugood/bricks-ctor 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.
- package/compile/action-name-map.ts +988 -0
- package/compile/index.ts +1245 -0
- package/compile/util.ts +358 -0
- package/index.ts +6 -0
- package/package.json +28 -0
- package/skills/bricks-design/LICENSE.txt +180 -0
- package/skills/bricks-design/SKILL.md +66 -0
- package/skills/bricks-project/SKILL.md +32 -0
- package/skills/bricks-project/rules/animation.md +159 -0
- package/skills/bricks-project/rules/architecture-patterns.md +69 -0
- package/skills/bricks-project/rules/automations.md +221 -0
- package/skills/bricks-project/rules/buttress.md +156 -0
- package/skills/bricks-project/rules/data-calculation.md +208 -0
- package/skills/bricks-project/rules/local-sync.md +129 -0
- package/skills/bricks-project/rules/media-flow.md +158 -0
- package/skills/bricks-project/rules/remote-data-bank.md +196 -0
- package/skills/bricks-project/rules/standby-transition.md +124 -0
- package/skills/rive-marketplace/SKILL.md +99 -0
- package/tools/deploy.ts +151 -0
- package/tools/icons/.gitattributes +1 -0
- package/tools/icons/fa6pro-glyphmap.json +4686 -0
- package/tools/icons/fa6pro-meta.json +3671 -0
- package/tools/mcp-server.ts +28 -0
- package/tools/mcp-tools/compile.ts +91 -0
- package/tools/mcp-tools/huggingface.ts +762 -0
- package/tools/mcp-tools/icons.ts +70 -0
- package/tools/mcp-tools/lottie.ts +102 -0
- package/tools/mcp-tools/media.ts +110 -0
- package/tools/postinstall.ts +229 -0
- package/tools/preview-main.mjs +293 -0
- package/tools/preview.ts +143 -0
- package/tools/pull.ts +116 -0
- package/tsconfig.json +16 -0
- package/types/animation.ts +100 -0
- package/types/automation.ts +235 -0
- package/types/brick-base.ts +80 -0
- package/types/bricks/Camera.ts +246 -0
- package/types/bricks/Chart.ts +372 -0
- package/types/bricks/GenerativeMedia.ts +276 -0
- package/types/bricks/Icon.ts +98 -0
- package/types/bricks/Image.ts +114 -0
- package/types/bricks/Items.ts +476 -0
- package/types/bricks/Lottie.ts +168 -0
- package/types/bricks/Maps.ts +262 -0
- package/types/bricks/QrCode.ts +117 -0
- package/types/bricks/Rect.ts +150 -0
- package/types/bricks/RichText.ts +128 -0
- package/types/bricks/Rive.ts +220 -0
- package/types/bricks/Slideshow.ts +201 -0
- package/types/bricks/Svg.ts +99 -0
- package/types/bricks/Text.ts +148 -0
- package/types/bricks/TextInput.ts +242 -0
- package/types/bricks/Video.ts +175 -0
- package/types/bricks/VideoStreaming.ts +112 -0
- package/types/bricks/WebRtcStream.ts +65 -0
- package/types/bricks/WebView.ts +168 -0
- package/types/bricks/index.ts +21 -0
- package/types/canvas.ts +82 -0
- package/types/common.ts +144 -0
- package/types/data-calc-command.ts +7005 -0
- package/types/data-calc-script.ts +21 -0
- package/types/data-calc.ts +11 -0
- package/types/data.ts +95 -0
- package/types/generators/AlarmClock.ts +110 -0
- package/types/generators/Assistant.ts +621 -0
- package/types/generators/BleCentral.ts +247 -0
- package/types/generators/BlePeripheral.ts +208 -0
- package/types/generators/CanvasMap.ts +74 -0
- package/types/generators/CastlesPay.ts +87 -0
- package/types/generators/DataBank.ts +160 -0
- package/types/generators/File.ts +432 -0
- package/types/generators/GraphQl.ts +132 -0
- package/types/generators/Http.ts +222 -0
- package/types/generators/HttpServer.ts +176 -0
- package/types/generators/Information.ts +103 -0
- package/types/generators/Intent.ts +168 -0
- package/types/generators/Iterator.ts +108 -0
- package/types/generators/Keyboard.ts +105 -0
- package/types/generators/LlmAnthropicCompat.ts +212 -0
- package/types/generators/LlmAppleBuiltin.ts +159 -0
- package/types/generators/LlmGgml.ts +861 -0
- package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
- package/types/generators/LlmMlx.ts +227 -0
- package/types/generators/LlmOnnx.ts +213 -0
- package/types/generators/LlmOpenAiCompat.ts +244 -0
- package/types/generators/LlmQualcommAiEngine.ts +247 -0
- package/types/generators/Mcp.ts +637 -0
- package/types/generators/McpServer.ts +289 -0
- package/types/generators/MediaFlow.ts +170 -0
- package/types/generators/MqttBroker.ts +141 -0
- package/types/generators/MqttClient.ts +141 -0
- package/types/generators/Question.ts +408 -0
- package/types/generators/RealtimeTranscription.ts +279 -0
- package/types/generators/RerankerGgml.ts +191 -0
- package/types/generators/SerialPort.ts +151 -0
- package/types/generators/SoundPlayer.ts +94 -0
- package/types/generators/SoundRecorder.ts +130 -0
- package/types/generators/SpeechToTextGgml.ts +415 -0
- package/types/generators/SpeechToTextOnnx.ts +236 -0
- package/types/generators/SpeechToTextPlatform.ts +85 -0
- package/types/generators/SqLite.ts +159 -0
- package/types/generators/Step.ts +107 -0
- package/types/generators/SttAppleBuiltin.ts +130 -0
- package/types/generators/Tcp.ts +126 -0
- package/types/generators/TcpServer.ts +147 -0
- package/types/generators/TextToSpeechAppleBuiltin.ts +127 -0
- package/types/generators/TextToSpeechGgml.ts +221 -0
- package/types/generators/TextToSpeechOnnx.ts +178 -0
- package/types/generators/TextToSpeechOpenAiLike.ts +121 -0
- package/types/generators/ThermalPrinter.ts +191 -0
- package/types/generators/Tick.ts +83 -0
- package/types/generators/Udp.ts +120 -0
- package/types/generators/VadGgml.ts +250 -0
- package/types/generators/VadOnnx.ts +231 -0
- package/types/generators/VadTraditional.ts +138 -0
- package/types/generators/VectorStore.ts +257 -0
- package/types/generators/Watchdog.ts +107 -0
- package/types/generators/WebCrawler.ts +103 -0
- package/types/generators/WebRtc.ts +181 -0
- package/types/generators/WebSocket.ts +148 -0
- package/types/generators/index.ts +57 -0
- package/types/index.ts +13 -0
- package/types/subspace.ts +59 -0
- package/types/switch.ts +51 -0
- package/types/system.ts +707 -0
- package/utils/calc.ts +126 -0
- package/utils/data.ts +497 -0
- package/utils/event-props.ts +836 -0
- package/utils/id.ts +80 -0
|
@@ -0,0 +1,191 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
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
|
+
}
|