@fugood/bricks-project 2.24.0-beta.23 → 2.24.0-beta.25

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.
@@ -798,6 +798,24 @@ export const templateActionNameMap = {
798
798
  tools: 'GENERATOR_QNN_LLM_TOOLS',
799
799
  },
800
800
  },
801
+ GENERATOR_NEUROPILOT_LLM: {
802
+ GENERATOR_NEUROPILOT_LLM_LOAD_MODEL: {
803
+ runnerPath: 'GENERATOR_NEUROPILOT_LLM_RUNNER_PATH',
804
+ configPath: 'GENERATOR_NEUROPILOT_LLM_CONFIG_PATH',
805
+ workingDirectory: 'GENERATOR_NEUROPILOT_LLM_WORKING_DIRECTORY',
806
+ libraryPaths: 'GENERATOR_NEUROPILOT_LLM_LIBRARY_PATHS',
807
+ daemonHost: 'GENERATOR_NEUROPILOT_LLM_DAEMON_HOST',
808
+ daemonPort: 'GENERATOR_NEUROPILOT_LLM_DAEMON_PORT',
809
+ daemonSocketName: 'GENERATOR_NEUROPILOT_LLM_DAEMON_SOCKET_NAME',
810
+ daemonSocketNamespace: 'GENERATOR_NEUROPILOT_LLM_DAEMON_SOCKET_NAMESPACE',
811
+ },
812
+ GENERATOR_NEUROPILOT_LLM_GENERATE: {
813
+ prompt: 'GENERATOR_NEUROPILOT_LLM_PROMPT',
814
+ messages: 'GENERATOR_NEUROPILOT_LLM_MESSAGES',
815
+ maxNewTokens: 'GENERATOR_NEUROPILOT_LLM_MAX_NEW_TOKENS',
816
+ preformatter: 'GENERATOR_NEUROPILOT_LLM_PREFORMATTER',
817
+ },
818
+ },
801
819
  GENERATOR_OPENAI_LLM: {
802
820
  GENERATOR_OPENAI_LLM_COMPLETION: {
803
821
  messages: 'GENERATOR_OPENAI_LLM_MESSAGES',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.24.0-beta.23",
3
+ "version": "2.24.0-beta.25",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
@@ -24,5 +24,5 @@
24
24
  "peerDependencies": {
25
25
  "oxfmt": "^0.36.0"
26
26
  },
27
- "gitHead": "4c429fc414415518956c78aabd8123a537036951"
27
+ "gitHead": "5d7fca12b2a14ebc8dc441f702c31ffaeb3ef476"
28
28
  }
@@ -434,7 +434,7 @@ Default property:
434
434
  | DataLink
435
435
  /* Whether to cache messages */
436
436
  cacheMessages?: boolean | DataLink
437
- /* LLM Generator (Supports `LLM (GGML)`, `LLM (MLX)`, and `OpenAI LLM` generators) */
437
+ /* LLM Generator (Supports `LLM (GGML)`, `LLM (MLX)`, `OpenAI LLM`, `LLM (Qualcomm AI Engine)`, `LLM (ONNX)`, `LLM (Anthropic-compat)`, and `LLM (MediaTek NeuroPilot)` generators) */
438
438
  llmGeneratorId?: string | DataLink | (() => Generator)
439
439
  /* LLM Live Policy. If the policy is `only-in-use`, the LLM context will be released when the assistant is not in use.
440
440
 
@@ -0,0 +1,224 @@
1
+ /* Auto generated by build script */
2
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
+ import type { Data, DataLink } from '../data'
4
+ import type {
5
+ Brick,
6
+ Generator,
7
+ EventAction,
8
+ ActionWithDataParams,
9
+ ActionWithParams,
10
+ Action,
11
+ EventProperty,
12
+ } from '../common'
13
+
14
+ /* Load or validate the NeuroPilot model context */
15
+ export type GeneratorNeuropilotLlmActionLoadModel = ActionWithParams & {
16
+ __actionName: 'GENERATOR_NEUROPILOT_LLM_LOAD_MODEL'
17
+ params?: Array<
18
+ | {
19
+ input: 'runnerPath'
20
+ value?: string | DataLink | EventProperty
21
+ mapping?: string
22
+ }
23
+ | {
24
+ input: 'configPath'
25
+ value?: string | DataLink | EventProperty
26
+ mapping?: string
27
+ }
28
+ | {
29
+ input: 'workingDirectory'
30
+ value?: string | DataLink | EventProperty
31
+ mapping?: string
32
+ }
33
+ | {
34
+ input: 'libraryPaths'
35
+ value?: Array<any> | DataLink | EventProperty
36
+ mapping?: string
37
+ }
38
+ | {
39
+ input: 'daemonHost'
40
+ value?: string | DataLink | EventProperty
41
+ mapping?: string
42
+ }
43
+ | {
44
+ input: 'daemonPort'
45
+ value?: number | DataLink | EventProperty
46
+ mapping?: string
47
+ }
48
+ | {
49
+ input: 'daemonSocketName'
50
+ value?: string | DataLink | EventProperty
51
+ mapping?: string
52
+ }
53
+ | {
54
+ input: 'daemonSocketNamespace'
55
+ value?: string | DataLink | EventProperty
56
+ mapping?: string
57
+ }
58
+ >
59
+ }
60
+
61
+ /* Run text generation with the current NeuroPilot context */
62
+ export type GeneratorNeuropilotLlmActionGenerate = ActionWithParams & {
63
+ __actionName: 'GENERATOR_NEUROPILOT_LLM_GENERATE'
64
+ params?: Array<
65
+ | {
66
+ input: 'prompt'
67
+ value?: string | DataLink | EventProperty
68
+ mapping?: string
69
+ }
70
+ | {
71
+ input: 'messages'
72
+ value?: Array<any> | DataLink | EventProperty
73
+ mapping?: string
74
+ }
75
+ | {
76
+ input: 'maxNewTokens'
77
+ value?: number | DataLink | EventProperty
78
+ mapping?: string
79
+ }
80
+ | {
81
+ input: 'preformatter'
82
+ value?: string | DataLink | EventProperty
83
+ mapping?: string
84
+ }
85
+ >
86
+ }
87
+
88
+ /* Abort an in-flight NeuroPilot generation request */
89
+ export type GeneratorNeuropilotLlmActionAbortGeneration = Action & {
90
+ __actionName: 'GENERATOR_NEUROPILOT_LLM_ABORT_GENERATION'
91
+ }
92
+
93
+ /* Release the current NeuroPilot context */
94
+ export type GeneratorNeuropilotLlmActionReleaseContext = Action & {
95
+ __actionName: 'GENERATOR_NEUROPILOT_LLM_RELEASE_CONTEXT'
96
+ }
97
+
98
+ interface GeneratorNeuropilotLlmDef {
99
+ /*
100
+ Default property:
101
+ {
102
+ "runnerPath": "/data/local/tmp/llm_sdk/main",
103
+ "configPath": "/data/local/tmp/llm_sdk/config_gemma2_2b_instruct.yaml",
104
+ "workingDirectory": "/data/local/tmp/llm_sdk",
105
+ "libraryPaths": [
106
+ "/vendor/lib64",
107
+ "/system_ext/lib64",
108
+ "/vendor/lib",
109
+ "/system_ext/lib"
110
+ ],
111
+ "runtimeMode": "auto",
112
+ "preformatter": "GemmaNoInput",
113
+ "maxNewTokens": 128
114
+ }
115
+ */
116
+ property?: {
117
+ /* Preloadable NeuroPilot model bundle preset */
118
+ modelBundle?:
119
+ | 'Gemma 2 2B Instruct'
120
+ | 'Gemma 2 2B Instruct (Tailpatched)'
121
+ | 'Gemma 2 2B Instruct (Tailpatched MDLA53)'
122
+ | 'Qwen 2.5 0.5B Instruct'
123
+ | 'Llama 3 8B Instruct'
124
+ | DataLink
125
+ /* Override base URL for NeuroPilot model bundle downloads */
126
+ modelBaseUrl?: string | DataLink
127
+ /* Validate runner/config paths on generator initialization */
128
+ init?: boolean | DataLink
129
+ /* Runner binary path on device */
130
+ runnerPath?: string | DataLink
131
+ /* YAML config path on device */
132
+ configPath?: string | DataLink
133
+ /* Working directory for the runner process */
134
+ workingDirectory?: string | DataLink
135
+ /* Extra library search paths for the runner process */
136
+ libraryPaths?: Array<string | DataLink> | DataLink
137
+ /* Daemon host for a preloaded NeuroPilot service */
138
+ daemonHost?: string | DataLink
139
+ /* Daemon TCP port for a preloaded NeuroPilot service */
140
+ daemonPort?: number | DataLink
141
+ /* Android local socket name for a privileged NeuroPilot service */
142
+ daemonSocketName?: string | DataLink
143
+ /* Android local socket namespace used by the privileged NeuroPilot service */
144
+ daemonSocketNamespace?: 'abstract' | 'reserved' | 'filesystem' | DataLink
145
+ /* Runtime selection strategy for MediaTek execution */
146
+ runtimeMode?: 'auto' | 'daemon' | 'root-runner' | 'native' | DataLink
147
+ /* Prompt preformatter used by the vendor runner */
148
+ preformatter?:
149
+ | 'AlpacaNoInput'
150
+ | 'OneShotConversation'
151
+ | 'VicunaNoInput'
152
+ | 'QwenNoInput'
153
+ | 'Qwen3NoInput'
154
+ | 'Qwen3NoInputNoThink'
155
+ | 'Llama3NoInput'
156
+ | 'Phi3NoInput'
157
+ | 'MinicpmNoInput'
158
+ | 'MinicpmNoInputZh'
159
+ | 'InternLM2'
160
+ | 'GemmaNoInput'
161
+ | DataLink
162
+ /* Prompt to run */
163
+ prompt?: string | DataLink
164
+ /* Chat messages to flatten into a prompt */
165
+ messages?: Array<DataLink | {}> | DataLink
166
+ /* Maximum tokens requested from the runner */
167
+ maxNewTokens?: number | DataLink
168
+ }
169
+ events?: {
170
+ /* Event triggered when the NeuroPilot context state changes */
171
+ onContextStateChange?: Array<EventAction>
172
+ /* Event triggered when a completion token or partial result is emitted */
173
+ onCompletion?: Array<EventAction>
174
+ /* Event triggered when generation finishes */
175
+ onCompletionFinished?: Array<EventAction>
176
+ /* Event triggered when a NeuroPilot error occurs */
177
+ onError?: Array<EventAction>
178
+ }
179
+ outlets?: {
180
+ /* Current NeuroPilot context state */
181
+ contextState?: () => Data<string>
182
+ /* Final generated result text */
183
+ result?: () => Data<string>
184
+ /* Full context returned by the runner */
185
+ fullContext?: () => Data<string>
186
+ /* Last emitted token or chunk */
187
+ lastToken?: () => Data<string>
188
+ /* Raw output captured from the NeuroPilot runner */
189
+ rawOutput?: () => Data<string>
190
+ /* Prompt-phase performance in tokens per second */
191
+ promptTokensPerSec?: () => Data<string>
192
+ /* Generation-phase performance in tokens per second */
193
+ generationTokensPerSec?: () => Data<string>
194
+ }
195
+ }
196
+
197
+ /* On-device LLM inference using MediaTek NeuroPilot native SDK integration on Android */
198
+ export type GeneratorNeuropilotLlm = Generator &
199
+ GeneratorNeuropilotLlmDef & {
200
+ templateKey: 'GENERATOR_NEUROPILOT_LLM'
201
+ switches?: Array<
202
+ SwitchDef &
203
+ GeneratorNeuropilotLlmDef & {
204
+ conds?: Array<{
205
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
206
+ cond:
207
+ | SwitchCondInnerStateCurrentCanvas
208
+ | SwitchCondData
209
+ | {
210
+ __typename: 'SwitchCondInnerStateOutlet'
211
+ outlet:
212
+ | 'contextState'
213
+ | 'result'
214
+ | 'fullContext'
215
+ | 'lastToken'
216
+ | 'rawOutput'
217
+ | 'promptTokensPerSec'
218
+ | 'generationTokensPerSec'
219
+ value: any
220
+ }
221
+ }>
222
+ }
223
+ >
224
+ }
@@ -46,6 +46,7 @@ export * from './TextToSpeechGgml'
46
46
  export * from './RerankerGgml'
47
47
  export * from './LlmMlx'
48
48
  export * from './LlmQualcommAiEngine'
49
+ export * from './LlmMediaTekNeuroPilot'
49
50
  export * from './LlmOpenAiCompat'
50
51
  export * from './TextToSpeechOpenAiLike'
51
52
  export * from './LlmAnthropicCompat'
@@ -940,6 +940,26 @@ export const templateEventPropsMap = {
940
940
  'GENERATOR_QNN_LLM_ERROR', // type: string
941
941
  ],
942
942
  },
