@fugood/bricks-project 2.23.5 → 2.23.6

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.
@@ -812,6 +812,24 @@ export const templateActionNameMap = {
812
812
  tools: 'GENERATOR_QNN_LLM_TOOLS',
813
813
  },
814
814
  },
815
+ GENERATOR_NEUROPILOT_LLM: {
816
+ GENERATOR_NEUROPILOT_LLM_LOAD_MODEL: {
817
+ runnerPath: 'GENERATOR_NEUROPILOT_LLM_RUNNER_PATH',
818
+ configPath: 'GENERATOR_NEUROPILOT_LLM_CONFIG_PATH',
819
+ workingDirectory: 'GENERATOR_NEUROPILOT_LLM_WORKING_DIRECTORY',
820
+ libraryPaths: 'GENERATOR_NEUROPILOT_LLM_LIBRARY_PATHS',
821
+ daemonHost: 'GENERATOR_NEUROPILOT_LLM_DAEMON_HOST',
822
+ daemonPort: 'GENERATOR_NEUROPILOT_LLM_DAEMON_PORT',
823
+ daemonSocketName: 'GENERATOR_NEUROPILOT_LLM_DAEMON_SOCKET_NAME',
824
+ daemonSocketNamespace: 'GENERATOR_NEUROPILOT_LLM_DAEMON_SOCKET_NAMESPACE',
825
+ },
826
+ GENERATOR_NEUROPILOT_LLM_GENERATE: {
827
+ prompt: 'GENERATOR_NEUROPILOT_LLM_PROMPT',
828
+ messages: 'GENERATOR_NEUROPILOT_LLM_MESSAGES',
829
+ maxNewTokens: 'GENERATOR_NEUROPILOT_LLM_MAX_NEW_TOKENS',
830
+ preformatter: 'GENERATOR_NEUROPILOT_LLM_PREFORMATTER',
831
+ },
832
+ },
815
833
  GENERATOR_OPENAI_LLM: {
816
834
  GENERATOR_OPENAI_LLM_COMPLETION: {
817
835
  messages: 'GENERATOR_OPENAI_LLM_MESSAGES',
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.23.5",
3
+ "version": "2.23.6",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
7
7
  "build": "bun scripts/build.js"
8
8
  },
9
9
  "dependencies": {
10
- "@fugood/bricks-cli": "^2.23.5",
10
+ "@fugood/bricks-cli": "^2.23.6",
11
11
  "@huggingface/gguf": "^0.3.2",
12
12
  "@iarna/toml": "^3.0.0",
13
13
  "@modelcontextprotocol/sdk": "^1.15.0",
package/tools/deploy.ts CHANGED
@@ -8,6 +8,8 @@ const {
8
8
  changelogs: changelogsArg,
9
9
  'changelogs-file': changelogsFile,
10
10
  'auto-commit': autoCommit,
11
+ 'auto-version': autoVersion,
12
+ version: versionArg,
11
13
  yes,
12
14
  help,
13
15
  },
@@ -17,6 +19,8 @@ const {
17
19
  changelogs: { type: 'string' },
18
20
  'changelogs-file': { type: 'string' },
19
21
  'auto-commit': { type: 'boolean' },
22
+ 'auto-version': { type: 'boolean' },
23
+ version: { type: 'string' },
20
24
  yes: { type: 'boolean', short: 'y' },
21
25
  help: { type: 'boolean', short: 'h' },
22
26
  },
@@ -28,6 +32,8 @@ if (help) {
28
32
  --changelogs <text> Changelogs text for the release
29
33
  --changelogs-file <path> Read changelogs from a file
30
34
  --auto-commit Auto-commit unstaged changes before deploying
35
+ --auto-version Auto-bump patch version before deploying
36
+ --version <version> Set explicit version for the release
31
37
  -y, --yes Skip all prompts
32
38
  -h, --help Show this help message`)
33
39
  process.exit(0) // eslint-disable-line unicorn/no-process-exit
@@ -46,9 +52,28 @@ if (!isGitRepo && !yes) {
46
52
  const app = await Bun.file(`${cwd}/application.json`).json()
47
53
  const config = await Bun.file(`${cwd}/.bricks/build/application-config.json`).json()
48
54
 
49
- // Get version from project's package.json
55
+ // Resolve version: explicit flag > auto-bump > package.json
50
56
  const pkgFile = Bun.file(`${cwd}/package.json`)
51
- const version = (await pkgFile.exists()) ? (await pkgFile.json()).version : undefined
57
+ const pkgExists = await pkgFile.exists()
58
+ let version: string | undefined
59
+
60
+ if (versionArg) {
61
+ version = versionArg
62
+ if (pkgExists) {
63
+ const pkg = await pkgFile.json()
64
+ pkg.version = version
65
+ await Bun.write(`${cwd}/package.json`, JSON.stringify(pkg, null, 2) + '\n')
66
+ }
67
+ } else if (autoVersion && pkgExists) {
68
+ const pkg = await pkgFile.json()
69
+ const parts = (pkg.version || '0.0.0').split('.')
70
+ parts[2] = String(Number(parts[2] || 0) + 1)
71
+ version = parts.join('.')
72
+ pkg.version = version
73
+ await Bun.write(`${cwd}/package.json`, JSON.stringify(pkg, null, 2) + '\n')
74
+ } else {
75
+ version = pkgExists ? (await pkgFile.json()).version : undefined
76
+ }
52
77
 
53
78
  // Get changelog from flag or file
54
79
  let changelogs = ''
@@ -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
+ }
@@ -31,6 +31,11 @@ export type GeneratorRealtimeTranscriptionActionReset = Action & {
31
31
  __actionName: 'GENERATOR_REALTIME_TRANSCRIPTION_RESET'
32
32
  }
33
33
 
34
+ /* List available microphone devices (Web / Desktop only) */
35
+ export type GeneratorRealtimeTranscriptionActionListDevices = Action & {
36
+ __actionName: 'GENERATOR_REALTIME_TRANSCRIPTION_LIST_DEVICES'
37
+ }
38
+
34
39
  interface GeneratorRealtimeTranscriptionDef {
35
40
  /*
36
41
  Default property:
@@ -57,6 +62,10 @@ Default property:
57
62
  }
58
63
  */
59
64
  property?: {
65
+ /* Specifies the device ID to use for audio input.
66
+ Web / Desktop: device ID string from enumerateDevices
67
+ Android: audio source name - DEFAULT, MIC, VOICE_UPLINK, VOICE_DOWNLINK, VOICE_CALL, CAMCORDER, VOICE_RECOGNITION, VOICE_COMMUNICATION, UNPROCESSED */
68
+ deviceId?: string | DataLink
60
69
  /* STT Generator for Whisper context */
61
70
  sttGeneratorId?: string | DataLink | (() => Generator)
62
71
  /* STT Live Policy. If the policy is `only-in-use`, the STT context will be released when not in use. */
@@ -213,6 +222,8 @@ Default property:
213
222
  stabilizedText?: () => Data<string>
214
223
  /* Audio output file path (auto-generated when saving audio) */
215
224
  audioOutputPath?: () => Data<string>
225
+ /* Available microphone devices (Web / Desktop only) */
226
+ devices?: () => Data<Array<any>>
216
227
  }
217
228
  }
218
229
 
@@ -241,6 +252,7 @@ export type GeneratorRealtimeTranscription = Generator &
241
252
  | 'lastVadEvent'
242
253
  | 'stabilizedText'
243
254
  | 'audioOutputPath'
255
+ | 'devices'
244
256
  value: any
245
257
  }
246
258
  }>
@@ -31,6 +31,11 @@ export type GeneratorSoundRecorderActionStop = Action & {
31
31
  __actionName: 'GENERATOR_SOUND_RECORDER_STOP'
32
32
  }
33
33
 
34
+ /* List available microphone devices (Web / Desktop only) */
35
+ export type GeneratorSoundRecorderActionListDevices = Action & {
36
+ __actionName: 'GENERATOR_SOUND_RECORDER_LIST_DEVICES'
37
+ }
38
+
34
39
  interface GeneratorSoundRecorderDef {
35
40
  /*
36
41
  Default property:
@@ -51,6 +56,10 @@ Default property:
51
56
  property?: {
52
57
  /* Start record on init (Need user trigger on Web) */
53
58
  init?: boolean | DataLink
59
+ /* Specifies the device ID to use for audio input.
60
+ Web / Desktop: device ID string from enumerateDevices
61
+ Android: audio source name - DEFAULT, MIC, VOICE_UPLINK, VOICE_DOWNLINK, VOICE_CALL, CAMCORDER, VOICE_RECOGNITION, VOICE_COMMUNICATION, UNPROCESSED */
62
+ deviceId?: string | DataLink
54
63
  /* Record sample rate */
55
64
  sampleRate?: number | DataLink
56
65
  /* PCM bit depth */
@@ -89,6 +98,8 @@ Default property:
89
98
  volume?: () => Data<number>
90
99
  /* Error message */
91
100
  errorMessage?: () => Data<string>
101
+ /* Available microphone devices (Web / Desktop only) */
102
+ devices?: () => Data<Array<any>>
92
103
  }
93
104
  }
94
105
 
@@ -106,7 +117,7 @@ export type GeneratorSoundRecorder = Generator &
106
117
  | SwitchCondData
107
118
  | {
108
119
  __typename: 'SwitchCondInnerStateOutlet'
109
- outlet: 'isRecording' | 'recordedPath' | 'volume' | 'errorMessage'
120
+ outlet: 'isRecording' | 'recordedPath' | 'volume' | 'errorMessage' | 'devices'
110
121
  value: any
111
122
  }
112
123
  }>
@@ -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