@fugood/bricks-project 2.25.0-beta.21 → 2.25.0-beta.22

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.25.0-beta.21",
3
+ "version": "2.25.0-beta.22",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
package/package.json.bak CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fugood/bricks-ctor",
3
- "version": "2.25.0-beta.21",
3
+ "version": "2.25.0-beta.22",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bricks-ctor
3
- description: Advanced BRICKS configuration knowledge. Covers Standby Transition, Automations (E2E testing), Data Calculation (JS sandbox libraries), Local Sync, Remote Data Bank, Media Flow, Buttress (remote inference), and the verification toolchain (compile/preview MCP, on-device DevTools, definition-of-done gate). Triggers on multi-device sync, cloud data, media assets, AI offloading, E2E testing, canvas transitions, or verifying project work before declaring done.
3
+ description: Advanced BRICKS configuration knowledge. Covers Standby Transition, Automations (E2E testing), Data Calculation (JS sandbox libraries), Local Sync, Remote Data Bank, Media Flow, Buttress (remote inference), and the verification toolchain (compile, harness-specific preview tool, on-device DevTools, definition-of-done gate). Triggers on multi-device sync, cloud data, media assets, AI offloading, E2E testing, canvas transitions, or verifying project work before declaring done.
4
4
  ---
5
5
 
6
6
  # BRICKS Ctor - Advanced Features
@@ -20,7 +20,7 @@ This skill covers advanced BRICKS features not in the main project instructions.
20
20
  | [Remote Data Bank](rules/remote-data-bank.md) | Cloud data sync and API access |
21
21
  | [Media Flow](rules/media-flow.md) | Media asset management |
22
22
  | [Buttress](rules/buttress.md) | Remote inference for AI generators |
23
- | [Verification Toolchain](rules/verification-toolchain.md) | Definition of done, compile/preview MCP, on-device DevTools, Path 1/2/3 decision rule |
23
+ | [Verification Toolchain](rules/verification-toolchain.md) | Definition of done, compile, preview tool selection, on-device DevTools, Path 1/2/3 decision rule |
24
24
 
25
25
  ## Quick Reference
26
26
 
@@ -26,6 +26,8 @@ The primary way to orchestrate multi-step flows. A single event can contain an a
26
26
  - Use `dataParams` + `mapping` to pass event data downstream
27
27
  - This is the "glue" that wires generators, state, and UI together
28
28
 
29
+ Sequential `PROPERTY_BANK` / `PROPERTY_BANK_EXPRESSION` actions in one chain read the data values that existed when the chain started. If a later action needs to read what an earlier action wrote, set `waitAsync: true` on the earlier action.
30
+
29
31
  ### System Actions (Priority 3)
30
32
  Built-in commands for direct state and UI changes.
31
33
  - **PROPERTY_BANK**: set data value
@@ -67,3 +69,13 @@ Only actual data derivation maps to Data Calculation:
67
69
 
68
70
  ### Step 4: Wire with Event Action Chains
69
71
  Connect the pieces through events on generators and bricks.
72
+
73
+ ## Recipe: user-driven state machine (calculator, form wizard, picker)
74
+
75
+ A brief like "state vars X, Y, Z; button A updates X from X+Y; button B resets" is a state machine. The shape:
76
+
77
+ - Each state variable is its own `Data` entity. Displays read it via `linkData(() => data.dFoo)`.
78
+ - Each button's `onPress` is an Event Action Chain. For every state var that changes, append one `PROPERTY_BANK_EXPRESSION` whose `expression` reads the current state and returns the new value.
79
+ - Use `Data Calculation` only for reusable pure derivations referenced as inputs to those expressions.
80
+
81
+ A 10-button calculator with 4 state vars is ~10 small chains of 1–4 inline expressions. If you find yourself writing a single auto-mode `DataCalculationScript` that consumes all state vars and emits all-new state through mirror `dFooResult` data — or pinging a `dLastInput` field to force an auto calc to re-run — the chain shape was the right answer.
@@ -167,7 +167,7 @@ code: `
167
167
 
168
168
  ## Triggering Manually
169
169
 
170
- Use `PROPERTY_BANK_COMMAND` system action to trigger a manual calculation:
170
+ Use `PROPERTY_BANK_COMMAND` system action to trigger a manual calculation. `input` references a Data that is a trigger input (`trigger: true`) of the target calc — the system runs the calc(s) that data feeds into. It does NOT reference the DataCalculation itself.
171
171
 
172
172
  ```typescript
173
173
  const triggerCalc: EventAction = {
@@ -176,7 +176,7 @@ const triggerCalc: EventAction = {
176
176
  __actionName: 'PROPERTY_BANK_COMMAND',
177
177
  parent: 'System',
178
178
  dataParams: [
179
- { input: () => computeTotalCalc }, // Reference to DataCalculation
179
+ { input: () => priceData }, // Reference to a trigger Data input of the calc
180
180
  ],
181
181
  },
182
182
  }
