@fugood/bricks-project 2.23.0-beta.9 → 2.23.2

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 (118) hide show
  1. package/api/instance.ts +37 -5
  2. package/compile/action-name-map.ts +107 -0
  3. package/compile/index.ts +172 -66
  4. package/compile/util.ts +13 -4
  5. package/package.json +9 -5
  6. package/skills/bricks-project/SKILL.md +32 -0
  7. package/skills/bricks-project/rules/animation.md +159 -0
  8. package/skills/bricks-project/rules/architecture-patterns.md +62 -0
  9. package/skills/bricks-project/rules/automations.md +221 -0
  10. package/skills/bricks-project/rules/buttress.md +153 -0
  11. package/skills/bricks-project/rules/data-calculation.md +208 -0
  12. package/skills/bricks-project/rules/local-sync.md +129 -0
  13. package/skills/bricks-project/rules/media-flow.md +158 -0
  14. package/skills/bricks-project/rules/remote-data-bank.md +196 -0
  15. package/skills/bricks-project/rules/standby-transition.md +124 -0
  16. package/skills/rive-marketplace/SKILL.md +99 -0
  17. package/tools/deploy.ts +74 -12
  18. package/tools/icons/.gitattributes +1 -0
  19. package/tools/icons/fa6pro-glyphmap.json +4686 -0
  20. package/tools/icons/fa6pro-meta.json +26127 -0
  21. package/tools/mcp-server.ts +818 -9
  22. package/tools/postinstall.ts +75 -13
  23. package/tools/preview-main.mjs +54 -4
  24. package/tools/preview.ts +54 -7
  25. package/tools/pull.ts +37 -16
  26. package/types/automation.ts +232 -0
  27. package/types/brick-base.ts +1 -0
  28. package/types/bricks/Camera.ts +26 -10
  29. package/types/bricks/Chart.ts +1 -0
  30. package/types/bricks/GenerativeMedia.ts +21 -3
  31. package/types/bricks/Icon.ts +1 -0
  32. package/types/bricks/Image.ts +6 -0
  33. package/types/bricks/Items.ts +1 -0
  34. package/types/bricks/Lottie.ts +1 -0
  35. package/types/bricks/Maps.ts +254 -0
  36. package/types/bricks/QrCode.ts +1 -0
  37. package/types/bricks/Rect.ts +1 -0
  38. package/types/bricks/RichText.ts +1 -0
  39. package/types/bricks/Rive.ts +1 -0
  40. package/types/bricks/Slideshow.ts +1 -0
  41. package/types/bricks/Svg.ts +1 -0
  42. package/types/bricks/Text.ts +1 -0
  43. package/types/bricks/TextInput.ts +1 -0
  44. package/types/bricks/Video.ts +1 -0
  45. package/types/bricks/VideoStreaming.ts +1 -0
  46. package/types/bricks/WebRtcStream.ts +1 -0
  47. package/types/bricks/WebView.ts +8 -1
  48. package/types/bricks/index.ts +2 -0
  49. package/types/canvas.ts +1 -0
  50. package/types/common.ts +2 -0
  51. package/types/data-calc-command.ts +7003 -0
  52. package/types/data-calc-script.ts +21 -0
  53. package/types/data-calc.ts +3 -6977
  54. package/types/data.ts +3 -0
  55. package/types/generators/AlarmClock.ts +2 -0
  56. package/types/generators/Assistant.ts +30 -6
  57. package/types/generators/BleCentral.ts +2 -0
  58. package/types/generators/BlePeripheral.ts +2 -0
  59. package/types/generators/CanvasMap.ts +2 -0
  60. package/types/generators/CastlesPay.ts +2 -0
  61. package/types/generators/DataBank.ts +2 -0
  62. package/types/generators/File.ts +2 -0
  63. package/types/generators/GraphQl.ts +2 -0
  64. package/types/generators/Http.ts +84 -2
  65. package/types/generators/HttpServer.ts +5 -1
  66. package/types/generators/Information.ts +2 -0
  67. package/types/generators/Intent.ts +51 -0
  68. package/types/generators/Iterator.ts +11 -2
  69. package/types/generators/Keyboard.ts +2 -0
  70. package/types/generators/LlmAnthropicCompat.ts +2 -0
  71. package/types/generators/LlmAppleBuiltin.ts +144 -0
  72. package/types/generators/LlmGgml.ts +28 -4
  73. package/types/generators/LlmOnnx.ts +2 -0
  74. package/types/generators/LlmOpenAiCompat.ts +2 -0
  75. package/types/generators/LlmQualcommAiEngine.ts +2 -0
  76. package/types/generators/Mcp.ts +6 -4
  77. package/types/generators/McpServer.ts +8 -6
  78. package/types/generators/MediaFlow.ts +2 -0
  79. package/types/generators/MqttBroker.ts +2 -0
  80. package/types/generators/MqttClient.ts +2 -0
  81. package/types/generators/Question.ts +9 -0
  82. package/types/generators/RealtimeTranscription.ts +18 -8
  83. package/types/generators/RerankerGgml.ts +23 -16
  84. package/types/generators/SerialPort.ts +2 -0
  85. package/types/generators/SoundPlayer.ts +2 -0
  86. package/types/generators/SoundRecorder.ts +2 -0
  87. package/types/generators/SpeechToTextGgml.ts +19 -4
  88. package/types/generators/SpeechToTextOnnx.ts +2 -0
  89. package/types/generators/SpeechToTextPlatform.ts +2 -0
  90. package/types/generators/SqLite.ts +32 -1
  91. package/types/generators/Step.ts +2 -0
  92. package/types/generators/SttAppleBuiltin.ts +117 -0
  93. package/types/generators/Tcp.ts +2 -0
  94. package/types/generators/TcpServer.ts +5 -1
  95. package/types/generators/TextToSpeechApple.ts +113 -0
  96. package/types/generators/TextToSpeechAppleBuiltin.ts +114 -0
  97. package/types/generators/TextToSpeechGgml.ts +24 -3
  98. package/types/generators/TextToSpeechOnnx.ts +2 -0
  99. package/types/generators/TextToSpeechOpenAiLike.ts +2 -0
  100. package/types/generators/ThermalPrinter.ts +2 -0
  101. package/types/generators/Tick.ts +5 -1
  102. package/types/generators/TtsAppleBuiltin.ts +105 -0
  103. package/types/generators/Udp.ts +2 -0
  104. package/types/generators/VadGgml.ts +4 -2
  105. package/types/generators/VadOnnx.ts +201 -0
  106. package/types/generators/VadTraditional.ts +123 -0
  107. package/types/generators/VectorStore.ts +15 -2
  108. package/types/generators/Watchdog.ts +2 -0
  109. package/types/generators/WebCrawler.ts +2 -0
  110. package/types/generators/WebRtc.ts +4 -2
  111. package/types/generators/WebSocket.ts +2 -0
  112. package/types/generators/index.ts +5 -0
  113. package/types/index.ts +3 -0
  114. package/types/system.ts +48 -6
  115. package/utils/calc.ts +15 -9
  116. package/utils/data.ts +1 -0
  117. package/utils/event-props.ts +112 -2
  118. package/utils/id.ts +3 -1
