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

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 (126) 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-project → bricks-ctor}/SKILL.md +2 -2
  7. package/skills/{bricks-project → bricks-ctor}/rules/animation.md +1 -1
  8. package/skills/{bricks-project → bricks-ctor}/rules/architecture-patterns.md +7 -0
  9. package/skills/bricks-ctor/rules/automations.md +221 -0
  10. package/skills/{bricks-project → bricks-ctor}/rules/buttress.md +10 -7
  11. package/skills/{bricks-project → bricks-ctor}/rules/data-calculation.md +1 -1
  12. package/skills/{bricks-project → bricks-ctor}/rules/local-sync.md +2 -2
  13. package/skills/{bricks-project → bricks-ctor}/rules/media-flow.md +3 -3
  14. package/skills/{bricks-project → bricks-ctor}/rules/remote-data-bank.md +6 -6
  15. package/skills/{bricks-project → bricks-ctor}/rules/standby-transition.md +1 -1
  16. package/skills/bricks-design/LICENSE.txt +180 -0
  17. package/skills/bricks-design/SKILL.md +66 -0
  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/skills/bricks-project/rules/automations.md +0 -175
  125. package/types/generators/TextToSpeechApple.ts +0 -113
  126. package/types/generators/TtsAppleBuiltin.ts +0 -105
@@ -1,4 +1,8 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Traditional Voice Activity Detection (VAD) using pitch detection and RMS volume analysis
4
+ * No model download required - pure algorithmic approach
5
+ */
2
6
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
7
  import type { Data, DataLink } from '../data'
4
8
  import type {
@@ -10,6 +14,7 @@ import type {
10
14
  Action,
11
15
  EventProperty,
12
16
  } from '../common'
17
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
18
 
14
19
  /* Detect speech in audio file */
15
20
  export type GeneratorVadInferenceTraditionalActionDetectFile = ActionWithParams & {
@@ -68,36 +73,46 @@ Default property:
68
73
  }
69
74
  events?: {
70
75
  /* Event triggered when context state changes */
71
- onContextStateChange?: Array<EventAction>
76
+ onContextStateChange?: Array<
77
+ EventAction<string & keyof TemplateEventPropsMap['TraditionalVad']['onContextStateChange']>
78
+ >
72
79
  /* Event triggered when detection result is available */
73
- onDetected?: Array<EventAction>
80
+ onDetected?: Array<
81
+ EventAction<string & keyof TemplateEventPropsMap['TraditionalVad']['onDetected']>
82
+ >
74
83
  /* Event triggered when error occurs */
75
- onError?: Array<EventAction>
84
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['TraditionalVad']['onError']>>
76
85
  }
77
86
  outlets?: {
78
87
  /* Context state */
79
- contextState?: () => Data
88
+ contextState?: () => Data<string>
80
89
  /* Is detecting */
81
- isDetecting?: () => Data
90
+ isDetecting?: () => Data<boolean>
82
91
  /* Is speaking (real-time) */
83
- isSpeaking?: () => Data
92
+ isSpeaking?: () => Data<boolean>
84
93
  /* Detection segments result */
85
- detectionSegments?: () => Data
94
+ detectionSegments?: () => Data<
95
+ Array<{
96
+ t0?: number
97
+ t1?: number
98
+ [key: string]: any
99
+ }>
100
+ >
86
101
  /* Current volume in dB */
87
- currentVolume?: () => Data
102
+ currentVolume?: () => Data<number>
88
103
  /* Current frequency clarity (0-1) */
89
- currentClarity?: () => Data
104
+ currentClarity?: () => Data<number>
90
105
  /* Current detected frequency in Hz */
91
- currentFrequency?: () => Data
106
+ currentFrequency?: () => Data<number>
92
107
  }
93
108
  }
94
109
 
95
- /* Traditional Voice Activity Detection (VAD) using pitch detection and RMS volume analysis
110
+ /* Traditional Voice Activity Detection (VAD) using pitch detection and RMS volume analysis
96
111
  No model download required - pure algorithmic approach */
