@fugood/bricks-ctor 2.25.0-beta.5 → 2.25.0-beta.50

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 (185) hide show
  1. package/compile/__tests__/config-diff.test.js +100 -0
  2. package/compile/__tests__/index.test.js +365 -0
  3. package/compile/__tests__/util.test.js +317 -0
  4. package/compile/action-name-map.ts +64 -0
  5. package/compile/config-diff.ts +155 -0
  6. package/compile/index.ts +273 -32
  7. package/compile/util.ts +26 -7
  8. package/package.json +7 -3
  9. package/skills/bricks-ctor/SKILL.md +23 -17
  10. package/skills/bricks-ctor/{rules → references}/animation.md +3 -2
  11. package/skills/bricks-ctor/{rules → references}/architecture-patterns.md +18 -0
  12. package/skills/bricks-ctor/{rules → references}/automations.md +11 -0
  13. package/skills/bricks-ctor/references/buttress.md +245 -0
  14. package/skills/bricks-ctor/references/data-calculation.md +239 -0
  15. package/skills/bricks-ctor/references/simulator.md +132 -0
  16. package/skills/bricks-ctor/references/source-editing-tools.md +81 -0
  17. package/skills/bricks-ctor/references/verification-toolchain.md +200 -0
  18. package/skills/bricks-design/SKILL.md +150 -45
  19. package/skills/bricks-design/references/architecture-truths.md +132 -0
  20. package/skills/bricks-design/references/avoiding-complexity.md +91 -0
  21. package/skills/bricks-design/references/design-critique.md +195 -0
  22. package/skills/bricks-design/references/design-languages.md +265 -0
  23. package/skills/bricks-design/references/performance.md +116 -0
  24. package/skills/bricks-design/references/presentation-and-slideshow.md +137 -0
  25. package/skills/bricks-design/references/translating-inputs.md +152 -0
  26. package/skills/bricks-design/references/variations-and-tweaks.md +124 -0
  27. package/skills/bricks-design/references/when-the-brief-is-branded.md +284 -0
  28. package/skills/bricks-design/references/when-the-brief-is-vague.md +85 -0
  29. package/skills/bricks-design/references/workflow.md +134 -0
  30. package/skills/bricks-ux/SKILL.md +114 -0
  31. package/skills/bricks-ux/references/accessibility.md +162 -0
  32. package/skills/bricks-ux/references/flow-states.md +175 -0
  33. package/skills/bricks-ux/references/interaction-archetypes.md +189 -0
  34. package/skills/bricks-ux/references/monitoring-screens.md +153 -0
  35. package/skills/bricks-ux/references/pressable-composition.md +126 -0
  36. package/skills/bricks-ux/references/user-journey.md +168 -0
  37. package/skills/bricks-ux/references/ux-critique.md +256 -0
  38. package/tools/__tests__/_cli-error.test.ts +35 -0
  39. package/tools/_cli-error.ts +17 -0
  40. package/tools/_edits-log.ts +41 -0
  41. package/tools/_git-author.ts +10 -2
  42. package/tools/_last-pushed-commit.ts +28 -0
  43. package/tools/_shell.ts +8 -1
  44. package/tools/deploy.ts +17 -6
  45. package/tools/mcp-env.ts +13 -0
  46. package/tools/mcp-server.ts +8 -0
  47. package/tools/mcp-tools/__tests__/data-calc-editing.test.js +516 -0
  48. package/tools/mcp-tools/__tests__/entry-editing.test.js +866 -0
  49. package/tools/mcp-tools/__tests__/huggingface.test.ts +49 -0
  50. package/tools/mcp-tools/__tests__/icons.test.ts +21 -0
  51. package/tools/mcp-tools/__tests__/mcp-env.test.js +19 -0
  52. package/tools/mcp-tools/_editing-helpers.ts +58 -0
  53. package/tools/mcp-tools/_verify.ts +50 -0
  54. package/tools/mcp-tools/compile.ts +21 -9
  55. package/tools/mcp-tools/data-calc-editing.ts +1349 -0
  56. package/tools/mcp-tools/entry-editing.ts +2336 -0
  57. package/tools/mcp-tools/huggingface.ts +23 -13
  58. package/tools/mcp-tools/icons.ts +23 -7
  59. package/tools/mcp-tools/media.ts +4 -1
  60. package/tools/postinstall.ts +80 -3
  61. package/tools/pull.ts +93 -22
  62. package/tools/push-config.ts +114 -0
  63. package/tools/{preview-main.mjs → simulator-main.mjs} +207 -12
  64. package/tools/simulator-preload.cjs +16 -0
  65. package/tools/{preview.ts → simulator.ts} +4 -4
  66. package/types/{animation.ts → animation.d.ts} +24 -8
  67. package/types/{automation.ts → automation.d.ts} +16 -20
  68. package/types/{brick-base.ts → brick-base.d.ts} +1 -1
  69. package/types/bricks/{Camera.ts → Camera.d.ts} +8 -8
  70. package/types/bricks/{Chart.ts → Chart.d.ts} +4 -4
  71. package/types/bricks/{GenerativeMedia.ts → GenerativeMedia.d.ts} +15 -15
  72. package/types/bricks/{Icon.ts → Icon.d.ts} +7 -7
  73. package/types/bricks/{Image.ts → Image.d.ts} +21 -9
  74. package/types/bricks/{Items.ts → Items.d.ts} +7 -7
  75. package/types/bricks/{Lottie.ts → Lottie.d.ts} +10 -10
  76. package/types/bricks/{Maps.ts → Maps.d.ts} +11 -11
  77. package/types/bricks/{QrCode.ts → QrCode.d.ts} +7 -7
  78. package/types/bricks/{Rect.ts → Rect.d.ts} +7 -7
  79. package/types/bricks/{RichText.ts → RichText.d.ts} +12 -9
  80. package/types/bricks/{Rive.ts → Rive.d.ts} +9 -9
  81. package/types/bricks/Scene3D.d.ts +676 -0
  82. package/types/bricks/{Sketch.ts → Sketch.d.ts} +6 -6
  83. package/types/bricks/{Slideshow.ts → Slideshow.d.ts} +7 -7
  84. package/types/bricks/{Svg.ts → Svg.d.ts} +7 -7
  85. package/types/bricks/{Text.ts → Text.d.ts} +9 -9
  86. package/types/bricks/{TextInput.ts → TextInput.d.ts} +10 -10
  87. package/types/bricks/{Video.ts → Video.d.ts} +12 -12
  88. package/types/bricks/{VideoStreaming.ts → VideoStreaming.d.ts} +10 -10
  89. package/types/bricks/{WebRtcStream.ts → WebRtcStream.d.ts} +1 -1
  90. package/types/bricks/{WebView.ts → WebView.d.ts} +4 -4
  91. package/types/bricks/{index.ts → index.d.ts} +1 -0
  92. package/types/{common.ts → common.d.ts} +3 -6
  93. package/types/data-calc-command/base.d.ts +57 -0
  94. package/types/data-calc-command/collection.d.ts +418 -0
  95. package/types/data-calc-command/color.d.ts +432 -0
  96. package/types/data-calc-command/constant.d.ts +50 -0
  97. package/types/data-calc-command/datetime.d.ts +147 -0
  98. package/types/data-calc-command/file.d.ts +129 -0
  99. package/types/data-calc-command/index.d.ts +13 -0
  100. package/types/data-calc-command/iteratee.d.ts +23 -0
  101. package/types/data-calc-command/logictype.d.ts +190 -0
  102. package/types/data-calc-command/math.d.ts +275 -0
  103. package/types/data-calc-command/object.d.ts +119 -0
  104. package/types/data-calc-command/sandbox.d.ts +66 -0
  105. package/types/data-calc-command/string.d.ts +407 -0
  106. package/types/{data-calc.ts → data-calc.d.ts} +1 -0
  107. package/types/{data.ts → data.d.ts} +4 -2
  108. package/types/generators/{Assistant.ts → Assistant.d.ts} +19 -0
  109. package/types/generators/{LlmGgml.ts → LlmGgml.d.ts} +43 -1
  110. package/types/generators/{LlmMlx.ts → LlmMlx.d.ts} +1 -0
  111. package/types/generators/{RerankerGgml.ts → RerankerGgml.d.ts} +5 -1
  112. package/types/generators/{SoundRecorder.ts → SoundRecorder.d.ts} +10 -1
  113. package/types/generators/{SpeechToTextGgml.ts → SpeechToTextGgml.d.ts} +6 -1
  114. package/types/generators/{SttAppleBuiltin.ts → SttAppleBuiltin.d.ts} +27 -4
  115. package/types/generators/{ThermalPrinter.ts → ThermalPrinter.d.ts} +9 -7
  116. package/types/generators/{VadGgml.ts → VadGgml.d.ts} +12 -2
  117. package/types/{subspace.ts → subspace.d.ts} +1 -1
  118. package/utils/__tests__/calc.test.js +25 -0
  119. package/utils/__tests__/id.test.js +154 -0
  120. package/utils/calc.ts +5 -1
  121. package/utils/data.ts +5 -7
  122. package/utils/event-props.ts +17 -0
  123. package/utils/id.ts +109 -56
  124. package/skills/bricks-ctor/rules/buttress.md +0 -156
  125. package/skills/bricks-ctor/rules/data-calculation.md +0 -209
  126. package/skills/bricks-design/LICENSE.txt +0 -180
  127. package/types/data-calc-command.ts +0 -7005
  128. /package/skills/bricks-ctor/{rules → references}/local-sync.md +0 -0
  129. /package/skills/bricks-ctor/{rules → references}/media-flow.md +0 -0
  130. /package/skills/bricks-ctor/{rules → references}/remote-data-bank.md +0 -0
  131. /package/skills/bricks-ctor/{rules → references}/standby-transition.md +0 -0
  132. /package/types/{canvas.ts → canvas.d.ts} +0 -0
  133. /package/types/{data-calc-script.ts → data-calc-script.d.ts} +0 -0
  134. /package/types/generators/{AlarmClock.ts → AlarmClock.d.ts} +0 -0
  135. /package/types/generators/{BleCentral.ts → BleCentral.d.ts} +0 -0
  136. /package/types/generators/{BlePeripheral.ts → BlePeripheral.d.ts} +0 -0
  137. /package/types/generators/{CanvasMap.ts → CanvasMap.d.ts} +0 -0
  138. /package/types/generators/{CastlesPay.ts → CastlesPay.d.ts} +0 -0
  139. /package/types/generators/{DataBank.ts → DataBank.d.ts} +0 -0
  140. /package/types/generators/{File.ts → File.d.ts} +0 -0
  141. /package/types/generators/{GraphQl.ts → GraphQl.d.ts} +0 -0
  142. /package/types/generators/{Http.ts → Http.d.ts} +0 -0
  143. /package/types/generators/{HttpServer.ts → HttpServer.d.ts} +0 -0
  144. /package/types/generators/{Information.ts → Information.d.ts} +0 -0
  145. /package/types/generators/{Intent.ts → Intent.d.ts} +0 -0
  146. /package/types/generators/{Iterator.ts → Iterator.d.ts} +0 -0
  147. /package/types/generators/{Keyboard.ts → Keyboard.d.ts} +0 -0
  148. /package/types/generators/{LlmAnthropicCompat.ts → LlmAnthropicCompat.d.ts} +0 -0
  149. /package/types/generators/{LlmAppleBuiltin.ts → LlmAppleBuiltin.d.ts} +0 -0
  150. /package/types/generators/{LlmMediaTekNeuroPilot.ts → LlmMediaTekNeuroPilot.d.ts} +0 -0
  151. /package/types/generators/{LlmOnnx.ts → LlmOnnx.d.ts} +0 -0
  152. /package/types/generators/{LlmOpenAiCompat.ts → LlmOpenAiCompat.d.ts} +0 -0
  153. /package/types/generators/{LlmQualcommAiEngine.ts → LlmQualcommAiEngine.d.ts} +0 -0
  154. /package/types/generators/{Mcp.ts → Mcp.d.ts} +0 -0
  155. /package/types/generators/{McpServer.ts → McpServer.d.ts} +0 -0
  156. /package/types/generators/{MediaFlow.ts → MediaFlow.d.ts} +0 -0
  157. /package/types/generators/{MqttBroker.ts → MqttBroker.d.ts} +0 -0
  158. /package/types/generators/{MqttClient.ts → MqttClient.d.ts} +0 -0
  159. /package/types/generators/{Question.ts → Question.d.ts} +0 -0
  160. /package/types/generators/{RealtimeTranscription.ts → RealtimeTranscription.d.ts} +0 -0
  161. /package/types/generators/{SerialPort.ts → SerialPort.d.ts} +0 -0
  162. /package/types/generators/{SoundPlayer.ts → SoundPlayer.d.ts} +0 -0
  163. /package/types/generators/{SpeechToTextOnnx.ts → SpeechToTextOnnx.d.ts} +0 -0
  164. /package/types/generators/{SpeechToTextPlatform.ts → SpeechToTextPlatform.d.ts} +0 -0
  165. /package/types/generators/{SqLite.ts → SqLite.d.ts} +0 -0
  166. /package/types/generators/{Step.ts → Step.d.ts} +0 -0
  167. /package/types/generators/{Tcp.ts → Tcp.d.ts} +0 -0
  168. /package/types/generators/{TcpServer.ts → TcpServer.d.ts} +0 -0
  169. /package/types/generators/{TextToSpeechAppleBuiltin.ts → TextToSpeechAppleBuiltin.d.ts} +0 -0
  170. /package/types/generators/{TextToSpeechGgml.ts → TextToSpeechGgml.d.ts} +0 -0
  171. /package/types/generators/{TextToSpeechOnnx.ts → TextToSpeechOnnx.d.ts} +0 -0
  172. /package/types/generators/{TextToSpeechOpenAiLike.ts → TextToSpeechOpenAiLike.d.ts} +0 -0
  173. /package/types/generators/{Tick.ts → Tick.d.ts} +0 -0
  174. /package/types/generators/{Udp.ts → Udp.d.ts} +0 -0
  175. /package/types/generators/{VadOnnx.ts → VadOnnx.d.ts} +0 -0
  176. /package/types/generators/{VadTraditional.ts → VadTraditional.d.ts} +0 -0
  177. /package/types/generators/{VectorStore.ts → VectorStore.d.ts} +0 -0
  178. /package/types/generators/{Watchdog.ts → Watchdog.d.ts} +0 -0
  179. /package/types/generators/{WebCrawler.ts → WebCrawler.d.ts} +0 -0
  180. /package/types/generators/{WebRtc.ts → WebRtc.d.ts} +0 -0
  181. /package/types/generators/{WebSocket.ts → WebSocket.d.ts} +0 -0
  182. /package/types/generators/{index.ts → index.d.ts} +0 -0
  183. /package/types/{index.ts → index.d.ts} +0 -0
  184. /package/types/{switch.ts → switch.d.ts} +0 -0
  185. /package/types/{system.ts → system.d.ts} +0 -0