@@ -0,0 +1,201 @@
1
+ /* Auto generated by build script */
2
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
+ import type { Data, DataLink } from '../data'
4
+ import type {
5
+ Brick,
6
+ Generator,
7
+ EventAction,
8
+ ActionWithDataParams,
9
+ ActionWithParams,
10
+ Action,
11
+ EventProperty,
12
+ } from '../common'
13
+
14
+ /* Load the model */
15
+ export type GeneratorVadInferenceOnnxActionLoadModel = Action & {
16
+ __actionName: 'GENERATOR_ONNX_VAD_LOAD_MODEL'
17
+ }
18
+
19
+ /* Detect speech in audio file */
20
+ export type GeneratorVadInferenceOnnxActionDetectFile = ActionWithParams & {
21
+ __actionName: 'GENERATOR_ONNX_VAD_DETECT_FILE'
22
+ params?: Array<
23
+ | {
24
+ input: 'fileUrl'
25
+ value?: string | DataLink | EventProperty
26
+ mapping?: string
27
+ }
28
+ | {
29
+ input: 'threshold'
30
+ value?: number | DataLink | EventProperty
31
+ mapping?: string
32
+ }
33
+ | {
34
+ input: 'minSpeechDurationMs'
35
+ value?: number | DataLink | EventProperty
36
+ mapping?: string
37
+ }
38
+ | {
39
+ input: 'minSilenceDurationMs'
40
+ value?: number | DataLink | EventProperty
41
+ mapping?: string
42
+ }
43
+ | {
44
+ input: 'maxSpeechDurationS'
45
+ value?: number | DataLink | EventProperty
46
+ mapping?: string
47
+ }
48
+ | {
49
+ input: 'speechPadMs'
50
+ value?: number | DataLink | EventProperty
51
+ mapping?: string
52
+ }
53
+ >
54
+ }
55
+
56
+ /* Detect speech in audio data */
57
+ export type GeneratorVadInferenceOnnxActionDetectData = ActionWithParams & {
58
+ __actionName: 'GENERATOR_ONNX_VAD_DETECT_DATA'
59
+ params?: Array<
60
+ | {
61
+ input: 'data'
62
+ value?: any | EventProperty
63
+ mapping?: string
64
+ }
65
+ | {
66
+ input: 'threshold'
67
+ value?: number | DataLink | EventProperty
68
+ mapping?: string
69
+ }
70
+ | {
71
+ input: 'minSpeechDurationMs'
72
+ value?: number | DataLink | EventProperty
73
+ mapping?: string
74
+ }
75
+ | {
76
+ input: 'minSilenceDurationMs'
77
+ value?: number | DataLink | EventProperty
78
+ mapping?: string
79
+ }
80
+ | {
81
+ input: 'maxSpeechDurationS'
82
+ value?: number | DataLink | EventProperty
83
+ mapping?: string
84
+ }
85
+ | {
86
+ input: 'speechPadMs'
87
+ value?: number | DataLink | EventProperty
88
+ mapping?: string
89
+ }
90
+ >
91
+ }
92
+
93
+ /* Clean cache */
94
+ export type GeneratorVadInferenceOnnxActionCleanCache = Action & {
95
+ __actionName: 'GENERATOR_ONNX_VAD_CLEAN_CACHE'
96
+ }
97
+
98
+ /* Release context */
99
+ export type GeneratorVadInferenceOnnxActionReleaseContext = Action & {
100
+ __actionName: 'GENERATOR_ONNX_VAD_RELEASE_CONTEXT'
101
+ }
102
+
103
+ interface GeneratorVadInferenceOnnxDef {
104
+ /*
105
+ Default property:
106
+ {
107
+ "modelType": "auto",
108
+ "detectThreshold": 0.5,
109
+ "detectMinSpeechDurationMs": 250,
110
+ "detectMinSilenceDurationMs": 100,
111
+ "detectMaxSpeechDurationS": 30,
112
+ "detectSpeechPadMs": 30,
113
+ "executionMode": "sequential"
114
+ }
115
+ */
116
+ property?: {
117
+ /* Initialize the VAD context on generator initialization */
118
+ init?: boolean | DataLink
119
+ /* VAD model */
120
+ model?: string | DataLink
121
+ /* Model type (auto-detected from config.json) */
122
+ modelType?: string | DataLink
123
+ /* Quantize type */
124
+ quantizeType?:
125
+ | 'auto'
126
+ | 'none'
127
+ | 'fp16'
128
+ | 'q8'
129
+ | 'int8'
130
+ | 'uint8'
131
+ | 'q4'
132
+ | 'bnb4'
133
+ | 'q4f16'
134
+ | DataLink
135
+ /* Speech probability threshold (0.0-1.0) */
136
+ detectThreshold?: number | DataLink
137
+ /* Minimum speech duration in milliseconds */
138
+ detectMinSpeechDurationMs?: number | DataLink
139
+ /* Minimum silence duration in milliseconds */
140
+ detectMinSilenceDurationMs?: number | DataLink
141
+ /* Maximum speech duration in seconds */
142
+ detectMaxSpeechDurationS?: number | DataLink
143
+ /* Padding around speech segments in milliseconds */
144
+ detectSpeechPadMs?: number | DataLink
145
+ /* Executor candidates, descending order of priority
146
+ Default will be xnnpack, wasm, cpu */
147
+ executors?:
148
+ | Array<'qnn' | 'dml' | 'nnapi' | 'xnnpack' | 'coreml' | 'cpu' | 'wasm' | 'webgpu' | DataLink>
149
+ | DataLink
150
+ /* Execution mode
151
+ Usually when the model has many branches, setting this option to `parallel` will give you better performance. */
152
+ executionMode?: 'sequential' | 'parallel' | DataLink
153
+ /* QNN backend */
154
+ qnnBackend?: 'HTP' | 'HTA' | 'DSP' | 'GPU' | 'CPU' | DataLink
155
+ /* Enable FP16 for QNN HTP */
156
+ qnnHtpEnableFp16?: boolean | DataLink
157
+ /* Enable QNN debug */
158
+ qnnEnableDebug?: boolean | DataLink
159
+ }
160
+ events?: {
161
+ /* Event triggered when context state changes */
162
+ onContextStateChange?: Array<EventAction>
163
+ /* Event triggered when error occurs */
164
+ onError?: Array<EventAction>
165
+ /* Event triggered when got detection result */
166
+ onDetected?: Array<EventAction>
167
+ }
168
+ outlets?: {
169
+ /* Context state */
170
+ contextState?: () => Data
171
+ /* Is detecting */
172
+ isDetecting?: () => Data
173
+ /* Detection segments result */
174
+ detectionSegments?: () => Data
175
+ /* Detection details */
176
+ detectionDetails?: () => Data
177
+ }
178
+ }
179
+
180
+ /* Local Voice Activity Detection (VAD) inference based on [transformers.js](https://huggingface.co/docs/transformers.js)
181
+ You can use any compatible VAD model from HuggingFace (Silero VAD, smart-turn, etc.) */
182
+ export type GeneratorVadInferenceOnnx = Generator &
183
+ GeneratorVadInferenceOnnxDef & {
184
+ templateKey: 'GENERATOR_ONNX_VAD'
185
+ switches: Array<
186
+ SwitchDef &
187
+ GeneratorVadInferenceOnnxDef & {
188
+ conds?: Array<{
189
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
190
+ cond:
191
+ | SwitchCondInnerStateCurrentCanvas
192
+ | SwitchCondData
193
+ | {
194
+ __typename: 'SwitchCondInnerStateOutlet'
195
+ outlet: 'contextState' | 'isDetecting' | 'detectionSegments' | 'detectionDetails'
196
+ value: any
197
+ }
198
+ }>
199
+ }
200
+ >
201
+ }
@@ -0,0 +1,123 @@
1
+ /* Auto generated by build script */
2
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
+ import type { Data, DataLink } from '../data'
4
+ import type {
5
+ Brick,
6
+ Generator,
7
+ EventAction,
8
+ ActionWithDataParams,
9
+ ActionWithParams,
10
+ Action,
11
+ EventProperty,
12
+ } from '../common'
13
+
14
+ /* Detect speech in audio file */
15
+ export type GeneratorVadInferenceTraditionalActionDetectFile = ActionWithParams & {
16
+ __actionName: 'GENERATOR_TRADITIONAL_VAD_DETECT_FILE'
17
+ params?: Array<{
18
+ input: 'fileUrl'
19
+ value?: string | DataLink | EventProperty
20
+ mapping?: string
21
+ }>
22
+ }
23
+
24
+ /* Detect speech in audio data stream */
25
+ export type GeneratorVadInferenceTraditionalActionDetectData = ActionWithParams & {
26
+ __actionName: 'GENERATOR_TRADITIONAL_VAD_DETECT_DATA'
27
+ params?: Array<{
28
+ input: 'data'
29
+ value?: any | EventProperty
30
+ mapping?: string
31
+ }>
32
+ }
33
+
34
+ interface GeneratorVadInferenceTraditionalDef {
35
+ /*
36
+ Default property:
37
+ {
38
+ "detectVocalFreqMin": 75,
39
+ "detectVocalFreqMax": 900,
40
+ "detectThreshold": 0.5,
41
+ "detectMinSpeechDurationMs": 250,
42
+ "detectMinSilenceDurationMs": 100,
43
+ "detectMaxSpeechDurationS": 30,
44
+ "detectSpeechPadMs": 30
45
+ }
46
+ */
47
+ property?: {
48
+ /* Minimum vocal frequency in Hz */
49
+ detectVocalFreqMin?: number | DataLink
50
+ /* Maximum vocal frequency in Hz */
51
+ detectVocalFreqMax?: number | DataLink
52
+ /* Volume threshold in dB */
53
+ detectVolumeThreshold?: number | DataLink
54
+ /* Speech probability threshold (0.0-1.0) - maps to frequency clarity */
55
+ detectThreshold?: number | DataLink
56
+ /* Minimum speech duration in milliseconds */
57
+ detectMinSpeechDurationMs?: number | DataLink
58
+ /* Minimum silence duration in milliseconds */
59
+ detectMinSilenceDurationMs?: number | DataLink
60
+ /* Maximum speech duration in seconds */
61
+ detectMaxSpeechDurationS?: number | DataLink
62
+ /* Padding around speech segments in milliseconds */
63
+ detectSpeechPadMs?: number | DataLink
64
+ /* The file URL or path to be analyzed */
65
+ detectFileUrl?: string | DataLink
66
+ /* MD5 of file to be analyzed */
67
+ detectFileMd5?: string | DataLink
68
+ }
69
+ events?: {
70
+ /* Event triggered when context state changes */
71
+ onContextStateChange?: Array<EventAction>
72
+ /* Event triggered when detection result is available */
73
+ onDetected?: Array<EventAction>
74
+ /* Event triggered when error occurs */
75
+ onError?: Array<EventAction>
76
+ }
77
+ outlets?: {
78
+ /* Context state */
79
+ contextState?: () => Data
80
+ /* Is detecting */
81
+ isDetecting?: () => Data
82
+ /* Is speaking (real-time) */
83
+ isSpeaking?: () => Data
84
+ /* Detection segments result */
85
+ detectionSegments?: () => Data
86
+ /* Current volume in dB */
87
+ currentVolume?: () => Data
88
+ /* Current frequency clarity (0-1) */
89
+ currentClarity?: () => Data
90
+ /* Current detected frequency in Hz */
91
+ currentFrequency?: () => Data
92
+ }
93
+ }
94
+
95
+ /* Traditional Voice Activity Detection (VAD) using pitch detection and RMS volume analysis
96
+ No model download required - pure algorithmic approach */
97
+ export type GeneratorVadInferenceTraditional = Generator &
98
+ GeneratorVadInferenceTraditionalDef & {
99
+ templateKey: 'GENERATOR_TRADITIONAL_VAD'
100
+ switches: Array<
101
+ SwitchDef &
102
+ GeneratorVadInferenceTraditionalDef & {
103
+ conds?: Array<{
104
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
105
+ cond:
106
+ | SwitchCondInnerStateCurrentCanvas
107
+ | SwitchCondData
108
+ | {
109
+ __typename: 'SwitchCondInnerStateOutlet'
110
+ outlet:
111
+ | 'contextState'
112
+ | 'isDetecting'
113
+ | 'isSpeaking'
114
+ | 'detectionSegments'
115
+ | 'currentVolume'
116
+ | 'currentClarity'
117
+ | 'currentFrequency'
118
+ value: any
119
+ }
120
+ }>
121
+ }
122
+ >
123
+ }
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -159,8 +161,19 @@ Default property:
159
161
  ggmlContextSize?: number | DataLink