97
112
  export type GeneratorVadInferenceTraditional = Generator &
98
113
  GeneratorVadInferenceTraditionalDef & {
99
114
  templateKey: 'GENERATOR_TRADITIONAL_VAD'
100
- switches: Array<
115
+ switches?: Array<
101
116
  SwitchDef &
102
117
  GeneratorVadInferenceTraditionalDef & {
103
118
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Vector database for semantic search. Supports GGML (on-device GGUF models) and OpenAI Compatible API (OpenAI/ollama/llama.cpp) as embedding sources
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
  /* Load the model (Only if source is ggml) */
15
19
  export type GeneratorVectorStoreActionModelLoad = Action & {
@@ -31,7 +35,7 @@ export type GeneratorVectorStoreActionReset = ActionWithParams & {
31
35
  }>
32
36
  }
33
37
 
34
- /* Insert file content with path or url, support Office / OpenOffice / PDF
38
+ /* Insert file content with path or url, support Office / OpenOffice / PDF
35
39
 
36
40
  PDF is not currently supprted in iOS / Android */
37
41
  export type GeneratorVectorStoreActionInsertFile = ActionWithParams & {
@@ -161,13 +165,13 @@ Default property:
161
165
  ggmlContextSize?: number | DataLink
162
166
  /* Pooling type of ggml model */
163
167
  ggmlPoolingType?: 'none' | 'mean' | 'cls' | 'last' | 'rank' | DataLink
164
- /* GGML accelerator variant (Only for desktop)
168
+ /* GGML accelerator variant (Only for desktop)
165
169
  `default` - CPU / Metal (macOS)
166
170
  `vulkan` - Use Vulkan
167
171
  `cuda` - Use CUDA
168
172
  `snapdragon` - Use OpenCL/Hexagon of Qualcomm Snapdragon */
169
173
  ggmlAccelVariant?: 'default' | 'vulkan' | 'cuda' | 'snapdragon' | DataLink
170
- /* Devices. For example:
174
+ /* Devices. For example:
171
175
 
172
176
  Metal or CPU for iOS/tvOS/MacOS
173
177
  OpenCL or CPU for Android
@@ -197,27 +201,44 @@ Default property:
197
201
  }
198
202
  events?: {
199
203
  /* Event triggered when error occurs */
200
- onError?: Array<EventAction>
204
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['VectorStore']['onError']>>
201
205
  }
202
206
  outlets?: {
203
207
  /* undefined */
204
- isReady?: () => Data
208
+ isReady?: () => Data<boolean>
205
209
  /* Whether the embedding is processing */
206
- processing?: () => Data
210
+ processing?: () => Data<boolean>
207
211
  /* Progress of embedding processing */
208
- processProgress?: () => Data
212
+ processProgress?: () => Data<{
213
+ chunking?: number
214
+ embedding?: number
215
+ writing?: number
216
+ [key: string]: any
217
+ }>
209
218
  /* Files inserted to embedding */
210
- files?: () => Data
219
+ files?: () => Data<Array<string>>
211
220
  /* Search result */
212
- searchResult?: () => Data
221
+ searchResult?: () => Data<
222
+ Array<{
223
+ sessionId?: string
224
+ payload?: { [key: string]: any }
225
+ filename?: string
226
+ text?: string
227
+ textTokenSize?: number
228
+ fileTokenPos?: number
229
+ fileTokenLength?: number
230
+ distance?: number
231
+ [key: string]: any
232
+ }>
233
+ >
213
234
  }
214
235
  }
215
236
 
216
- /* Vector Store - File embeddings & search */
237
+ /* Vector database for semantic search. Supports GGML (on-device GGUF models) and OpenAI Compatible API (OpenAI/ollama/llama.cpp) as embedding sources */
217
238
  export type GeneratorVectorStore = Generator &
218
239
  GeneratorVectorStoreDef & {
219
240
  templateKey: 'GENERATOR_VECTOR_STORE'
220
- switches: Array<
241
+ switches?: Array<
221
242
  SwitchDef &
222
243
  GeneratorVectorStoreDef & {
223
244
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Trigger event with timeout by listening to specified events
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
  /* Reset watch */
15
19
  export type GeneratorWatchdogActionResetWatch = Action & {
@@ -52,29 +56,34 @@ Default property:
52
56
  }
53
57
  events?: {
54
58
  /* Event on specific sender id trigger event */
55
- onEvent?: Array<EventAction>
59
+ onEvent?: Array<EventAction<string & keyof TemplateEventPropsMap['Watchdog']['onEvent']>>
56
60
  /* Event on timeout */
57
- onTimeout?: Array<EventAction>
61
+ onTimeout?: Array<EventAction<string & keyof TemplateEventPropsMap['Watchdog']['onTimeout']>>
58
62
  }
59
63
  outlets?: {
60
64
  /* The last event */
61
- lastEvent?: () => Data
65
+ lastEvent?: () => Data<{
66
+ id?: string
67
+ type?: string
68
+ triggerType?: string
69
+ timeout?: number
70
+ }>
62
71
  /* The type fo last event */
63
- lastEventType?: () => Data
72
+ lastEventType?: () => Data<string>
64
73
  /* The trigger type of last event */
65
- lastEventTriggerType?: () => Data
74
+ lastEventTriggerType?: () => Data<string>
66
75
  /* The sender id of last event */
67
- lastEventSenderId?: () => Data
76
+ lastEventSenderId?: () => Data<string>
68
77
  /* Is timed out */
69
- isTimedOut?: () => Data
78
+ isTimedOut?: () => Data<boolean>
70
79
  }
71
80
  }
72
81
 
73
- /* Triger event with timeout by listen specified events */
82
+ /* Trigger event with timeout by listening to specified events */
74
83
  export type GeneratorWatchdog = Generator &
75
84
  GeneratorWatchdogDef & {
76
85
  templateKey: 'GENERATOR_WATCHDOG'
77
- switches: Array<
86
+ switches?: Array<
78
87
  SwitchDef &
79
88
  GeneratorWatchdogDef & {
80
89
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
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
+ */
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
  /* Run Crawler request with defined properties */
15
19
  export type GeneratorWebCrawlerActionRunRequest = Action & {
@@ -31,7 +35,7 @@ Default property:
31
35
  init?: boolean | DataLink
32
36
  /* URL of crawler request */
33
37
  url?: string | DataLink
34
- /* Method of crawler request
38
+ /* Method of crawler request
35
39
 
36
40
  Platform not supported for `webview`: tvOS, Desktop, Web */
37
41
  method?: 'webview' | 'http' | DataLink
@@ -68,19 +72,19 @@ Default property:
68
72
  }
69
73
  outlets?: {
70
74
  /* Response for CRAWLER request (selector) */
71
- response?: () => Data
75
+ response?: () => Data<string>
72
76
  /* Responses for CRAWLER request (selectorList) */
73
- responseList?: () => Data
77
+ responseList?: () => Data<Array<any>>
74
78
  /* The error response of CRAWLER request, it will save to property bank */
75
- error?: () => Data
79
+ error?: () => Data<string>
76
80
  }
77
81
  }
78
82
 
79
- /* Web crawler to get specific value */
83
+ /* Extract web content via CSS selectors. Supports WebView method (iOS/Android, renders JS) and HTTP method (all platforms, direct request) */
80
84
  export type GeneratorWebCrawler = Generator &
81
85
  GeneratorWebCrawlerDef & {
82
86
  templateKey: 'GENERATOR_WEB_CRAWLER'
83
- switches: Array<
87
+ switches?: Array<
84
88
  SwitchDef &
85
89
  GeneratorWebCrawlerDef & {
86
90
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * WebRTC peer connection for real-time audio/video/data communication
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
  /* Initiate WebRTC request */
15
19
  export type GeneratorWebRTCActionInitiate = Action & {
@@ -63,7 +67,7 @@ Default property:
63
67
  localVideoTarget?: string | DataLink | (() => Brick)
64
68
  /* Target remote WebRTC stream brick ID */
65
69
  remoteVideoTarget?: string | DataLink | (() => Brick)
66
- /* ICE Server list
70
+ /* ICE Server list
67
71
  Default use Google public STUN servers if not setted. */
68
72
  iceServers?:
69
73
  | Array<
@@ -89,7 +93,7 @@ Default property:
89
93
  videoWidth?: number | DataLink
90
94
  /* Label of data channel */
91
95
  dataChannelLabel?: string | DataLink
92
- /* Input signal for create peer connection
96
+ /* Input signal for create peer connection
93
97
  Signal Types:
94
98
  `initiate`: Initiate a WebRTC call
95
99
  `offer`: WebRTC SDP offer
@@ -102,45 +106,55 @@ Default property:
102
106
  }
103
107
  events?: {
104
108
  /* Event of signal update */
105
- onSignalUpdate?: Array<EventAction>
109
+ onSignalUpdate?: Array<
110
+ EventAction<string & keyof TemplateEventPropsMap['Webrtc']['onSignalUpdate']>
111
+ >
106
112
  /* Event of peer connected */
107
113
  onConnected?: Array<EventAction>
108
114
  /* Event of peer disconnected */
109
115
  onDisconnected?: Array<EventAction>
110
116
  /* Event of handshake error */
111
- onError?: Array<EventAction>
117
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Webrtc']['onError']>>
112
118
  /* Event of data channel open */
113
119
  onChannelOpen?: Array<EventAction>
114
120
  /* Event of data channel close */
115
121
  onChannelClose?: Array<EventAction>
116
122
  /* Event of received message on data channel */
117
- onChannelMessage?: Array<EventAction>
123
+ onChannelMessage?: Array<
124
+ EventAction<string & keyof TemplateEventPropsMap['Webrtc']['onChannelMessage']>
125
+ >
118
126
  }
119
127
  outlets?: {
120
128
  /* Signal to create peer connection */
121
- signal?: () => Data
129
+ signal?: () => Data<any>
122
130
  /* Local SDP offer */
123
- sdpOffer?: () => Data
131
+ sdpOffer?: () => Data<{
132
+ type?: string
133
+ sdp?: string
134
+ }>
124
135
  /* Local SDP answer */
125
- sdpAnswer?: () => Data
136
+ sdpAnswer?: () => Data<{
137
+ type?: string
138
+ sdp?: string
139
+ }>
126
140
  /* Peer connection state */
127
- connectionState?: () => Data
141
+ connectionState?: () => Data<string>
128
142
  /* ICE connection state */
129
- iceConnectionState?: () => Data
143
+ iceConnectionState?: () => Data<string>
130
144
  /* Signaling state */
131
- signalingState?: () => Data
145
+ signalingState?: () => Data<string>
132
146
  /* Last message from data channel */
133
- lastChannelMessage?: () => Data
147
+ lastChannelMessage?: () => Data<string>
134
148
  /* Error message */
135
- errorMessage?: () => Data
149
+ errorMessage?: () => Data<string>
136
150
  }
137
151
  }
138
152
 
139
- /* WebRTC */
153
+ /* WebRTC peer connection for real-time audio/video/data communication */
140
154
  export type GeneratorWebRTC = Generator &
141
155
  GeneratorWebRTCDef & {
142
156
  templateKey: 'GENERATOR_WEBRTC'
143
- switches: Array<
157
+ switches?: Array<
144
158
  SwitchDef &
145
159
  GeneratorWebRTCDef & {
146
160
  conds?: Array<{
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * WebSocket or Socket.IO Generator
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 */
15
19
  export type GeneratorWebSocketActionConnect = Action & {
@@ -105,19 +109,19 @@ Default property:
105
109
  /* Event for disconnect from server */
106
110
  onClose?: Array<EventAction>
107
111
  /* Event for receive message */
108
- onMessage?: Array<EventAction>
112
+ onMessage?: Array<EventAction<string & keyof TemplateEventPropsMap['WebSocket']['onMessage']>>
109
113
  /* Event for error occurred */
110
114
  onError?: Array<EventAction>
111
115
  }
112
116
  outlets?: {
113
117
  /* Show socket.io connected or not */
114
- readyState?: () => Data
118
+ readyState?: () => Data<string>
115
119
  /* Results of each countdown change, it will save to Data */
116
- message?: () => Data
120
+ message?: () => Data<any>
117
121
  /* When Socket.IO mode server can response acknowledgemnt with data to client */
118
- acknowledgeData?: () => Data
122
+ acknowledgeData?: () => Data<{ [key: string]: any }>
119
123
  /* Error message */
120
- errorMessage?: () => Data
124
+ errorMessage?: () => Data<string>
121
125
  }
122
126
  }
123
127
 
@@ -125,7 +129,7 @@ Default property:
125
129
  export type GeneratorWebSocket = Generator &
126
130
  GeneratorWebSocketDef & {
127
131
  templateKey: 'GENERATOR_WEB_SOCKET'
128
- switches: Array<
132
+ switches?: Array<
129
133
  SwitchDef &
130
134
  GeneratorWebSocketDef & {
131
135
  conds?: Array<{
@@ -44,7 +44,9 @@ export * from './RealtimeTranscription'
44
44
  export * from './LlmGgml'
45
45
  export * from './TextToSpeechGgml'
46
46
  export * from './RerankerGgml'
47
+ export * from './LlmMlx'
47
48
  export * from './LlmQualcommAiEngine'
49
+ export * from './LlmMediaTekNeuroPilot'
48
50
  export * from './LlmOpenAiCompat'
49
51
  export * from './TextToSpeechOpenAiLike'
50
52
  export * from './LlmAnthropicCompat'
package/types/subspace.ts CHANGED
@@ -9,6 +9,9 @@ export type Subspace = {
9
9
  id: string
10
10
  title: string
11
11
  description?: string
12
+ hideShortRef?: boolean
13
+ unused?: boolean
14
+ portal?: 'top' | 'left' | 'bottom' | 'right'
12
15
  // Unexpanded information in Editor
13
16
  unexpanded?: {
14
17
  data?: boolean
package/types/system.ts CHANGED
@@ -276,7 +276,7 @@ export type SystemActionPopupReset = ActionWithParams & {
276
276
  >
277
277
  }
278
278
 
279
- /* Take screenshot for current subspace */
279
+ /* Take screenshot for current subspace or the full viewport (including portal subspaces) */
280
280
  export type SystemActionTakeScreenshot = ActionWithParams & {
281
281
  __actionName: 'TAKE_SCREENSHOT'
282
282
  params?: Array<
package/utils/calc.ts CHANGED
@@ -33,10 +33,12 @@ export const generateDataCalculationMapEditorInfo = (
33
33
  nodes.forEach((node) => {
34
34
  // Count and track inputs
35
35
  if ('inputs' in node) {
36
- const inputs = node.inputs
37
- .filter((input) => input !== null)
38
- .map((input) => (Array.isArray(input) ? input.length : 1))
39
- .reduce((sum, count) => sum + count, 0)
36
+ let inputs = 0
37
+ for (const input of node.inputs) {
38
+ if (input === null) continue
39
+ if (Array.isArray(input)) inputs += input.length
40
+ else inputs += 1
41
+ }
40
42
  inputCounts.set(node, inputs)
41
43
 
42
44
  // Track connections
@@ -59,10 +61,12 @@ export const generateDataCalculationMapEditorInfo = (
59
61
 
60
62
  // Count outputs
61
63
  if ('outputs' in node) {
62
- const outputs = node.outputs
63
- .filter((output) => output !== null)
64
- .map((output) => (Array.isArray(output) ? output.length : 1))
65
- .reduce((sum, count) => sum + count, 0)
64
+ let outputs = 0
65
+ for (const output of node.outputs) {
66
+ if (output === null) continue
67
+ if (Array.isArray(output)) outputs += output.length
68
+ else outputs += 1
69
+ }
66
70
  outputCounts.set(node, outputs)
67
71
  } else {
68
72
  outputCounts.set(node, 0)