@@ -11,6 +11,8 @@
11
11
  * - Supported Hexagon NPU for Qualcomm Snapdragon 8 Gen 1+ GPUs.
12
12
  * - Linux / Windows [@nextline - Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property
13
13
  * - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux)
14
+ * - Web: Supported with CPU and WebGPU acceleration.
15
+ * - Single thread only in the current web preview (no SharedArrayBuffer due to cross-origin isolation / CORP), so multi-thread is unavailable.
14
16
  */
15
17
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
16
18
  import type { Data, DataLink } from '../data'
@@ -393,6 +395,31 @@ export type GeneratorLLMActionCompletion = ActionWithParams & {
393
395
  value?: boolean | DataLink | EventProperty
394
396
  mapping?: string
395
397
  }
398
+ | {
399
+ input: 'mtpSpeculativeDecoding'
400
+ value?: boolean | DataLink | EventProperty
401
+ mapping?: string
402
+ }
403
+ | {
404
+ input: 'mtpDraftTokens'
405
+ value?: number | DataLink | EventProperty
406
+ mapping?: string
407
+ }
408
+ | {
409
+ input: 'mtpDraftMinTokens'
410
+ value?: number | DataLink | EventProperty
411
+ mapping?: string
412
+ }
413
+ | {
414
+ input: 'mtpDraftMinProbability'
415
+ value?: number | DataLink | EventProperty
416
+ mapping?: string
417
+ }
418
+ | {
419
+ input: 'mtpDraftSplitProbability'
420
+ value?: number | DataLink | EventProperty
421
+ mapping?: string
422
+ }
396
423
  | {
397
424
  input: 'functionCallEnabled'
398
425
  value?: boolean | DataLink | EventProperty
@@ -465,6 +492,8 @@ Default property:
465
492
  "cacheVType": "f16",
466
493
  "ctxShift": true,
467
494
  "cpuMoeLayers": 0,
495
+ "mtpSpeculativeDecoding": false,
496
+ "mtpDraftTokens": 3,
468
497
  "transformScriptEnabled": false,
469
498
  "transformScriptCode": "\/\* Global variable: inputs = { prompt, messages, variables }, members = { llmUtils } \*\/\nreturn inputs.prompt",
470
499
  "transformScriptVariables": {},
@@ -575,6 +604,16 @@ Default property:
575
604
  ctxShift?: boolean | DataLink
576
605
  /* Number of layers to keep MoE weights on CPU */
577
606
  cpuMoeLayers?: number | DataLink
607
+ /* Enable MTP speculative decoding for GGUF models that contain MTP / NextN layers */
608
+ mtpSpeculativeDecoding?: boolean | DataLink
609
+ /* Maximum number of MTP draft tokens */
610
+ mtpDraftTokens?: number | DataLink
611
+ /* Minimum number of MTP draft tokens */
612
+ mtpDraftMinTokens?: number | DataLink
613
+ /* Minimum probability for greedy MTP draft tokens */
614
+ mtpDraftMinProbability?: number | DataLink
615
+ /* Split probability for MTP speculative decoding */
616
+ mtpDraftSplitProbability?: number | DataLink
578
617
  /* Enable Transform Script for processing the prompt */
579
618
  transformScriptEnabled?: boolean | DataLink
580
619
  /* Code of Transform Script */
@@ -713,6 +752,7 @@ Default property:
713
752
  | {
714
753
  enabled?: boolean | DataLink
715
754
  url?: string | DataLink
755
+ autoDiscoverType?: 'manual' | 'auto' | DataLink
716
756
  fallbackType?: 'use-local' | 'no-op' | DataLink
717
757
  strategy?: 'prefer-local' | 'prefer-buttress' | 'prefer-best' | DataLink
718
758
  }
@@ -825,7 +865,9 @@ Default property:
825
865
  - Supported GPU acceleration by OpenCL, currently only for Qualcomm Adreno 700+ GPUs, other GPUs are not supported.
826
866
  - Supported Hexagon NPU for Qualcomm Snapdragon 8 Gen 1+ GPUs.
827
867
  - Linux / Windows [@nextline - Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property
828
- - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux) */
868
+ - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux)
869
+ - Web: Supported with CPU and WebGPU acceleration.
870
+ - Single thread only in the current web preview (no SharedArrayBuffer due to cross-origin isolation / CORP), so multi-thread is unavailable. */
829
871
  export type GeneratorLLM = Generator &