160
162
  /* Pooling type of ggml model */
161
163
  ggmlPoolingType?: 'none' | 'mean' | 'cls' | 'last' | 'rank' | DataLink
162
- /* Accelerator variant of ggml model */
163
- ggmlAccelVariant?: 'default' | 'vulkan' | 'cuda' | DataLink
164
+ /* GGML accelerator variant (Only for desktop)
165
+ `default` - CPU / Metal (macOS)
166
+ `vulkan` - Use Vulkan
167
+ `cuda` - Use CUDA
168
+ `snapdragon` - Use OpenCL/Hexagon of Qualcomm Snapdragon */
169
+ ggmlAccelVariant?: 'default' | 'vulkan' | 'cuda' | 'snapdragon' | DataLink
170
+ /* Devices. For example:
171
+
172
+ Metal or CPU for iOS/tvOS/MacOS
173
+ OpenCL or CPU for Android
174
+ - Add `HTP0`, `HTP1`, `...` for OpenCL/Hexagon devices (Use HTP* for all HTP devices)
175
+ For Desktop, you may want to include/exclude GPUs */
176
+ ggmlDevices?: Array<string | DataLink> | DataLink
164
177
  /* Normalize */
165
178
  ggmlEmbdNormalize?: number | DataLink
166
179
  /* API key of OpenAI Compatible API */
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -58,9 +60,9 @@ Default property:
58
60
  /* Calee ID, to ilter caller signal */