943
+ GENERATOR_NEUROPILOT_LLM: {
944
+ onContextStateChange: [
945
+ 'GENERATOR_NEUROPILOT_LLM_CONTEXT_STATE', // type: string
946
+ ],
947
+ onCompletion: [
948
+ 'GENERATOR_NEUROPILOT_LLM_COMPLETION_TOKEN', // type: string
949
+ 'GENERATOR_NEUROPILOT_LLM_COMPLETION_RESULT', // type: string
950
+ ],
951
+ onCompletionFinished: [
952
+ 'GENERATOR_NEUROPILOT_LLM_RESULT', // type: string
953
+ 'GENERATOR_NEUROPILOT_LLM_FULL_CONTEXT', // type: string
954
+ 'GENERATOR_NEUROPILOT_LLM_RAW_OUTPUT', // type: string
955
+ 'GENERATOR_NEUROPILOT_LLM_EXIT_CODE', // type: number
956
+ 'GENERATOR_NEUROPILOT_LLM_PROMPT_TOKENS_PER_SEC', // type: string
957
+ 'GENERATOR_NEUROPILOT_LLM_GENERATION_TOKENS_PER_SEC', // type: string
958
+ ],
959
+ onError: [
960
+ 'GENERATOR_NEUROPILOT_LLM_ERROR', // type: string
961
+ ],
962
+ },
943
963
  GENERATOR_OPENAI_LLM: {
944
964
  onError: [
945
965
  'GENERATOR_OPENAI_LLM_ERROR', // type: string