@fugood/bricks-project 2.23.0-beta.60 → 2.23.0-beta.62
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
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-project",
|
|
3
|
-
"version": "2.23.0-beta.
|
|
3
|
+
"version": "2.23.0-beta.62",
|
|
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.23.0-beta.
|
|
9
|
+
"@fugood/bricks-cli": "^2.23.0-beta.61",
|
|
10
10
|
"@huggingface/gguf": "^0.3.2",
|
|
11
11
|
"@modelcontextprotocol/sdk": "^1.15.0",
|
|
12
12
|
"@toon-format/toon": "^2.1.0",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"lodash": "^4.17.4",
|
|
19
19
|
"uuid": "^8.3.1"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "aaa3df5305420b5250f4ba1d6500ba07b799b116"
|
|
22
22
|
}
|
|
@@ -11,6 +11,7 @@ This skill covers advanced BRICKS features not in the main project instructions.
|
|
|
11
11
|
|
|
12
12
|
| Rule | Description |
|
|
13
13
|
|------|-------------|
|
|
14
|
+
| [Architecture Patterns](rules/architecture-patterns.md) | **Read first** — decompose flows and select patterns |
|
|
14
15
|
| [Animation](rules/animation.md) | Animation system for brick transforms and opacity |
|
|
15
16
|
| [Standby Transition](rules/standby-transition.md) | Canvas enter/exit animations |
|
|
16
17
|
| [Automations](rules/automations.md) | E2E testing and scheduled tasks |
|
|
@@ -22,6 +23,7 @@ This skill covers advanced BRICKS features not in the main project instructions.
|
|
|
22
23
|
|
|
23
24
|
## Quick Reference
|
|
24
25
|
|
|
26
|
+
- **Complex flows**: See [Architecture Patterns](rules/architecture-patterns.md) for decomposing multi-step workflows
|
|
25
27
|
- **Multi-device**: See [Local Sync](rules/local-sync.md) for LAN coordination
|
|
26
28
|
- **Cloud data**: See [Remote Data Bank](rules/remote-data-bank.md) for sync and API access
|
|
27
29
|
- **Media assets**: See [Media Flow](rules/media-flow.md) for centralized asset management
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Architecture Patterns
|
|
2
|
+
|
|
3
|
+
How to decompose complex flows into the right combination of BRICKS patterns.
|
|
4
|
+
|
|
5
|
+
## Pattern Selection Priority
|
|
6
|
+
|
|
7
|
+
Prefer higher-priority patterns; only fall to lower when they genuinely can't solve the sub-problem:
|
|
8
|
+
|
|
9
|
+
| Priority | Pattern | Use For |
|
|
10
|
+
|----------|---------|---------|
|
|
11
|
+
| 1 | Generator + Events | I/O, AI inference, external data |
|
|
12
|
+
| 2 | Event Action Chains | Orchestration, sequential steps |
|
|
13
|
+
| 3 | System Actions | State changes, navigation, UI triggers |
|
|
14
|
+
| 4 | Data Calculation | Pure data transformation ONLY |
|
|
15
|
+
|
|
16
|
+
### Generators (Priority 1)
|
|
17
|
+
For all external I/O and AI inference. Each generator emits events that naturally chain into actions.
|
|
18
|
+
- **GeneratorAssistant**: multi-turn LLM conversations, function calling, built-in message history
|
|
19
|
+
- **GeneratorLLM**: single-shot local inference (GGML)
|
|
20
|
+
- **GeneratorHttp**: REST API calls
|
|
21
|
+
- **GeneratorMqtt / GeneratorWebSocket**: real-time messaging
|
|
22
|
+
|
|
23
|
+
### Event Action Chains (Priority 2)
|
|
24
|
+
The primary way to orchestrate multi-step flows. A single event can contain an array of EventActions executed sequentially.
|
|
25
|
+
- Use `waitAsync: true` to await async actions before the next step
|
|
26
|
+
- Use `dataParams` + `mapping` to pass event data downstream
|
|
27
|
+
- This is the "glue" that wires generators, state, and UI together
|
|
28
|
+
|
|
29
|
+
### System Actions (Priority 3)
|
|
30
|
+
Built-in commands for direct state and UI changes.
|
|
31
|
+
- **PROPERTY_BANK**: set data value
|
|
32
|
+
- **PROPERTY_BANK_EXPRESSION**: inline JS expression for simple compute
|
|
33
|
+
- **CHANGE_CANVAS**: navigate to another canvas
|
|
34
|
+
- **DYNAMIC_ANIMATION**: trigger animation
|
|
35
|
+
- **ALERT / MESSAGE**: system feedback
|
|
36
|
+
|
|
37
|
+
### Data Calculation (Priority 4)
|
|
38
|
+
ONLY for deriving, formatting, or aggregating values from other data. Not for orchestration, side effects, or flow control.
|
|
39
|
+
|
|
40
|
+
## Flow Decomposition
|
|
41
|
+
|
|
42
|
+
When the user describes a complex flow, decompose it BEFORE writing code:
|
|
43
|
+
|
|
44
|
+
### Step 1: Extract I/O boundaries
|
|
45
|
+
Every external interaction maps to a Generator:
|
|
46
|
+
- "call LLM" → GeneratorAssistant or GeneratorLLM
|
|
47
|
+
- "fetch API" → GeneratorHttp
|
|
48
|
+
- "speech to text" → GeneratorSpeechInference
|
|
49
|
+
|
|
50
|
+
### Step 2: Extract state transitions
|
|
51
|
+
Every UI change maps to a System Action in an event chain:
|
|
52
|
+
- "show loading" → PROPERTY_BANK on a boolean data
|
|
53
|
+
- "go to result screen" → CHANGE_CANVAS
|
|
54
|
+
- "animate in" → DYNAMIC_ANIMATION
|
|
55
|
+
|
|
56
|
+
### Step 3: Extract pure transformations
|
|
57
|
+
Only actual data derivation maps to Data Calculation:
|
|
58
|
+
- "format the response" → DataCalculationScript
|
|
59
|
+
- "compute a score" → DataCalculationScript or DataCalculationMap
|
|
60
|
+
|
|
61
|
+
### Step 4: Wire with Event Action Chains
|
|
62
|
+
Connect the pieces through events on generators and bricks.
|
|
@@ -49,7 +49,7 @@ Use `manual` to prevent circular dependencies or for explicit control.
|
|
|
49
49
|
|
|
50
50
|
## Script Sandbox Features
|
|
51
51
|
|
|
52
|
-
Scripts run in `use strict` mode
|
|
52
|
+
Scripts run in `use strict` mode with a sandboxed set of globals and libraries.
|
|
53
53
|
|
|
54
54
|
### Built-in Globals
|
|
55
55
|
|
|
@@ -140,9 +140,10 @@ Enable `enableAsync: true` to unlock additional capabilities:
|
|
|
140
140
|
|
|
141
141
|
```typescript
|
|
142
142
|
code: `
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
const result = await new Promise((resolve) => {
|
|
144
|
+
setTimeout(() => resolve(inputs.value * 2), 100)
|
|
145
|
+
})
|
|
146
|
+
return result
|
|
146
147
|
`,
|
|
147
148
|
enableAsync: true,
|
|
148
149
|
```
|
|
@@ -186,3 +187,22 @@ const triggerCalc: EventAction = {
|
|
|
186
187
|
2. **Error handling**: Always set `error` output for scripts that might fail
|
|
187
188
|
3. **Keep scripts pure**: Avoid side effects, return computed values
|
|
188
189
|
4. **Debounce rapid updates**: Use `manual` mode + timer for high-frequency inputs
|
|
190
|
+
|
|
191
|
+
## Anti-Patterns (AVOID)
|
|
192
|
+
|
|
193
|
+
See [Architecture Patterns](architecture-patterns.md) for the full pattern selection guide.
|
|
194
|
+
|
|
195
|
+
### Using Data Calc as an orchestrator
|
|
196
|
+
Scripts that manage state machines, control UI flow, or coordinate multi-step processes belong in Event Action Chains, not here.
|
|
197
|
+
|
|
198
|
+
**Symptom**: Script has if/else branches deciding "what happens next" or tracks "current step".
|
|
199
|
+
|
|
200
|
+
### Quick reference
|
|
201
|
+
|
|
202
|
+
| If you need to... | Use instead |
|
|
203
|
+
|---|---|
|
|
204
|
+
| Call an LLM / AI model | Generator (Assistant, LLM, HTTP) |
|
|
205
|
+
| Sequence multiple actions | Event Action Chain |
|
|
206
|
+
| Set a data value directly | PROPERTY_BANK system action |
|
|
207
|
+
| Compute a simple expression | PROPERTY_BANK_EXPRESSION |
|
|
208
|
+
| Transform/format/parse data | Data Calculation (correct use) |
|
package/types/system.ts
CHANGED
|
@@ -642,6 +642,11 @@ export type SystemActionThrowException = ActionWithParams & {
|
|
|
642
642
|
>
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
/* Restart the foundation (React Native bundle) */
|
|
646
|
+
export type SystemActionRestartFoundation = Action & {
|
|
647
|
+
__actionName: 'RESTART_FOUNDATION'
|
|
648
|
+
}
|
|
649
|
+
|
|
645
650
|
/* Dismiss keyboard */
|
|
646
651
|
export type SystemActionDismissKeyboard = Action & {
|
|
647
652
|
__actionName: 'DISMISS_KEYBOARD'
|