@fugood/bricks-project 2.24.0-beta.7 → 2.24.0-beta.9
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.
- package/package.json +3 -3
- package/skills/bricks-project/rules/automations.md +68 -22
- package/types/bricks/Camera.ts +1 -1
- package/types/bricks/Chart.ts +1 -1
- package/types/bricks/GenerativeMedia.ts +1 -1
- package/types/bricks/Icon.ts +1 -1
- package/types/bricks/Image.ts +1 -1
- package/types/bricks/Items.ts +1 -1
- package/types/bricks/Lottie.ts +1 -1
- package/types/bricks/Maps.ts +1 -1
- package/types/bricks/QrCode.ts +1 -1
- package/types/bricks/Rect.ts +1 -1
- package/types/bricks/RichText.ts +1 -1
- package/types/bricks/Rive.ts +1 -1
- package/types/bricks/Slideshow.ts +1 -1
- package/types/bricks/Svg.ts +1 -1
- package/types/bricks/Text.ts +1 -1
- package/types/bricks/TextInput.ts +1 -1
- package/types/bricks/Video.ts +1 -1
- package/types/bricks/VideoStreaming.ts +1 -1
- package/types/bricks/WebRtcStream.ts +1 -1
- package/types/bricks/WebView.ts +1 -1
- package/types/canvas.ts +2 -2
- package/types/common.ts +4 -4
- package/types/generators/AlarmClock.ts +1 -1
- package/types/generators/Assistant.ts +1 -1
- package/types/generators/BleCentral.ts +1 -1
- package/types/generators/BlePeripheral.ts +1 -1
- package/types/generators/CanvasMap.ts +1 -1
- package/types/generators/CastlesPay.ts +1 -1
- package/types/generators/DataBank.ts +1 -1
- package/types/generators/File.ts +1 -1
- package/types/generators/GraphQl.ts +1 -1
- package/types/generators/Http.ts +1 -1
- package/types/generators/HttpServer.ts +1 -1
- package/types/generators/Information.ts +1 -1
- package/types/generators/Intent.ts +1 -1
- package/types/generators/Iterator.ts +1 -1
- package/types/generators/Keyboard.ts +1 -1
- package/types/generators/LlmAnthropicCompat.ts +1 -1
- package/types/generators/LlmAppleBuiltin.ts +1 -1
- package/types/generators/LlmGgml.ts +1 -1
- package/types/generators/LlmOnnx.ts +1 -1
- package/types/generators/LlmOpenAiCompat.ts +1 -1
- package/types/generators/LlmQualcommAiEngine.ts +1 -1
- package/types/generators/Mcp.ts +1 -1
- package/types/generators/McpServer.ts +1 -1
- package/types/generators/MediaFlow.ts +1 -1
- package/types/generators/MqttBroker.ts +1 -1
- package/types/generators/MqttClient.ts +1 -1
- package/types/generators/Question.ts +1 -1
- package/types/generators/RealtimeTranscription.ts +1 -1
- package/types/generators/RerankerGgml.ts +1 -1
- package/types/generators/SerialPort.ts +1 -1
- package/types/generators/SoundPlayer.ts +1 -1
- package/types/generators/SoundRecorder.ts +1 -1
- package/types/generators/SpeechToTextGgml.ts +1 -1
- package/types/generators/SpeechToTextOnnx.ts +1 -1
- package/types/generators/SpeechToTextPlatform.ts +1 -1
- package/types/generators/SqLite.ts +1 -1
- package/types/generators/Step.ts +1 -1
- package/types/generators/SttAppleBuiltin.ts +1 -1
- package/types/generators/Tcp.ts +1 -1
- package/types/generators/TcpServer.ts +1 -1
- package/types/generators/TextToSpeechAppleBuiltin.ts +1 -1
- package/types/generators/TextToSpeechGgml.ts +1 -1
- package/types/generators/TextToSpeechOnnx.ts +1 -1
- package/types/generators/TextToSpeechOpenAiLike.ts +1 -1
- package/types/generators/ThermalPrinter.ts +1 -1
- package/types/generators/Tick.ts +1 -1
- package/types/generators/Udp.ts +1 -1
- package/types/generators/VadGgml.ts +1 -1
- package/types/generators/VadOnnx.ts +1 -1
- package/types/generators/VadTraditional.ts +1 -1
- package/types/generators/VectorStore.ts +1 -1
- package/types/generators/Watchdog.ts +1 -1
- package/types/generators/WebCrawler.ts +1 -1
- package/types/generators/WebRtc.ts +1 -1
- package/types/generators/WebSocket.ts +1 -1
- package/utils/id.ts +4 -0
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-project",
|
|
3
|
-
"version": "2.24.0-beta.
|
|
3
|
+
"version": "2.24.0-beta.9",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "bun scripts/build.js"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@fugood/bricks-cli": "^2.24.0-beta.
|
|
9
|
+
"@fugood/bricks-cli": "^2.24.0-beta.8",
|
|
10
10
|
"@huggingface/gguf": "^0.3.2",
|
|
11
11
|
"@iarna/toml": "^3.0.0",
|
|
12
12
|
"@modelcontextprotocol/sdk": "^1.15.0",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"lodash": "^4.17.4",
|
|
20
20
|
"uuid": "^8.3.1"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "e95218456eba0a34caafc17f3ffdd74035695c8b"
|
|
23
23
|
}
|
|
@@ -4,15 +4,16 @@ E2E testing and scheduled execution for BRICKS applications. Simulates user beha
|
|
|
4
4
|
|
|
5
5
|
## Automation Types
|
|
6
6
|
|
|
7
|
-
| Type
|
|
8
|
-
|
|
9
|
-
| `launch`
|
|
10
|
-
| `anytime` | Execute anytime via manual trigger
|
|
11
|
-
| `cron`
|
|
7
|
+
| Type | Description |
|
|
8
|
+
| --------- | ---------------------------------------------------------- |
|
|
9
|
+
| `launch` | Run on application launch (restarts app when run manually) |
|
|
10
|
+
| `anytime` | Execute anytime via manual trigger |
|
|
11
|
+
| `cron` | Scheduled execution using crontab expressions |
|
|
12
12
|
|
|
13
13
|
## Simulation Actions
|
|
14
14
|
|
|
15
15
|
Automations can simulate:
|
|
16
|
+
|
|
16
17
|
- **Brick Press**: Tap/click on bricks
|
|
17
18
|
- **Key Events**: Key up/down for keyboard input
|
|
18
19
|
- **HTTP Request**: API calls
|
|
@@ -21,6 +22,7 @@ Automations can simulate:
|
|
|
21
22
|
## Assertions
|
|
22
23
|
|
|
23
24
|
Automations can validate:
|
|
25
|
+
|
|
24
26
|
- **Brick Exists**: Check if brick is rendered
|
|
25
27
|
- **Event Triggered**: Verify event from Brick/Generator/Canvas
|
|
26
28
|
- **Canvas Changed**: Confirm canvas navigation
|
|
@@ -100,25 +102,58 @@ const testLoginFlow: AutomationTest = {
|
|
|
100
102
|
|
|
101
103
|
## Test Methods
|
|
102
104
|
|
|
103
|
-
| Method
|
|
104
|
-
|
|
105
|
-
| `brick_press`
|
|
106
|
-
| `brick_exists`
|
|
107
|
-
| `wait_until_brick_exists`
|
|
108
|
-
| `wait_until_event_trigger`
|
|
109
|
-
| `wait_until_canvas_change`
|
|
110
|
-
| `keydown`
|
|
111
|
-
| `keyup`
|
|
112
|
-
| `http_request`
|
|
113
|
-
| `assert_property`
|
|
114
|
-
| `wait_until_property_change` | `[subspace, property, value, timeout?]`
|
|
115
|
-
| `execute_action`
|
|
116
|
-
| `match_screenshot`
|
|
117
|
-
| `delay`
|
|
105
|
+
| Method | Signature | Description |
|
|
106
|
+
| ---------------------------- | ------------------------------------------------ | -------------------- |
|
|
107
|
+
| `brick_press` | `[subspace, brick, options?]` | Simulate brick press |
|
|
108
|
+
| `brick_exists` | `[subspace, brick, frame?]` | Check brick exists |
|
|
109
|
+
| `wait_until_brick_exists` | `[subspace, brick, timeout?, frame?]` | Wait for brick |
|
|
110
|
+
| `wait_until_event_trigger` | `[subspace, sender, eventKey, timeout?]` | Wait for event |
|
|
111
|
+
| `wait_until_canvas_change` | `[subspace, canvas, timeout?]` | Wait for canvas |
|
|
112
|
+
| `keydown` | `[keyCode, pressedKey?, flags?]` | Key down event |
|
|
113
|
+
| `keyup` | `[keyCode, pressedKey?, flags?]` | Key up event |
|
|
114
|
+
| `http_request` | `[url, options?]` | HTTP request |
|
|
115
|
+
| `assert_property` | `[subspace, property, value]` | Assert data value |
|
|
116
|
+
| `wait_until_property_change` | `[subspace, property, value, timeout?]` | Wait for value |
|
|
117
|
+
| `execute_action` | `[subspace, handler, action, params?, options?]` | Execute action |
|
|
118
|
+
| `match_screenshot` | `[name, threshold?, maxRetry?]` | Screenshot compare |
|
|
119
|
+
| `delay` | `[subspace?, property?, defaultValue?]` | Delay execution |
|
|
120
|
+
|
|
121
|
+
### execute_action Params
|
|
122
|
+
|
|
123
|
+
The `params` object in `execute_action` uses **runtime event property keys** from `event-props.ts`, NOT the action config `input` names from type definitions.
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// CORRECT — use runtime event property key
|
|
127
|
+
run: ['execute_action', () => subspace0, bricks.bInput.id, 'BRICK_TEXT_INPUT_SET_TEXT',
|
|
128
|
+
{ BRICK_TEXT_INPUT_TEXT: 'hello' }]
|
|
129
|
+
|
|
130
|
+
// WRONG — action config input name doesn't work in automation
|
|
131
|
+
run: ['execute_action', () => subspace0, bricks.bInput.id, 'BRICK_TEXT_INPUT_SET_TEXT',
|
|
132
|
+
{ text: 'hello' }]
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Reference `event-props.ts` for the correct runtime keys (e.g., `BRICK_TEXT_INPUT_TEXT`, `GENERATOR_MQTT_PAYLOAD`).
|
|
136
|
+
|
|
137
|
+
### Prefer UI Interactions Over Direct Generator Calls
|
|
138
|
+
|
|
139
|
+
For realistic E2E testing, prefer simulating user actions (set text input + press button) over calling generator actions directly:
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
// GOOD — simulates real user behavior
|
|
143
|
+
{ run: ['execute_action', () => sub, bricks.bInput.id, 'BRICK_TEXT_INPUT_SET_TEXT',
|
|
144
|
+
{ BRICK_TEXT_INPUT_TEXT: 'hello' }] },
|
|
145
|
+
{ run: ['brick_press', () => sub, () => bricks.bSendBtn] },
|
|
146
|
+
{ run: ['wait_until_property_change', () => sub, () => data.dPayload, 'hello', 10000] },
|
|
147
|
+
|
|
148
|
+
// AVOID — bypasses UI, doesn't test the full flow
|
|
149
|
+
{ run: ['execute_action', () => sub, generators.gClient.id, 'GENERATOR_MQTT_PUBLISH',
|
|
150
|
+
{ topic: 'test', payload: 'hello', qos: '0' }] },
|
|
151
|
+
```
|
|
118
152
|
|
|
119
153
|
## Recording Automations
|
|
120
154
|
|
|
121
155
|
In BRICKS Editor Preview mode:
|
|
156
|
+
|
|
122
157
|
1. Perform operations normally
|
|
123
158
|
2. Open menu (right-bottom corner)
|
|
124
159
|
3. Select "Record Events as Automation"
|
|
@@ -127,12 +162,15 @@ In BRICKS Editor Preview mode:
|
|
|
127
162
|
## Running Automations
|
|
128
163
|
|
|
129
164
|
### Manual Run
|
|
165
|
+
|
|
130
166
|
`Menu` → `Automations` → Select automation → `Run`
|
|
131
167
|
|
|
132
168
|
### On Launch
|
|
169
|
+
|
|
133
170
|
`Bind Device` → `Select Automation` (only `launch` or `cron` types)
|
|
134
171
|
|
|
135
172
|
### Scheduled (Cron)
|
|
173
|
+
|
|
136
174
|
`Bind Device` → `Cron Automation` (allows multi-select)
|
|
137
175
|
|
|
138
176
|
Use [crontab.guru](https://crontab.guru) to build cron expressions.
|
|
@@ -144,7 +182,7 @@ Visual regression testing with screenshot comparison:
|
|
|
144
182
|
```typescript
|
|
145
183
|
{
|
|
146
184
|
__typename: 'TestCase',
|
|
147
|
-
id: '
|
|
185
|
+
id: makeId('test_case'),
|
|
148
186
|
name: 'Match dashboard screenshot',
|
|
149
187
|
run: ['match_screenshot', 'dashboard-initial-state', 0.01, 3],
|
|
150
188
|
exit_on_failed: true,
|
|
@@ -156,6 +194,7 @@ Visual regression testing with screenshot comparison:
|
|
|
156
194
|
```
|
|
157
195
|
|
|
158
196
|
Screenshots can be stored:
|
|
197
|
+
|
|
159
198
|
- Local file system
|
|
160
199
|
- Media Flow workspace
|
|
161
200
|
|
|
@@ -165,11 +204,18 @@ First run captures baseline. Use "Run with Update" to update baseline.
|
|
|
165
204
|
|
|
166
205
|
Automations work with Modules. Use Manual Run in Preview mode for module testing.
|
|
167
206
|
|
|
207
|
+
## Important Notes
|
|
208
|
+
|
|
209
|
+
- **Automation map key**: Always use `'AUTOMATION_MAP_DEFAULT'` as the automation map ID (not `makeId()`). The preview test runner reads from `automationMap['AUTOMATION_MAP_DEFAULT']?.map`.
|
|
210
|
+
- **Valid makeId types**: Use `'test'` for AutomationTest, `'test_case'` for TestCase, `'test_var'` for TestVariable. Do NOT use `'automation_test'` or `'automation_test_map'`.
|
|
211
|
+
- **handler in execute_action**: Pass the entity's `.id` string (e.g., `bricks.bInput.id`), not a getter function.
|
|
212
|
+
|
|
168
213
|
## Best Practices
|
|
169
214
|
|
|
170
215
|
1. **Test culture**: Create automations for every significant flow
|
|
171
216
|
2. **CI/CD integration**: Use `launch` automations for deployment validation
|
|
172
|
-
3. **Incremental waits**: Use `
|
|
217
|
+
3. **Incremental waits**: Use `wait_until_property_change` with appropriate timeouts
|
|
173
218
|
4. **Visual testing**: Add screenshot comparisons for critical UI states
|
|
174
219
|
5. **Cron monitoring**: Schedule health checks for production displays
|
|
175
220
|
6. **Isolation**: Each automation should be independent and idempotent
|
|
221
|
+
7. **UI-first testing**: Simulate real user interactions (text input, button press) rather than calling generators directly
|
package/types/bricks/Camera.ts
CHANGED
package/types/bricks/Chart.ts
CHANGED
package/types/bricks/Icon.ts
CHANGED
package/types/bricks/Image.ts
CHANGED
package/types/bricks/Items.ts
CHANGED
package/types/bricks/Lottie.ts
CHANGED
package/types/bricks/Maps.ts
CHANGED
package/types/bricks/QrCode.ts
CHANGED
package/types/bricks/Rect.ts
CHANGED
package/types/bricks/RichText.ts
CHANGED
package/types/bricks/Rive.ts
CHANGED
package/types/bricks/Svg.ts
CHANGED
package/types/bricks/Text.ts
CHANGED
package/types/bricks/Video.ts
CHANGED
package/types/bricks/WebView.ts
CHANGED
package/types/canvas.ts
CHANGED
package/types/common.ts
CHANGED
|
@@ -7,8 +7,8 @@ export interface Brick {
|
|
|
7
7
|
__typename: 'Brick'
|
|
8
8
|
id: string
|
|
9
9
|
templateKey: string
|
|
10
|
-
title
|
|
11
|
-
description
|
|
10
|
+
title?: string
|
|
11
|
+
description?: string
|
|
12
12
|
property?: {}
|
|
13
13
|
events: {}
|
|
14
14
|
outlets?: {}
|
|
@@ -25,8 +25,8 @@ export interface Generator {
|
|
|
25
25
|
__typename: 'Generator'
|
|
26
26
|
id: string
|
|
27
27
|
templateKey: string
|
|
28
|
-
title
|
|
29
|
-
description
|
|
28
|
+
title?: string
|
|
29
|
+
description?: string
|
|
30
30
|
localSyncRunMode?: LocalSyncStrategy
|
|
31
31
|
property?: {}
|
|
32
32
|
events: {}
|
|
@@ -185,7 +185,7 @@ Default property:
|
|
|
185
185
|
export type GeneratorBlePeripheral = Generator &
|
|
186
186
|
GeneratorBlePeripheralDef & {
|
|
187
187
|
templateKey: 'GENERATOR_BLE_PERIPHERAL'
|
|
188
|
-
switches
|
|
188
|
+
switches?: Array<
|
|
189
189
|
SwitchDef &
|
|
190
190
|
GeneratorBlePeripheralDef & {
|
|
191
191
|
conds?: Array<{
|
package/types/generators/File.ts
CHANGED
package/types/generators/Http.ts
CHANGED
|
@@ -171,7 +171,7 @@ Default property:
|
|
|
171
171
|
export type GeneratorAnthropicLLM = Generator &
|
|
172
172
|
GeneratorAnthropicLLMDef & {
|
|
173
173
|
templateKey: 'GENERATOR_ANTHROPIC_LLM'
|
|
174
|
-
switches
|
|
174
|
+
switches?: Array<
|
|
175
175
|
SwitchDef &
|
|
176
176
|
GeneratorAnthropicLLMDef & {
|
|
177
177
|
conds?: Array<{
|
package/types/generators/Mcp.ts
CHANGED
|
@@ -161,7 +161,7 @@ Default property:
|
|
|
161
161
|
export type GeneratorRealtimeTranscription = Generator &
|
|
162
162
|
GeneratorRealtimeTranscriptionDef & {
|
|
163
163
|
templateKey: 'GENERATOR_REALTIME_TRANSCRIPTION'
|
|
164
|
-
switches
|
|
164
|
+
switches?: Array<
|
|
165
165
|
SwitchDef &
|
|
166
166
|
GeneratorRealtimeTranscriptionDef & {
|
|
167
167
|
conds?: Array<{
|
|
@@ -355,7 +355,7 @@ Default property:
|
|
|
355
355
|
export type GeneratorSpeechInference = Generator &
|
|
356
356
|
GeneratorSpeechInferenceDef & {
|
|
357
357
|
templateKey: 'GENERATOR_SPEECH_INFERENCE'
|
|
358
|
-
switches
|
|
358
|
+
switches?: Array<
|
|
359
359
|
SwitchDef &
|
|
360
360
|
GeneratorSpeechInferenceDef & {
|
|
361
361
|
conds?: Array<{
|
package/types/generators/Step.ts
CHANGED
package/types/generators/Tcp.ts
CHANGED
|
@@ -168,7 +168,7 @@ Default property:
|
|
|
168
168
|
export type GeneratorThermalPrinter = Generator &
|
|
169
169
|
GeneratorThermalPrinterDef & {
|
|
170
170
|
templateKey: 'GENERATOR_THERMAL_PRINTER'
|
|
171
|
-
switches
|
|
171
|
+
switches?: Array<
|
|
172
172
|
SwitchDef &
|
|
173
173
|
GeneratorThermalPrinterDef & {
|
|
174
174
|
conds?: Array<{
|
package/types/generators/Tick.ts
CHANGED
package/types/generators/Udp.ts
CHANGED
|
@@ -189,7 +189,7 @@ Default property:
|
|
|
189
189
|
export type GeneratorVadInference = Generator &
|
|
190
190
|
GeneratorVadInferenceDef & {
|
|
191
191
|
templateKey: 'GENERATOR_VAD_INFERENCE'
|
|
192
|
-
switches
|
|
192
|
+
switches?: Array<
|
|
193
193
|
SwitchDef &
|
|
194
194
|
GeneratorVadInferenceDef & {
|
|
195
195
|
conds?: Array<{
|
|
@@ -182,7 +182,7 @@ Default property:
|
|
|
182
182
|
export type GeneratorVadInferenceOnnx = Generator &
|
|
183
183
|
GeneratorVadInferenceOnnxDef & {
|
|
184
184
|
templateKey: 'GENERATOR_ONNX_VAD'
|
|
185
|
-
switches
|
|
185
|
+
switches?: Array<
|
|
186
186
|
SwitchDef &
|
|
187
187
|
GeneratorVadInferenceOnnxDef & {
|
|
188
188
|
conds?: Array<{
|
|
@@ -97,7 +97,7 @@ Default property:
|
|
|
97
97
|
export type GeneratorVadInferenceTraditional = Generator &
|
|
98
98
|
GeneratorVadInferenceTraditionalDef & {
|
|
99
99
|
templateKey: 'GENERATOR_TRADITIONAL_VAD'
|
|
100
|
-
switches
|
|
100
|
+
switches?: Array<
|
|
101
101
|
SwitchDef &
|
|
102
102
|
GeneratorVadInferenceTraditionalDef & {
|
|
103
103
|
conds?: Array<{
|
|
@@ -217,7 +217,7 @@ Default property:
|
|
|
217
217
|
export type GeneratorVectorStore = Generator &
|
|
218
218
|
GeneratorVectorStoreDef & {
|
|
219
219
|
templateKey: 'GENERATOR_VECTOR_STORE'
|
|
220
|
-
switches
|
|
220
|
+
switches?: Array<
|
|
221
221
|
SwitchDef &
|
|
222
222
|
GeneratorVectorStoreDef & {
|
|
223
223
|
conds?: Array<{
|
package/utils/id.ts
CHANGED
|
@@ -21,6 +21,7 @@ export const makeId = (
|
|
|
21
21
|
| 'property_bank_command'
|
|
22
22
|
| 'property_bank_calc'
|
|
23
23
|
| 'dynamic-brick'
|
|
24
|
+
| 'automation_map'
|
|
24
25
|
| 'test'
|
|
25
26
|
| 'test_case'
|
|
26
27
|
| 'test_var'
|
|
@@ -61,6 +62,9 @@ export const makeId = (
|
|
|
61
62
|
case 'property_bank_calc':
|
|
62
63
|
prefix = 'PROPERTY_BANK_COMMAND_MAP_'
|
|
63
64
|
break
|
|
65
|
+
case 'automation_map':
|
|
66
|
+
prefix = 'AUTOMATION_MAP_'
|
|
67
|
+
break
|
|
64
68
|
case 'test':
|
|
65
69
|
prefix = 'TEST_'
|
|
66
70
|
break
|