@fugood/bricks-project 2.24.0-beta.9 → 2.24.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 (123) hide show
  1. package/compile/action-name-map.ts +38 -0
  2. package/compile/index.ts +460 -158
  3. package/compile/util.ts +2 -0
  4. package/package.json +7 -3
  5. package/package.json.bak +27 -0
  6. package/skills/{bricks-project → bricks-ctor}/SKILL.md +2 -2
  7. package/skills/{bricks-project → bricks-ctor}/rules/animation.md +1 -1
  8. package/skills/{bricks-project → bricks-ctor}/rules/architecture-patterns.md +7 -0
  9. package/skills/{bricks-project → bricks-ctor}/rules/buttress.md +10 -7
  10. package/skills/{bricks-project → bricks-ctor}/rules/data-calculation.md +1 -1
  11. package/skills/{bricks-project → bricks-ctor}/rules/local-sync.md +2 -2
  12. package/skills/{bricks-project → bricks-ctor}/rules/media-flow.md +3 -3
  13. package/skills/{bricks-project → bricks-ctor}/rules/remote-data-bank.md +6 -6
  14. package/skills/{bricks-project → bricks-ctor}/rules/standby-transition.md +1 -1
  15. package/skills/bricks-design/LICENSE.txt +180 -0
  16. package/skills/bricks-design/SKILL.md +66 -0
  17. package/tools/deploy.ts +66 -12
  18. package/tools/icons/fa6pro-meta.json +3669 -26125
  19. package/tools/mcp-server.ts +11 -878
  20. package/tools/mcp-tools/compile.ts +91 -0
  21. package/tools/mcp-tools/huggingface.ts +762 -0
  22. package/tools/mcp-tools/icons.ts +70 -0
  23. package/tools/mcp-tools/lottie.ts +102 -0
  24. package/tools/mcp-tools/media.ts +110 -0
  25. package/tools/postinstall.ts +137 -40
  26. package/tools/preview-main.mjs +135 -2
  27. package/tools/preview.ts +41 -2
  28. package/tools/pull.ts +37 -19
  29. package/tsconfig.json +16 -0
  30. package/types/animation.ts +4 -0
  31. package/types/automation.ts +4 -1
  32. package/types/brick-base.ts +1 -1
  33. package/types/bricks/Camera.ts +47 -12
  34. package/types/bricks/Chart.ts +9 -3
  35. package/types/bricks/GenerativeMedia.ts +29 -13
  36. package/types/bricks/Icon.ts +8 -4
  37. package/types/bricks/Image.ts +9 -5
  38. package/types/bricks/Items.ts +28 -14
  39. package/types/bricks/Lottie.ts +14 -6
  40. package/types/bricks/Maps.ts +15 -7
  41. package/types/bricks/QrCode.ts +8 -4
  42. package/types/bricks/Rect.ts +44 -5
  43. package/types/bricks/RichText.ts +8 -4
  44. package/types/bricks/Rive.ts +20 -10
  45. package/types/bricks/Slideshow.ts +19 -9
  46. package/types/bricks/Svg.ts +7 -3
  47. package/types/bricks/Text.ts +8 -4
  48. package/types/bricks/TextInput.ts +22 -12
  49. package/types/bricks/Video.ts +10 -6
  50. package/types/bricks/VideoStreaming.ts +7 -3
  51. package/types/bricks/WebRtcStream.ts +6 -2
  52. package/types/bricks/WebView.ts +11 -7
  53. package/types/canvas.ts +2 -0
  54. package/types/common.ts +15 -8
  55. package/types/data-calc-command.ts +2 -0
  56. package/types/data-calc.ts +1 -0
  57. package/types/data.ts +2 -0
  58. package/types/generators/AlarmClock.ts +16 -10
  59. package/types/generators/Assistant.ts +68 -17
  60. package/types/generators/BleCentral.ts +30 -10
  61. package/types/generators/BlePeripheral.ts +10 -6
  62. package/types/generators/CanvasMap.ts +9 -5
  63. package/types/generators/CastlesPay.ts +14 -6
  64. package/types/generators/DataBank.ts +43 -8
  65. package/types/generators/File.ts +108 -29
  66. package/types/generators/GraphQl.ts +11 -5
  67. package/types/generators/Http.ts +32 -9
  68. package/types/generators/HttpServer.ts +22 -14
  69. package/types/generators/Information.ts +8 -4
  70. package/types/generators/Intent.ts +14 -4
  71. package/types/generators/Iterator.ts +14 -10
  72. package/types/generators/Keyboard.ts +26 -12
  73. package/types/generators/LlmAnthropicCompat.ts +32 -10
  74. package/types/generators/LlmAppleBuiltin.ts +24 -9
  75. package/types/generators/LlmGgml.ts +139 -30
  76. package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
  77. package/types/generators/LlmMlx.ts +227 -0
  78. package/types/generators/LlmOnnx.ts +33 -13
  79. package/types/generators/LlmOpenAiCompat.ts +46 -10
  80. package/types/generators/LlmQualcommAiEngine.ts +44 -12
  81. package/types/generators/Mcp.ts +374 -33
  82. package/types/generators/McpServer.ts +57 -18
  83. package/types/generators/MediaFlow.ts +37 -11
  84. package/types/generators/MqttBroker.ts +28 -10
  85. package/types/generators/MqttClient.ts +18 -8
  86. package/types/generators/Question.ts +12 -8
  87. package/types/generators/RealtimeTranscription.ts +107 -18
  88. package/types/generators/RerankerGgml.ts +42 -11
  89. package/types/generators/SerialPort.ts +17 -9
  90. package/types/generators/SoundPlayer.ts +9 -3
  91. package/types/generators/SoundRecorder.ts +23 -8
  92. package/types/generators/SpeechToTextGgml.ts +51 -17
  93. package/types/generators/SpeechToTextOnnx.ts +17 -10
  94. package/types/generators/SpeechToTextPlatform.ts +14 -6
  95. package/types/generators/SqLite.ts +19 -9
  96. package/types/generators/Step.ts +8 -4
  97. package/types/generators/SttAppleBuiltin.ts +21 -8
  98. package/types/generators/Tcp.ts +12 -8
  99. package/types/generators/TcpServer.ts +19 -13
  100. package/types/generators/TextToSpeechAppleBuiltin.ts +20 -7
  101. package/types/generators/TextToSpeechGgml.ts +28 -10
  102. package/types/generators/TextToSpeechOnnx.ts +18 -11
  103. package/types/generators/TextToSpeechOpenAiLike.ts +13 -7
  104. package/types/generators/ThermalPrinter.ts +12 -8
  105. package/types/generators/Tick.ts +10 -6
  106. package/types/generators/Udp.ts +16 -7
  107. package/types/generators/VadGgml.ts +50 -13
  108. package/types/generators/VadOnnx.ts +41 -11
  109. package/types/generators/VadTraditional.ts +27 -12
  110. package/types/generators/VectorStore.ts +32 -11
  111. package/types/generators/Watchdog.ts +18 -9
  112. package/types/generators/WebCrawler.ts +10 -6
  113. package/types/generators/WebRtc.ts +29 -15
  114. package/types/generators/WebSocket.ts +10 -6
  115. package/types/generators/index.ts +2 -0
  116. package/types/subspace.ts +4 -0
  117. package/types/system.ts +1 -1
  118. package/utils/event-props.ts +833 -1022
  119. package/api/index.ts +0 -1
  120. package/api/instance.ts +0 -213
  121. package/types/generators/TextToSpeechApple.ts +0 -113
  122. package/types/generators/TtsAppleBuiltin.ts +0 -105
  123. /package/skills/{bricks-project → bricks-ctor}/rules/automations.md +0 -0
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Listen to keyboard and remote control key events (keyDown, keyUp)
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  interface GeneratorKeyboardDef {
15
19
  /*
@@ -27,13 +31,13 @@ Default property:
27
31
  property?: {
28
32
  /* Enable listening for input */
29
33
  enabled?: boolean | DataLink
30
- /* Key map to transform key or key code to the designated content
34
+ /* Key map to transform key or key code to the designated content
31
35
  Example: { 37: 'left', 38: 'up', 39: 'right', 40: 'down', 'Enter': 'confirm' }
32
36
  Supports both key codes (numbers) and key names (strings) as keys */
33
37
  keyMap?: {} | DataLink
34
38
  /* Key outlet preference use key code or key. */
35
39
  keyOutletPrefer?: 'auto' | 'key-code' | 'key' | DataLink
36
- /* Key or code to finish batch input
40
+ /* Key or code to finish batch input
37
41
  Common values: 13 (Enter), 27 (Escape), 'Enter', 'Escape' */
38
42
  batchStopKeys?: Array<string | DataLink | number | DataLink | DataLink> | DataLink
39
43
  /* Debounce time (ms) to finish batch input */
@@ -43,27 +47,37 @@ Default property:
43
47
  }
