@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.
Files changed (129) hide show
  1. package/compile/action-name-map.ts +988 -0
  2. package/compile/index.ts +1245 -0
  3. package/compile/util.ts +358 -0
  4. package/index.ts +6 -0
  5. package/package.json +28 -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 +32 -0
  9. package/skills/bricks-project/rules/animation.md +159 -0
  10. package/skills/bricks-project/rules/architecture-patterns.md +69 -0
  11. package/skills/bricks-project/rules/automations.md +221 -0
  12. package/skills/bricks-project/rules/buttress.md +156 -0
  13. package/skills/bricks-project/rules/data-calculation.md +208 -0
  14. package/skills/bricks-project/rules/local-sync.md +129 -0
  15. package/skills/bricks-project/rules/media-flow.md +158 -0
  16. package/skills/bricks-project/rules/remote-data-bank.md +196 -0
  17. package/skills/bricks-project/rules/standby-transition.md +124 -0
  18. package/skills/rive-marketplace/SKILL.md +99 -0
  19. package/tools/deploy.ts +151 -0
  20. package/tools/icons/.gitattributes +1 -0
  21. package/tools/icons/fa6pro-glyphmap.json +4686 -0
  22. package/tools/icons/fa6pro-meta.json +3671 -0
  23. package/tools/mcp-server.ts +28 -0
  24. package/tools/mcp-tools/compile.ts +91 -0
  25. package/tools/mcp-tools/huggingface.ts +762 -0
  26. package/tools/mcp-tools/icons.ts +70 -0
  27. package/tools/mcp-tools/lottie.ts +102 -0
  28. package/tools/mcp-tools/media.ts +110 -0
  29. package/tools/postinstall.ts +229 -0
  30. package/tools/preview-main.mjs +293 -0
  31. package/tools/preview.ts +143 -0
  32. package/tools/pull.ts +116 -0
  33. package/tsconfig.json +16 -0
  34. package/types/animation.ts +100 -0
  35. package/types/automation.ts +235 -0
  36. package/types/brick-base.ts +80 -0
  37. package/types/bricks/Camera.ts +246 -0
  38. package/types/bricks/Chart.ts +372 -0
  39. package/types/bricks/GenerativeMedia.ts +276 -0
  40. package/types/bricks/Icon.ts +98 -0
  41. package/types/bricks/Image.ts +114 -0
  42. package/types/bricks/Items.ts +476 -0
  43. package/types/bricks/Lottie.ts +168 -0
  44. package/types/bricks/Maps.ts +262 -0
  45. package/types/bricks/QrCode.ts +117 -0
  46. package/types/bricks/Rect.ts +150 -0
  47. package/types/bricks/RichText.ts +128 -0
  48. package/types/bricks/Rive.ts +220 -0
  49. package/types/bricks/Slideshow.ts +201 -0
  50. package/types/bricks/Svg.ts +99 -0
  51. package/types/bricks/Text.ts +148 -0
  52. package/types/bricks/TextInput.ts +242 -0
  53. package/types/bricks/Video.ts +175 -0
  54. package/types/bricks/VideoStreaming.ts +112 -0
  55. package/types/bricks/WebRtcStream.ts +65 -0
  56. package/types/bricks/WebView.ts +168 -0
  57. package/types/bricks/index.ts +21 -0
  58. package/types/canvas.ts +82 -0
  59. package/types/common.ts +144 -0
  60. package/types/data-calc-command.ts +7005 -0
  61. package/types/data-calc-script.ts +21 -0
  62. package/types/data-calc.ts +11 -0
  63. package/types/data.ts +95 -0
  64. package/types/generators/AlarmClock.ts +110 -0
  65. package/types/generators/Assistant.ts +621 -0
  66. package/types/generators/BleCentral.ts +247 -0
  67. package/types/generators/BlePeripheral.ts +208 -0
  68. package/types/generators/CanvasMap.ts +74 -0
  69. package/types/generators/CastlesPay.ts +87 -0
  70. package/types/generators/DataBank.ts +160 -0
  71. package/types/generators/File.ts +432 -0
  72. package/types/generators/GraphQl.ts +132 -0
  73. package/types/generators/Http.ts +222 -0
  74. package/types/generators/HttpServer.ts +176 -0
  75. package/types/generators/Information.ts +103 -0
  76. package/types/generators/Intent.ts +168 -0
  77. package/types/generators/Iterator.ts +108 -0
  78. package/types/generators/Keyboard.ts +105 -0
  79. package/types/generators/LlmAnthropicCompat.ts +212 -0
  80. package/types/generators/LlmAppleBuiltin.ts +159 -0
  81. package/types/generators/LlmGgml.ts +861 -0
  82. package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
  83. package/types/generators/LlmMlx.ts +227 -0
  84. package/types/generators/LlmOnnx.ts +213 -0
  85. package/types/generators/LlmOpenAiCompat.ts +244 -0
  86. package/types/generators/LlmQualcommAiEngine.ts +247 -0
  87. package/types/generators/Mcp.ts +637 -0
  88. package/types/generators/McpServer.ts +289 -0
  89. package/types/generators/MediaFlow.ts +170 -0
  90. package/types/generators/MqttBroker.ts +141 -0
  91. package/types/generators/MqttClient.ts +141 -0
  92. package/types/generators/Question.ts +408 -0
  93. package/types/generators/RealtimeTranscription.ts +279 -0
  94. package/types/generators/RerankerGgml.ts +191 -0
  95. package/types/generators/SerialPort.ts +151 -0
  96. package/types/generators/SoundPlayer.ts +94 -0
  97. package/types/generators/SoundRecorder.ts +130 -0
  98. package/types/generators/SpeechToTextGgml.ts +415 -0
  99. package/types/generators/SpeechToTextOnnx.ts +236 -0
  100. package/types/generators/SpeechToTextPlatform.ts +85 -0
  101. package/types/generators/SqLite.ts +159 -0
  102. package/types/generators/Step.ts +107 -0
  103. package/types/generators/SttAppleBuiltin.ts +130 -0
  104. package/types/generators/Tcp.ts +126 -0
  105. package/types/generators/TcpServer.ts +147 -0
  106. package/types/generators/TextToSpeechAppleBuiltin.ts +127 -0
  107. package/types/generators/TextToSpeechGgml.ts +221 -0
  108. package/types/generators/TextToSpeechOnnx.ts +178 -0
  109. package/types/generators/TextToSpeechOpenAiLike.ts +121 -0
  110. package/types/generators/ThermalPrinter.ts +191 -0
  111. package/types/generators/Tick.ts +83 -0
  112. package/types/generators/Udp.ts +120 -0
  113. package/types/generators/VadGgml.ts +250 -0
  114. package/types/generators/VadOnnx.ts +231 -0
  115. package/types/generators/VadTraditional.ts +138 -0
  116. package/types/generators/VectorStore.ts +257 -0
  117. package/types/generators/Watchdog.ts +107 -0
  118. package/types/generators/WebCrawler.ts +103 -0
  119. package/types/generators/WebRtc.ts +181 -0
  120. package/types/generators/WebSocket.ts +148 -0
  121. package/types/generators/index.ts +57 -0
  122. package/types/index.ts +13 -0
  123. package/types/subspace.ts +59 -0
  124. package/types/switch.ts +51 -0
  125. package/types/system.ts +707 -0
  126. package/utils/calc.ts +126 -0
  127. package/utils/data.ts +497 -0
  128. package/utils/event-props.ts +836 -0
  129. package/utils/id.ts +80 -0
