@fugood/bricks-project 2.23.0-beta.3 → 2.23.0-beta.33

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 (91) hide show
  1. package/compile/action-name-map.ts +59 -0
  2. package/compile/index.ts +52 -60
  3. package/package.json +4 -4
  4. package/tools/mcp-server.ts +3 -3
  5. package/tools/postinstall.ts +2 -5
  6. package/tools/preview.ts +1 -1
  7. package/tools/pull.ts +1 -1
  8. package/types/brick-base.ts +1 -0
  9. package/types/bricks/Camera.ts +1 -0
  10. package/types/bricks/Chart.ts +1 -0
  11. package/types/bricks/GenerativeMedia.ts +21 -3
  12. package/types/bricks/Icon.ts +1 -0
  13. package/types/bricks/Image.ts +1 -0
  14. package/types/bricks/Items.ts +1 -0
  15. package/types/bricks/Lottie.ts +1 -0
  16. package/types/bricks/QrCode.ts +1 -0
  17. package/types/bricks/Rect.ts +1 -0
  18. package/types/bricks/RichText.ts +1 -0
  19. package/types/bricks/Rive.ts +1 -0
  20. package/types/bricks/Slideshow.ts +38 -2
  21. package/types/bricks/Svg.ts +1 -0
  22. package/types/bricks/Text.ts +1 -0
  23. package/types/bricks/TextInput.ts +1 -0
  24. package/types/bricks/Video.ts +1 -0
  25. package/types/bricks/VideoStreaming.ts +1 -0
  26. package/types/bricks/WebRtcStream.ts +1 -0
  27. package/types/bricks/WebView.ts +1 -0
  28. package/types/bricks/index.ts +1 -0
  29. package/types/canvas.ts +1 -0
  30. package/types/data-calc.ts +44 -0
  31. package/types/data.ts +1 -0
  32. package/types/generators/AlarmClock.ts +1 -0
  33. package/types/generators/Assistant.ts +17 -1
  34. package/types/generators/BleCentral.ts +1 -0
  35. package/types/generators/BlePeripheral.ts +1 -0
  36. package/types/generators/CanvasMap.ts +15 -3
  37. package/types/generators/CastlesPay.ts +1 -0
  38. package/types/generators/DataBank.ts +1 -0
  39. package/types/generators/File.ts +1 -0
  40. package/types/generators/GraphQl.ts +1 -0
  41. package/types/generators/Http.ts +75 -1
  42. package/types/generators/HttpServer.ts +1 -0
  43. package/types/generators/Information.ts +1 -0
  44. package/types/generators/Intent.ts +50 -0
  45. package/types/generators/Iterator.ts +10 -2
  46. package/types/generators/Keyboard.ts +1 -0
  47. package/types/generators/LlmAnthropicCompat.ts +1 -0
  48. package/types/generators/LlmAppleBuiltin.ts +143 -0
  49. package/types/generators/LlmGgml.ts +23 -5
  50. package/types/generators/LlmOnnx.ts +8 -0
  51. package/types/generators/LlmOpenAiCompat.ts +1 -0
  52. package/types/generators/LlmQualcommAiEngine.ts +1 -0
  53. package/types/generators/Mcp.ts +1 -0
  54. package/types/generators/McpServer.ts +1 -0
  55. package/types/generators/MediaFlow.ts +1 -0
  56. package/types/generators/MqttBroker.ts +1 -0
  57. package/types/generators/MqttClient.ts +1 -0
  58. package/types/generators/Question.ts +8 -0
  59. package/types/generators/RealtimeTranscription.ts +1 -0
  60. package/types/generators/RerankerGgml.ts +22 -16
  61. package/types/generators/SerialPort.ts +1 -0
  62. package/types/generators/SoundPlayer.ts +1 -0
  63. package/types/generators/SoundRecorder.ts +1 -0
  64. package/types/generators/SpeechToTextGgml.ts +13 -4
  65. package/types/generators/SpeechToTextOnnx.ts +1 -0
  66. package/types/generators/SpeechToTextPlatform.ts +1 -0
  67. package/types/generators/SqLite.ts +31 -1
  68. package/types/generators/Step.ts +1 -0
  69. package/types/generators/SttAppleBuiltin.ts +116 -0
  70. package/types/generators/Tcp.ts +1 -0
  71. package/types/generators/TcpServer.ts +1 -0
  72. package/types/generators/TextToSpeechApple.ts +113 -0
  73. package/types/generators/TextToSpeechAppleBuiltin.ts +113 -0
  74. package/types/generators/TextToSpeechGgml.ts +23 -3
  75. package/types/generators/TextToSpeechOnnx.ts +1 -0
  76. package/types/generators/TextToSpeechOpenAiLike.ts +1 -0
  77. package/types/generators/ThermalPrinter.ts +1 -0
  78. package/types/generators/Tick.ts +4 -1
  79. package/types/generators/TtsAppleBuiltin.ts +105 -0
  80. package/types/generators/Udp.ts +1 -0
  81. package/types/generators/VadGgml.ts +3 -2
  82. package/types/generators/VectorStore.ts +14 -2
  83. package/types/generators/Watchdog.ts +1 -0
  84. package/types/generators/WebCrawler.ts +1 -0
  85. package/types/generators/WebRtc.ts +1 -0
  86. package/types/generators/WebSocket.ts +1 -0
  87. package/types/generators/index.ts +3 -0
  88. package/types/system.ts +1 -0
  89. package/utils/data.ts +1 -0
  90. package/utils/event-props.ts +79 -3
  91. package/utils/id.ts +3 -1