@@ -194,9 +194,7 @@ const triggerCalc: EventAction = {
194
194
  See [Architecture Patterns](architecture-patterns.md) for the full pattern selection guide.
195
195
 
196
196
  ### Using Data Calc as an orchestrator
197
- Scripts that manage state machines, control UI flow, or coordinate multi-step processes belong in Event Action Chains, not here.
198
-
199
- **Symptom**: Script has if/else branches deciding "what happens next" or tracks "current step".
197
+ Scripts that manage state machines, control UI flow, or coordinate multi-step processes belong in Event Action Chains. Symptoms: if/else on "what happens next", mirror `dFooResult` outputs that copy back to `dFoo` via `valueChange`, or a `dLastInput` field set-then-cleared to force an auto calc. See the "user-driven state machine" recipe in [Architecture Patterns](architecture-patterns.md).
200
198
 
201
199
  ### Quick reference
202
200
 
@@ -7,7 +7,7 @@ Three runtime targets, one decision rule. Verify against the cheapest path that
7
7
  Before the agent is allowed to claim work is complete, **all** of the following must be true:
8
8
 
9
9
  1. **Compile clean.** Latest source passes `compile` with no errors.
10
- 2. **Every Canvas screenshot captured.** A rendered screenshot of every Canvas in the deliverable, captured via `preview` MCP (`responseImage: true`) at the target hardware resolution and orientation. Canvases gated behind events are reached via Automation runs (`testId` / `testTitleLike` with `brick_press` / `wait_until_canvas_change` cases). Single-Canvas Subspaces still require a captured screenshot.
10
+ 2. **Every Canvas screenshot captured.** A rendered screenshot of every Canvas in the deliverable, captured via the available preview tool (`responseImage: true` when the selected model supports vision) at the target hardware resolution and orientation. Canvases gated behind events are reached via Automation runs (`testId` / `testTitleLike` with `brick_press` / `wait_until_canvas_change` cases). Single-Canvas Subspaces still require a captured screenshot.
11
11
  3. **Every screenshot reviewed by the agent.** The agent must read each captured screenshot back through the host's image-reading capability — saving the file is not the same as seeing it. The model that produced the Canvas must also have seen the rendered result, or the verification gate has not passed.
12
12
  4. **Reference comparison report.** If the user supplied any reference material (Figma / website / HTML / screenshot / PDF / brand book / competitor), produce a short delta report per Canvas:
13
13
  - What matches the reference.
@@ -30,23 +30,30 @@ If any item is unmet, the work is mid-iteration. Say so explicitly to the user;
30
30
 
31
31
  The default loop. Always available; deterministic; no device wear; safe for side-effecting flows because nothing real fires.
32
32
 
33
- ### `bricks-ctor` MCP `compile`
33
+ `bun update-app` and `bun deploy-app` publish to the BRICKS portal. The local preview reads `.bricks/build/application-config.json` (produced by `compile`) directly.
34
+
35
+ ### Compile tool
34
36
 
35
37
  Typecheck + compile the project. Gate every iteration on this; everything below assumes a clean compile.
36
38
 
37
39
  Agent invocation: call the MCP tool `compile` exposed by the `bricks-ctor` MCP server registered for the project. No arguments.
38
40
 
39
- ### `bricks-ctor` MCP — `preview`
41
+ ### Preview tool
42
+
43
+ Use the preview implementation exposed by the current harness:
44
+
45
+ - **CTOR Desktop agent session:** use `preview_invoke`. CTOR Desktop disables the `bricks-ctor` MCP `preview` tool and routes screenshots/automation through the desktop preview pane instead. If the user already opened the simulator pane, `preview_invoke` should reuse it rather than start a separate preview.
46
+ - **Pure `bricks-ctor` project / other agent harness:** use the `bricks-ctor` MCP `preview` tool when `preview_invoke` is not available.
40
47
 
41
- Launches headless Electron, takes a screenshot, optionally runs a named Automation test by id or partial title.
48
+ Both forms are the same verification primitive: launch or reuse Electron preview, take a screenshot, and optionally run a named Automation test by id or partial title. Do not hard-code one tool name into the workflow; choose the available preview tool for the environment.
42
49
 
43
- Arguments:
44
- - `delay` (ms before screenshot) — default 3000. Increase if Standby Transitions are still in flight.
50
+ Common arguments:
51
+ - `delay` (ms before screenshot) — default is harness-specific: usually 3000 for a fresh/standalone preview; CTOR Desktop may capture immediately when its preview already has a settled latest config. Increase if Standby Transitions are still in flight.
45
52
  - `width`, `height` — screenshot dimensions in px.
46
- - `responseImage: true` — return base64 jpeg as MCP image content (recommended for visual sanity).
53
+ - `responseImage: true` — return the screenshot as image content when the selected model supports vision. If vision is unavailable, save the screenshot and report the path.
47
54
  - `testId` or `testTitleLike` — run a project Automation before the screenshot. Use `testTitleLike` for fuzzy matches (case-insensitive partial title).
48
55
 
49
- Returns text log + (if `responseImage`) base64 image content.
56
+ Returns text log + saved screenshot path + image content when supported.
50
57
 
51
58
  ### `bun preview` (project script)
52
59
 
@@ -76,7 +83,7 @@ Trigger types: `launch` (runs on app start), `anytime` (manual), `cron` (schedul
76
83
 
77
84
  Important: the automation map id must be `'AUTOMATION_MAP_DEFAULT'` (not a generated id) — the preview test runner reads from `automationMap['AUTOMATION_MAP_DEFAULT']?.map`.
78
85
 
79
- Run a single test from the agent: `bricks-ctor` MCP `preview` with `testId` or `testTitleLike`.
86
+ Run a single test from the agent: call the available preview tool (`preview_invoke` in CTOR Desktop, otherwise `bricks-ctor` MCP `preview`) with `testId` or `testTitleLike`.
80
87
 
81
88
  ## Path 2 — Real device with DevTools enabled
82
89
 
@@ -23,7 +23,7 @@ description: >-
23
23
  Encodes architecture truths, performance and complexity guardrails,
24
24
  input-translation rules, visual languages library, Direction
25
25
  Advisor for vague briefs, Media Flow protocol for branded work.
26
- Verification toolchain (compile/preview MCP, on-device DevTools,
26
+ Verification toolchain (compile, preview tool selection, on-device DevTools,
27
27
  Path 1/2/3) lives in the bricks-ctor skill.
28
28
  ---
29
29
 
@@ -57,7 +57,7 @@ Use when variations share most of the Brick tree but differ on a chunk that can'
57
57
  - Each variant Subspace imports the shared module and overrides only the variant-specific chunk.
58
58
  - Bricks reused by reference, not duplicated.
59
59
 
60
- **Comparison surface:** screenshot per variant via preview MCP, assembled in chat.
60
+ **Comparison surface:** screenshot per variant via the available preview tool, assembled in chat.
61
61
 
62
62
  **Token cost:** 1 shared module + N small variant Subspaces.
63
63
 
@@ -71,11 +71,11 @@ Default property:
71
71
  property?: {
72
72
  /* Connect printer on generator initialized */
73
73
  init?: boolean | DataLink
74
- /* Connection driver */
75
- driver?: 'escpos' | 'star' | 'tsc' | DataLink
76
- /* The address of the printer */
74
+ /* Connection driver (`castles` driver: built-in or WiFi printer on Castles Saturn PDA) */
75
+ driver?: 'escpos' | 'star' | 'tsc' | 'castles' | DataLink
76
+ /* The address of the printer (For castles driver: `mode=builtin` (Saturn 1000) or `mode=wifi` (Saturn 7000); optional `heatLevel=1-5`, default 3) */
77
77
  connectString?: string | DataLink
78
- /* The language of the printer (only for EPSON) */
78
+ /* The language of the printer (only for EPSON and TSC drivers) */
79
79
  lang?: 'ANK' | 'CHINESE' | 'TAIWAN' | 'KOREAN' | 'THAI' | 'SOUTHASIA' | DataLink
80
80
  /* The timeout of scanning */
81
81
  scanTimeout?: number | DataLink
@@ -99,10 +99,12 @@ Default property:
99
99
  { type: 'barcode', content: '1234567890', barcodeType: 'CODE128' }
100
100
  { type: 'symbol', content: '1234567890', symbolType: 'QRCODE' }
101
101
  Notes:
102
- - `reverse-feed` only works on ESC/POS driver
102
+ - `reverse-feed` works on ESC/POS driver and castles driver (line mode only)
103
103
  - `width` and `height` in Star driver is magnification factor
104
104
  - `y` position in ESC/POS is use feed lines to offset
105
- - `textFont` only works on TSC driver */
105
+ - `textFont` only works on TSC driver
106
+ - castles driver: `image` requires `height` in line mode
107
+ - castles driver: `UPC_A`, `UPC_E`, `ITF` barcode types are not supported */
106
108
  payload?:
107
109
  | Array<
108
110
  | DataLink
@@ -149,7 +151,7 @@ Default property:
149
151
  }
150
152
  >
151
153
  | DataLink
152
- /* Raw ASCII commands to print */
154
+ /* Raw ASCII commands to print (not supported on castles driver) */
153
155
  rawCommands?: string | DataLink
154
156
  }
155
157
  events?: {