@fugood/bricks-project 2.23.0-beta.24 → 2.23.0-beta.26

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 +25 -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 +1 -0
  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 +1 -0
  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 +1 -0
  31. package/types/data.ts +1 -0
  32. package/types/generators/AlarmClock.ts +1 -0
  33. package/types/generators/Assistant.ts +1 -0
  34. package/types/generators/BleCentral.ts +1 -0
  35. package/types/generators/BlePeripheral.ts +1 -0
  36. package/types/generators/CanvasMap.ts +1 -0
  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 +1 -0
  42. package/types/generators/HttpServer.ts +1 -0
  43. package/types/generators/Information.ts +1 -0
  44. package/types/generators/Intent.ts +1 -0
  45. package/types/generators/Iterator.ts +1 -0
  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 +1 -0
  50. package/types/generators/LlmOnnx.ts +1 -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 +1 -0
  59. package/types/generators/RealtimeTranscription.ts +1 -0
  60. package/types/generators/RerankerGgml.ts +1 -0
  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 +1 -0
  65. package/types/generators/SpeechToTextOnnx.ts +1 -0
  66. package/types/generators/SpeechToTextPlatform.ts +1 -0
  67. package/types/generators/SqLite.ts +1 -0
  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 +1 -0
  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 +1 -0
  79. package/types/generators/TtsAppleBuiltin.ts +105 -0
  80. package/types/generators/Udp.ts +1 -0
  81. package/types/generators/VadGgml.ts +1 -0
  82. package/types/generators/VectorStore.ts +1 -0
  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 +33 -0
  91. package/utils/id.ts +3 -1
@@ -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 {
@@ -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 {
@@ -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: {},
@@ -918,6 +919,38 @@ export const templateEventPropsMap = {
918
919
  'GENERATOR_ANTHROPIC_LLM_TOOL_USE_INPUT', // type: object
919
920
  ],
920
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
+ },
921
954
  GENERATOR_ASSISTANT: {
922
955
  onError: [
923
956
  'GENERATOR_ASSISTANT_ERROR', // type: string
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