44
48
  events?: {
45
49
  /* Event on key press */
46
- onDown?: Array<EventAction>
50
+ onDown?: Array<EventAction<string & keyof TemplateEventPropsMap['Keyboard']['onDown']>>
47
51
  /* Event on key up */
48
- onUp?: Array<EventAction>
52
+ onUp?: Array<EventAction<string & keyof TemplateEventPropsMap['Keyboard']['onUp']>>
49
53
  /* Event on batch input complete */
50
- onBatch?: Array<EventAction>
54
+ onBatch?: Array<EventAction<string & keyof TemplateEventPropsMap['Keyboard']['onBatch']>>
51
55
  }
52
56
  outlets?: {
53
57
  /* Last key code pressed */
54
- lastKeyDown?: () => Data
58
+ lastKeyDown?: () => Data<string | number>
55
59
  /* Modifier key information on last key press */
56
- lastKeyDownFlags?: () => Data
60
+ lastKeyDownFlags?: () => Data<{ [key: string]: any }>
57
61
  /* Last key code released */
58
- lastKeyUp?: () => Data
62
+ lastKeyUp?: () => Data<string | number>
59
63
  /* Modifier key information on last key release */
60
- lastKeyUpFlags?: () => Data
64
+ lastKeyUpFlags?: () => Data<{ [key: string]: any }>
61
65
  /* Last batch event */
62
- lastBatchEvents?: () => Data
66
+ lastBatchEvents?: () => Data<
67
+ Array<{
68
+ event?: string
69
+ key?: any
70
+ keyNoMapping?: any
71
+ keyCode?: any
72
+ keyCodeNoMapping?: any
73
+ flags?: { [key: string]: any }
74
+ [key: string]: any
75
+ }>
76
+ >
63
77
  }