830
872
  GeneratorLLMDef & {
831
873
  templateKey: 'GENERATOR_LLM'
@@ -158,6 +158,7 @@ Default property:
158
158
  | {
159
159
  enabled?: boolean | DataLink
160
160
  url?: string | DataLink
161
+ autoDiscoverType?: 'manual' | 'auto' | DataLink
161
162
  fallbackType?: 'use-local' | 'no-op' | DataLink
162
163
  strategy?: 'prefer-local' | 'prefer-buttress' | 'prefer-best' | DataLink
163
164
  }
@@ -12,6 +12,8 @@
12
12
  * - Linux / Windows
13
13
  * - Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property
14
14
  * - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux)
15
+ * - Web: Supported with CPU and WebGPU acceleration.
16
+ * - Single thread only in the current web preview (no SharedArrayBuffer due to cross-origin isolation / CORP), so multi-thread is unavailable.
15
17
  */
16
18
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
17
19
  import type { Data, DataLink } from '../data'
@@ -163,7 +165,9 @@ Default property:
163
165
  - Supported Hexagon NPU for Qualcomm Snapdragon 8 Gen 2+ GPUs.
164
166
  - Linux / Windows
165
167
  - Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property
166
- - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux) */
168
+ - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux)
169
+ - Web: Supported with CPU and WebGPU acceleration.
170
+ - Single thread only in the current web preview (no SharedArrayBuffer due to cross-origin isolation / CORP), so multi-thread is unavailable. */
167
171
  export type GeneratorReranker = Generator &
