@fugood/bricks-project 2.22.0-beta.9 → 2.22.0

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 (86) hide show
  1. package/compile/action-name-map.ts +108 -1
  2. package/compile/index.ts +10 -1
  3. package/package.json +3 -3
  4. package/tools/postinstall.ts +16 -9
  5. package/types/animation.ts +2 -1
  6. package/types/brick-base.ts +79 -0
  7. package/types/bricks/3DViewer.ts +200 -0
  8. package/types/bricks/Camera.ts +195 -0
  9. package/types/bricks/Chart.ts +362 -0
  10. package/types/bricks/GenerativeMedia.ts +240 -0
  11. package/types/bricks/Icon.ts +93 -0
  12. package/types/bricks/Image.ts +104 -0
  13. package/types/bricks/Items.ts +461 -0
  14. package/types/bricks/Lottie.ts +159 -0
  15. package/types/bricks/QrCode.ts +112 -0
  16. package/types/bricks/Rect.ts +110 -0
  17. package/types/bricks/RichText.ts +123 -0
  18. package/types/bricks/Rive.ts +209 -0
  19. package/types/bricks/Slideshow.ts +155 -0
  20. package/types/bricks/Svg.ts +94 -0
  21. package/types/bricks/Text.ts +143 -0
  22. package/types/bricks/TextInput.ts +231 -0
  23. package/types/bricks/Video.ts +170 -0
  24. package/types/bricks/VideoStreaming.ts +107 -0
  25. package/types/bricks/WebRtcStream.ts +60 -0
  26. package/types/bricks/WebView.ts +157 -0
  27. package/types/bricks/index.ts +20 -0
  28. package/types/common.ts +8 -3
  29. package/types/data.ts +6 -0
  30. package/types/generators/AlarmClock.ts +102 -0
  31. package/types/generators/Assistant.ts +546 -0
  32. package/types/generators/BleCentral.ts +225 -0
  33. package/types/generators/BlePeripheral.ts +202 -0
  34. package/types/generators/CanvasMap.ts +57 -0
  35. package/types/generators/CastlesPay.ts +77 -0
  36. package/types/generators/DataBank.ts +123 -0
  37. package/types/generators/File.ts +351 -0
  38. package/types/generators/GraphQl.ts +124 -0
  39. package/types/generators/Http.ts +117 -0
  40. package/types/generators/HttpServer.ts +164 -0
  41. package/types/generators/Information.ts +97 -0
  42. package/types/generators/Intent.ts +107 -0
  43. package/types/generators/Iterator.ts +95 -0
  44. package/types/generators/Keyboard.ts +85 -0
  45. package/types/generators/LlmAnthropicCompat.ts +188 -0
  46. package/types/generators/LlmGgml.ts +719 -0
  47. package/types/generators/LlmOnnx.ts +184 -0
  48. package/types/generators/LlmOpenAiCompat.ts +206 -0
  49. package/types/generators/LlmQualcommAiEngine.ts +213 -0
  50. package/types/generators/Mcp.ts +294 -0
  51. package/types/generators/McpServer.ts +248 -0
  52. package/types/generators/MediaFlow.ts +142 -0
  53. package/types/generators/MqttBroker.ts +121 -0
  54. package/types/generators/MqttClient.ts +129 -0
  55. package/types/generators/Question.ts +395 -0
  56. package/types/generators/RealtimeTranscription.ts +180 -0
  57. package/types/generators/RerankerGgml.ts +153 -0
  58. package/types/generators/SerialPort.ts +141 -0
  59. package/types/generators/SoundPlayer.ts +86 -0
  60. package/types/generators/SoundRecorder.ts +113 -0
  61. package/types/generators/SpeechToTextGgml.ts +462 -0
  62. package/types/generators/SpeechToTextOnnx.ts +227 -0
  63. package/types/generators/SpeechToTextPlatform.ts +75 -0
  64. package/types/generators/SqLite.ts +118 -0
  65. package/types/generators/Step.ts +101 -0
  66. package/types/generators/TapToPayOnIPhone.ts +175 -0
  67. package/types/generators/Tcp.ts +120 -0
  68. package/types/generators/TcpServer.ts +137 -0
  69. package/types/generators/TextToSpeechGgml.ts +182 -0
  70. package/types/generators/TextToSpeechOnnx.ts +169 -0
  71. package/types/generators/TextToSpeechOpenAiLike.ts +113 -0
  72. package/types/generators/ThermalPrinter.ts +185 -0
  73. package/types/generators/Tick.ts +75 -0
  74. package/types/generators/Udp.ts +109 -0
  75. package/types/generators/VadGgml.ts +211 -0
  76. package/types/generators/VectorStore.ts +223 -0
  77. package/types/generators/Watchdog.ts +96 -0
  78. package/types/generators/WebCrawler.ts +97 -0
  79. package/types/generators/WebRtc.ts +165 -0
  80. package/types/generators/WebSocket.ts +142 -0
  81. package/types/generators/index.ts +51 -0
  82. package/types/system.ts +64 -0
  83. package/utils/data.ts +45 -0
  84. package/utils/event-props.ts +89 -0
  85. package/types/bricks.ts +0 -3168
  86. package/types/generators.ts +0 -7633
