@fugood/bricks-project 2.25.0-beta.4 → 2.25.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 (159) hide show
  1. package/compile/action-name-map.ts +63 -0
  2. package/compile/index.ts +208 -19
  3. package/package.json +4 -3
  4. package/package.json.bak +4 -3
  5. package/skills/bricks-ctor/SKILL.md +21 -17
  6. package/skills/bricks-ctor/{rules → references}/animation.md +3 -2
  7. package/skills/bricks-ctor/{rules → references}/architecture-patterns.md +12 -0
  8. package/skills/bricks-ctor/{rules → references}/automations.md +11 -0
  9. package/skills/bricks-ctor/references/buttress.md +245 -0
  10. package/skills/bricks-ctor/{rules → references}/data-calculation.md +5 -5
  11. package/skills/bricks-ctor/references/simulator.md +115 -0
  12. package/skills/bricks-ctor/references/verification-toolchain.md +179 -0
  13. package/skills/bricks-design/SKILL.md +160 -45
  14. package/skills/bricks-design/references/architecture-truths.md +132 -0
  15. package/skills/bricks-design/references/avoiding-complexity.md +91 -0
  16. package/skills/bricks-design/references/design-critique.md +195 -0
  17. package/skills/bricks-design/references/design-languages.md +265 -0
  18. package/skills/bricks-design/references/performance.md +116 -0
  19. package/skills/bricks-design/references/presentation-and-slideshow.md +137 -0
  20. package/skills/bricks-design/references/translating-inputs.md +152 -0
  21. package/skills/bricks-design/references/variations-and-tweaks.md +124 -0
  22. package/skills/bricks-design/references/when-the-brief-is-branded.md +284 -0
  23. package/skills/bricks-design/references/when-the-brief-is-vague.md +85 -0
  24. package/skills/bricks-design/references/workflow.md +134 -0
  25. package/skills/bricks-ux/SKILL.md +120 -0
  26. package/skills/bricks-ux/references/accessibility.md +162 -0
  27. package/skills/bricks-ux/references/flow-states.md +175 -0
  28. package/skills/bricks-ux/references/interaction-archetypes.md +189 -0
  29. package/skills/bricks-ux/references/monitoring-screens.md +153 -0
  30. package/skills/bricks-ux/references/pressable-composition.md +126 -0
  31. package/skills/bricks-ux/references/user-journey.md +168 -0
  32. package/skills/bricks-ux/references/ux-critique.md +256 -0
  33. package/tools/_git-author.ts +10 -2
  34. package/tools/_last-pushed-commit.ts +28 -0
  35. package/tools/_shell.ts +8 -1
  36. package/tools/deploy.ts +15 -0
  37. package/tools/mcp-tools/compile.ts +19 -9
  38. package/tools/mcp-tools/media.ts +4 -1
  39. package/tools/pull.ts +91 -16
  40. package/tools/push-config.ts +118 -0
  41. package/tools/{preview-main.mjs → simulator-main.mjs} +207 -12
  42. package/tools/simulator-preload.cjs +16 -0
  43. package/tools/{preview.ts → simulator.ts} +4 -4
  44. package/types/{animation.ts → animation.d.ts} +24 -8
  45. package/types/{automation.ts → automation.d.ts} +16 -20
  46. package/types/{brick-base.ts → brick-base.d.ts} +1 -1
  47. package/types/bricks/{Camera.ts → Camera.d.ts} +8 -8
  48. package/types/bricks/{Chart.ts → Chart.d.ts} +4 -4
  49. package/types/bricks/{GenerativeMedia.ts → GenerativeMedia.d.ts} +15 -15
  50. package/types/bricks/{Icon.ts → Icon.d.ts} +7 -7
  51. package/types/bricks/{Image.ts → Image.d.ts} +21 -9
  52. package/types/bricks/{Items.ts → Items.d.ts} +7 -7
  53. package/types/bricks/{Lottie.ts → Lottie.d.ts} +10 -10
  54. package/types/bricks/{Maps.ts → Maps.d.ts} +11 -11
  55. package/types/bricks/{QrCode.ts → QrCode.d.ts} +7 -7
  56. package/types/bricks/{Rect.ts → Rect.d.ts} +7 -7
  57. package/types/bricks/{RichText.ts → RichText.d.ts} +12 -9
  58. package/types/bricks/{Rive.ts → Rive.d.ts} +9 -9
  59. package/types/bricks/Scene3D.d.ts +596 -0
  60. package/types/bricks/{Sketch.ts → Sketch.d.ts} +6 -6
  61. package/types/bricks/{Slideshow.ts → Slideshow.d.ts} +7 -7
  62. package/types/bricks/{Svg.ts → Svg.d.ts} +7 -7
  63. package/types/bricks/{Text.ts → Text.d.ts} +9 -9
  64. package/types/bricks/{TextInput.ts → TextInput.d.ts} +10 -10
  65. package/types/bricks/{Video.ts → Video.d.ts} +12 -12
  66. package/types/bricks/{VideoStreaming.ts → VideoStreaming.d.ts} +10 -10
  67. package/types/bricks/{WebRtcStream.ts → WebRtcStream.d.ts} +1 -1
  68. package/types/bricks/{WebView.ts → WebView.d.ts} +4 -4
  69. package/types/bricks/{index.ts → index.d.ts} +1 -0
  70. package/types/{common.ts → common.d.ts} +3 -6
  71. package/types/data-calc-command/base.d.ts +57 -0
  72. package/types/data-calc-command/collection.d.ts +418 -0
  73. package/types/data-calc-command/color.d.ts +432 -0
  74. package/types/data-calc-command/constant.d.ts +50 -0
  75. package/types/data-calc-command/datetime.d.ts +147 -0
  76. package/types/data-calc-command/file.d.ts +129 -0
  77. package/types/data-calc-command/index.d.ts +13 -0
  78. package/types/data-calc-command/iteratee.d.ts +23 -0
  79. package/types/data-calc-command/logictype.d.ts +190 -0
  80. package/types/data-calc-command/math.d.ts +275 -0
  81. package/types/data-calc-command/object.d.ts +119 -0
  82. package/types/data-calc-command/sandbox.d.ts +58 -0
  83. package/types/data-calc-command/string.d.ts +407 -0
  84. package/types/{data-calc.ts → data-calc.d.ts} +1 -0
  85. package/types/{data.ts → data.d.ts} +4 -2
  86. package/types/generators/{Assistant.ts → Assistant.d.ts} +19 -0
  87. package/types/generators/{LlmGgml.ts → LlmGgml.d.ts} +43 -1
  88. package/types/generators/{LlmMlx.ts → LlmMlx.d.ts} +1 -0
  89. package/types/generators/{RerankerGgml.ts → RerankerGgml.d.ts} +5 -1
  90. package/types/generators/{SoundRecorder.ts → SoundRecorder.d.ts} +10 -1
  91. package/types/generators/{SpeechToTextGgml.ts → SpeechToTextGgml.d.ts} +6 -1
  92. package/types/generators/{SttAppleBuiltin.ts → SttAppleBuiltin.d.ts} +27 -4
  93. package/types/generators/{ThermalPrinter.ts → ThermalPrinter.d.ts} +9 -7
  94. package/types/generators/{VadGgml.ts → VadGgml.d.ts} +12 -2
  95. package/types/{subspace.ts → subspace.d.ts} +1 -1
  96. package/utils/data.ts +2 -2
  97. package/utils/event-props.ts +17 -0
  98. package/utils/id.ts +78 -27
  99. package/skills/bricks-ctor/rules/buttress.md +0 -156
  100. package/skills/bricks-design/LICENSE.txt +0 -180
  101. package/types/data-calc-command.ts +0 -7005
  102. /package/skills/bricks-ctor/{rules → references}/local-sync.md +0 -0
  103. /package/skills/bricks-ctor/{rules → references}/media-flow.md +0 -0
  104. /package/skills/bricks-ctor/{rules → references}/remote-data-bank.md +0 -0
  105. /package/skills/bricks-ctor/{rules → references}/standby-transition.md +0 -0
  106. /package/types/{canvas.ts → canvas.d.ts} +0 -0
  107. /package/types/{data-calc-script.ts → data-calc-script.d.ts} +0 -0
  108. /package/types/generators/{AlarmClock.ts → AlarmClock.d.ts} +0 -0
  109. /package/types/generators/{BleCentral.ts → BleCentral.d.ts} +0 -0
  110. /package/types/generators/{BlePeripheral.ts → BlePeripheral.d.ts} +0 -0
  111. /package/types/generators/{CanvasMap.ts → CanvasMap.d.ts} +0 -0
  112. /package/types/generators/{CastlesPay.ts → CastlesPay.d.ts} +0 -0
  113. /package/types/generators/{DataBank.ts → DataBank.d.ts} +0 -0
  114. /package/types/generators/{File.ts → File.d.ts} +0 -0
  115. /package/types/generators/{GraphQl.ts → GraphQl.d.ts} +0 -0
  116. /package/types/generators/{Http.ts → Http.d.ts} +0 -0
  117. /package/types/generators/{HttpServer.ts → HttpServer.d.ts} +0 -0
  118. /package/types/generators/{Information.ts → Information.d.ts} +0 -0
  119. /package/types/generators/{Intent.ts → Intent.d.ts} +0 -0
  120. /package/types/generators/{Iterator.ts → Iterator.d.ts} +0 -0
  121. /package/types/generators/{Keyboard.ts → Keyboard.d.ts} +0 -0
  122. /package/types/generators/{LlmAnthropicCompat.ts → LlmAnthropicCompat.d.ts} +0 -0
  123. /package/types/generators/{LlmAppleBuiltin.ts → LlmAppleBuiltin.d.ts} +0 -0
  124. /package/types/generators/{LlmMediaTekNeuroPilot.ts → LlmMediaTekNeuroPilot.d.ts} +0 -0
  125. /package/types/generators/{LlmOnnx.ts → LlmOnnx.d.ts} +0 -0
  126. /package/types/generators/{LlmOpenAiCompat.ts → LlmOpenAiCompat.d.ts} +0 -0
  127. /package/types/generators/{LlmQualcommAiEngine.ts → LlmQualcommAiEngine.d.ts} +0 -0
  128. /package/types/generators/{Mcp.ts → Mcp.d.ts} +0 -0
  129. /package/types/generators/{McpServer.ts → McpServer.d.ts} +0 -0
  130. /package/types/generators/{MediaFlow.ts → MediaFlow.d.ts} +0 -0
  131. /package/types/generators/{MqttBroker.ts → MqttBroker.d.ts} +0 -0
  132. /package/types/generators/{MqttClient.ts → MqttClient.d.ts} +0 -0
  133. /package/types/generators/{Question.ts → Question.d.ts} +0 -0
  134. /package/types/generators/{RealtimeTranscription.ts → RealtimeTranscription.d.ts} +0 -0
  135. /package/types/generators/{SerialPort.ts → SerialPort.d.ts} +0 -0
  136. /package/types/generators/{SoundPlayer.ts → SoundPlayer.d.ts} +0 -0
  137. /package/types/generators/{SpeechToTextOnnx.ts → SpeechToTextOnnx.d.ts} +0 -0
  138. /package/types/generators/{SpeechToTextPlatform.ts → SpeechToTextPlatform.d.ts} +0 -0
  139. /package/types/generators/{SqLite.ts → SqLite.d.ts} +0 -0
  140. /package/types/generators/{Step.ts → Step.d.ts} +0 -0
  141. /package/types/generators/{Tcp.ts → Tcp.d.ts} +0 -0
  142. /package/types/generators/{TcpServer.ts → TcpServer.d.ts} +0 -0
  143. /package/types/generators/{TextToSpeechAppleBuiltin.ts → TextToSpeechAppleBuiltin.d.ts} +0 -0
  144. /package/types/generators/{TextToSpeechGgml.ts → TextToSpeechGgml.d.ts} +0 -0
  145. /package/types/generators/{TextToSpeechOnnx.ts → TextToSpeechOnnx.d.ts} +0 -0
  146. /package/types/generators/{TextToSpeechOpenAiLike.ts → TextToSpeechOpenAiLike.d.ts} +0 -0
  147. /package/types/generators/{Tick.ts → Tick.d.ts} +0 -0
  148. /package/types/generators/{Udp.ts → Udp.d.ts} +0 -0
  149. /package/types/generators/{VadOnnx.ts → VadOnnx.d.ts} +0 -0
  150. /package/types/generators/{VadTraditional.ts → VadTraditional.d.ts} +0 -0
  151. /package/types/generators/{VectorStore.ts → VectorStore.d.ts} +0 -0
  152. /package/types/generators/{Watchdog.ts → Watchdog.d.ts} +0 -0
  153. /package/types/generators/{WebCrawler.ts → WebCrawler.d.ts} +0 -0
  154. /package/types/generators/{WebRtc.ts → WebRtc.d.ts} +0 -0
  155. /package/types/generators/{WebSocket.ts → WebSocket.d.ts} +0 -0
  156. /package/types/generators/{index.ts → index.d.ts} +0 -0
  157. /package/types/{index.ts → index.d.ts} +0 -0
  158. /package/types/{switch.ts → switch.d.ts} +0 -0
  159. /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