59
61
  calleeId?: string | DataLink
60
62
  /* Target local WebRTC stream preview brick ID */
61
- localVideoTarget?: string | DataLink
63
+ localVideoTarget?: string | DataLink | (() => Brick)
62
64
  /* Target remote WebRTC stream brick ID */
63
- remoteVideoTarget?: string | DataLink
65
+ remoteVideoTarget?: string | DataLink | (() => Brick)
64
66
  /* ICE Server list
65
67
  Default use Google public STUN servers if not setted. */
66
68
  iceServers?:
@@ -1,6 +1,8 @@
1
+ /* Auto generated by build script */
1
2
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
3
  import type { Data, DataLink } from '../data'
3
4
  import type {
5
+ Brick,
4
6
  Generator,
5
7
  EventAction,
6
8
  ActionWithDataParams,
@@ -33,9 +33,11 @@ export * from './ThermalPrinter'
33
33
  export * from './SqLite'
34
34
  export * from './McpServer'
35
35
  export * from './Mcp'
36
+ export * from './VadTraditional'
36
37
  export * from './TextToSpeechOnnx'
37
38
  export * from './LlmOnnx'
38
39
  export * from './SpeechToTextOnnx'
40
+ export * from './VadOnnx'
39
41
  export * from './SpeechToTextGgml'
40
42
  export * from './VadGgml'
41
43
  export * from './RealtimeTranscription'
@@ -46,5 +48,8 @@ export * from './LlmQualcommAiEngine'
46
48
  export * from './LlmOpenAiCompat'
47
49
  export * from './TextToSpeechOpenAiLike'
48
50
  export * from './LlmAnthropicCompat'
51
+ export * from './LlmAppleBuiltin'
52
+ export * from './SttAppleBuiltin'
53
+ export * from './TextToSpeechAppleBuiltin'
49
54
  export * from './Assistant'
50
55
  export * from './VectorStore'
package/types/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './data'
2
2
  export * from './data-calc'
3
+ export * from './data-calc-script'
4
+ export * from './data-calc-command'
3
5
  export * from './generators'
4
6
  export * from './bricks'
5
7
  export * from './animation'
@@ -8,3 +10,4 @@ export * from './subspace'
8
10
  export * from './common'
9
11
  export * from './switch'
10
12
  export * from './system'
13
+ export * from './automation'
package/types/system.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /* Auto generated by build script */
1
2
  import type {
2
3
  Action,
3
4
  ActionWithDataParams,
@@ -10,7 +11,7 @@ import type { Animation } from './animation'
10
11
  import type { Canvas } from './canvas'
11
12
  import type { Data, DataLink } from './data'
12
13
 
13
- /* Change Data value with script expression */
14
+ /* Change Data value with script expression. One expression of return value */
14
15
  export type SystemActionPropertyBankExpression = ActionWithParams & {
15
16
  __actionName: 'PROPERTY_BANK_EXPRESSION'
16
17
  params?: Array<
@@ -21,7 +22,13 @@ export type SystemActionPropertyBankExpression = ActionWithParams & {
21
22
  }
22
23
  | {
23
24
  input: 'variables'
24
- value?: {} | DataLink | EventProperty
25
+ value?:
26
+ | Array<{
27
+ id?: string
28
+ key?: string
29
+ }>
30
+ | DataLink
31
+ | EventProperty
25
32
  mapping?: string
26
33
  }
27
34
  | {
@@ -152,7 +159,13 @@ export type SystemActionChangeCanvas = ActionWithParams & {
152
159
  }
153
160
  | {
154
161
  input: 'canvasKeyMapList'
155
- value?: {} | DataLink | EventProperty
162
+ value?:
163
+ | Array<{
164
+ key?: string
165
+ value?: string
166
+ }>
167
+ | DataLink
168
+ | EventProperty
156
169
  mapping?: string
157
170
  }
158
171
  | {
@@ -217,7 +230,15 @@ export type SystemActionAlert = ActionWithParams & {
217
230
  }
218
231
  | {
219
232
  input: 'selections'
220
- value?: {} | DataLink | EventProperty
233
+ value?:
234
+ | Array<{
235
+ label?: string
236
+ color?: string
237
+ value?: string
238
+ disableResult?: boolean
239
+ }>
240
+ | DataLink
241
+ | EventProperty
221
242
  mapping?: string
222
243
  }
223
244
  | {
@@ -414,7 +435,15 @@ export type SystemActionChannelSubscribe = ActionWithParams & {
414
435
  }
415
436
  | {
416
437
  input: 'dataAssignList'
417
- value?: {} | DataLink | EventProperty
438
+ value?:
439
+ | Array<{
440
+ path?: string
441
+ type?: any
442
+ id?: string
443
+ required?: boolean
444
+ }>
445
+ | DataLink
446
+ | EventProperty
418
447
  mapping?: string
419
448
  }
420
449
  | {
@@ -424,7 +453,15 @@ export type SystemActionChannelSubscribe = ActionWithParams & {
424
453
  }
425
454
  | {
426
455
  input: 'progressAssignList'
427
- value?: {} | DataLink | EventProperty
456
+ value?:
457
+ | Array<{
458
+ path?: string
459
+ type?: any
460
+ id?: string
461
+ required?: boolean
462
+ }>
463
+ | DataLink
464
+ | EventProperty
428
465
  mapping?: string
429
466
  }
430
467
  | {
@@ -605,6 +642,11 @@ export type SystemActionThrowException = ActionWithParams & {
605
642
  >
606
643
  }
607
644
 
645
+ /* Restart the foundation (React Native bundle) */
646
+ export type SystemActionRestartFoundation = Action & {
647
+ __actionName: 'RESTART_FOUNDATION'
648
+ }
649
+
608
650
  /* Dismiss keyboard */
609
651
  export type SystemActionDismissKeyboard = Action & {
610
652
  __actionName: 'DISMISS_KEYBOARD'
package/utils/calc.ts CHANGED
@@ -1,4 +1,8 @@
1
- import type { DataCalculationMap, DataCalculationData, DataCommand } from '../types/data-calc'
1
+ import type {
2
+ DataCommand,
3
+ DataCalculationMap,
4
+ DataCalculationData,
5
+ } from '../types/data-calc-command'
2
6
 
3
7
  const GRID = {
4
8
  WIDTH: 300, // Distance between columns
@@ -29,10 +33,11 @@ export const generateDataCalculationMapEditorInfo = (
29
33
  nodes.forEach((node) => {
30
34
  // Count and track inputs
31
35
  if ('inputs' in node) {
32
- const inputs = node.inputs
33
- .filter((input) => input !== null)
34
- .map((input) => (Array.isArray(input) ? input.length : 1))
35
- .reduce((sum, count) => sum + count, 0)
36
+ const inputs = node.inputs.reduce((count, input) => {
37
+ if (input === null) return count
38
+ if (Array.isArray(input)) return count + input.length
39
+ return count + 1
40
+ }, 0)
36
41
  inputCounts.set(node, inputs)
37
42
 
38
43
  // Track connections
@@ -55,10 +60,11 @@ export const generateDataCalculationMapEditorInfo = (
55
60
 
56
61
  // Count outputs
57
62
  if ('outputs' in node) {
58
- const outputs = node.outputs
59
- .filter((output) => output !== null)
60
- .map((output) => (Array.isArray(output) ? output.length : 1))
61
- .reduce((sum, count) => sum + count, 0)
63
+ const outputs = node.outputs.reduce((count, output) => {
64
+ if (output === null) return count
65
+ if (Array.isArray(output)) return count + output.length
66
+ return count + 1
67
+ }, 0)
62
68
  outputCounts.set(node, outputs)
63
69
  } else {
64
70
  outputCounts.set(node, 0)
package/utils/data.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /* Auto generated by build script */
1
2
  import type { DataLink, Data, Canvas } from '../types'
2
3
  import { makeId } from './id'
3
4