@@ -0,0 +1,188 @@
1
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
+ import type { Data, DataLink } from '../data'
3
+ import type {
4
+ Generator,
5
+ EventAction,
6
+ ActionWithDataParams,
7
+ ActionWithParams,
8
+ Action,
9
+ EventProperty,
10
+ } from '../common'
11
+
12
+ /* Run text completion */
13
+ export type GeneratorAnthropicLLMActionCompletion = ActionWithParams & {
14
+ __actionName: 'GENERATOR_ANTHROPIC_LLM_COMPLETION'
15
+ params?: Array<
16
+ | {
17
+ input: 'systemMessage'
18
+ value?: string | DataLink | EventProperty
19
+ mapping?: string
20
+ }
21
+ | {
22
+ input: 'messages'
23
+ value?: Array<any> | DataLink | EventProperty
24
+ mapping?: string
25
+ }
26
+ | {
27
+ input: 'maxTokens'
28
+ value?: number | DataLink | EventProperty
29
+ mapping?: string
30
+ }
31
+ | {
32
+ input: 'temperature'
33
+ value?: number | DataLink | EventProperty
34
+ mapping?: string
35
+ }
36
+ | {
37
+ input: 'topP'
38
+ value?: number | DataLink | EventProperty
39
+ mapping?: string
40
+ }
41
+ | {
42
+ input: 'topK'
43
+ value?: number | DataLink | EventProperty
44
+ mapping?: string
45
+ }
46
+ | {
47
+ input: 'stopSequences'
48
+ value?: Array<any> | DataLink | EventProperty
49
+ mapping?: string
50
+ }
51
+ | {
52
+ input: 'tools'
53
+ value?: Array<any> | DataLink | EventProperty
54
+ mapping?: string
55
+ }
56
+ | {
57
+ input: 'toolChoice'
58
+ value?: {} | DataLink | EventProperty
59
+ mapping?: string
60
+ }
61
+ >
62
+ }
63
+
64
+ /* Stop text completion */
65
+ export type GeneratorAnthropicLLMActionStopCompletion = Action & {
66
+ __actionName: 'GENERATOR_ANTHROPIC_LLM_STOP_COMPLETION'
67
+ }
68
+
69
+ interface GeneratorAnthropicLLMDef {
70
+ /*
71
+ Default property:
72
+ {
73
+ "apiEndpoint": "https://api.anthropic.com/v1/messages",
74
+ "model": "claude-3-5-sonnet-20241022",
75
+ "systemMessage": "You are a helpful assistant.",
76
+ "completionMessages": [],
77
+ "completionMaxTokens": 1024,
78
+ "completionTemperature": 1,
79
+ "completionTopP": 1,
80
+ "completionStopSequences": []
81
+ }
82
+ */
83
+ property?: {
84
+ /* API endpoint URL */
85
+ apiEndpoint?: string | DataLink
86
+ /* API key */
87
+ apiKey?: string | DataLink
88
+ /* Model name (Default: claude-3-5-sonnet-20241022) */
89
+ model?: string | DataLink
90
+ /* System message content */
91
+ systemMessage?: string | DataLink
92
+ /* Chat messages (user/assistant only) */
93
+ completionMessages?:
94
+ | Array<
95
+ | DataLink
96
+ | {
97
+ role?: 'user' | 'assistant' | DataLink
98
+ content?:
99
+ | string
100
+ | DataLink
101
+ | Array<
102
+ | DataLink
103
+ | {
104
+ type?: 'text' | 'image' | DataLink
105
+ text?: string | DataLink
106
+ source?:
107
+ | DataLink
108
+ | {
109
+ type?: string | DataLink
110
+ media_type?: string | DataLink
111
+ data?: string | DataLink
112
+ }
113
+ }
114
+ >
115
+ | DataLink
116
+ | DataLink
117
+ }
118
+ >
119
+ | DataLink
120
+ /* Tools for function calling following Anthropic format
121
+ Format: Array of objects with {name, description, input_schema} structure
122
+ See: https://docs.anthropic.com/en/docs/tool-use */
123
+ completionTools?: Array<{} | DataLink> | DataLink
124
+ /* Tool choice for function calling */
125
+ completionToolChoice?:
126
+ | DataLink
127
+ | {
128
+ type?: 'auto' | 'any' | 'tool' | DataLink
129
+ name?: string | DataLink
130
+ }
131
+ /* Maximum tokens to generate */
132
+ completionMaxTokens?: number | DataLink
133
+ /* Temperature */
134
+ completionTemperature?: number | DataLink
135
+ /* Top P sampling */
136
+ completionTopP?: number | DataLink
137
+ /* Top K sampling */
138
+ completionTopK?: number | DataLink
139
+ /* Stop sequences */
140
+ completionStopSequences?: Array<string | DataLink> | DataLink
141
+ }
142
+ events?: {
143
+ /* Error event */
144
+ onError?: Array<EventAction>
145
+ /* Completion event */
146
+ onCompletion?: Array<EventAction>
147
+ /* Completion finished event */
148
+ onCompletionFinished?: Array<EventAction>
149
+ /* Tool use event */
150
+ onToolUse?: Array<EventAction>
151
+ }
152
+ outlets?: {
153
+ /* Evaluating outlet */
154
+ isEvaluating?: () => Data
155
+ /* Completion result outlet */
156
+ completionResult?: () => Data
157
+ /* Completion details outlet */
158
+ completionDetails?: () => Data
159
+ }
160
+ }
161
+
162
+ /* LLM inference using Anthropic-compatible API endpoints
163
+
164
+ ## Features
165
+ - Compatible with Anthropic API format
166
+ - Supports function calling (tools)
167
+ - Streaming responses
168
+ - Custom API endpoints (Default to https://api.anthropic.com/v1/messages) */
169
+ export type GeneratorAnthropicLLM = Generator &
170
+ GeneratorAnthropicLLMDef & {
171
+ templateKey: 'GENERATOR_ANTHROPIC_LLM'
172
+ switches: Array<
173
+ SwitchDef &
174
+ GeneratorAnthropicLLMDef & {
175
+ conds?: Array<{
176
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
177
+ cond:
178
+ | SwitchCondInnerStateCurrentCanvas
179
+ | SwitchCondData
180
+ | {
181
+ __typename: 'SwitchCondInnerStateOutlet'
182
+ outlet: 'isEvaluating' | 'completionResult' | 'completionDetails'
183
+ value: any
184
+ }
185
+ }>
186
+ }
187
+ >
188
+ }