@fugood/bricks-ctor 2.25.0-beta.60 → 2.25.0-beta.62

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 (192) hide show
  1. package/package.json +4 -28
  2. package/tools/__tests__/legacy-forwarder.test.js +91 -0
  3. package/tools/_forward.ts +26 -0
  4. package/tools/deploy.ts +3 -175
  5. package/tools/mcp-server.ts +3 -35
  6. package/tools/postinstall.ts +3 -291
  7. package/tools/pull.ts +3 -198
  8. package/tools/push-config.ts +3 -113
  9. package/tools/simulator.ts +3 -149
  10. package/compile/__tests__/config-diff.test.js +0 -100
  11. package/compile/__tests__/index.test.js +0 -461
  12. package/compile/__tests__/util.test.js +0 -450
  13. package/compile/action-name-map.ts +0 -1079
  14. package/compile/config-diff.ts +0 -155
  15. package/compile/index.ts +0 -1594
  16. package/compile/util.ts +0 -482
  17. package/index.ts +0 -6
  18. package/skills/bricks-ctor/SKILL.md +0 -38
  19. package/skills/bricks-ctor/references/animation.md +0 -160
  20. package/skills/bricks-ctor/references/architecture-patterns.md +0 -88
  21. package/skills/bricks-ctor/references/automations.md +0 -232
  22. package/skills/bricks-ctor/references/buttress.md +0 -245
  23. package/skills/bricks-ctor/references/data-calculation.md +0 -252
  24. package/skills/bricks-ctor/references/local-sync.md +0 -129
  25. package/skills/bricks-ctor/references/media-flow.md +0 -165
  26. package/skills/bricks-ctor/references/remote-data-bank.md +0 -196
  27. package/skills/bricks-ctor/references/simulator.md +0 -132
  28. package/skills/bricks-ctor/references/source-editing-tools.md +0 -81
  29. package/skills/bricks-ctor/references/standby-transition.md +0 -124
  30. package/skills/bricks-ctor/references/verification-toolchain.md +0 -200
  31. package/skills/bricks-design/SKILL.md +0 -171
  32. package/skills/bricks-design/references/architecture-truths.md +0 -132
  33. package/skills/bricks-design/references/avoiding-complexity.md +0 -91
  34. package/skills/bricks-design/references/design-critique.md +0 -195
  35. package/skills/bricks-design/references/design-languages.md +0 -265
  36. package/skills/bricks-design/references/performance.md +0 -116
  37. package/skills/bricks-design/references/presentation-and-slideshow.md +0 -137
  38. package/skills/bricks-design/references/translating-inputs.md +0 -152
  39. package/skills/bricks-design/references/variations-and-tweaks.md +0 -124
  40. package/skills/bricks-design/references/when-the-brief-is-branded.md +0 -284
  41. package/skills/bricks-design/references/when-the-brief-is-vague.md +0 -85
  42. package/skills/bricks-design/references/workflow.md +0 -134
  43. package/skills/bricks-ux/SKILL.md +0 -114
  44. package/skills/bricks-ux/references/accessibility.md +0 -162
  45. package/skills/bricks-ux/references/flow-states.md +0 -175
  46. package/skills/bricks-ux/references/interaction-archetypes.md +0 -189
  47. package/skills/bricks-ux/references/monitoring-screens.md +0 -153
  48. package/skills/bricks-ux/references/pressable-composition.md +0 -126
  49. package/skills/bricks-ux/references/user-journey.md +0 -168
  50. package/skills/bricks-ux/references/ux-critique.md +0 -256
  51. package/skills/rive-marketplace/SKILL.md +0 -99
  52. package/tools/__tests__/_cli-error.test.ts +0 -35
  53. package/tools/__tests__/_mcp-config.test.ts +0 -67
  54. package/tools/__tests__/pull.test.ts +0 -108
  55. package/tools/_cli-error.ts +0 -17
  56. package/tools/_edits-log.ts +0 -41
  57. package/tools/_git-author.ts +0 -37
  58. package/tools/_last-pushed-commit.ts +0 -28
  59. package/tools/_mcp-config.ts +0 -42
  60. package/tools/_shell.ts +0 -180
  61. package/tools/icons/.gitattributes +0 -1
  62. package/tools/icons/fa6pro-glyphmap.json +0 -4686
  63. package/tools/icons/fa6pro-meta.json +0 -1
  64. package/tools/mcp-env.ts +0 -13
  65. package/tools/mcp-tools/__tests__/data-calc-editing.test.js +0 -516
  66. package/tools/mcp-tools/__tests__/entry-editing.test.js +0 -866
  67. package/tools/mcp-tools/__tests__/huggingface.test.ts +0 -49
  68. package/tools/mcp-tools/__tests__/icons.test.ts +0 -21
  69. package/tools/mcp-tools/__tests__/mcp-env.test.js +0 -19
  70. package/tools/mcp-tools/_editing-helpers.ts +0 -98
  71. package/tools/mcp-tools/_verify.ts +0 -50
  72. package/tools/mcp-tools/compile.ts +0 -104
  73. package/tools/mcp-tools/data-calc-editing.ts +0 -1311
  74. package/tools/mcp-tools/entry-editing.ts +0 -2297
  75. package/tools/mcp-tools/huggingface.ts +0 -772
  76. package/tools/mcp-tools/icons.ts +0 -97
  77. package/tools/mcp-tools/lottie.ts +0 -102
  78. package/tools/mcp-tools/media.ts +0 -113
  79. package/tools/simulator-main.mjs +0 -488
  80. package/tools/simulator-preload.cjs +0 -16
  81. package/types/animation.d.ts +0 -116
  82. package/types/automation.d.ts +0 -231
  83. package/types/brick-base.d.ts +0 -80
  84. package/types/bricks/Camera.d.ts +0 -246
  85. package/types/bricks/Chart.d.ts +0 -372
  86. package/types/bricks/GenerativeMedia.d.ts +0 -290
  87. package/types/bricks/Icon.d.ts +0 -98
  88. package/types/bricks/Image.d.ts +0 -126
  89. package/types/bricks/Items.d.ts +0 -480
  90. package/types/bricks/Lottie.d.ts +0 -168
  91. package/types/bricks/Maps.d.ts +0 -262
  92. package/types/bricks/QrCode.d.ts +0 -117
  93. package/types/bricks/Rect.d.ts +0 -150
  94. package/types/bricks/RichText.d.ts +0 -131
  95. package/types/bricks/Rive.d.ts +0 -220
  96. package/types/bricks/Scene3D.d.ts +0 -676
  97. package/types/bricks/Sketch.d.ts +0 -256
  98. package/types/bricks/Slideshow.d.ts +0 -201
  99. package/types/bricks/Svg.d.ts +0 -99
  100. package/types/bricks/Text.d.ts +0 -148
  101. package/types/bricks/TextInput.d.ts +0 -242
  102. package/types/bricks/Video.d.ts +0 -242
  103. package/types/bricks/VideoStreaming.d.ts +0 -112
  104. package/types/bricks/WebRtcStream.d.ts +0 -65
  105. package/types/bricks/WebView.d.ts +0 -168
  106. package/types/bricks/index.d.ts +0 -23
  107. package/types/canvas.d.ts +0 -82
  108. package/types/common.d.ts +0 -141
  109. package/types/data-calc-command/base.d.ts +0 -57
  110. package/types/data-calc-command/collection.d.ts +0 -418
  111. package/types/data-calc-command/color.d.ts +0 -432
  112. package/types/data-calc-command/constant.d.ts +0 -50
  113. package/types/data-calc-command/datetime.d.ts +0 -147
  114. package/types/data-calc-command/file.d.ts +0 -129
  115. package/types/data-calc-command/index.d.ts +0 -13
  116. package/types/data-calc-command/iteratee.d.ts +0 -23
  117. package/types/data-calc-command/logictype.d.ts +0 -190
  118. package/types/data-calc-command/math.d.ts +0 -275
  119. package/types/data-calc-command/object.d.ts +0 -119
  120. package/types/data-calc-command/sandbox.d.ts +0 -66
  121. package/types/data-calc-command/string.d.ts +0 -407
  122. package/types/data-calc-script.d.ts +0 -21
  123. package/types/data-calc.d.ts +0 -12
  124. package/types/data.d.ts +0 -97
  125. package/types/generators/AlarmClock.d.ts +0 -110
  126. package/types/generators/Assistant.d.ts +0 -640
  127. package/types/generators/BleCentral.d.ts +0 -247
  128. package/types/generators/BlePeripheral.d.ts +0 -208
  129. package/types/generators/CanvasMap.d.ts +0 -74
  130. package/types/generators/CastlesPay.d.ts +0 -87
  131. package/types/generators/DataBank.d.ts +0 -160
  132. package/types/generators/File.d.ts +0 -432
  133. package/types/generators/GraphQl.d.ts +0 -132
  134. package/types/generators/Http.d.ts +0 -222
  135. package/types/generators/HttpServer.d.ts +0 -230
  136. package/types/generators/Information.d.ts +0 -103
  137. package/types/generators/Intent.d.ts +0 -168
  138. package/types/generators/Iterator.d.ts +0 -108
  139. package/types/generators/Keyboard.d.ts +0 -105
  140. package/types/generators/LlmAnthropicCompat.d.ts +0 -212
  141. package/types/generators/LlmAppleBuiltin.d.ts +0 -159
  142. package/types/generators/LlmGgml.d.ts +0 -903
  143. package/types/generators/LlmMediaTekNeuroPilot.d.ts +0 -235
  144. package/types/generators/LlmMlx.d.ts +0 -228
  145. package/types/generators/LlmOnnx.d.ts +0 -213
  146. package/types/generators/LlmOpenAiCompat.d.ts +0 -312
  147. package/types/generators/LlmQualcommAiEngine.d.ts +0 -247
  148. package/types/generators/Mcp.d.ts +0 -637
  149. package/types/generators/McpServer.d.ts +0 -289
  150. package/types/generators/MediaFlow.d.ts +0 -170
  151. package/types/generators/MqttBroker.d.ts +0 -141
  152. package/types/generators/MqttClient.d.ts +0 -141
  153. package/types/generators/Question.d.ts +0 -408
  154. package/types/generators/RealtimeTranscription.d.ts +0 -287
  155. package/types/generators/RerankerGgml.d.ts +0 -195
  156. package/types/generators/SerialPort.d.ts +0 -151
  157. package/types/generators/SoundPlayer.d.ts +0 -94
  158. package/types/generators/SoundRecorder.d.ts +0 -139
  159. package/types/generators/SpeechToTextGgml.d.ts +0 -424
  160. package/types/generators/SpeechToTextOnnx.d.ts +0 -236
  161. package/types/generators/SpeechToTextPlatform.d.ts +0 -85
  162. package/types/generators/SqLite.d.ts +0 -159
  163. package/types/generators/Step.d.ts +0 -107
  164. package/types/generators/SttAppleBuiltin.d.ts +0 -153
  165. package/types/generators/Tcp.d.ts +0 -126
  166. package/types/generators/TcpServer.d.ts +0 -147
  167. package/types/generators/TextToSpeechAppleBuiltin.d.ts +0 -127
  168. package/types/generators/TextToSpeechGgml.d.ts +0 -221
  169. package/types/generators/TextToSpeechOnnx.d.ts +0 -178
  170. package/types/generators/TextToSpeechOpenAiLike.d.ts +0 -121
  171. package/types/generators/ThermalPrinter.d.ts +0 -193
  172. package/types/generators/Tick.d.ts +0 -83
  173. package/types/generators/Udp.d.ts +0 -120
  174. package/types/generators/VadGgml.d.ts +0 -260
  175. package/types/generators/VadOnnx.d.ts +0 -231
  176. package/types/generators/VadTraditional.d.ts +0 -138
  177. package/types/generators/VectorStore.d.ts +0 -257
  178. package/types/generators/Watchdog.d.ts +0 -107
  179. package/types/generators/WebCrawler.d.ts +0 -103
  180. package/types/generators/WebRtc.d.ts +0 -181
  181. package/types/generators/WebSocket.d.ts +0 -148
  182. package/types/generators/index.d.ts +0 -57
  183. package/types/index.d.ts +0 -13
  184. package/types/subspace.d.ts +0 -60
  185. package/types/switch.d.ts +0 -51
  186. package/types/system.d.ts +0 -707
  187. package/utils/__tests__/calc.test.js +0 -25
  188. package/utils/__tests__/id.test.js +0 -154
  189. package/utils/calc.ts +0 -130
  190. package/utils/data.ts +0 -495
  191. package/utils/event-props.ts +0 -912
  192. package/utils/id.ts +0 -133