168
172
  GeneratorRerankerDef & {
169
173
  templateKey: 'GENERATOR_RERANKER'
@@ -54,7 +54,8 @@ Default property:
54
54
  "autoCuttingVocalFreqMin": 75,
55
55
  "autoCuttingVocalFreqMax": 900,
56
56
  "autoCuttingFreqClarity": 0.5,
57
- "autoCuttingSpeakSpacing": 0.5
57
+ "autoCuttingSpeakSpacing": 0.5,
58
+ "userMediaAudioOptions": {}
58
59
  }
59
60
  */
60
61
  property?: {
@@ -86,6 +87,14 @@ Default property:
86
87
  autoCuttingVolumeThreshold?: number | DataLink
87
88
  /* Speak spacing of cutting fragments */
88
89
  autoCuttingSpeakSpacing?: number | DataLink
90
+ /* Custom getUserMedia audio options for Web / Desktop. Merged into the audio constraints. */
91
+ userMediaAudioOptions?:
92
+ | DataLink
93
+ | {
94
+ autoGainControl?: boolean | DataLink
95
+ echoCancellation?: boolean | DataLink
96
+ noiseSuppression?: boolean | DataLink
97
+ }
89
98
  }
90
99
  events?: {
91
100
  /* Event for chunk data (Base64 encoded PCM) */
@@ -7,6 +7,8 @@
7
7
  * - macOS: Supported GPU acceleration, recommended use M1+ chip device
8
8
  * - Android: Currently not supported GPU acceleration (Coming soon), recommended use Android 13+ system
9
9
  * - Linux / Windows: Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property
10
+ * - Web: Supported with WASM CPU and optional WebGPU acceleration in Web Preview.
11
+ * - Single thread only in the current web preview (no SharedArrayBuffer due to cross-origin isolation / CORP), so multi-thread is unavailable.
10
12
  */
11
13
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
12
14
  import type { Data, DataLink } from '../data'
@@ -323,6 +325,7 @@ Default property:
323
325
  | {
324
326
  enabled?: boolean | DataLink
325
327
  url?: string | DataLink
328
+ autoDiscoverType?: 'manual' | 'auto' | DataLink
326
329
  fallbackType?: 'use-local' | 'no-op' | DataLink
327
330
  strategy?: 'prefer-local' | 'prefer-buttress' | 'prefer-best' | DataLink
328
331
  }
@@ -388,7 +391,9 @@ Default property:
388
391
  - iOS: Supported GPU acceleration, recommended use M1+ / A17+ chip device
389
392
  - macOS: Supported GPU acceleration, recommended use M1+ chip device
390
393
  - Android: Currently not supported GPU acceleration (Coming soon), recommended use Android 13+ system
391
- - Linux / Windows: Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property */
394
+ - Linux / Windows: Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property
395
+ - Web: Supported with WASM CPU and optional WebGPU acceleration in Web Preview.
396
+ - Single thread only in the current web preview (no SharedArrayBuffer due to cross-origin isolation / CORP), so multi-thread is unavailable. */
392
397
  export type GeneratorSpeechInference = Generator &
393
398
  GeneratorSpeechInferenceDef & {
394
399
  templateKey: 'GENERATOR_SPEECH_INFERENCE'
@@ -1,13 +1,13 @@
1
1
  /* Auto generated by build script
2
2
  *
3
- * Speech recognition on iOS 26+ (Not supported on tvOS)
3
+ * Speech recognition on iOS 26+ and Desktop (macOS 26+). Not supported on tvOS
4
4
  *
5
5
  * ## Features
6
6
  * - Native Apple speech recognition
7
7
  * - High accuracy transcription
8
8
  * - Privacy-focused on-device processing
9
9
  * - Supports file and data transcription
10
- * - Requires iOS 26+ (Not supported on tvOS)
10
+ * - Requires iOS 26+ or Desktop on macOS 26+. Not supported on tvOS
11
11
  */
12
12
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
13
13
  import type { Data, DataLink } from '../data'
@@ -41,6 +41,11 @@ export type GeneratorAppleSTTActionTranscribeFile = ActionWithParams & {
41
41
  value?: string | DataLink | EventProperty
42
42
  mapping?: string
43
43
  }
44
+ | {
45
+ input: 'contextualStrings'
46
+ value?: Array<any> | DataLink | EventProperty
47
+ mapping?: string
48
+ }
44
49
  >
45
50
  }
46
51
 
@@ -58,15 +63,26 @@ export type GeneratorAppleSTTActionTranscribeData = ActionWithParams & {
58
63
  value?: string | DataLink | EventProperty
59
64
  mapping?: string
60
65
  }
66
+ | {
67
+ input: 'contextualStrings'
68
+ value?: Array<any> | DataLink | EventProperty
69
+ mapping?: string
70
+ }
61
71
  >
62
72
  }