64
78
  }
65
79
 
66
- /* Access keyboard (remote control) events */
80
+ /* Listen to keyboard and remote control key events (keyDown, keyUp) */
67
81
  export type GeneratorKeyboard = Generator &
68
82
  GeneratorKeyboardDef & {
69
83
  templateKey: 'GENERATOR_KEYBOARD'
@@ -1,4 +1,13 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * LLM inference using Anthropic-compatible API endpoints
4
+ *
5
+ * ## Features
6
+ * - Compatible with Anthropic API format
7
+ * - Supports function calling (tools)
8
+ * - Streaming responses
9
+ * - Custom API endpoints (Default to https://api.anthropic.com/v1/messages)
10
+ */
2
11
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
12
  import type { Data, DataLink } from '../data'
4
13
  import type {
@@ -10,6 +19,7 @@ import type {
10
19
  Action,
11
20
  EventProperty,
12
21
  } from '../common'
22
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
23
 
14
24
  /* Run text completion */
15
25
  export type GeneratorAnthropicLLMActionCompletion = ActionWithParams & {
@@ -119,7 +129,7 @@ Default property:
119
129
  }
120
130
  >
121
131
  | DataLink
122
- /* Tools for function calling following Anthropic format
132
+ /* Tools for function calling following Anthropic format
123
133
  Format: Array of objects with {name, description, input_schema} structure
124
134
  See: https://docs.anthropic.com/en/docs/tool-use */
125
135
  completionTools?: Array<{} | DataLink> | DataLink
@@ -143,25 +153,37 @@ Default property:
143
153
  }
144
154
  events?: {
145
155
  /* Error event */
146
- onError?: Array<EventAction>
156
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['AnthropicLlm']['onError']>>
147
157
  /* Completion event */
148
- onCompletion?: Array<EventAction>
158
+ onCompletion?: Array<
159
+ EventAction<string & keyof TemplateEventPropsMap['AnthropicLlm']['onCompletion']>
160
+ >
149
161
  /* Completion finished event */
150
- onCompletionFinished?: Array<EventAction>
162
+ onCompletionFinished?: Array<
163
+ EventAction<string & keyof TemplateEventPropsMap['AnthropicLlm']['onCompletionFinished']>
164
+ >
151
165
  /* Tool use event */
152
- onToolUse?: Array<EventAction>
166
+ onToolUse?: Array<
167
+ EventAction<string & keyof TemplateEventPropsMap['AnthropicLlm']['onToolUse']>
168
+ >
153
169
  }
154
170
  outlets?: {
155
171
  /* Evaluating outlet */
156
- isEvaluating?: () => Data
172
+ isEvaluating?: () => Data<boolean>
157
173
  /* Completion result outlet */
158
- completionResult?: () => Data
174
+ completionResult?: () => Data<string>
159
175
  /* Completion details outlet */
160
- completionDetails?: () => Data
176
+ completionDetails?: () => Data<{
177
+ model?: string
178
+ stop_reason?: string
179
+ usage?: { [key: string]: any }
180
+ content?: Array<any>
181
+ [key: string]: any
182
+ }>
161
183
  }
162
184
  }
163
185
 
164
- /* LLM inference using Anthropic-compatible API endpoints
186
+ /* LLM inference using Anthropic-compatible API endpoints
165
187
 
166
188
  ## Features
167
189
  - Compatible with Anthropic API format
@@ -1,4 +1,14 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * LLM inference using Apple Intelligence on iOS/tvOS 26+
4
+ *
5
+ * ## Features
6
+ * - Native Apple Intelligence integration
7
+ * - No model download required
8
+ * - Privacy-focused on-device processing
9
+ * - Optimized for Apple Silicon
10
+ * - Requires iOS 26+ or tvOS 26+
11
+ */
2
12
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
13
  import type { Data, DataLink } from '../data'
4
14
  import type {
@@ -10,6 +20,7 @@ import type {
10
20
  Action,
11
21
  EventProperty,
12
22
  } from '../common'
23
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
24
 
14
25
  /* Load model */
15
26
  export type GeneratorAppleLLMActionLoadModel = Action & {
@@ -90,27 +101,31 @@ Default property:
90
101
  }
91
102
  events?: {
92
103
  /* Error event */
93
- onError?: Array<EventAction>
104
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['AppleLlm']['onError']>>
94
105
  /* Model loaded event */
95
106
  onModelLoaded?: Array<EventAction>
96
107
  /* Completion event */
97
- onCompletion?: Array<EventAction>
108
+ onCompletion?: Array<
109
+ EventAction<string & keyof TemplateEventPropsMap['AppleLlm']['onCompletion']>
110
+ >
98
111
  /* Completion finished event */
99
- onCompletionFinished?: Array<EventAction>
112
+ onCompletionFinished?: Array<
113
+ EventAction<string & keyof TemplateEventPropsMap['AppleLlm']['onCompletionFinished']>
114
+ >
100
115
  }
101
116
  outlets?: {
102
117
  /* Context state outlet */
103
- contextState?: () => Data
118
+ contextState?: () => Data<string>
104
119
  /* Evaluating outlet */
105
- isEvaluating?: () => Data
120
+ isEvaluating?: () => Data<boolean>
106
121
  /* Completion result outlet */
107
- completionResult?: () => Data
122
+ completionResult?: () => Data<string>
108
123
  /* Last token outlet */
109
- completionLastToken?: () => Data
124
+ completionLastToken?: () => Data<string>
110
125
  }
111
126
  }
112
127
 
113
- /* LLM inference using Apple Intelligence on iOS/tvOS 26+
128
+ /* LLM inference using Apple Intelligence on iOS/tvOS 26+
114
129
 
115
130
  ## Features
116
131
  - Native Apple Intelligence integration
@@ -1,4 +1,17 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Local Large Language Model (LLM) inference based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
4
+ *
5
+ * ## Notice
6
+ * - The device RAM must be larger than 8GB
7
+ * - iOS: Recommended use M1+ / A17+ chip device. Supported GPU acceleration by Metal.
8
+ * - macOS: Recommended use M1+ chip device. Supported GPU acceleration by Metal.
9
+ * - Android: Recommended use Android 13+ system.
10
+ * - Supported GPU acceleration by OpenCL, currently only for Qualcomm Adreno 700+ GPUs, other GPUs are not supported.
11
+ * - Supported Hexagon NPU for Qualcomm Snapdragon 8 Gen 1+ GPUs.
12
+ * - Linux / Windows [@nextline - Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property
13
+ * - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux)
14
+ */
2
15
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
16
  import type { Data, DataLink } from '../data'
4
17
  import type {
@@ -10,6 +23,7 @@ import type {
10
23
  Action,
11
24
  EventProperty,
12
25
  } from '../common'
26
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
27
 
14
28
  /* Load the model */
15
29
  export type GeneratorLLMActionLoadModel = Action & {
@@ -97,6 +111,16 @@ export type GeneratorLLMActionProcessPrompt = ActionWithParams & {
97
111
  value?: boolean | DataLink | EventProperty
98
112
  mapping?: string
99
113
  }
114
+ | {
115
+ input: 'thinkingBudgetTokens'
116
+ value?: number | DataLink | EventProperty
117
+ mapping?: string
118
+ }
119
+ | {
120
+ input: 'thinkingBudgetMessage'
121
+ value?: string | DataLink | EventProperty
122
+ mapping?: string
123
+ }
100
124
  | {
101
125
  input: 'prompt'
102
126
  value?: string | DataLink | EventProperty
@@ -137,6 +161,11 @@ export type GeneratorLLMActionProcessPrompt = ActionWithParams & {
137
161
  value?: string | DataLink | EventProperty
138
162
  mapping?: string
139
163
  }
164
+ | {
165
+ input: 'forcePureContent'
166
+ value?: boolean | DataLink | EventProperty
167
+ mapping?: string
168
+ }
140
169
  >
141
170
  }
142
171
 
@@ -179,6 +208,16 @@ export type GeneratorLLMActionCompletion = ActionWithParams & {
179
208
  value?: boolean | DataLink | EventProperty
180
209
  mapping?: string
181
210
  }
211
+ | {
212
+ input: 'thinkingBudgetTokens'
213
+ value?: number | DataLink | EventProperty
214
+ mapping?: string
215
+ }
216
+ | {
217
+ input: 'thinkingBudgetMessage'
218
+ value?: string | DataLink | EventProperty
219
+ mapping?: string
220
+ }
182
221
  | {
183
222
  input: 'useReasoningFormat'
184
223
  value?: string | DataLink | EventProperty
@@ -224,6 +263,11 @@ export type GeneratorLLMActionCompletion = ActionWithParams & {
224
263
  value?: string | DataLink | EventProperty
225
264
  mapping?: string
226
265
  }
266
+ | {
267
+ input: 'forcePureContent'
268
+ value?: boolean | DataLink | EventProperty
269
+ mapping?: string
270
+ }
227
271
  | {
228
272
  input: 'grammar'
229
273
  value?: string | DataLink | EventProperty
@@ -432,6 +476,7 @@ Default property:
432
476
  "completionEnableThinking": true,
433
477
  "completionAddGenerationPrompt": true,
434
478
  "completionChatTemplateKwargs": {},
479
+ "completionForcePureContent": false,
435
480
  "completionUseReasoningFormat": "auto",
436
481
  "completionStopWords": [],
437
482
  "completionPredict": 400,
@@ -459,10 +504,10 @@ Default property:
459
504
  }
460
505
  */
461
506
  property?: {
462
- /* Initialize the Llama context on generator initialization
507
+ /* Initialize the Llama context on generator initialization
463
508
  Please note that it will take some RAM depending on the model size */
464
509
  init?: boolean | DataLink
465
- /* The URL or path of model
510
+ /* The URL or path of model
466
511
  We used GGUF format model, please refer to https://github.com/ggerganov/llama.cpp/tree/master#description */
467
512
  modelUrl?: string | DataLink
468
513
  /* Hash type of model */
@@ -477,10 +522,10 @@ Default property:
477
522
  mmprojHashType?: 'md5' | 'sha256' | 'sha1' | DataLink
478
523
  /* Hash of mmproj file (PREVIEW FEATURE) */
479
524
  mmprojHash?: string | DataLink
480
- /* Minimum tokens for image encoding in multimodal (PREVIEW FEATURE)
525
+ /* Minimum tokens for image encoding in multimodal (PREVIEW FEATURE)
481
526
  Useful for dynamic resolution models (e.g. Qwen-VL). Default: -1 (auto) */
482
527
  imageMinTokens?: number | DataLink
483
- /* Maximum tokens for image encoding in multimodal (PREVIEW FEATURE)
528
+ /* Maximum tokens for image encoding in multimodal (PREVIEW FEATURE)
484
529
  Limit tokens for dynamic resolution models to balance speed vs. detail. Default: -1 (auto) */
485
530
  imageMaxTokens?: number | DataLink
486
531
  /* Chat Template (Jinja format) to override the default template from model */
@@ -493,13 +538,13 @@ Default property:
493
538
  uBatchSize?: number | DataLink
494
539
  /* Number of threads */
495
540
  maxThreads?: number | DataLink
496
- /* Accelerator variant (Only for desktop)
541
+ /* Accelerator variant (Only for desktop)
497
542
  `default` - CPU / Metal (macOS)
498
543
  `vulkan` - Use Vulkan
499
544
  `cuda` - Use CUDA
500
545
  `snapdragon` - Use OpenCL/Hexagon of Qualcomm Snapdragon */
501
546
  accelVariant?: 'default' | 'vulkan' | 'cuda' | 'snapdragon' | DataLink
502
- /* Devices. For example:
547
+ /* Devices. For example:
503
548
 
504
549
  Metal or CPU for iOS/tvOS/MacOS
505
550
  OpenCL or CPU for Android
@@ -514,6 +559,8 @@ Default property:
514
559
  useMlock?: boolean | DataLink
515
560
  /* Use mmap */
516
561
  useMmap?: boolean | DataLink
562
+ /* Disable extra buffer types for weight repacking. Reduces memory usage at the cost of slower prompt processing. */
563
+ noExtraBuffs?: boolean | DataLink
517
564
  /* Use Flash Attention for inference (Recommended with GPU enabled) */
518
565
  useFlashAttn?: 'auto' | 'on' | 'off' | DataLink
519
566
  /* KV cache data type for the K (Default: f16) */
@@ -534,7 +581,7 @@ Default property:
534
581
  transformScriptCode?: string | DataLink
535
582
  /* Variables used in Transform Script (object) */
536
583
  transformScriptVariables?: {} | DataLink
537
- /* Session save mode
584
+ /* Session save mode
538
585
  `none` - No session saving
539
586
  `prompt` - Save session when prompt processed
540
587
  `completion` - Save session when completion finished
@@ -546,7 +593,7 @@ Default property:
546
593
  sessionRemain?: number | DataLink
547
594
  /* TODO:loran_gqarms_norm_epsrope_freq_baserope_freq_scale */
548
595
  completionMode?: 'auto' | 'chat' | 'text' | DataLink
549
- /* Tools for chat mode using OpenAI-compatible function calling format
596
+ /* Tools for chat mode using OpenAI-compatible function calling format
550
597
  Format: Array of objects with {type, function: {name, description, parameters}} structure
551
598
  See: https://platform.openai.com/docs/guides/function-calling */
552
599
  completionTools?: Array<{} | DataLink> | DataLink
@@ -566,7 +613,7 @@ Default property:
566
613
  | DataLink
567
614
  /* Prompt (text mode) */
568
615
  completionPrompt?: string | DataLink
569
- /* Media paths to be used in the prompt template (PREVIEW FEATURE)
616
+ /* Media paths to be used in the prompt template (PREVIEW FEATURE)
570
617
  In prompt, use `<__media__>` for position of media content */
571
618
  completionPromptMediaPaths?: Array<string | DataLink> | DataLink
572
619
  /* Data to be used in the prompt template (e.g. `Hello ${name}`). Supports nested data, such as `Hello ${user.name}`. */
@@ -588,13 +635,19 @@ Default property:
588
635
  }
589
636
  /* Enable thinking */
590
637
  completionEnableThinking?: boolean | DataLink
638
+ /* Maximum tokens allowed inside the model's thinking block before forcing it closed. Only applies when chat formatting exposes thinking tags. */
639
+ completionThinkingBudgetTokens?: number | DataLink
640
+ /* Message injected before the thinking end tag when the thinking budget is exhausted. */
641
+ completionThinkingBudgetMessage?: string | DataLink
591
642
  /* Add generation prompt */
592
643
  completionAddGenerationPrompt?: boolean | DataLink
593
644
  /* Now (for fill current date in chat template if supported) */
594
645
  completionNow?: string | DataLink
595
646
  /* Additional keyword arguments for chat template (object) */
596
647
  completionChatTemplateKwargs?: {} | DataLink
597
- /* Use reasoning format for enhanced response structure
648
+ /* Force pure content (accept any model that has a chat_template without requiring template validation) */
649
+ completionForcePureContent?: boolean | DataLink
650
+ /* Use reasoning format for enhanced response structure
598
651
  `auto` - Auto-determine the reasoning format of the model
599
652
  `none` - Disable reasoning format */
600
653
  completionUseReasoningFormat?: 'auto' | 'none' | DataLink
@@ -666,47 +719,103 @@ Default property:
666
719
  }
667
720
  events?: {
668
721
  /* Event triggered when context state changes */
669
- onContextStateChange?: Array<EventAction>
722
+ onContextStateChange?: Array<
723
+ EventAction<string & keyof TemplateEventPropsMap['Llm']['onContextStateChange']>
724
+ >
670
725
  /* Event triggered when error occurs */
671
- onError?: Array<EventAction>
726
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Llm']['onError']>>
672
727
  /* Event triggered when completion */
673
- onCompletion?: Array<EventAction>
728
+ onCompletion?: Array<EventAction<string & keyof TemplateEventPropsMap['Llm']['onCompletion']>>
674
729
  /* Event triggered when completion finished */
675
- onCompletionFinished?: Array<EventAction>
730
+ onCompletionFinished?: Array<
731
+ EventAction<string & keyof TemplateEventPropsMap['Llm']['onCompletionFinished']>
732
+ >
676
733
  /* Event triggered on get function call request */
677
- onCompletionFunctionCall?: Array<EventAction>
734
+ onCompletionFunctionCall?: Array<
735
+ EventAction<string & keyof TemplateEventPropsMap['Llm']['onCompletionFunctionCall']>
736
+ >
678
737
  }
679
738
  outlets?: {
680
739
  /* Context state */
681
- contextState?: () => Data
740
+ contextState?: () => Data<string>
682
741
  /* Context load progress (0-100) */
683
- contextLoadProgress?: () => Data
742
+ contextLoadProgress?: () => Data<number>
684
743
  /* Context details */
685
- contextDetails?: () => Data
744
+ contextDetails?: () => Data<{
745
+ state?: string
746
+ contextId?: string
747
+ gpu?: string
748
+ reasonNoGPU?: string
749
+ model?: { [key: string]: any }
750
+ isMultimodalEnabled?: boolean
751
+ [key: string]: any
752
+ }>
686
753
  /* Session details */
687
- sessions?: () => Data
754
+ sessions?: () => Data<{
755
+ last_session_id?: string
756
+ sessions?: Array<{
757
+ id?: string
758
+ type?: string
759
+ prompt?: string
760
+ sessionKey?: string
761
+ model_instance_id?: string
762
+ tokens_evaluated?: number
763
+ t?: number
764
+ [key: string]: any
765
+ }>
766
+ last_custom_session_id?: string
767
+ custom_sessions?: Array<{
768
+ id?: string
769
+ type?: string
770
+ prompt?: string
771
+ sessionKey?: string
772
+ model_instance_id?: string
773
+ tokens_evaluated?: number
774
+ t?: number
775
+ [key: string]: any
776
+ }>
777
+ [key: string]: any
778
+ }>
688
779
  /* Is evaluating */
689
- isEvaluating?: () => Data
780
+ isEvaluating?: () => Data<boolean>
690
781
  /* Tokenize result */
691
- tokenizeResult?: () => Data
782
+ tokenizeResult?: () => Data<Array<number>>
692
783
  /* Detokenize result */
693
- detokenizeResult?: () => Data
784
+ detokenizeResult?: () => Data<string>
694
785
  /* Last formatted prompt (messages or prompt) */
695
- completionLastFormattedPrompt?: () => Data
786
+ completionLastFormattedPrompt?: () => Data<string>
696
787
  /* Last completion token */
697
- completionLastToken?: () => Data
788
+ completionLastToken?: () => Data<string>
698
789
  /* Completion result */
699
- completionResult?: () => Data
790
+ completionResult?: () => Data<string>
700
791
  /* Reasoning content from model responses */
701
- completionReasoningContent?: () => Data
792
+ completionReasoningContent?: () => Data<string>
702
793
  /* Full context (Prompt + Completion) */
703
- completionFullContext?: () => Data
794
+ completionFullContext?: () => Data<string>
704
795
  /* Inference result details */
705
- completionResultDetails?: () => Data
796
+ completionResultDetails?: () => Data<{
797
+ prompt?: string
798
+ full_context?: string
799
+ text?: string
800
+ content?: string
801
+ reasoning_content?: string
802
+ token?: string
803
+ tool_calls?: Array<{
804
+ id?: string
805
+ type?: string
806
+ function?: {
807
+ name?: string
808
+ arguments?: string
809
+ [key: string]: any
810
+ }
811
+ [key: string]: any
812
+ }>
813
+ [key: string]: any
814
+ }>
706
815
  }
707
816
  }
708
817
 
709
- /* Local Large Language Model (LLM) inference based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
818
+ /* Local Large Language Model (LLM) inference based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp)
710
819
 
711
820
  ## Notice
712
821
  - The device RAM must be larger than 8GB