@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
+ * Video playback with play/pause controls and streaming support
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type { Animation, AnimationBasicEvents } from '../animation'
@@ -12,6 +15,7 @@ import type {
12
15
  EventProperty,
13
16
  } from '../common'
14
17
  import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
18
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
15
19
 
16
20
  /* Play the video */
17
21
  export type BrickVideoActionPlay = Action & {
@@ -117,7 +121,7 @@ Default property:
117
121
  /* Event of the brick blur (Use TV Device with controller) */
118
122
  onBlur?: Array<EventAction>
119
123
  /* Event of the next video on change start */
120
- nextVideo?: Array<EventAction>
124
+ nextVideo?: Array<EventAction<string & keyof TemplateEventPropsMap['Video']['nextVideo']>>
121
125
  /* Event on plays of path are totally end */
122
126
  roundEnd?: Array<EventAction>
123
127
  /* Event on video load */
@@ -125,13 +129,13 @@ Default property:
125
129
  /* Event of the video playing error */
126
130
  onError?: Array<EventAction>
127
131
  /* Event of the video progress interval */
128
- onProgress?: Array<EventAction>
132
+ onProgress?: Array<EventAction<string & keyof TemplateEventPropsMap['Video']['onProgress']>>
129
133
  }
130
134
  outlets?: {
131
135
  /* Brick is pressing */
132
- brickPressing?: () => Data
136
+ brickPressing?: () => Data<boolean>
133
137
  /* Brick is focusing (Use TV Device with controller) */
134
- brickFocusing?: () => Data
138
+ brickFocusing?: () => Data<boolean>
135
139
  }
136
140
  animation?: AnimationBasicEvents & {
137
141
  onPress?: Animation
@@ -148,7 +152,7 @@ Default property:
148
152
  }
149
153
  }
150
154
 
151
- /* Video brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378577-video)) */
155
+ /* Video playback with play/pause controls and streaming support */
152
156
  export type BrickVideo = Brick &