@@ -1,3 +1,4 @@
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 {
@@ -49,6 +50,8 @@ Default property:
49
50
  outlets?: {
50
51
  /* Countdown step value */
51
52
  countdown?: () => Data
53
+ /* Is tick running? */
54
+ running?: () => Data
52
55
  }
53
56
  }
54
57
 
@@ -66,7 +69,7 @@ export type GeneratorTick = Generator &
66
69
  | SwitchCondData
67
70
  | {
68
71
  __typename: 'SwitchCondInnerStateOutlet'
69
- outlet: 'countdown'
72
+ outlet: 'countdown' | 'running'
70
73
  value: any
71
74
  }
72
75
  }>
@@ -0,0 +1,105 @@
1
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
+ import type { Data, DataLink } from '../data'
3
+ import type { Generator, EventAction, ActionWithParams, Action, EventProperty } from '../common'
4
+
5
+ /* Load the TTS model */
6
+ export type GeneratorAppleTTSActionLoadModel = Action & {
7
+ __actionName: 'GENERATOR_APPLE_TTS_LOAD_MODEL'
8
+ }
9
+
10
+ /* Generate audio */
11
+ export type GeneratorAppleTTSActionGenerate = ActionWithParams & {
12
+ __actionName: 'GENERATOR_APPLE_TTS_GENERATE'
13
+ params?: Array<{
14
+ input: 'text'
15
+ value?: string | DataLink | EventProperty
16
+ mapping?: string
17
+ }>
18
+ }
19
+
20
+ /* Clean cache */
21
+ export type GeneratorAppleTTSActionCleanCache = Action & {
22
+ __actionName: 'GENERATOR_APPLE_TTS_CLEAN_CACHE'
23
+ }
24
+
25
+ /* Cancel current generation and clear queue */
26
+ export type GeneratorAppleTTSActionCancel = Action & {
27
+ __actionName: 'GENERATOR_APPLE_TTS_CANCEL'
28
+ }
29
+
30
+ interface GeneratorAppleTTSDef {
31
+ /*
32
+ Default property:
33
+ {
34
+ "language": "en-US",
35
+ "outputType": "play",
36
+ "cacheGenerated": true,
37
+ "autoInferEnable": false,
38
+ "softBreakRegex": "^[^\\r\\n\\t\\f\\v]*([\\r\\n]+|[。!?!?.]\\B)",
39
+ "hardBreakTime": 500
40
+ }
41
+ */
42
+ property?: {
43
+ /* Initialize the TTS context on generator initialization */
44
+ init?: boolean | DataLink
45
+ /* Voice identifier */
46
+ voice?: string | DataLink
47
+ /* Language/locale (e.g., 'en-US') */
48
+ language?: string | DataLink
49
+ /* Output mode */
50
+ outputType?: 'play' | 'file' | DataLink
51
+ /* Enable cache for generated audio */
52
+ cacheGenerated?: boolean | DataLink
53
+ /* Text to generate */
54
+ prompt?: string | DataLink
55
+ /* Auto inference when prompt changes */
56
+ autoInferEnable?: boolean | DataLink
57
+ /* Segmentation rule for auto inference */
58
+ softBreakRegex?: string | DataLink
59
+ /* Time to force inference when softBreakRegex is not satisfied */
60
+ hardBreakTime?: number | DataLink
61
+ }
62
+ events?: {
63
+ /* Event triggered when state change */
64
+ onContextStateChange?: Array<EventAction>
65
+ /* Event triggered when error occurs */
66
+ onError?: Array<EventAction>
67
+ }
68
+ outlets?: {
69
+ /* Context state */
70
+ contextState?: () => Data
71
+ /* Generated audio file */
72
+ generatedAudio?: () => Data
73
+ /* Generated audio file is playing */
74
+ generatedAudioPlaying?: () => Data
75
+ }
76
+ }
77
+
78
+ /* Text-to-speech synthesis using Apple's native speech synthesis
79
+
80
+ ## Features
81
+ - Native Apple speech synthesis
82
+ - Natural sounding voices
83
+ - Privacy-focused on-device processing
84
+ - Multiple voice options
85
+ - Requires iOS 13+ (native speech synthesis) */
86
+ export type GeneratorAppleTTS = Generator &
87
+ GeneratorAppleTTSDef & {
88
+ templateKey: 'GENERATOR_APPLE_TTS'
89
+ switches: Array<
90
+ SwitchDef &
91
+ GeneratorAppleTTSDef & {
92
+ conds?: Array<{
93
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
94
+ cond:
95
+ | SwitchCondInnerStateCurrentCanvas
96
+ | SwitchCondData
97
+ | {
98
+ __typename: 'SwitchCondInnerStateOutlet'
99
+ outlet: 'contextState' | 'generatedAudio' | 'generatedAudioPlaying'
100
+ value: any
101
+ }
102
+ }>
103
+ }
104
+ >
105
+ }
@@ -1,3 +1,4 @@
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 {
@@ -1,3 +1,4 @@
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 {
@@ -113,7 +114,7 @@ interface GeneratorVadInferenceDef {
113
114
  Default property:
114
115
  {
115
116
  "init": false,
116
- "modelName": "silero-v5.1.2",
117
+ "modelName": "silero-v6.2.0",
117
118
  "modelUseGPU": true,
118
119
  "modelThreads": 4,
119
120
  "detectThreshold": 0.5,
@@ -131,7 +132,7 @@ Default property:
131
132
  /* Use model name, currently only supports the Silero VAD model.
132
133
  The model download progress will be done in preload stage or the generator initialization stage.
133
134
  You can also choose `custom` option and set `Model URL` and `Model SHA1` to use your own model */
134
- modelName?: 'custom' | 'silero-v5.1.2' | DataLink
135
+ modelName?: 'custom' | 'silero-v6.2.0' | 'silero-v5.1.2' | DataLink
135
136
  /* The URL or path of model
136
137
  We used `ggml` format model, please refer to https://huggingface.co/ggml-org/whisper-vad */
137
138
  modelUrl?: string | DataLink
@@ -1,3 +1,4 @@
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 {
@@ -159,8 +160,19 @@ Default property:
159
160
  ggmlContextSize?: number | DataLink
160
161
  /* Pooling type of ggml model */
161
162
  ggmlPoolingType?: 'none' | 'mean' | 'cls' | 'last' | 'rank' | DataLink
162
- /* Accelerator variant of ggml model */
163
- ggmlAccelVariant?: 'default' | 'vulkan' | 'cuda' | DataLink
163
+ /* GGML accelerator variant (Only for desktop)
164
+ `default` - CPU / Metal (macOS)
165
+ `vulkan` - Use Vulkan
166
+ `cuda` - Use CUDA
167
+ `snapdragon` - Use OpenCL/Hexagon of Qualcomm Snapdragon */
168
+ ggmlAccelVariant?: 'default' | 'vulkan' | 'cuda' | 'snapdragon' | DataLink
169
+ /* Devices. For example:
170
+
171
+ Metal or CPU for iOS/tvOS/MacOS
172
+ OpenCL or CPU for Android
173
+ - Add `HTP0`, `HTP1`, `...` for OpenCL/Hexagon devices (Use HTP* for all HTP devices)
174
+ For Desktop, you may want to include/exclude GPUs */
175
+ ggmlDevices?: Array<string | DataLink> | DataLink
164
176
  /* Normalize */
165
177
  ggmlEmbdNormalize?: number | DataLink
166
178
  /* API key of OpenAI Compatible API */
@@ -1,3 +1,4 @@
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 {
@@ -1,3 +1,4 @@
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 {
@@ -1,3 +1,4 @@
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 {
@@ -1,3 +1,4 @@
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 {
@@ -46,5 +46,8 @@ export * from './LlmQualcommAiEngine'
46
46
  export * from './LlmOpenAiCompat'
47
47
  export * from './TextToSpeechOpenAiLike'
48
48
  export * from './LlmAnthropicCompat'
49
+ export * from './LlmAppleBuiltin'
50
+ export * from './SttAppleBuiltin'
51
+ export * from './TextToSpeechAppleBuiltin'
49
52
  export * from './Assistant'
50
53
  export * from './VectorStore'
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,
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
 
@@ -1,3 +1,4 @@
1
+ /* Auto generated by build script */
1
2
  export const templateEventPropsMap = {
2
3
  BRICK_RECT: {},
3
4
  BRICK_TEXT: {},
@@ -55,6 +56,11 @@ export const templateEventPropsMap = {
55
56
  'BRICK_SLIDESHOW_PAYLOAD_VALUE', // type: number
56
57
  'BRICK_SLIDESHOW_ORIGINAL_INDEX', // type: number
57
58
  ],
59
+ mediaOnError: [
60
+ 'BRICK_SLIDESHOW_ERROR_MESSAGE', // type: string
61
+ 'BRICK_SLIDESHOW_ERROR_URL', // type: string
62
+ 'BRICK_SLIDESHOW_ERROR_INDEX', // type: number
63
+ ],
58
64
  },
59
65
  BRICK_CHART: {
60
66
  onPress: [
@@ -371,7 +377,16 @@ export const templateEventPropsMap = {
371
377
  'GENERATOR_WEB_SOCKET_MESSAGE', // type: any
372
378
  ],
373
379
  },
374
-
380
+ GENERATOR_CANVAS_MAP: {
381
+ onNavigate: [
382
+ 'GENERATOR_CANVAS_MAP_MATCHED_RULE', // type: object
383
+ 'GENERATOR_CANVAS_MAP_MATCHED_INDEX', // type: number
384
+ 'GENERATOR_CANVAS_MAP_TARGET_CANVAS_ID', // type: string
385
+ 'GENERATOR_CANVAS_MAP_TARGET_CANVAS_TITLE_LIKE', // type: string
386
+ 'GENERATOR_CANVAS_MAP_PROPERTY_VALUE', // type: any
387
+ 'GENERATOR_CANVAS_MAP_PREVIOUS_VALUE', // type: any
388
+ ],
389
+ },
375
390
  GENERATOR_STEP: {
376
391
  onStep: [
377
392
  'GENERATOR_STEP_PAYLOAD', // type: string
@@ -382,7 +397,21 @@ export const templateEventPropsMap = {
382
397
  iterate: [
383
398
  'GENERATOR_ITERATOR_ITERATE_VALUE', // type: any
384
399
  'GENERATOR_ITERATOR_ITERATE_KEY', // type: any
385
- 'GENERATOR_ITERATOR_ITERATE_INDEX', // type: string
400
+ 'GENERATOR_ITERATOR_ITERATE_INDEX', // type: number
401
+ ],
402
+ first: [
403
+ 'GENERATOR_ITERATOR_ITERATE_VALUE', // type: any
404
+ 'GENERATOR_ITERATOR_ITERATE_KEY', // type: any
405
+ 'GENERATOR_ITERATOR_ITERATE_INDEX', // type: number
406
+ ],
407
+ end: [
408
+ 'GENERATOR_ITERATOR_ITERATE_VALUE', // type: any
409
+ 'GENERATOR_ITERATOR_ITERATE_KEY', // type: any
410
+ 'GENERATOR_ITERATOR_ITERATE_INDEX', // type: number
411
+ ],
412
+ error: [
413
+ 'GENERATOR_ITERATOR_ERROR_MESSAGE', // type: string
414
+ 'GENERATOR_ITERATOR_ERROR_DATA', // type: any
386
415
  ],
387
416
  },
388
417
  GENERATOR_WATCHDOG: {
@@ -821,7 +850,15 @@ export const templateEventPropsMap = {
821
850
  'GENERATOR_GGML_TTS_ERROR', // type: string
822
851
  ],
823
852
  },
824
- GENERATOR_RERANKER: {},
853
+ GENERATOR_RERANKER: {
854
+ onContextStateChange: [
855
+ 'GENERATOR_RERANKER_CONTEXT_STATE', // type: string
856
+ 'GENERATOR_RERANKER_CONTEXT_DETAILS', // type: object
857
+ ],
858
+ onError: [
859
+ 'GENERATOR_RERANKER_ERROR', // type: string
860
+ ],
861
+ },
825
862
  GENERATOR_QNN_LLM: {
826
863
  onContextStateChange: [
827
864
  'GENERATOR_QNN_LLM_CONTEXT_STATE', // type: string
@@ -882,6 +919,38 @@ export const templateEventPropsMap = {
882
919
  'GENERATOR_ANTHROPIC_LLM_TOOL_USE_INPUT', // type: object
883
920
  ],
884
921
  },
922
+ GENERATOR_APPLE_LLM: {
923
+ onError: [
924
+ 'GENERATOR_APPLE_LLM_ERROR', // type: string
925
+ ],
926
+ onModelLoaded: [],
927
+ onCompletion: [
928
+ 'GENERATOR_APPLE_LLM_COMPLETION_TOKEN', // type: string
929
+ 'GENERATOR_APPLE_LLM_COMPLETION_RESULT', // type: string
930
+ ],
931
+ onCompletionFinished: [
932
+ 'GENERATOR_APPLE_LLM_COMPLETION_RESULT', // type: string
933
+ ],
934
+ },
935
+ GENERATOR_APPLE_STT: {
936
+ onError: [
937
+ 'GENERATOR_APPLE_STT_ERROR', // type: string
938
+ ],
939
+ onTranscribed: [
940
+ 'GENERATOR_APPLE_STT_TRANSCRIBE_RESULT', // type: string
941
+ 'GENERATOR_APPLE_STT_TRANSCRIBE_START_TIME', // type: number
942
+ 'GENERATOR_APPLE_STT_TRANSCRIBE_END_TIME', // type: number
943
+ 'GENERATOR_APPLE_STT_TRANSCRIBE_TIME', // type: number
944
+ ],
945
+ },
946
+ GENERATOR_APPLE_TTS: {
947
+ onContextStateChange: [
948
+ 'GENERATOR_APPLE_TTS_CONTEXT_STATE', // type: string
949
+ ],
950
+ onError: [
951
+ 'GENERATOR_APPLE_TTS_ERROR', // type: string
952
+ ],
953
+ },
885
954
  GENERATOR_ASSISTANT: {
886
955
  onError: [
887
956
  'GENERATOR_ASSISTANT_ERROR', // type: string
@@ -892,6 +961,13 @@ export const templateEventPropsMap = {
892
961
  onMessagesUpdate: [
893
962
  'GENERATOR_ASSISTANT_MESSAGES', // type: array
894
963
  ],
964
+ onHeatupFinished: [],
965
+ onGenerating: [],
966
+ onFinished: [
967
+ 'GENERATOR_ASSISTANT_MESSAGES', // type: array
968
+ 'GENERATOR_ASSISTANT_LAST_MESSAGE', // type: object
969
+ 'GENERATOR_ASSISTANT_IS_ERROR', // type: bool
970
+ ],
895
971
  },
896
972
  GENERATOR_VECTOR_STORE: {
897
973
  onError: [
package/utils/id.ts CHANGED
@@ -4,7 +4,9 @@ let count = 0
4
4
 
5
5
  // Used for snapshot mode
6
6
  const countUUID = () => {
7
- return `00000000-0000-0000-0000-${(count++).toString().padStart(12, '0')}`
7
+ const current = count
8
+ count += 1
9
+ return `00000000-0000-0000-0000-${current.toString().padStart(12, '0')}`
8
10
  }
9
11
 
10
12
  // Make a random id if not want to use fixed id