63
73
 
74
+ /* Release context */
75
+ export type GeneratorAppleSTTActionReleaseContext = Action & {
76
+ __actionName: 'GENERATOR_APPLE_STT_RELEASE_CONTEXT'
77
+ }
78
+
64
79
  interface GeneratorAppleSTTDef {
65
80
  /*
66
81
  Default property:
67
82
  {
68
83
  "init": false,
69
84
  "language": "en-US",
85
+ "contextualStrings": [],
70
86
  "enablePartialResults": true
71
87
  }
72
88
  */
@@ -75,6 +91,13 @@ Default property:
75
91
  init?: boolean | DataLink
76
92
  /* Language/locale for recognition (e.g., 'en-US') */
77
93
  language?: string | DataLink
94
+ /* Phrases that should be recognized, even if they are not in the system vocabulary. */
95
+ contextualStrings?:
96
+ | Array<string | DataLink>
97
+ | DataLink
98
+ | Record<string, Array<string | DataLink> | DataLink>
99
+ | DataLink
100
+ | DataLink
78
101
  /* Enable partial results during transcription */
79
102
  enablePartialResults?: boolean | DataLink
80
103
  /* The file URL or path to be transcribed */
@@ -100,14 +123,14 @@ Default property:
100
123
  }
101
124
  }
102
125
 
103
- /* Speech recognition on iOS 26+ (Not supported on tvOS)
126
+ /* Speech recognition on iOS 26+ and Desktop (macOS 26+). Not supported on tvOS
104
127
 
105
128
  ## Features
106
129
  - Native Apple speech recognition
107
130
  - High accuracy transcription
108
131
  - Privacy-focused on-device processing
109
132
  - Supports file and data transcription
110
- - Requires iOS 26+ (Not supported on tvOS) */
133
+ - Requires iOS 26+ or Desktop on macOS 26+. Not supported on tvOS */
111
134
  export type GeneratorAppleSTT = Generator &