153
157
  BrickVideoDef & {
154
158
  templateKey: 'BRICK_VIDEO'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Brick video streaming component, supports RTSP / RTMP streaming.
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type { Animation, AnimationBasicEvents } from '../animation'
@@ -12,6 +15,7 @@ import type {
12
15
  EventProperty,
13
16
  } from '../common'
14
17
  import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
18
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
15
19
 
16
20
  interface BrickVideoStreamingDef {
17
21
  /*
@@ -68,9 +72,9 @@ Default property:
68
72
  }
69
73
  outlets?: {
70
74
  /* Brick is pressing */
71
- brickPressing?: () => Data
75
+ brickPressing?: () => Data<boolean>
72
76
  /* Brick is focusing (Use TV Device with controller) */
73
- brickFocusing?: () => Data
77
+ brickFocusing?: () => Data<boolean>
74
78
  }
75
79
  animation?: AnimationBasicEvents & {
76
80
  onPress?: Animation
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Display WebRTC video/audio stream from a WebRTC generator connection
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type { Animation, AnimationBasicEvents } from '../animation'
@@ -12,6 +15,7 @@ import type {
12
15
  EventProperty,
13
16
  } from '../common'
14
17
  import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
18
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
15
19
 
16
20
  interface BrickWebRTCStreamDef {
17
21
  /*
@@ -38,7 +42,7 @@ Default property:
38
42
  }
39
43
  }
40
44
 
41
- /* WebRTCStream brick */
45
+ /* Display WebRTC video/audio stream from a WebRTC generator connection */
42
46
  export type BrickWebRTCStream = Brick &
43
47
  BrickWebRTCStreamDef & {
44
48
  templateKey: 'BRICK_WEBRTC_STREAM'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Embedded web browser with JS injection, DOM query selectors, content cropping, navigation control, and permission management
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type { Animation, AnimationBasicEvents } from '../animation'
@@ -12,6 +15,7 @@ import type {
12
15
  EventProperty,
13
16
  } from '../common'
14
17
  import type { BrickBasicProperty, BrickBasicEvents, BrickBasicEventsForItem } from '../brick-base'
18
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
15
19
 
16
20
  /* Run Javascript on the WebView */
17
21
  export type BrickWebViewActionInjectJavascript = ActionWithParams & {
@@ -122,17 +126,17 @@ Default property:
122
126
  }
123
127
  events?: BrickBasicEvents & {
124
128
  /* Event of the WebView on load */
125
- onLoad?: Array<EventAction>
129
+ onLoad?: Array<EventAction<string & keyof TemplateEventPropsMap['Webview']['onLoad']>>
126
130
  /* Event when the WebView load fails */
127
- onError?: Array<EventAction>
131
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Webview']['onError']>>
128
132
  /* Event of the webview on message by `window.ReactNativeWebView.postMessage` on you're injected javascript code */
129
- onMessage?: Array<EventAction>
133
+ onMessage?: Array<EventAction<string & keyof TemplateEventPropsMap['Webview']['onMessage']>>
130
134
  }
131
135
  outlets?: {
132
136
  /* The result of the query selector action */
133
- queryResult?: () => Data
137
+ queryResult?: () => Data<any>
134
138
  /* The error of the query selector action */
135
- queryError?: () => Data
139
+ queryError?: () => Data<string>
136
140
  }
137
141
  animation?: AnimationBasicEvents & {
138
142
  onLoad?: Animation
@@ -141,7 +145,7 @@ Default property:
141
145
  }
142
146
  }
143
147
 
144
- /* WebView brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378588-web-view)) */
148
+ /* Embedded web browser with JS injection, DOM query selectors, content cropping, navigation control, and permission management */
145
149
  export type BrickWebView = Brick &
146
150
  BrickWebViewDef & {
147
151
  templateKey: 'BRICK_WEBVIEW'
package/types/canvas.ts CHANGED
@@ -36,8 +36,10 @@ interface CanvasDef {
36
36
  export type Canvas = CanvasDef & {
37
37
  __typename: 'Canvas'
38
38
  id: string
39
+ alias?: string
39
40
  title?: string
40
41
  description?: string
42
+ hideShortRef?: boolean
41
43
  switches?: Array<
42
44
  SwitchDef &
43
45
  CanvasDef & {
package/types/common.ts CHANGED
@@ -6,9 +6,11 @@ import type { AutomationMap } from './automation'
6
6
  export interface Brick {
7
7
  __typename: 'Brick'
8
8
  id: string
9
+ alias?: string
9
10
  templateKey: string
10
11
  title?: string
11
12
  description?: string
13
+ hideShortRef?: boolean
12
14
  property?: {}
13
15
  events: {}
14
16
  outlets?: {}
@@ -24,9 +26,11 @@ export enum LocalSyncStrategy {
24
26
  export interface Generator {
25
27
  __typename: 'Generator'
26
28
  id: string
29
+ alias?: string
27
30
  templateKey: string
28
31
  title?: string
29
32
  description?: string
33
+ hideShortRef?: boolean
30
34
  localSyncRunMode?: LocalSyncStrategy
31
35
  property?: {}
32
36
  events: {}
@@ -43,34 +47,36 @@ export type Action = {
43
47
  name?: string
44
48
  }
45
49
 
46
- // Find correct key in bricks-project/utils/event-props for EventAction
50
+ // For standalone action types where specific event properties are not known
47
51
  export type EventProperty = string
48
52
 
49
- export type ActionWithParams = Action & {
53
+ export type ActionWithParams<EP extends string = string> = Action & {
50
54
  params?: Array<{
51
55
  input: string
52
- value?: any | EventProperty
56
+ value?: any | EP
53
57
  mapping?: string
54
58
  }>
55
59
  }
56
60
 
57
- export type ActionWithDataParams = Action & {
61
+ export type ActionWithDataParams<EP extends string = string> = Action & {
58
62
  dataParams?: Array<{
59
63
  input: () => Data
60
- value?: any | EventProperty
64
+ value?: any | EP
61
65
  mapping?: string
62
66
  }>
63
67
  }
64
68
 
65
69
  export type ItemBrickID = string
66
70
 
67
- export type EventAction = {
71
+ // EP carries available event property keys for this event context
72
+ // Use: EventAction<string & keyof TemplateEventPropsMap['Name']['event']>
73
+ export type EventAction<EP extends string = string> = {
68
74
  handler: 'system' | (() => Brick | Generator) | SubspaceID | ItemBrickID
69
- action: ActionWithParams | ActionWithDataParams
75
+ action: ActionWithParams<EP> | ActionWithDataParams<EP>
70
76
  waitAsync?: boolean
71
77
  }
72
78
 
73
- export type EventActionForItem = {
79
+ export type EventActionForItem<EP extends string = string> = {
74
80
  handler:
75
81
  | 'system'
76
82
  | (() => Brick | Generator | { brickId: string; templateKey: string })
@@ -121,6 +127,7 @@ export type ApplicationSettings = {
121
127
  useOpenAiApiKeySystemData?: boolean
122
128
  useGeminiApiKeySystemData?: boolean
123
129
  }
130
+ hideShortRefs?: boolean
124
131
  }
125
132
 
126
133
  export type Application = {
@@ -6,6 +6,7 @@ export interface DataCalculationData {
6
6
  __typename: 'DataCalculationData'
7
7
  title?: string
8
8
  description?: string
9
+ hideShortRef?: boolean
9
10
  data: () => Data
10
11
  inputs: Array<{
11
12
  key: 'change'
@@ -26,6 +27,7 @@ export interface DataCommand {
26
27
  id: string
27
28
  title?: string
28
29
  description?: string
30
+ hideShortRef?: boolean
29
31
  inputs: Array<{
30
32
  key: string
31
33
  source: (() => DataCalculationData | DataCommand) | any
@@ -4,6 +4,7 @@ export interface DataCalculation {
4
4
  id: string
5
5
  title?: string
6
6
  description?: string
7
+ hideShortRef?: boolean
7
8
  // Auto: Run the calculation when inputs change and allow triggers. Careful with circular dependencies!
8
9
  // Manual: Only run the calculation when manually triggered by System Action PROPERTY_BANK_COMMAND
9
10
  triggerMode?: 'auto' | 'manual'
package/types/data.ts CHANGED
@@ -17,8 +17,10 @@ interface DataDef {
17
17
  export type Data<T = any> = DataDef & {
18
18
  __typename: 'Data'
19
19
  id: string
20
+ alias?: string
20
21
  title: string
21
22
  description?: string
23
+ hideShortRef?: boolean
22
24
  metadata?: {
23
25
  linked?: Array<SubspaceID>
24
26
  linkedFrom?: SubspaceID
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Schedule events using cron expressions (e.g. daily, hourly)
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
  /* Start the alarm clock */
15
19
  export type GeneratorAlarmClockActionStart = Action & {
@@ -61,27 +65,29 @@ Default property:
61
65
  }
62
66
  events?: {
63
67
  /* Event for cron rule is not invalid */
64
- onRuleInvalid?: Array<EventAction>
68
+ onRuleInvalid?: Array<
69
+ EventAction<string & keyof TemplateEventPropsMap['AlarmClock']['onRuleInvalid']>
70
+ >
65
71
  /* Event for alarm clock start */
66
- onStart?: Array<EventAction>
72
+ onStart?: Array<EventAction<string & keyof TemplateEventPropsMap['AlarmClock']['onStart']>>
67
73
  /* Event for alarm clock trig */
68
- onTrig?: Array<EventAction>
74
+ onTrig?: Array<EventAction<string & keyof TemplateEventPropsMap['AlarmClock']['onTrig']>>
69
75
  /* Event for alarm clock stop */
70
- onEnd?: Array<EventAction>
76
+ onEnd?: Array<EventAction<string & keyof TemplateEventPropsMap['AlarmClock']['onEnd']>>
71
77
  }
72
78
  outlets?: {
73
79
  /* Current time of each alarm clock trig */
74
- trigTime?: () => Data
80
+ trigTime?: () => Data<string>
75
81
  /* Current timestamp (unix time) of each alarm clock trig */
76
- trigTimestamp?: () => Data
82
+ trigTimestamp?: () => Data<string | number>
77
83
  /* Count of alarm clock trigs */
78
- trigCount?: () => Data
84
+ trigCount?: () => Data<string | number>
79
85
  /* Is alarm clock running? */
80
- running?: () => Data
86
+ running?: () => Data<boolean | string | number>
81
87
  }
82
88
  }
83
89
 
84
- /* Execute event by cron tab */
90
+ /* Schedule events using cron expressions (e.g. daily, hourly) */
85
91
  export type GeneratorAlarmClock = Generator &
86
92
  GeneratorAlarmClockDef & {
87
93
  templateKey: 'GENERATOR_ALARM_CLOCK'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Conversational AI agent orchestrating LLM (GGML/MLX/OpenAI/QNN/ONNX/Anthropic/NeuroPilot), STT, TTS, MCP tool-use, and file search (RAG) with auto-summary
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
  /* Add a message to the assistant */
15
19
  export type GeneratorAssistantActionAddMessage = ActionWithParams & {
@@ -364,7 +368,7 @@ export type GeneratorAssistantActionInsertMcpResource = ActionWithParams & {
364
368
  >
365
369
  }
366
370
 
367
- /* Summarize messages based on the conversation
371
+ /* Summarize messages based on the conversation
368
372
 
369
373
  Note: Summary uses the same LLM context size, so it is recommended only to use it when the system prompt (in Initial Messages) is long, otherwise it may still fail when the context is full (Ctx Shift is NO). */
370
374
  export type GeneratorAssistantActionSummaryMessages = ActionWithParams & {
@@ -434,15 +438,15 @@ Default property:
434
438
  | DataLink
435
439
  /* Whether to cache messages */
436
440
  cacheMessages?: boolean | DataLink
437
- /* LLM Generator (Supports `LLM (GGML)` and `OpenAI LLM` generators) */
441
+ /* LLM Generator (Supports `LLM (GGML)`, `LLM (MLX)`, `OpenAI LLM`, `LLM (Qualcomm AI Engine)`, `LLM (ONNX)`, `LLM (Anthropic-compat)`, and `LLM (MediaTek NeuroPilot)` generators) */
438
442
  llmGeneratorId?: string | DataLink | (() => Generator)
439
- /* LLM Live Policy. If the policy is `only-in-use`, the LLM context will be released when the assistant is not in use.
443
+ /* LLM Live Policy. If the policy is `only-in-use`, the LLM context will be released when the assistant is not in use.
440
444
 
441
445
  Note: LLM (Qualcomm AI Engine) recommend use `manual` and loaded constantly. */
442
446
  llmLivePolicy?: 'only-in-use' | 'manual' | DataLink
443
447
  /* LLM main session key */
444
448
  llmSessionKey?: string | DataLink
445
- /* Auto Summary Messages (Automatically summarize messages when the LLM context is full or content gets truncated, currently only supported with LLM (GGML) generators)
449
+ /* Auto Summary Messages (Automatically summarize messages when the LLM context is full or content gets truncated, currently only supported with LLM (GGML) generators)
446
450
 
447
451
  Note: Summary uses the same LLM context size, so it is recommended only to use it when the system prompt (in Initial Messages) is long, otherwise it may still fail when the context is full (Ctx Shift is NO). */
448
452
  llmAutoSummaryMessages?: boolean | DataLink
@@ -510,37 +514,84 @@ Default property:
510
514
  }
511
515
  events?: {
512
516
  /* Error event */
513
- onError?: Array<EventAction>
517
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Assistant']['onError']>>
514
518
  /* Log event */
515
- onLogs?: Array<EventAction>
519
+ onLogs?: Array<EventAction<string & keyof TemplateEventPropsMap['Assistant']['onLogs']>>
516
520
  /* Messages update event */
517
- onMessagesUpdate?: Array<EventAction>
521
+ onMessagesUpdate?: Array<
522
+ EventAction<string & keyof TemplateEventPropsMap['Assistant']['onMessagesUpdate']>
523
+ >
518
524
  /* Heatup finished event */
519
525
  onHeatupFinished?: Array<EventAction>
520
526
  /* Generating event (triggered when assistant starts generating response) */
521
527
  onGenerating?: Array<EventAction>
522
528
  /* Finished event (triggered when assistant finishes generating response) */
523
- onFinished?: Array<EventAction>
529
+ onFinished?: Array<EventAction<string & keyof TemplateEventPropsMap['Assistant']['onFinished']>>
524
530
  }
525
531
  outlets?: {
526
532
  /* Whether the assistant is heating up */
527
- isHeatingUp?: () => Data
533
+ isHeatingUp?: () => Data<boolean>
528
534
  /* Whether the assistant is file processing */
529
- isFileProcessing?: () => Data
535
+ isFileProcessing?: () => Data<boolean>
530
536
  /* Whether the assistant is responding */
531
- isResponding?: () => Data
537
+ isResponding?: () => Data<boolean>
532
538
  /* Whether the assistant is busy */
533
- isBusy?: () => Data
539
+ isBusy?: () => Data<boolean>
534
540
  /* Embedding files of the assistant */
535
- files?: () => Data
541
+ files?: () => Data<Array<any>>
536
542
  /* Messages of the assistant */
537
- messages?: () => Data
543
+ messages?: () => Data<
544
+ Array<{
545
+ role?: string
546
+ name?: string
547
+ content?: any
548
+ tool_call_id?: string
549
+ tool_calls?: Array<{
550
+ id?: string
551
+ type?: string
552
+ function?: {
553
+ name?: string
554
+ arguments?: string
555
+ [key: string]: any
556
+ }
557
+ [key: string]: any
558
+ }>
559
+ reasoning_content?: string
560
+ audio?: {
561
+ generating?: boolean
562
+ [key: string]: any
563
+ }
564
+ last_generated_at?: number
565
+ responding?: boolean
566
+ is_summary?: boolean
567
+ summary_created_at?: number
568
+ [key: string]: any
569
+ }>
570
+ >
538
571
  /* MCP servers status and available tools */
539
- mcpServers?: () => Data
572
+ mcpServers?: () => Data<
573
+ Array<{
574
+ generatorId?: string
575
+ generatorKey?: string
576
+ name?: string
577
+ version?: string
578
+ connected?: boolean
579
+ error?: string
580
+ resources?: Array<{
581
+ name?: string
582
+ [key: string]: any
583
+ }>
584
+ tools?: Array<{
585
+ name?: string
586
+ [key: string]: any
587
+ }>
588
+ [key: string]: any
589
+ }>
590
+ >
540
591
  }
541
592
  }
542
593
 
543
- /* AI Assistant */
594
+ /* Conversational AI agent orchestrating LLM (GGML/MLX/OpenAI/QNN/ONNX/Anthropic/NeuroPilot), STT, TTS, MCP tool-use, and file search (RAG) with auto-summary */
544
595
  export type GeneratorAssistant = Generator &
545
596
  GeneratorAssistantDef & {
546
597
  templateKey: 'GENERATOR_ASSISTANT'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Bluetooth Low Energy central: scan, connect, and communicate with BLE peripherals
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
  /* Start scan */
15
19
  export type GeneratorBleCentralActionStartScan = Action & {
@@ -178,33 +182,49 @@ Default property:
178
182
  /* Event for state change */
179
183
  onStateChange?: Array<EventAction>
180
184
  /* Event for error occurred */
181
- onError?: Array<EventAction>
185
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['BleCentral']['onError']>>
182
186
  /* Event for start scan */
183
187
  onStartScan?: Array<EventAction>
184
188
  /* Event for stop scan */
185
189
  onStopScan?: Array<EventAction>
186
190
  /* Event for discover device */
187
- onDiscoverDevice?: Array<EventAction>
191
+ onDiscoverDevice?: Array<
192
+ EventAction<string & keyof TemplateEventPropsMap['BleCentral']['onDiscoverDevice']>
193
+ >
188
194
  /* Event for device connected */
189
- onConnectDevice?: Array<EventAction>
195
+ onConnectDevice?: Array<
196
+ EventAction<string & keyof TemplateEventPropsMap['BleCentral']['onConnectDevice']>
197
+ >
190
198
  /* Event for device disconnected */
191
199
  onDisconnectDevice?: Array<EventAction>
192
200
  /* Event for receive on read */
193
- onReadReceive?: Array<EventAction>
201
+ onReadReceive?: Array<
202
+ EventAction<string & keyof TemplateEventPropsMap['BleCentral']['onReadReceive']>
203
+ >
194
204
  /* Event for receive on monitor */
195
- onMonitorReceive?: Array<EventAction>
205
+ onMonitorReceive?: Array<
206
+ EventAction<string & keyof TemplateEventPropsMap['BleCentral']['onMonitorReceive']>
207
+ >
196
208
  }
197
209
  outlets?: {
198
210
  /* Is scaning */
199
- isScaning?: () => Data
211
+ isScaning?: () => Data<boolean>
200
212
  /* Discovered device list */
201
- discoveredDeviceList?: () => Data
213
+ discoveredDeviceList?: () => Data<
214
+ Array<{
215
+ id?: string
216
+ name?: string
217
+ rssi?: number
218
+ advertising?: { [key: string]: any }
219
+ [key: string]: any
220
+ }>
221
+ >
202
222
  /* Error message */
203
- errorMessage?: () => Data
223
+ errorMessage?: () => Data<string>
204
224
  }
205
225
  }
206
226
 
207
- /* BLE Central Mode Generator */
227
+ /* Bluetooth Low Energy central: scan, connect, and communicate with BLE peripherals */
208
228
  export type GeneratorBleCentral = Generator &
209
229
  GeneratorBleCentralDef & {
210
230
  templateKey: 'GENERATOR_BLE_CENTRAL'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Bluetooth Low Energy peripheral: advertise services and respond to central connections
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
  /* Start advertise */
15
19
  export type GeneratorBlePeripheralActionStart = Action & {
@@ -149,7 +153,7 @@ Default property:
149
153
  beaconsEnable?: boolean | DataLink
150
154
  /* Measured RSSI @ 1m, used for calculate distance */
151
155
  beaconsTxPower?: number | DataLink
152
- /* Beacon configs
156
+ /* Beacon configs
153
157
  presets has pre-defined layout and manufacturerId
154
158
  layout string is like AltBeacon's Beacon Layout, but replace "x" as extra data
155
159
  id and data could be 0x prefixed hex, hex string, decimal or UUID
@@ -173,15 +177,15 @@ Default property:
173
177
  events?: {}
174
178
  outlets?: {
175
179
  /* Is advertising */
176
- isAdvertising?: () => Data
180
+ isAdvertising?: () => Data<boolean>
177
181
  /* Last receive written */
178
- lastWrite?: () => Data
182
+ lastWrite?: () => Data<{ [key: string]: any }>
179
183
  /* Error message */
180
- errorMessage?: () => Data
184
+ errorMessage?: () => Data<string>
181
185
  }
182
186
  }
183
187
 
184
- /* BLE Peripheral Mode Generator */
188
+ /* Bluetooth Low Energy peripheral: advertise services and respond to central connections */
185
189
  export type GeneratorBlePeripheral = Generator &
186
190
  GeneratorBlePeripheralDef & {
187
191
  templateKey: 'GENERATOR_BLE_PERIPHERAL'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Trigger canvas navigation by setup rules
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 GeneratorCanvasMapDef {
15
19
  /*
@@ -35,15 +39,15 @@ Default property:
35
39
  }
36
40
  events?: {
37
41
  /* Event triggered when a rule matches and canvas navigation occurs */
38
- onNavigate?: Array<EventAction>
42
+ onNavigate?: Array<EventAction<string & keyof TemplateEventPropsMap['CanvasMap']['onNavigate']>>
39
43
  }
40
44
  outlets?: {
41
45
  /* Last matched trigger rule that caused canvas navigation */
42
- lastMatchedRule?: () => Data
46
+ lastMatchedRule?: () => Data<{ [key: string]: any }>
43
47
  /* Index of the last matched rule in triggerList */
44
- lastMatchedIndex?: () => Data
48
+ lastMatchedIndex?: () => Data<number>
45
49
  /* Total count of canvas navigations triggered by this generator */
46
- navigationCount?: () => Data
50
+ navigationCount?: () => Data<number>
47
51
  }
48
52
  }
49
53