package/utils/data.ts CHANGED
@@ -85,8 +85,8 @@ type SystemDataName =
85
85
  type SystemDataInfo = {
86
86
  name: SystemDataName
87
87
  id: string
88
- type: 'string' | 'number' | 'bool' | 'array' | 'object' | 'any'
89
- title: string
88
+ type: 'string' | 'number' | 'bool' | 'boolean' | 'array' | 'object' | 'any'
89
+ title?: string
90
90
  description?: string
91
91
  schema?: object
92
92
  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' },
package/utils/id.ts CHANGED
@@ -1,38 +1,83 @@
1
1
  import { v4 as uuid } from 'uuid'
2
+ import { createHash } from 'node:crypto'
3
+ import { readFileSync } from 'node:fs'
4
+ import { join } from 'node:path'
2
5
 
3
6
  let count = 0
4
7
 
5
- // Used for snapshot mode
6
- const countUUID = () => {
7
- const current = count
8
- count += 1
9
- return `00000000-0000-0000-0000-${current.toString().padStart(12, '0')}`
8
+ type IdType =
9
+ | 'animation'
10
+ | 'brick'
11
+ | 'canvas'
12
+ | 'generator'
13
+ | 'data'
14
+ | 'switch'
15
+ | 'property_bank_command'
16
+ | 'property_bank_calc'
17
+ | 'dynamic-brick'
18
+ | 'automation_map'
19
+ | 'test'
20
+ | 'test_case'
21
+ | 'test_var'
22
+ | 'subspace'
23
+
24
+ type IdOptions = {
25
+ snapshotMode?: boolean
26
+ }
27
+
28
+ const APPLICATION_ID_FALLBACK = 'unknown-application'
29
+
30
+ const usedStableAliases = new Set<string>()
31
+ let applicationIdCache: { cwd: string; id: string } | null = null
32
+
33
+ const readApplicationId = () => {
34
+ const cwd = process.cwd()
35
+ if (applicationIdCache?.cwd === cwd) return applicationIdCache.id
36
+
37
+ let id = APPLICATION_ID_FALLBACK
38
+ try {
39
+ const app = JSON.parse(readFileSync(join(cwd, 'application.json'), 'utf8'))
40
+ if (typeof app.id === 'string' && app.id) id = app.id
41
+ } catch {
42
+ // `makeId` is also used from tests and utilities outside project roots.
43
+ }
44
+
45
+ applicationIdCache = { cwd, id }
46
+ return id
47
+ }
48
+
49
+ const hashToRandomBytes = (parts: string[]) => {
50
+ const hash = createHash('sha256').update(JSON.stringify(parts)).digest()
51
+ return new Uint8Array(hash.subarray(0, 16))
10
52
  }
11
53
 
12
- // Make a random id if not want to use fixed id
13
- export const makeId = (
14
- type:
15
- | 'animation'
16
- | 'brick'
17
- | 'canvas'
18
- | 'generator'
19
- | 'data'
20
- | 'switch'
21
- | 'property_bank_command'
22
- | 'property_bank_calc'
23
- | 'dynamic-brick'
24
- | 'automation_map'
25
- | 'test'
26
- | 'test_case'
27
- | 'test_var'
28
- | 'subspace',
29
- opts?: {
30
- snapshotMode?: boolean
31
- },
32
- ) => {
54
+ const makeStableUuid = (type: string, alias?: string) => {
55
+ const applicationId = readApplicationId()
56
+ const seed = alias ?? String(count)
57
+ if (alias === undefined) count += 1
58
+
59
+ if (alias !== undefined) {
60
+ const aliasKey = JSON.stringify([applicationId, type, alias])
61
+ if (usedStableAliases.has(aliasKey)) {
62
+ throw new Error(`Duplicate makeId alias '${alias}' for type '${type}'`)
63
+ }
64
+ usedStableAliases.add(aliasKey)
65
+ }
66
+
67
+ return uuid({
68
+ random: hashToRandomBytes([applicationId, type, seed]),
69
+ })
70
+ }
71
+
72
+ // Make stable ids by default; explicit snapshotMode: false preserves the random escape hatch.
73
+ export const makeId = (type: IdType, aliasOrOpts?: string | IdOptions, opts?: IdOptions) => {
33
74
  if (type === 'subspace') {
34
75
  throw new Error('Currently subspace is not supported for ID generation, please use a fixed ID')
35
76
  }
77
+
78
+ const alias = typeof aliasOrOpts === 'string' ? aliasOrOpts : undefined
79
+ const options = typeof aliasOrOpts === 'string' ? opts : (aliasOrOpts ?? opts)
80
+
36
81
  let prefix = ''
37
82
  switch (type) {
38
83
  case 'animation':
@@ -76,5 +121,11 @@ export const makeId = (
76
121
  break
77
122
  default:
78
123
  }
79
- return `${prefix}${opts?.snapshotMode ? countUUID() : uuid()}`
124
+
125
+ const useCountFallback = aliasOrOpts === undefined && opts === undefined
126
+ const id =
127
+ alias !== undefined || options?.snapshotMode || useCountFallback
128
+ ? makeStableUuid(type, alias)
129
+ : uuid()
130
+ return `${prefix}${id}`
80
131
  }
@@ -1,156 +0,0 @@
1
- # Buttress (Remote Inference)
2
-
3
- Backend system for offloading compute-intensive AI generator tasks from BRICKS devices to more powerful machines.
4
-
5
- ## Purpose
6
-
7
- When mobile devices or embedded systems lack hardware for local AI inference (LLM, speech-to-text), Buttress transparently delegates work to a server with appropriate resources (GPU).
8
-
9
- ## How It Works
10
-
11
- 1. **Capability Exchange**: Client and server share hardware capabilities
12
- 2. **Strategy Selection**: System decides local vs. remote execution
13
- 3. **Transparent Offloading**: Generator operates same way, execution happens remotely
14
-
15
- ## Supported Generators
16
-
17
- - LLM (GGML) (LlmMlx.ts) - Local Large Language Model inference with GGML
18
- - LLM (MLX) (LlmGgml.ts) - Local Large Language Model inference with MLX
19
- - Speech-to-Text (GGML) (SpeechToTextGgml.ts) - Local Speech-to-Text inference with GGML
20
-
21
- ## Client Configuration
22
-
23
- In generator properties, configure Buttress settings:
24
-
25
- | Setting | Description |
26
- |---------|-------------|
27
- | `Enabled` | Toggle Buttress offloading |
28
- | `URL` | Buttress server URL (e.g., `http://192.168.1.100:2080`) |
29
- | `Fallback Type` | Action if Buttress unavailable: `use-local` or `no-op` |
30
- | `Strategy` | Execution preference |
31
-
32
- ### Strategy Options
33
-
34
- | Strategy | Description |
35
- |----------|-------------|
36
- | `prefer-local` | Use local if capable, fallback to Buttress |
37
- | `prefer-buttress` | Use Buttress if available, fallback to local |
38
- | `prefer-best` | Auto-select based on capability comparison |
39
-
40
- ## Generator Configuration Example
41
-
42
- ```typescript
43
- import { makeId } from 'bricks-ctor'
44
-
45
- const llmGenerator: GeneratorLLM = {
46
- __typename: 'Generator',
47
- templateKey: 'GENERATOR_LLM',
48
- id: makeId('generator'),
49
- title: 'Chat LLM',
50
- description: '',
51
- property: {
52
- modelUrl: 'https://huggingface.co/ggml-org/gemma-3-12b-it-qat-GGUF/resolve/main/gemma-3-12b-it-qat-q4_0.gguf',
53
- contextSize: 8192,
54
- buttressConnectionSettings: {
55
- enabled: true,
56
- url: 'http://192.168.1.100:2080',
57
- fallbackType: 'use-local',
58
- strategy: 'prefer-best',
59
- },
60
- },
61
- events: {},
62
- switches: [],
63
- }
64
- ```
65
-
66
- ## Server Setup
67
-
68
- ### Requirements
69
- - [Bun](https://bun.sh) v1.3+
70
- - GPU recommended for LLM/STT
71
-
72
- ### Installation
73
-
74
- ```bash
75
- bun add -g @fugood/buttress-server
76
- ```
77
-
78
- ### Start Server
79
-
80
- ```bash
81
- bricks-buttress
82
- # or with config
83
- bricks-buttress --config ./config.toml
84
- ```
85
-
86
- ### CLI Options
87
-
88
- | Option | Description |
89
- |--------|-------------|
90
- | `-p, --port` | Port (default: 2080) |
91
- | `-c, --config` | TOML config file path |
92
- | `-v, --version` | Show version |
93
- | `-h, --help` | Show help |
94
-
95
- ### Environment Variables
96
-
97
- | Variable | Description |
98
- |----------|-------------|
99
- | `HF_TOKEN` | Hugging Face token for model downloads |
100
- | `ENABLE_OPENAI_COMPAT_ENDPOINT` | Set to `1` for OpenAI-compatible API |
101
-
102
- ## Server Configuration (TOML)
103
-
104
- ```toml
105
- [server]
106
- port = 2080
107
-
108
- [runtime]
109
- cache_dir = "./.buttress-cache"
110
- n_threads = 6
111
- flash_attn_type = "on"
112
- cache_type_k = "q8_0"
113
- cache_type_v = "q8_0"
114
-
115
- # LLM Generator
116
- [[generators]]
117
- type = "ggml-llm"
118
- [generators.backend]
119
- variant_preference = ["cuda", "vulkan", "default"]
120
- gpu_memory_fraction = 0.95
121
- [generators.model]
122
- repo_id = "ggml-org/gemma-3-12b-it-qat-GGUF"
123
- download = true
124
- n_ctx = 8192
125
-
126
- # STT Generator
127
- [[generators]]
128
- type = "ggml-stt"
129
- [generators.backend]
130
- variant_preference = ["cuda", "vulkan", "default"]
131
- [generators.model]
132
- repo_id = "BricksDisplay/whisper-ggml"
133
- filename = "ggml-small-q8_0.bin"
134
- download = true
135
- use_gpu = true
136
- ```
137
-
138
- ## Use Cases
139
-
140
- ### Resource-Constrained Devices
141
- Digital signage with basic hardware offloads LLM to powerful server.
142
-
143
- ### Shared GPU Resources
144
- Multiple devices share single GPU server for inference.
145
-
146
- ### Development Testing
147
- Test AI features on lightweight dev machines by connecting to beefy server.
148
-
149
- ## Best Practices
150
-
151
- 1. **Network reliability**: Ensure stable LAN connection to Buttress server
152
- 2. **Fallback strategy**: Configure appropriate fallback for critical features
153
- 3. **Server monitoring**: Monitor Buttress server resource usage
154
- 4. **Model consistency**: Ensure client and server use compatible models
155
- 5. **Security**: Run Buttress on private network, not public internet
156
- 6. **Latency awareness**: Account for network latency in UX design