@@ -1,235 +0,0 @@
1
- /* Auto generated by build script
2
- *
3
- * On-device LLM inference using MediaTek NeuroPilot native SDK integration on Android
4
- */
5
- import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
6
- import type { Data, DataLink } from '../data'
7
- import type {
8
- Brick,
9
- Generator,
10
- EventAction,
11
- ActionWithDataParams,
12
- ActionWithParams,
13
- Action,
14
- EventProperty,
15
- } from '../common'
16
- import type { TemplateEventPropsMap } from '../../utils/event-props'
17
-
18
- /* Load or validate the NeuroPilot model context */
19
- export type GeneratorNeuropilotLlmActionLoadModel = ActionWithParams & {
20
- __actionName: 'GENERATOR_NEUROPILOT_LLM_LOAD_MODEL'
21
- params?: Array<
22
- | {
23
- input: 'runnerPath'
24
- value?: string | DataLink | EventProperty
25
- mapping?: string
26
- }
27
- | {
28
- input: 'configPath'
29
- value?: string | DataLink | EventProperty
30
- mapping?: string
31
- }
32
- | {
33
- input: 'workingDirectory'
34
- value?: string | DataLink | EventProperty
35
- mapping?: string
36
- }
37
- | {
38
- input: 'libraryPaths'
39
- value?: Array<any> | DataLink | EventProperty
40
- mapping?: string
41
- }
42
- | {
43
- input: 'daemonHost'
44
- value?: string | DataLink | EventProperty
45
- mapping?: string
46
- }
47
- | {
48
- input: 'daemonPort'
49
- value?: number | DataLink | EventProperty
50
- mapping?: string
51
- }
52
- | {
53
- input: 'daemonSocketName'
54
- value?: string | DataLink | EventProperty
55
- mapping?: string
56
- }
57
- | {
58
- input: 'daemonSocketNamespace'
59
- value?: string | DataLink | EventProperty
60
- mapping?: string
61
- }
62
- >
63
- }
64
-
65
- /* Run text generation with the current NeuroPilot context */
66
- export type GeneratorNeuropilotLlmActionGenerate = ActionWithParams & {
67
- __actionName: 'GENERATOR_NEUROPILOT_LLM_GENERATE'
68
- params?: Array<
69
- | {
70
- input: 'prompt'
71
- value?: string | DataLink | EventProperty
72
- mapping?: string
73
- }
74
- | {
75
- input: 'messages'
76
- value?: Array<any> | DataLink | EventProperty
77
- mapping?: string
78
- }
79
- | {
80
- input: 'maxNewTokens'
81
- value?: number | DataLink | EventProperty
82
- mapping?: string
83
- }
84
- | {
85
- input: 'preformatter'
86
- value?: string | DataLink | EventProperty
87
- mapping?: string
88
- }
89
- >
90
- }
91
-
92
- /* Abort an in-flight NeuroPilot generation request */
93
- export type GeneratorNeuropilotLlmActionAbortGeneration = Action & {
94
- __actionName: 'GENERATOR_NEUROPILOT_LLM_ABORT_GENERATION'
95
- }
96
-
97
- /* Release the current NeuroPilot context */
98
- export type GeneratorNeuropilotLlmActionReleaseContext = Action & {
99
- __actionName: 'GENERATOR_NEUROPILOT_LLM_RELEASE_CONTEXT'
100
- }
101
-
102
- interface GeneratorNeuropilotLlmDef {
103
- /*
104
- Default property:
105
- {
106
- "runnerPath": "/data/local/tmp/llm_sdk/main",
107
- "configPath": "/data/local/tmp/llm_sdk/config_gemma2_2b_instruct.yaml",
108
- "workingDirectory": "/data/local/tmp/llm_sdk",
109
- "libraryPaths": [
110
- "/vendor/lib64",
111
- "/system_ext/lib64",
112
- "/vendor/lib",
113
- "/system_ext/lib"
114
- ],
115
- "runtimeMode": "auto",
116
- "preformatter": "GemmaNoInput",
117
- "maxNewTokens": 128
118
- }
119
- */
120
- property?: {
121
- /* Preloadable NeuroPilot model bundle preset */
122
- modelBundle?:
123
- | 'Gemma 2 2B Instruct'
124
- | 'Gemma 2 2B Instruct (Tailpatched)'
125
- | 'Gemma 2 2B Instruct (Tailpatched MDLA53)'
126
- | 'Qwen 2.5 0.5B Instruct'
127
- | 'Qwen 2.5 1.5B Instruct'
128
- | 'Llama 3 8B Instruct'
129
- | DataLink
130
- /* Override base URL for NeuroPilot model bundle downloads */
131
- modelBaseUrl?: string | DataLink
132
- /* Validate runner/config paths on generator initialization */
133
- init?: boolean | DataLink
134
- /* Runner binary path on device */
135
- runnerPath?: string | DataLink
136
- /* YAML config path on device */
137
- configPath?: string | DataLink
138
- /* Working directory for the runner process */
139
- workingDirectory?: string | DataLink
140
- /* Extra library search paths for the runner process */
141
- libraryPaths?: Array<string | DataLink> | DataLink
142
- /* Daemon host for a preloaded NeuroPilot service */
143
- daemonHost?: string | DataLink
144
- /* Daemon TCP port for a preloaded NeuroPilot service */
145
- daemonPort?: number | DataLink
146
- /* Android local socket name for a privileged NeuroPilot service */
147
- daemonSocketName?: string | DataLink
148
- /* Android local socket namespace used by the privileged NeuroPilot service */
149
- daemonSocketNamespace?: 'abstract' | 'reserved' | 'filesystem' | DataLink
150
- /* Runtime selection strategy for MediaTek execution */
151
- runtimeMode?: 'auto' | 'daemon' | 'root-runner' | 'native' | DataLink
152
- /* Prompt preformatter used by the vendor runner */
153
- preformatter?:
154
- | 'AlpacaNoInput'
155
- | 'OneShotConversation'
156
- | 'VicunaNoInput'
157
- | 'QwenNoInput'
158
- | 'Qwen3NoInput'
159
- | 'Qwen3NoInputNoThink'
160
- | 'Llama3NoInput'
161
- | 'Phi3NoInput'
162
- | 'MinicpmNoInput'
163
- | 'MinicpmNoInputZh'
164
- | 'InternLM2'
165
- | 'GemmaNoInput'
166
- | DataLink
167
- /* Prompt to run */
168
- prompt?: string | DataLink
169
- /* Chat messages to flatten into a prompt */
170
- messages?: Array<DataLink | {}> | DataLink
171
- /* Maximum tokens requested from the runner */
172
- maxNewTokens?: number | DataLink
173
- }
174
- events?: {
175
- /* Event triggered when the NeuroPilot context state changes */
176
- onContextStateChange?: Array<
177
- EventAction<string & keyof TemplateEventPropsMap['NeuropilotLlm']['onContextStateChange']>
178
- >
179
- /* Event triggered when a completion token or partial result is emitted */
180
- onCompletion?: Array<
181
- EventAction<string & keyof TemplateEventPropsMap['NeuropilotLlm']['onCompletion']>
182
- >
183
- /* Event triggered when generation finishes */
184
- onCompletionFinished?: Array<
185
- EventAction<string & keyof TemplateEventPropsMap['NeuropilotLlm']['onCompletionFinished']>
186
- >
187
- /* Event triggered when a NeuroPilot error occurs */
188
- onError?: Array<EventAction<string & keyof TemplateEventPropsMap['NeuropilotLlm']['onError']>>
189
- }
190
- outlets?: {
191
- /* Current NeuroPilot context state */
192
- contextState?: () => Data<string>
193
- /* Final generated result text */
194
- result?: () => Data<string>
195
- /* Full context returned by the runner */
196
- fullContext?: () => Data<string>
197
- /* Last emitted token or chunk */
198
- lastToken?: () => Data<string>
199
- /* Raw output captured from the NeuroPilot runner */
200
- rawOutput?: () => Data<string>
201
- /* Prompt-phase performance in tokens per second */
202
- promptTokensPerSec?: () => Data<string>
203
- /* Generation-phase performance in tokens per second */
204
- generationTokensPerSec?: () => Data<string>
205
- }
206
- }
207
-
208
- /* On-device LLM inference using MediaTek NeuroPilot native SDK integration on Android */
209
- export type GeneratorNeuropilotLlm = Generator &
210
- GeneratorNeuropilotLlmDef & {
211
- templateKey: 'GENERATOR_NEUROPILOT_LLM'
212
- switches?: Array<
213
- SwitchDef &
214
- GeneratorNeuropilotLlmDef & {
215
- conds?: Array<{
216
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
217
- cond:
218
- | SwitchCondInnerStateCurrentCanvas
219
- | SwitchCondData
220
- | {
221
- __typename: 'SwitchCondInnerStateOutlet'
222
- outlet:
223
- | 'contextState'
224
- | 'result'
225
- | 'fullContext'
226
- | 'lastToken'
227
- | 'rawOutput'
228
- | 'promptTokensPerSec'
229
- | 'generationTokensPerSec'
230
- value: any
231
- }
232
- }>
233
- }
234
- >
235
- }
@@ -1,228 +0,0 @@
1
- /* Auto generated by build script
2
- *
3
- * On-device LLM inference using Apple MLX framework on iOS/tvOS
4
- *
5
- * ## Features
6
- * - Powered by MLX (Apple's ML framework optimized for Apple Silicon)
7
- * - Download models directly from HuggingFace Hub
8
- * - Streaming token generation
9
- * - Supports LLM and VLM (Vision Language Models)
10
- * - Requires iOS 17+ or tvOS 17+
11
- */
12
- import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
13
- import type { Data, DataLink } from '../data'
14
- import type {
15
- Brick,
16
- Generator,
17
- EventAction,
18
- ActionWithDataParams,
19
- ActionWithParams,
20
- Action,
21
- EventProperty,
22
- } from '../common'
23
- import type { TemplateEventPropsMap } from '../../utils/event-props'
24
-
25
- /* Load model */
26
- export type GeneratorMlxLLMActionLoadModel = ActionWithParams & {
27
- __actionName: 'GENERATOR_MLX_LLM_LOAD_MODEL'
28
- params?: Array<
29
- | {
30
- input: 'modelId'
31
- value?: string | DataLink | EventProperty
32
- mapping?: string
33
- }
34
- | {
35
- input: 'vlm'
36
- value?: boolean | DataLink | EventProperty
37
- mapping?: string
38
- }
39
- >
40
- }
41
-
42
- /* Run text completion */
43
- export type GeneratorMlxLLMActionCompletion = ActionWithParams & {
44
- __actionName: 'GENERATOR_MLX_LLM_COMPLETION'
45
- params?: Array<
46
- | {
47
- input: 'messages'
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: 'maxTokens'
58
- value?: number | DataLink | EventProperty
59
- mapping?: string
60
- }
61
- | {
62
- input: 'temperature'
63
- value?: number | DataLink | EventProperty
64
- mapping?: string
65
- }
66
- | {
67
- input: 'topP'
68
- value?: number | DataLink | EventProperty
69
- mapping?: string
70
- }
71
- | {
72
- input: 'repetitionPenalty'
73
- value?: number | DataLink | EventProperty
74
- mapping?: string
75
- }
76
- >
77
- }
78
-
79
- /* Stop text completion */
80
- export type GeneratorMlxLLMActionStopCompletion = Action & {
81
- __actionName: 'GENERATOR_MLX_LLM_STOP_COMPLETION'
82
- }
83
-
84
- /* Release model context */
85
- export type GeneratorMlxLLMActionReleaseContext = Action & {
86
- __actionName: 'GENERATOR_MLX_LLM_RELEASE_CONTEXT'
87
- }
88
-
89
- interface GeneratorMlxLLMDef {
90
- /*
91
- Default property:
92
- {
93
- "init": false,
94
- "modelId": "mlx-community/Qwen3-4B-4bit",
95
- "vlm": false,
96
- "completionMessages": [
97
- {
98
- "role": "system",
99
- "content": "You are a helpful assistant."
100
- },
101
- {
102
- "role": "user",
103
- "content": "Hello"
104
- }
105
- ],
106
- "completionMaxTokens": 1024,
107
- "completionTemperature": 0.6,
108
- "completionTopP": 1,
109
- "completionRepetitionContextSize": 20
110
- }
111
- */
112
- property?: {
113
- /* Initialize model on generator init */
114
- init?: boolean | DataLink
115
- /* HuggingFace model ID or local path to model directory
116
- e.g. "mlx-community/Qwen3-4B-4bit" */
117
- modelId?: string | DataLink
118
- /* Enable Vision Language Model (VLM) mode */
119
- vlm?: boolean | DataLink
120
- /* Chat messages (if first message has role 'system', it will be used as system prompt) */
121
- completionMessages?:
122
- | Array<
123
- | DataLink
124
- | {
125
- role?: string | DataLink
126
- content?: string | DataLink
127
- }
128
- >
129
- | DataLink
130
- /* Maximum tokens to generate */
131
- completionMaxTokens?: number | DataLink
132
- /* Temperature (0.0 to 2.0) */
133
- completionTemperature?: number | DataLink
134
- /* Top P sampling */
135
- completionTopP?: number | DataLink
136
- /* Repetition penalty factor */
137
- completionRepetitionPenalty?: number | DataLink
138
- /* Number of tokens to consider for repetition penalty */
139
- completionRepetitionContextSize?: number | DataLink
140
- /* Maximum KV cache size (context window). Uses rotating cache to limit memory.
141
- Smaller values (e.g. 512) use less memory but lower quality.
142
- Larger values (e.g. 4096) use more memory but better quality.
143
- Leave empty for unlimited (model default). */
144
- contextSize?: number | DataLink
145
- /* Enable thinking mode (model-dependent, e.g. Qwen3).
146
- When enabled, passes enable_thinking=true to the chat template.
147
- The model may output reasoning in &lt;think&gt; tags which will be extracted as reasoning_content. */
148
- completionEnableThinking?: boolean | DataLink
149
- /* Additional keyword arguments for chat template (object) */
150
- completionChatTemplateKwargs?: {} | DataLink
151
- /* Tools for chat mode using OpenAI-compatible function calling format
152
- Format: Array of objects with {type, function: {name, description, parameters}} structure
153
- See: https://platform.openai.com/docs/guides/function-calling */
154
- completionTools?: Array<{} | DataLink> | DataLink
155
- /* Buttress connection settings for remote inference */
156
- buttressConnectionSettings?:
157
- | DataLink
158
- | {
159
- enabled?: boolean | DataLink
160
- url?: string | DataLink
161
- autoDiscoverType?: 'manual' | 'auto' | DataLink
162
- fallbackType?: 'use-local' | 'no-op' | DataLink
163
- strategy?: 'prefer-local' | 'prefer-buttress' | 'prefer-best' | DataLink
164
- }
165
- }
166
- events?: {
167
- /* Event triggered when context state changes */
168
- onContextStateChange?: Array<
169
- EventAction<string & keyof TemplateEventPropsMap['MlxLlm']['onContextStateChange']>
170
- >
171
- /* Error event */
172
- onError?: Array<EventAction<string & keyof TemplateEventPropsMap['MlxLlm']['onError']>>
173
- /* Completion streaming event (emitted for each token) */
174
- onCompletion?: Array<
175
- EventAction<string & keyof TemplateEventPropsMap['MlxLlm']['onCompletion']>
176
- >
177
- /* Completion finished event */
178
- onCompletionFinished?: Array<
179
- EventAction<string & keyof TemplateEventPropsMap['MlxLlm']['onCompletionFinished']>
180
- >
181
- }
182
- outlets?: {
183
- /* Context state */
184
- contextState?: () => Data<string>
185
- /* Model load progress (0-1) */
186
- loadProgress?: () => Data<number>
187
- /* Whether the model is evaluating */
188
- isEvaluating?: () => Data<boolean>
189
- /* Completion result */
190
- completionResult?: () => Data<string>
191
- /* Last token */
192
- completionLastToken?: () => Data<string>
193
- }
194
- }
195
-
196
- /* On-device LLM inference using Apple MLX framework on iOS/tvOS
197
-
198
- ## Features
199
- - Powered by MLX (Apple's ML framework optimized for Apple Silicon)
200
- - Download models directly from HuggingFace Hub
201
- - Streaming token generation
202
- - Supports LLM and VLM (Vision Language Models)
203
- - Requires iOS 17+ or tvOS 17+ */
204
- export type GeneratorMlxLLM = Generator &
205
- GeneratorMlxLLMDef & {
206
- templateKey: 'GENERATOR_MLX_LLM'
207
- switches?: Array<
208
- SwitchDef &
209
- GeneratorMlxLLMDef & {
210
- conds?: Array<{
211
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
212
- cond:
213
- | SwitchCondInnerStateCurrentCanvas
214
- | SwitchCondData
215
- | {
216
- __typename: 'SwitchCondInnerStateOutlet'
217
- outlet:
218
- | 'contextState'
219
- | 'loadProgress'
220
- | 'isEvaluating'
221
- | 'completionResult'
222
- | 'completionLastToken'
223
- value: any
224
- }
225
- }>
226
- }
227
- >
228
- }
@@ -1,213 +0,0 @@
1
- /* Auto generated by build script
2
- *
3
- * Local LLM inference based on [transformers.js](https://huggingface.co/docs/transformers.js)
4
- * You can use any converted model on HuggingFace.
5
- */
6
- import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
7
- import type { Data, DataLink } from '../data'
8
- import type {
9
- Brick,
10
- Generator,
11
- EventAction,
12
- ActionWithDataParams,
13
- ActionWithParams,
14
- Action,
15
- EventProperty,
16
- } from '../common'
17
- import type { TemplateEventPropsMap } from '../../utils/event-props'
18
-
19
- /* Load the model */
20
- export type GeneratorOnnxLLMActionLoadModel = Action & {
21
- __actionName: 'GENERATOR_ONNX_LLM_LOAD_MODEL'
22
- }
23
-
24
- /* Inference */
25
- export type GeneratorOnnxLLMActionInfer = ActionWithParams & {
26
- __actionName: 'GENERATOR_ONNX_LLM_INFER'
27
- params?: Array<
28
- | {
29
- input: 'prompt'
30
- value?: string | DataLink | EventProperty
31
- mapping?: string
32
- }
33
- | {
34
- input: 'chat'
35
- value?: Array<any> | DataLink | EventProperty
36
- mapping?: string
37
- }
38
- | {
39
- input: 'images'
40
- value?: Array<any> | DataLink | EventProperty
41
- mapping?: string
42
- }
43
- | {
44
- input: 'audios'
45
- value?: Array<any> | DataLink | EventProperty
46
- mapping?: string
47
- }
48
- | {
49
- input: 'tools'
50
- value?: Array<any> | DataLink | EventProperty
51
- mapping?: string
52
- }
53
- | {
54
- input: 'toolChoice'
55
- value?: string | DataLink | EventProperty
56
- mapping?: string
57
- }
58
- >
59
- }
60
-
61
- /* Clean cache */
62
- export type GeneratorOnnxLLMActionCleanCache = Action & {
63
- __actionName: 'GENERATOR_ONNX_LLM_CLEAN_CACHE'
64
- }
65
-
66
- /* Release context */
67
- export type GeneratorOnnxLLMActionReleaseContext = Action & {
68
- __actionName: 'GENERATOR_ONNX_LLM_RELEASE_CONTEXT'
69
- }
70
-
71
- interface GeneratorOnnxLLMDef {
72
- /*
73
- Default property:
74
- {
75
- "modelType": "auto",
76
- "toolCallParser": "llama3_json",
77
- "toolChoice": "auto",
78
- "maxNewTokens": 256,
79
- "temperature": 0.7,
80
- "topK": 50,
81
- "topP": 0.9,
82
- "repetitionPenalty": 1,
83
- "noRepeatNgramSize": 0,
84
- "numBeams": 1,
85
- "doSample": true,
86
- "executionMode": "sequential"
87
- }
88
- */
89
- property?: {
90
- /* Initialize the TTS context on generator initialization */
91
- init?: boolean | DataLink
92
- /* LLM model */
93
- model?: string | DataLink
94
- /* Model type */
95
- modelType?: string | DataLink
96
- /* Quantize type */
97
- quantizeType?:
98
- | 'auto'
99
- | 'none'
100
- | 'fp16'
101
- | 'q8'
102
- | 'int8'
103
- | 'uint8'
104
- | 'q4'
105
- | 'bnb4'
106
- | 'q4f16'
107
- | DataLink
108
- /* Prompt to inference */
109
- prompt?: string | DataLink
110
- /* Messages to inference */
111
- messages?: Array<DataLink | {}> | DataLink
112
- /* Images with message to inference */
113
- images?: Array<string | DataLink> | DataLink
114
- /* Audios with message to inference */
115
- audios?: Array<string | DataLink> | DataLink
116
- /* Tool call parser */
117
- toolCallParser?: 'llama3_json' | 'mistral' | 'hermes' | 'internlm' | 'phi4' | DataLink
118
- /* Tools for chat mode using OpenAI-compatible function calling format
119
- Format: Array of objects with {type, function: {name, description, parameters}} structure
120
- See: https://platform.openai.com/docs/guides/function-calling */
121
- tools?: Array<{} | DataLink> | DataLink
122
- /* Tool choice for chat mode */
123
- toolChoice?: 'none' | 'auto' | DataLink
124
- /* Max new tokens to generate */
125
- maxNewTokens?: number | DataLink
126
- /* Temperature */
127
- temperature?: number | DataLink
128
- /* Top k */
129
- topK?: number | DataLink
130
- /* Top p */
131
- topP?: number | DataLink
132
- /* Repetition penalty */
133
- repetitionPenalty?: number | DataLink
134
- /* No repeat ngram size */
135
- noRepeatNgramSize?: number | DataLink
136
- /* Number of beams */
137
- numBeams?: number | DataLink
138
- /* Do sampling */
139
- doSample?: boolean | DataLink
140
- /* Executor candidates, descending order of priority
141
- Default will be xnnpack, wasm, cpu */
142
- executors?:
143
- | Array<'qnn' | 'dml' | 'nnapi' | 'xnnpack' | 'coreml' | 'cpu' | 'wasm' | 'webgpu' | DataLink>
144
- | DataLink
145
- /* Execution mode
146
- Usually when the model has many branches, setting this option to `parallel` will give you better performance. */
147
- executionMode?: 'sequential' | 'parallel' | DataLink
148
- /* QNN backend */
149
- qnnBackend?: 'HTP' | 'HTA' | 'DSP' | 'GPU' | 'CPU' | DataLink
150
- /* Enable FP16 for QNN HTP */
151
- qnnHtpEnableFp16?: boolean | DataLink
152
- /* Enable QNN debug */
153
- qnnEnableDebug?: boolean | DataLink
154
- }
155
- events?: {
156
- /* Event triggered when state change */
157
- onContextStateChange?: Array<
158
- EventAction<string & keyof TemplateEventPropsMap['OnnxLlm']['onContextStateChange']>
159
- >
160
- /* Event triggered on get function call request */
161
- onFunctionCall?: Array<
162
- EventAction<string & keyof TemplateEventPropsMap['OnnxLlm']['onFunctionCall']>
163
- >
164
- /* Event triggered on completion finished */
165
- onCompletionFinished?: Array<
166
- EventAction<string & keyof TemplateEventPropsMap['OnnxLlm']['onCompletionFinished']>
167
- >
168
- /* Event triggered when error occurs */
169
- onError?: Array<EventAction<string & keyof TemplateEventPropsMap['OnnxLlm']['onError']>>
170
- }
171
- outlets?: {
172
- /* Context state */
173
- contextState?: () => Data<string>
174
- /* Generated output */
175
- generated?: () => Data<string>
176
- /* Full result of generation */
177
- fullResult?: () => Data<string>
178
- /* Last function call */
179
- lastFunctionCall?: () => Data<{
180
- id?: string
181
- type?: string
182
- function?: {
183
- name?: string
184
- arguments?: string
185
- [key: string]: any
186
- }
187
- [key: string]: any
188
- }>
189
- }
190
- }
191
-
192
- /* Local LLM inference based on [transformers.js](https://huggingface.co/docs/transformers.js)
193
- You can use any converted model on HuggingFace. */
194
- export type GeneratorOnnxLLM = Generator &
195
- GeneratorOnnxLLMDef & {
196
- templateKey: 'GENERATOR_ONNX_LLM'
197
- switches?: Array<
198
- SwitchDef &
199
- GeneratorOnnxLLMDef & {
200
- conds?: Array<{
201
- method: '==' | '!=' | '>' | '<' | '>=' | '<='
202
- cond:
203
- | SwitchCondInnerStateCurrentCanvas
204
- | SwitchCondData
205
- | {
206
- __typename: 'SwitchCondInnerStateOutlet'
207
- outlet: 'contextState' | 'generated' | 'fullResult' | 'lastFunctionCall'
208
- value: any
209
- }
210
- }>
211
- }
212
- >
213
- }