112
135
  GeneratorAppleSTTDef & {
113
136
  templateKey: 'GENERATOR_APPLE_STT'
@@ -71,11 +71,11 @@ Default property:
71
71
  property?: {
72
72
  /* Connect printer on generator initialized */
73
73
  init?: boolean | DataLink
74
- /* Connection driver */
75
- driver?: 'escpos' | 'star' | 'tsc' | DataLink
76
- /* The address of the printer */
74
+ /* Connection driver (`castles` driver: built-in or WiFi printer on Castles Saturn PDA) */
75
+ driver?: 'escpos' | 'star' | 'tsc' | 'castles' | DataLink
76
+ /* The address of the printer (For castles driver: `mode=builtin` (Saturn 1000) or `mode=wifi` (Saturn 7000); optional `heatLevel=1-5`, default 3) */
77
77
  connectString?: string | DataLink
78
- /* The language of the printer (only for EPSON) */
78
+ /* The language of the printer (only for EPSON and TSC drivers) */
79
79
  lang?: 'ANK' | 'CHINESE' | 'TAIWAN' | 'KOREAN' | 'THAI' | 'SOUTHASIA' | DataLink
80
80
  /* The timeout of scanning */
81
81
  scanTimeout?: number | DataLink
@@ -99,10 +99,12 @@ Default property:
99
99
  { type: 'barcode', content: '1234567890', barcodeType: 'CODE128' }
100
100
  { type: 'symbol', content: '1234567890', symbolType: 'QRCODE' }
101
101
  Notes:
102
- - `reverse-feed` only works on ESC/POS driver
102
+ - `reverse-feed` works on ESC/POS driver and castles driver (line mode only)
103
103
  - `width` and `height` in Star driver is magnification factor
104
104
  - `y` position in ESC/POS is use feed lines to offset
105
- - `textFont` only works on TSC driver */
105
+ - `textFont` only works on TSC driver
106
+ - castles driver: `image` requires `height` in line mode
107
+ - castles driver: `UPC_A`, `UPC_E`, `ITF` barcode types are not supported */
106
108
  payload?:
107
109
  | Array<
108
110
  | DataLink
@@ -149,7 +151,7 @@ Default property:
149
151
  }
150
152
  >
151
153
  | DataLink
152
- /* Raw ASCII commands to print */
154
+ /* Raw ASCII commands to print (not supported on castles driver) */
153
155
  rawCommands?: string | DataLink
154
156
  }
155
157
  events?: {
@@ -1,6 +1,11 @@
1
1
  /* Auto generated by build script
2
2
  *
3
- * Local Voice Activity Detection (VAD) inference based on GGML and [whisper.rn](https://github.com/mybigday/whisper.rn)
3
+ * Local Voice Activity Detection (VAD) inference based on GGML and [whisper.cpp](https://github.com/ggerganov/whisper.cpp)
4
+ *
5
+ * ## Notice
6
+ * - Web: Supported with WASM CPU in Web Preview.
7
+ * - WebGPU is not used for browser VAD; the wasm package falls back to CPU for the VAD graph.
8
+ * - Single thread only in the current web preview (no SharedArrayBuffer due to cross-origin isolation / CORP), so multi-thread is unavailable.
4
9
  */
5
10
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
11
  import type { Data, DataLink } from '../data'
@@ -222,7 +227,12 @@ Default property:
222
227
  }
223
228
  }
224
229
 
225
- /* Local Voice Activity Detection (VAD) inference based on GGML and [whisper.rn](https://github.com/mybigday/whisper.rn) */
230
+ /* Local Voice Activity Detection (VAD) inference based on GGML and [whisper.cpp](https://github.com/ggerganov/whisper.cpp)
231
+
232
+ ## Notice
233
+ - Web: Supported with WASM CPU in Web Preview.
234
+ - WebGPU is not used for browser VAD; the wasm package falls back to CPU for the VAD graph.
235
+ - Single thread only in the current web preview (no SharedArrayBuffer due to cross-origin isolation / CORP), so multi-thread is unavailable. */
226
236
  export type GeneratorVadInference = Generator &