@@ -0,0 +1,107 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Trigger event with timeout by listening to specified events
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
+ /* Reset watch */
19
+ export type GeneratorWatchdogActionResetWatch = Action & {
20
+ __actionName: 'GENERATOR_WATCHDOG_RESET_WATCH'
21
+ }
22
+
23
+ interface GeneratorWatchdogDef {
24
+ /*
25
+ Default property:
26
+ {
27
+ "listening": false,
28
+ "timeout": 30000
29
+ }
30
+ */
31
+ property?: {
32
+ /* Start listening event */
33
+ listening?: boolean | DataLink
34
+ /* If no other events are fired after the specified event is fired, it times out and fires the Watchdog event. */
35
+ timeout?: number | DataLink
36
+ /* Reset timeout timer on properties change */
37
+ resetTimeoutOnChange?: boolean | DataLink
38
+ /* Set what brick id (allow mutiple) to listen for press */
39
+ brickOnPress?: Array<string | DataLink> | DataLink
40
+ /* Set what brick id (allow mutiple) to listen for focus */
41
+ brickOnFocus?: Array<string | DataLink> | DataLink
42
+ /* Set what brick id (allow mutiple) to listen for blur */
43
+ brickOnBlur?: Array<string | DataLink> | DataLink
44
+ /* Set what canvas id (allow mutiple) to listen for enter */
45
+ canvasOnEnter?: Array<string | DataLink> | DataLink
46
+ /* Set what canvas id (allow mutiple) to listen for exit */
47
+ canvasOnExit?: Array<string | DataLink> | DataLink
48
+ /* Set what Data id (allow mutiple) to listen for change */
49
+ propertyBankOnChange?: Array<string | DataLink> | DataLink
50
+ /* Set what Data id (allow mutiple) to listen for update */
51
+ propertyBankOnUpdate?: Array<string | DataLink> | DataLink
52
+ /* Set what Data id (allow mutiple) to listen for hit */
53
+ propertyBankOnHit?: Array<string | DataLink> | DataLink
54
+ /* Set what Data id (allow mutiple) to listen for hit */
55
+ propertyBankOnNotHit?: Array<string | DataLink> | DataLink
56
+ }
57
+ events?: {
58
+ /* Event on specific sender id trigger event */
59
+ onEvent?: Array<EventAction<string & keyof TemplateEventPropsMap['Watchdog']['onEvent']>>
60
+ /* Event on timeout */
61
+ onTimeout?: Array<EventAction<string & keyof TemplateEventPropsMap['Watchdog']['onTimeout']>>
62
+ }
63
+ outlets?: {
64
+ /* The last event */
65
+ lastEvent?: () => Data<{
66
+ id?: string
67
+ type?: string
68
+ triggerType?: string
69
+ timeout?: number
70
+ }>
71
+ /* The type fo last event */
72
+ lastEventType?: () => Data<string>
73
+ /* The trigger type of last event */
74
+ lastEventTriggerType?: () => Data<string>
75
+ /* The sender id of last event */
76
+ lastEventSenderId?: () => Data<string>
77
+ /* Is timed out */
78
+ isTimedOut?: () => Data<boolean>
79
+ }
80
+ }
81
+
82
+ /* Trigger event with timeout by listening to specified events */
83
+ export type GeneratorWatchdog = Generator &
84
+ GeneratorWatchdogDef & {
85
+ templateKey: 'GENERATOR_WATCHDOG'
86
+ switches?: Array<
87
+ SwitchDef &
88
+ GeneratorWatchdogDef & {
89
+ conds?: Array<{
90
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
91
+ cond:
92
+ | SwitchCondInnerStateCurrentCanvas
93
+ | SwitchCondData
94
+ | {
95
+ __typename: 'SwitchCondInnerStateOutlet'
96
+ outlet:
97
+ | 'lastEvent'
98
+ | 'lastEventType'
99
+ | 'lastEventTriggerType'
100
+ | 'lastEventSenderId'
101
+ | 'isTimedOut'
102
+ value: any
103
+ }
104
+ }>
105
+ }
106
+ >
107
+ }
@@ -0,0 +1,103 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Extract web content via CSS selectors. Supports WebView method (iOS/Android, renders JS) and HTTP method (all platforms, direct request)
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
+ /* Run Crawler request with defined properties */
19
+ export type GeneratorWebCrawlerActionRunRequest = Action & {
20
+ __actionName: 'GENERATOR_WEB_CRAWLER_RUN_REQUEST'
21
+ }
22
+
23
+ interface GeneratorWebCrawlerDef {
24
+ /*
25
+ Default property:
26
+ {
27
+ "init": false,
28
+ "httpMethod": "GET",
29
+ "timeout": 10000,
30
+ "attributePath": "textContent"
31
+ }
32
+ */
33
+ property?: {
34
+ /* Start Crawler request on generator initialized */
35
+ init?: boolean | DataLink
36
+ /* URL of crawler request */
37
+ url?: string | DataLink
38
+ /* Method of crawler request
39
+
40
+ Platform not supported for `webview`: tvOS, Desktop, Web */
41
+ method?: 'webview' | 'http' | DataLink
42
+ /* HTTP method of crawler request (weview only supported GET, POST) */
43
+ httpMethod?: 'GET' | 'POST' | 'PUT' | 'DELETE' | DataLink
44
+ /* Body of crawler request */
45
+ body?: string | DataLink
46
+ /* User-Agent of crawler request */
47
+ userAgent?: string | DataLink
48
+ /* Headers of crawler request */
49
+ headers?: {} | DataLink
50
+ /* Timeout of crawler request */
51
+ timeout?: number | DataLink
52
+ /* CSS Query Selector of selected element */
53
+ selector?: string | DataLink
54
+ /* Attribute path of HTMLElement */
55
+ attributePath?: string | DataLink
56
+ /* Multiple selectors and attribute paths. */
57
+ selectorList?:
58
+ | Array<
59
+ | DataLink
60
+ | {
61
+ selector?: string | DataLink
62
+ attributePath?: string | DataLink
63
+ }
64
+ >
65
+ | DataLink
66
+ }
67
+ events?: {
68
+ /* Event of crawling start */
69
+ onStart?: Array<EventAction>
70
+ /* Event of crawling end */
71
+ onEnd?: Array<EventAction>
72
+ }
73
+ outlets?: {
74
+ /* Response for CRAWLER request (selector) */
75
+ response?: () => Data<string>
76
+ /* Responses for CRAWLER request (selectorList) */
77
+ responseList?: () => Data<Array<any>>
78
+ /* The error response of CRAWLER request, it will save to property bank */
79
+ error?: () => Data<string>
80
+ }
81
+ }
82
+
83
+ /* Extract web content via CSS selectors. Supports WebView method (iOS/Android, renders JS) and HTTP method (all platforms, direct request) */
84
+ export type GeneratorWebCrawler = Generator &
85
+ GeneratorWebCrawlerDef & {
86
+ templateKey: 'GENERATOR_WEB_CRAWLER'
87
+ switches?: Array<
88
+ SwitchDef &
89
+ GeneratorWebCrawlerDef & {
90
+ conds?: Array<{
91
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
92
+ cond:
93
+ | SwitchCondInnerStateCurrentCanvas
94
+ | SwitchCondData
95
+ | {
96
+ __typename: 'SwitchCondInnerStateOutlet'
97
+ outlet: 'response' | 'responseList' | 'error'
98
+ value: any
99
+ }
100
+ }>
101
+ }
102
+ >
103
+ }
@@ -0,0 +1,181 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * WebRTC peer connection for real-time audio/video/data 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
+ /* Initiate WebRTC request */
19
+ export type GeneratorWebRTCActionInitiate = Action & {
20
+ __actionName: 'GENERATOR_WEBRTC_INITIATE'
21
+ }
22
+
23
+ /* Process input signal */
24
+ export type GeneratorWebRTCActionProcessInputSignal = ActionWithParams & {
25
+ __actionName: 'GENERATOR_WEBRTC_PROCESS_INPUT_SIGNAL'
26
+ params?: Array<{
27
+ input: 'inputSignal'
28
+ value?: any | EventProperty
29
+ mapping?: string
30
+ }>
31
+ }
32
+
33
+ /* Close WebRTC */
34
+ export type GeneratorWebRTCActionClose = Action & {
35
+ __actionName: 'GENERATOR_WEBRTC_CLOSE'
36
+ }
37
+
38
+ /* Send message in data channel */
39
+ export type GeneratorWebRTCActionChannelSend = ActionWithParams & {
40
+ __actionName: 'GENERATOR_WEBRTC_CHANNEL_SEND'
41
+ params?: Array<{
42
+ input: 'textMessage'
43
+ value?: string | DataLink | EventProperty
44
+ mapping?: string
45
+ }>
46
+ }
47
+
48
+ interface GeneratorWebRTCDef {
49
+ /*
50
+ Default property:
51
+ {
52
+ "enableAudio": true,
53
+ "enableVideo": true,
54
+ "videoFacing": "user",
55
+ "videoFrameRate": 30,
56
+ "videoHeight": 720,
57
+ "videoWidth": 1080,
58
+ "signalType": "json"
59
+ }
60
+ */
61
+ property?: {
62
+ /* Caller ID */
63
+ callerId?: string | DataLink
64
+ /* Calee ID, to ilter caller signal */
65
+ calleeId?: string | DataLink
66
+ /* Target local WebRTC stream preview brick ID */
67
+ localVideoTarget?: string | DataLink | (() => Brick)
68
+ /* Target remote WebRTC stream brick ID */
69
+ remoteVideoTarget?: string | DataLink | (() => Brick)
70
+ /* ICE Server list
71
+ Default use Google public STUN servers if not setted. */
72
+ iceServers?:
73
+ | Array<
74
+ | DataLink
75
+ | {
76
+ urls?: string | DataLink
77
+ username?: string | DataLink
78
+ credential?: string | DataLink
79
+ }
80
+ >
81
+ | DataLink
82
+ /* Enable capture device microphone */
83
+ enableAudio?: boolean | DataLink
84
+ /* Enable capture device camera */
85
+ enableVideo?: boolean | DataLink
86
+ /* Camera facing */
87
+ videoFacing?: 'user' | 'environment' | DataLink
88
+ /* Camera frame rate */
89
+ videoFrameRate?: number | DataLink
90
+ /* Output video height */
91
+ videoHeight?: number | DataLink
92
+ /* Output video width */
93
+ videoWidth?: number | DataLink
94
+ /* Label of data channel */
95
+ dataChannelLabel?: string | DataLink
96
+ /* Input signal for create peer connection
97
+ Signal Types:
98
+ `initiate`: Initiate a WebRTC call
99
+ `offer`: WebRTC SDP offer
100
+ `answer`: WebRTC SDP answer
101
+ `candidate`: WebRTC ICE candidate
102
+ `close`: Close WebRTC peer connection */
103
+ inputSignal?: any
104
+ /* Signal content type */
105
+ signalType?: 'json' | 'object' | DataLink
106
+ }
107
+ events?: {
108
+ /* Event of signal update */
109
+ onSignalUpdate?: Array<
110
+ EventAction<string & keyof TemplateEventPropsMap['Webrtc']['onSignalUpdate']>
111
+ >
112
+ /* Event of peer connected */
113
+ onConnected?: Array<EventAction>
114
+ /* Event of peer disconnected */
115
+ onDisconnected?: Array<EventAction>
116
+ /* Event of handshake error */
117
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Webrtc']['onError']>>
118
+ /* Event of data channel open */
119
+ onChannelOpen?: Array<EventAction>
120
+ /* Event of data channel close */
121
+ onChannelClose?: Array<EventAction>
122
+ /* Event of received message on data channel */
123
+ onChannelMessage?: Array<
124
+ EventAction<string & keyof TemplateEventPropsMap['Webrtc']['onChannelMessage']>
125
+ >
126
+ }
127
+ outlets?: {
128
+ /* Signal to create peer connection */
129
+ signal?: () => Data<any>
130
+ /* Local SDP offer */
131
+ sdpOffer?: () => Data<{
132
+ type?: string
133
+ sdp?: string
134
+ }>
135
+ /* Local SDP answer */
136
+ sdpAnswer?: () => Data<{
137
+ type?: string
138
+ sdp?: string
139
+ }>
140
+ /* Peer connection state */
141
+ connectionState?: () => Data<string>
142
+ /* ICE connection state */
143
+ iceConnectionState?: () => Data<string>
144
+ /* Signaling state */
145
+ signalingState?: () => Data<string>
146
+ /* Last message from data channel */
147
+ lastChannelMessage?: () => Data<string>
148
+ /* Error message */
149
+ errorMessage?: () => Data<string>
150
+ }
151
+ }
152
+
153
+ /* WebRTC peer connection for real-time audio/video/data communication */
154
+ export type GeneratorWebRTC = Generator &
155
+ GeneratorWebRTCDef & {
156
+ templateKey: 'GENERATOR_WEBRTC'
157
+ switches?: Array<
158
+ SwitchDef &
159
+ GeneratorWebRTCDef & {
160
+ conds?: Array<{
161
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
162
+ cond:
163
+ | SwitchCondInnerStateCurrentCanvas
164
+ | SwitchCondData
165
+ | {
166
+ __typename: 'SwitchCondInnerStateOutlet'
167
+ outlet:
168
+ | 'signal'
169
+ | 'sdpOffer'
170
+ | 'sdpAnswer'
171
+ | 'connectionState'
172
+ | 'iceConnectionState'
173
+ | 'signalingState'
174
+ | 'lastChannelMessage'
175
+ | 'errorMessage'
176
+ value: any
177
+ }
178
+ }>
179
+ }
180
+ >
181
+ }
@@ -0,0 +1,148 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * WebSocket or Socket.IO Generator
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
+ /* Connect */
19
+ export type GeneratorWebSocketActionConnect = Action & {
20
+ __actionName: 'GENERATOR_WEB_SOCKET_CONNECT'
21
+ }
22
+
23
+ /* Disconnect */
24
+ export type GeneratorWebSocketActionDisconnect = Action & {
25
+ __actionName: 'GENERATOR_WEB_SOCKET_DISCONNECT'
26
+ }
27
+
28
+ /* Emit event (Acknowledgement: It's callback, the channel of Socket.IO server can used it as last argument) */
29
+ export type GeneratorWebSocketActionEmit = ActionWithParams & {
30
+ __actionName: 'GENERATOR_WEB_SOCKET_EMIT'
31
+ params?: Array<
32
+ | {
33
+ input: 'eventName'
34
+ value?: string | DataLink | EventProperty
35
+ mapping?: string
36
+ }
37
+ | {
38
+ input: 'arguments'
39
+ value?: Array<any> | DataLink | EventProperty
40
+ mapping?: string
41
+ }
42
+ | {
43
+ input: 'acknowledgementType'
44
+ value?: 'text' | 'json' | DataLink | EventProperty
45
+ mapping?: string
46
+ }
47
+ | {
48
+ input: 'withAcknowledgement'
49
+ value?: boolean | DataLink | EventProperty
50
+ mapping?: string
51
+ }
52
+ >
53
+ }
54
+
55
+ /* Emit `message` */
56
+ export type GeneratorWebSocketActionSend = ActionWithParams & {
57
+ __actionName: 'GENERATOR_WEB_SOCKET_SEND'
58
+ params?: Array<{
59
+ input: 'value'
60
+ value?: string | DataLink | EventProperty
61
+ mapping?: string
62
+ }>
63
+ }
64
+
65
+ interface GeneratorWebSocketDef {
66
+ /*
67
+ Default property:
68
+ {}
69
+ */
70
+ property?: {
71
+ /* Try to connect on generator initialized */
72
+ init?: boolean | DataLink
73
+ /* Endpoint URL (support namespace) */
74
+ url?: string | DataLink
75
+ /* Name of the path that is captured on the server side */
76
+ path?: string | DataLink
77
+ /* URL query parameters */
78
+ query?: {} | DataLink
79
+ /* Whether to reconnect automatically */
80
+ reconnection?: boolean | DataLink
81
+ /* Number of reconnection attempts before giving up */
82
+ attemptTimes?: number | DataLink
83
+ /* How long to initially wait before attempting a new reconnection (1000). Affected by +/- randomizationFactor, for example the default initial delay will be between 500 to 1500ms. */
84
+ delayBase?: number | DataLink
85
+ /* Maximum amount of time to wait between reconnections (5000). Each attempt increases the reconnection delay by 2x along with a randomization as above */
86
+ delayMax?: number | DataLink
87
+ /* Randomization factor 0 <= deplayRandom <= 1 */
88
+ delayRandom?: number | DataLink
89
+ /* Message type, if type is json it's will auto transform to object */
90
+ messageType?: 'json' | 'text' | DataLink
91
+ /* Use Socket.IO as transport channel */
92
+ socketIoEnable?: boolean | DataLink
93
+ /* Socket.IO Version */
94
+ socketIoVersion?: 'latest' | 'v4' | 'v2' | DataLink
95
+ /* Whether to reuse an existing connection */
96
+ socketIoForceNew?: boolean | DataLink
97
+ /* Connection timeout before a connect_error and connect_timeout events are emitted */
98
+ socketIoTimeout?: number | DataLink
99
+ /* Event name to be subscribe */
100
+ socketIoEventName?: string | DataLink
101
+ /* Additional query parameters that are sent when connecting a namespace (then found in socket.handshake.query object on the server-side) */
102
+ socketIoQuery?: {} | DataLink
103
+ /* Protocols to be used in the WebSocket connection */
104
+ wsProtocols?: Array<string | DataLink> | DataLink | string | DataLink | DataLink
105
+ }
106
+ events?: {
107
+ /* Event for connected to server */
108
+ onOpen?: Array<EventAction>
109
+ /* Event for disconnect from server */
110
+ onClose?: Array<EventAction>
111
+ /* Event for receive message */
112
+ onMessage?: Array<EventAction<string & keyof TemplateEventPropsMap['WebSocket']['onMessage']>>
113
+ /* Event for error occurred */
114
+ onError?: Array<EventAction>
115
+ }
116
+ outlets?: {
117
+ /* Show socket.io connected or not */
118
+ readyState?: () => Data<string>
119
+ /* Results of each countdown change, it will save to Data */
120
+ message?: () => Data<any>
121
+ /* When Socket.IO mode server can response acknowledgemnt with data to client */
122
+ acknowledgeData?: () => Data<{ [key: string]: any }>
123
+ /* Error message */
124
+ errorMessage?: () => Data<string>
125
+ }
126
+ }
127
+
128
+ /* WebSocket or Socket.IO Generator */
129
+ export type GeneratorWebSocket = Generator &
130
+ GeneratorWebSocketDef & {
131
+ templateKey: 'GENERATOR_WEB_SOCKET'
132
+ switches?: Array<
133
+ SwitchDef &
134
+ GeneratorWebSocketDef & {
135
+ conds?: Array<{
136
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
137
+ cond:
138
+ | SwitchCondInnerStateCurrentCanvas
139
+ | SwitchCondData
140
+ | {
141
+ __typename: 'SwitchCondInnerStateOutlet'
142
+ outlet: 'readyState' | 'message' | 'acknowledgeData' | 'errorMessage'
143
+ value: any
144
+ }
145
+ }>
146
+ }
147
+ >
148
+ }
@@ -0,0 +1,57 @@
1
+ export * from './Tick'
2
+ export * from './AlarmClock'
3
+ export * from './File'
4
+ export * from './MediaFlow'
5
+ export * from './DataBank'
6
+ export * from './GraphQl'
7
+ export * from './Http'
8
+ export * from './SoundPlayer'
9
+ export * from './Keyboard'
10
+ export * from './WebSocket'
11
+ export * from './CanvasMap'
12
+ export * from './Step'
13
+ export * from './Iterator'
14
+ export * from './Watchdog'
15
+ export * from './MqttClient'
16
+ export * from './MqttBroker'
17
+ export * from './BleCentral'
18
+ export * from './SerialPort'
19
+ export * from './Tcp'
20
+ export * from './TcpServer'
21
+ export * from './Udp'
22
+ export * from './HttpServer'
23
+ export * from './WebRtc'
24
+ export * from './WebCrawler'
25
+ export * from './SoundRecorder'
26
+ export * from './BlePeripheral'
27
+ export * from './Question'
28
+ export * from './Information'
29
+ export * from './Intent'
30
+ export * from './CastlesPay'
31
+ export * from './SpeechToTextPlatform'
32
+ export * from './ThermalPrinter'
33
+ export * from './SqLite'
34
+ export * from './McpServer'
35
+ export * from './Mcp'
36
+ export * from './VadTraditional'
37
+ export * from './TextToSpeechOnnx'
38
+ export * from './LlmOnnx'
39
+ export * from './SpeechToTextOnnx'
40
+ export * from './VadOnnx'
41
+ export * from './SpeechToTextGgml'
42
+ export * from './VadGgml'
43
+ export * from './RealtimeTranscription'
44
+ export * from './LlmGgml'
45
+ export * from './TextToSpeechGgml'
46
+ export * from './RerankerGgml'
47
+ export * from './LlmMlx'
48
+ export * from './LlmQualcommAiEngine'
49
+ export * from './LlmMediaTekNeuroPilot'
50
+ export * from './LlmOpenAiCompat'
51
+ export * from './TextToSpeechOpenAiLike'
52
+ export * from './LlmAnthropicCompat'
53
+ export * from './LlmAppleBuiltin'
54
+ export * from './SttAppleBuiltin'
55
+ export * from './TextToSpeechAppleBuiltin'
56
+ export * from './Assistant'
57
+ export * from './VectorStore'
package/types/index.ts ADDED
@@ -0,0 +1,13 @@
1
+ export * from './data'
2
+ export * from './data-calc'
3
+ export * from './data-calc-script'
4
+ export * from './data-calc-command'
5
+ export * from './generators'
6
+ export * from './bricks'
7
+ export * from './animation'
8
+ export * from './canvas'
9
+ export * from './subspace'
10
+ export * from './common'
11
+ export * from './switch'
12
+ export * from './system'
13
+ export * from './automation'
@@ -0,0 +1,59 @@
1
+ import type { Brick, Generator, LocalSyncStrategy, EventAction, SubspaceID } from './common'
2
+ import type { Animation } from './animation'
3
+ import type { Canvas } from './canvas'
4
+ import type { Data } from './data'
5
+ import type { DataCalculation } from './data-calc'
6
+
7
+ export type Subspace = {
8
+ __typename: 'Subspace'
9
+ id: string
10
+ title: string
11
+ description?: string
12
+ hideShortRef?: boolean
13
+ unused?: boolean
14
+ portal?: 'top' | 'left' | 'bottom' | 'right'
15
+ // Unexpanded information in Editor
16
+ unexpanded?: {
17
+ data?: boolean
18
+ dataCalculation?: boolean
19
+ brick?: boolean
20
+ generator?: boolean
21
+ canvas?: Array<Canvas>
22
+ }
23
+ module?: {
24
+ id: string
25
+ version: string
26
+ selectedRequirements?: Array<{
27
+ subspace: SubspaceID
28
+ id: string
29
+ version: string
30
+ }>
31
+ // Module only
32
+ requirements?: Array<{
33
+ subspace: SubspaceID
34
+ id: string
35
+ version: string
36
+ }>
37
+ }
38
+ localSyncChangeCanvas?: LocalSyncStrategy
39
+ layout: {
40
+ width: number
41
+ height: number
42
+ resizeMode?: 'cover' | 'stretch'
43
+ }
44
+ rootCanvas: Canvas
45
+ canvases: Array<Canvas>
46
+ animations: Array<Animation>
47
+ bricks: Array<Brick>
48
+ generators: Array<Generator>
49
+ data: Array<Data>
50
+ dataRouting: Array<Data>
51
+ dataCalculation: Array<DataCalculation>
52
+ actions?: {
53
+ [key: string]: {
54
+ description: string
55
+ // TODO: add eventPropertyMap
56
+ }
57
+ }
58
+ events?: { [key: string]: Array<EventAction> }
59
+ }