227
237
  GeneratorVadInferenceDef & {
228
238
  templateKey: 'GENERATOR_VAD_INFERENCE'
@@ -7,7 +7,7 @@ import type { DataCalculation } from './data-calc'
7
7
  export type Subspace = {
8
8
  __typename: 'Subspace'
9
9
  id: string
10
- title: string
10
+ title?: string
11
11
  description?: string
12
12
  hideShortRef?: boolean
13
13
  unused?: boolean
@@ -0,0 +1,25 @@
1
+ import { generateDataCalculationMapEditorInfo } from '../calc'
2
+
3
+ describe('generateDataCalculationMapEditorInfo', () => {
4
+ test('indexes source nodes while resolving array input connections', () => {
5
+ const firstSource = { id: 'PROPERTY_BANK_DATA_NODE_first', title: 'First source' }
6
+ const secondSource = { id: 'PROPERTY_BANK_DATA_NODE_second', title: 'Second source' }
7
+ const command = {
8
+ id: 'PROPERTY_BANK_COMMAND_NODE_merge',
9
+ title: 'Merge values',
10
+ inputs: [
11
+ [
12
+ { id: firstSource.id, port: 'value' },
13
+ { id: secondSource.id, port: 'value' },
14
+ { id: 'PROPERTY_BANK_DATA_NODE_missing', port: 'value' },
15
+ ],
16
+ ],
17
+ outputs: [[{ id: firstSource.id, port: 'value' }]],
18
+ }
19
+
20
+ const editorInfo = generateDataCalculationMapEditorInfo([firstSource, secondSource, command])
21
+ const commandInfo = editorInfo.find((info) => info.node === command)
22
+
23
+ expect(commandInfo?.position.x).toBe(615)
24
+ })
25
+ })
@@ -0,0 +1,154 @@
1
+ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
2
+ import { tmpdir } from 'node:os'
3
+ import { join } from 'node:path'
4
+ import { makeId } from '../id'
5
+
6
+ const UUID = '[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}'
7
+ const UUID_ONLY_RE = new RegExp(`^${UUID}$`)
8
+
9
+ const withProjectDir = (app, fn) => {
10
+ const previousCwd = process.cwd()
11
+ const dir = mkdtempSync(join(tmpdir(), 'make-id-'))
12
+ try {
13
+ if (app) writeFileSync(join(dir, 'application.json'), JSON.stringify(app))
14
+ process.chdir(dir)
15
+ return fn()
16
+ } finally {
17
+ process.chdir(previousCwd)
18
+ rmSync(dir, { recursive: true, force: true })
19
+ }
20
+ }
21
+
22
+ describe('makeId', () => {
23
+ describe('type prefixes', () => {
24
+ const cases = [
25
+ ['animation', 'ANIMATION_'],
26
+ ['brick', 'BRICK_'],
27
+ ['dynamic-brick', 'DYNAMIC_BRICK_'],
28
+ ['canvas', 'CANVAS_'],
29
+ ['generator', 'GENERATOR_'],
30
+ ['data', 'PROPERTY_BANK_DATA_NODE_'],
31
+ ['switch', 'BRICK_STATE_GROUP_'],
32
+ ['property_bank_command', 'PROPERTY_BANK_COMMAND_NODE_'],
33
+ ['property_bank_calc', 'PROPERTY_BANK_COMMAND_MAP_'],
34
+ ['automation_map', 'AUTOMATION_MAP_'],
35
+ ['test', 'TEST_'],
36
+ ['test_case', 'TEST_CASE_'],
37
+ ['test_var', 'TEST_VAR_'],
38
+ ]
39
+
40
+ test.each(cases)('produces %p prefix', (type, prefix) => {
41
+ expect(makeId(type)).toMatch(new RegExp(`^${prefix}${UUID}$`))
42
+ })
43
+
44
+ test('uses generated count fallback when no alias is provided', () => {
45
+ const first = withProjectDir({ id: 'count-fallback-app' }, () => {
46
+ jest.resetModules()
47
+ const { makeId: makeFreshId } = require('../id')
48
+ return [makeFreshId('brick'), makeFreshId('brick')]
49
+ })
50
+ const second = withProjectDir({ id: 'count-fallback-app' }, () => {
51
+ jest.resetModules()
52
+ const { makeId: makeFreshId } = require('../id')
53
+ return [makeFreshId('brick'), makeFreshId('brick')]
54
+ })
55
+
56
+ expect(first[0]).toMatch(new RegExp(`^BRICK_${UUID}$`))
57
+ expect(first[1]).toMatch(new RegExp(`^BRICK_${UUID}$`))
58
+ expect(first[0]).not.toBe(first[1])
59
+ expect(second).toEqual(first)
60
+ jest.resetModules()
61
+ })
62
+
63
+ test('unknown type falls through to an unprefixed uuid', () => {
64
+ expect(makeId('not-a-real-type')).toMatch(UUID_ONLY_RE)
65
+ })
66
+ })
67
+
68
+ describe('subspace', () => {
69
+ test('throws because subspace IDs must be fixed', () => {
70
+ expect(() => makeId('subspace')).toThrow(/subspace is not supported/)
71
+ })
72
+ })
73
+
74
+ describe('snapshotMode', () => {
75
+ test('produces deterministic v4 uuids from the generated count', () => {
76
+ const previousCwd = process.cwd()
77
+ const dir = mkdtempSync(join(tmpdir(), 'make-id-snapshot-'))
78
+ writeFileSync(join(dir, 'application.json'), JSON.stringify({ id: 'snapshot-app' }))
79
+ try {
80
+ process.chdir(dir)
81
+ jest.resetModules()
82
+ const { makeId: makeFreshId } = require('../id')
83
+ const a = makeFreshId('brick', { snapshotMode: true })
84
+ const b = makeFreshId('brick', { snapshotMode: true })
85
+
86
+ jest.resetModules()
87
+ const { makeId: makeFreshIdAgain } = require('../id')
88
+ expect(makeFreshIdAgain('brick', { snapshotMode: true })).toBe(a)
89
+ expect(makeFreshIdAgain('brick', { snapshotMode: true })).toBe(b)
90
+ expect(a).not.toBe(b)
91
+ expect(a).toMatch(new RegExp(`^BRICK_${UUID}$`))
92
+ expect(b).toMatch(new RegExp(`^BRICK_${UUID}$`))
93
+ } finally {
94
+ process.chdir(previousCwd)
95
+ rmSync(dir, { recursive: true, force: true })
96
+ jest.resetModules()
97
+ }
98
+ })
99
+
100
+ test('snapshotMode false falls back to random uuid', () => {
101
+ const id = makeId('canvas', { snapshotMode: false })
102
+ expect(id).toMatch(new RegExp(`^CANVAS_${UUID}$`))
103
+ })
104
+ })
105
+
106
+ describe('stable aliases', () => {
107
+ test('produces the same id for the same application id, type, and alias', () => {
108
+ const first = withProjectDir({ id: 'stable-app' }, () => {
109
+ jest.resetModules()
110
+ return require('../id').makeId('brick', 'stable-hero')
111
+ })
112
+ const second = withProjectDir({ id: 'stable-app' }, () => {
113
+ jest.resetModules()
114
+ return require('../id').makeId('brick', 'stable-hero')
115
+ })
116
+
117
+ expect(second).toBe(first)
118
+ expect(first).toMatch(new RegExp(`^BRICK_${UUID}$`))
119
+ jest.resetModules()
120
+ })
121
+
122
+ test('uses the application id when hashing stable aliases', () => {
123
+ const idA = withProjectDir({ id: 'app-a' }, () => makeId('brick', 'hero'))
124
+ const idB = withProjectDir({ id: 'app-b' }, () => makeId('brick', 'hero'))
125
+
126
+ expect(idA).toMatch(new RegExp(`^BRICK_${UUID}$`))
127
+ expect(idB).toMatch(new RegExp(`^BRICK_${UUID}$`))
128
+ expect(idA).not.toBe(idB)
129
+ })
130
+
131
+ test('rejects duplicate aliases for the same application id and entry type', () => {
132
+ withProjectDir({ id: 'duplicate-app' }, () => {
133
+ expect(makeId('brick', 'shared')).toMatch(new RegExp(`^BRICK_${UUID}$`))
134
+ expect(() => makeId('brick', 'shared')).toThrow(/Duplicate makeId alias 'shared'/)
135
+ })
136
+ })
137
+
138
+ test('allows the same alias for different entry types', () => {
139
+ withProjectDir({ id: 'shared-alias-app' }, () => {
140
+ const brick = makeId('brick', 'shared')
141
+ const canvas = makeId('canvas', 'shared')
142
+
143
+ expect(brick).toMatch(new RegExp(`^BRICK_${UUID}$`))
144
+ expect(canvas).toMatch(new RegExp(`^CANVAS_${UUID}$`))
145
+ expect(brick).not.toBe(canvas)
146
+ })
147
+ })
148
+
149
+ test('falls back when application.json is not present', () => {
150
+ const id = withProjectDir(null, () => makeId('brick', 'fallback-app-id'))
151
+ expect(id).toMatch(new RegExp(`^BRICK_${UUID}$`))
152
+ })
153
+ })
154
+ })
package/utils/calc.ts CHANGED
@@ -28,6 +28,10 @@ export const generateDataCalculationMapEditorInfo = (
28
28
  DataCalculationData | DataCommand,
29
29
  Set<DataCalculationData | DataCommand>
30
30
  >()
31
+ const nodeById = new Map<string, DataCalculationData | DataCommand>()
32
+ for (const node of nodes) {
33
+ if ('id' in node) nodeById.set(node.id, node)
34
+ }
31
35
 
32
36
  // Analyze node connections
33
37
  nodes.forEach((node) => {
@@ -48,7 +52,7 @@ export const generateDataCalculationMapEditorInfo = (
48
52
  if (!connectedTo.has(node)) {
49
53
  connectedTo.set(node, new Set())
50
54
  }
51
- const sourceNode = nodes.find((n) => 'id' in n && n.id === conn.id)
55
+ const sourceNode = nodeById.get(conn.id)
52
56
  if (sourceNode) {
53
57
  connectedTo.get(node)!.add(sourceNode)
54
58
  }
package/utils/data.ts CHANGED
@@ -7,14 +7,12 @@ export const linkData: (dataGetter: () => Data) => DataLink = (dataGetter) => ({
7
7
  data: dataGetter,
8
8
  })
9
9
 
10
- const idOpts = {
11
- snapshotMode: process.env.BRICKS_SNAPSHOT_MODE === '1',
12
- }
13
-
14
10
  export const createCanvasIdRef: (canvasGetter: () => Canvas) => Data<string> = (canvasGetter) => {
15
11
  const data: Data<string> = {
16
12
  __typename: 'Data',
17
- id: makeId('data', idOpts),
13
+ // Stable by default (utils/id.ts) so recompiling unchanged source yields an
14
+ // identical config; the legacy snapshotMode opt-out made this id churn per compile.
15
+ id: makeId('data'),
18
16
  type: 'string',
19
17
  routing: 'read-only',
20
18
  kind: {
@@ -85,8 +83,8 @@ type SystemDataName =
85
83
  type SystemDataInfo = {
86
84
  name: SystemDataName
87
85
  id: string
88
- type: 'string' | 'number' | 'bool' | 'array' | 'object' | 'any'
89
- title: string
86
+ type: 'string' | 'number' | 'bool' | 'boolean' | 'array' | 'object' | 'any'
87
+ title?: string
90
88
  description?: string
91
89
  schema?: object
92
90
  value?: any
@@ -146,6 +146,23 @@ export const templateEventPropsMap = {
146
146
  onToolChange: { BRICK_SKETCH_TOOL: 'string' },
147
147
  onExportImage: { BRICK_SKETCH_IMAGE_URI: 'string' },
148
148
  },
149
+ Scene3D: {
150
+ onLoad: { BRICK_SCENE_3D_OBJECT_ID: 'string', BRICK_SCENE_3D_DURATION_MS: 'number' },
151
+ onLoadError: { BRICK_SCENE_3D_OBJECT_ID: 'string', BRICK_SCENE_3D_ERROR: 'string' },
152
+ onObjectClick: {
153
+ BRICK_SCENE_3D_OBJECT_ID: 'string',
154
+ BRICK_SCENE_3D_HIT_POINT: '{ x?: number y?: number z?: number }',
155
+ BRICK_SCENE_3D_HIT_DISTANCE: 'number',
156
+ },
157
+ onObjectHover: { BRICK_SCENE_3D_OBJECT_ID: 'string', BRICK_SCENE_3D_HOVER_ENTERED: 'boolean' },
158
+ onAnimationEnd: { BRICK_SCENE_3D_OBJECT_ID: 'string', BRICK_SCENE_3D_ANIMATION_NAME: 'string' },
159
+ onFrame: {
160
+ BRICK_SCENE_3D_FRAME_TIME: 'number',
161
+ BRICK_SCENE_3D_FRAME_DT: 'number',
162
+ BRICK_SCENE_3D_FPS: 'number',
163
+ },
164
+ onScriptError: { BRICK_SCENE_3D_ERROR: 'string', BRICK_SCENE_3D_PHASE: 'string' },
165
+ },
149
166
  Tick: {
150
167
  ticking: { GENERATOR_TICK_COUNTDOWN: 'number', GENERATOR_TICK_VALUE: 'any' },
151
168
  completed: { GENERATOR_TICK_COUNTDOWN: 'number', GENERATOR_TICK_VALUE: 'any' },