@fugood/bricks-project 2.23.6 → 2.23.8

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 (89) hide show
  1. package/compile/action-name-map.ts +6 -0
  2. package/compile/index.ts +64 -43
  3. package/compile/util.ts +2 -0
  4. package/package.json +2 -2
  5. package/skills/bricks-design/LICENSE.txt +180 -0
  6. package/skills/bricks-design/SKILL.md +66 -0
  7. package/tools/deploy.ts +2 -2
  8. package/tools/preview.ts +1 -1
  9. package/types/automation.ts +1 -1
  10. package/types/bricks/Camera.ts +15 -7
  11. package/types/bricks/Chart.ts +9 -3
  12. package/types/bricks/GenerativeMedia.ts +24 -8
  13. package/types/bricks/Icon.ts +6 -2
  14. package/types/bricks/Image.ts +7 -3
  15. package/types/bricks/Items.ts +22 -8
  16. package/types/bricks/Lottie.ts +12 -4
  17. package/types/bricks/Maps.ts +13 -5
  18. package/types/bricks/QrCode.ts +6 -2
  19. package/types/bricks/Rect.ts +6 -2
  20. package/types/bricks/RichText.ts +6 -2
  21. package/types/bricks/Rive.ts +20 -10
  22. package/types/bricks/Slideshow.ts +17 -7
  23. package/types/bricks/Svg.ts +5 -1
  24. package/types/bricks/Text.ts +6 -2
  25. package/types/bricks/TextInput.ts +13 -7
  26. package/types/bricks/Video.ts +8 -4
  27. package/types/bricks/VideoStreaming.ts +5 -1
  28. package/types/bricks/WebRtcStream.ts +6 -2
  29. package/types/bricks/WebView.ts +9 -5
  30. package/types/common.ts +10 -8
  31. package/types/generators/AlarmClock.ts +12 -6
  32. package/types/generators/Assistant.ts +12 -6
  33. package/types/generators/BleCentral.ts +19 -7
  34. package/types/generators/BlePeripheral.ts +6 -2
  35. package/types/generators/CanvasMap.ts +6 -2
  36. package/types/generators/CastlesPay.ts +12 -4
  37. package/types/generators/DataBank.ts +13 -5
  38. package/types/generators/File.ts +46 -16
  39. package/types/generators/GraphQl.ts +9 -3
  40. package/types/generators/Http.ts +6 -2
  41. package/types/generators/HttpServer.ts +14 -6
  42. package/types/generators/Information.ts +7 -3
  43. package/types/generators/Intent.ts +7 -3
  44. package/types/generators/Iterator.ts +9 -5
  45. package/types/generators/Keyboard.ts +9 -5
  46. package/types/generators/LlmAnthropicCompat.ts +21 -5
  47. package/types/generators/LlmAppleBuiltin.ts +19 -4
  48. package/types/generators/LlmGgml.ts +65 -6
  49. package/types/generators/LlmMediaTekNeuroPilot.ts +16 -5
  50. package/types/generators/LlmMlx.ts +22 -5
  51. package/types/generators/LlmOnnx.ts +16 -5
  52. package/types/generators/LlmOpenAiCompat.ts +25 -5
  53. package/types/generators/LlmQualcommAiEngine.ts +13 -5
  54. package/types/generators/Mcp.ts +43 -17
  55. package/types/generators/McpServer.ts +20 -8
  56. package/types/generators/MediaFlow.ts +12 -4
  57. package/types/generators/MqttBroker.ts +19 -7
  58. package/types/generators/MqttClient.ts +8 -4
  59. package/types/generators/Question.ts +7 -3
  60. package/types/generators/RealtimeTranscription.ts +26 -8
  61. package/types/generators/RerankerGgml.ts +20 -3
  62. package/types/generators/SerialPort.ts +12 -4
  63. package/types/generators/SoundPlayer.ts +8 -2
  64. package/types/generators/SoundRecorder.ts +7 -3
  65. package/types/generators/SpeechToTextGgml.ts +18 -4
  66. package/types/generators/SpeechToTextOnnx.ts +10 -3
  67. package/types/generators/SpeechToTextPlatform.ts +11 -3
  68. package/types/generators/SqLite.ts +10 -4
  69. package/types/generators/Step.ts +6 -2
  70. package/types/generators/SttAppleBuiltin.ts +16 -3
  71. package/types/generators/Tcp.ts +8 -4
  72. package/types/generators/TcpServer.ts +13 -7
  73. package/types/generators/TextToSpeechAppleBuiltin.ts +16 -3
  74. package/types/generators/TextToSpeechGgml.ts +21 -3
  75. package/types/generators/TextToSpeechOnnx.ts +10 -3
  76. package/types/generators/TextToSpeechOpenAiLike.ts +9 -3
  77. package/types/generators/ThermalPrinter.ts +7 -3
  78. package/types/generators/Tick.ts +8 -4
  79. package/types/generators/Udp.ts +8 -4
  80. package/types/generators/VadGgml.ts +12 -4
  81. package/types/generators/VadOnnx.ts +11 -4
  82. package/types/generators/VadTraditional.ts +13 -4
  83. package/types/generators/VectorStore.ts +7 -3
  84. package/types/generators/Watchdog.ts +8 -4
  85. package/types/generators/WebCrawler.ts +6 -2
  86. package/types/generators/WebRtc.ts +13 -5
  87. package/types/generators/WebSocket.ts +6 -2
  88. package/types/subspace.ts +2 -0
  89. package/utils/event-props.ts +833 -1059
@@ -716,6 +716,8 @@ export const templateActionNameMap = {
716
716
  parallelToolCalls: 'GENERATOR_LLM_PARALLEL_TOOL_CALLS',
717
717
  toolChoice: 'GENERATOR_LLM_TOOL_CHOICE',
718
718
  enableThinking: 'GENERATOR_LLM_ENABLE_THINKING',
719
+ thinkingBudgetTokens: 'GENERATOR_LLM_THINKING_BUDGET_TOKENS',
720
+ thinkingBudgetMessage: 'GENERATOR_LLM_THINKING_BUDGET_MESSAGE',
719
721
  prompt: 'GENERATOR_LLM_PROMPT',
720
722
  promptMediaPaths: 'GENERATOR_LLM_PROMPT_MEDIA_PATHS',
721
723
  promptTemplateData: 'GENERATOR_LLM_PROMPT_TEMPLATE_DATA',
@@ -724,6 +726,7 @@ export const templateActionNameMap = {
724
726
  chatTemplateKwargs: 'GENERATOR_LLM_CHAT_TEMPLATE_KWARGS',
725
727
  addGenerationPrompt: 'GENERATOR_LLM_ADD_GENERATION_PROMPT',
726
728
  now: 'GENERATOR_LLM_NOW',
729
+ forcePureContent: 'GENERATOR_LLM_FORCE_PURE_CONTENT',
727
730
  },
728
731
  GENERATOR_LLM_COMPLETION: {
729
732
  sessionKey: 'GENERATOR_LLM_SESSION_KEY',
@@ -733,6 +736,8 @@ export const templateActionNameMap = {
733
736
  parallelToolCalls: 'GENERATOR_LLM_PARALLEL_TOOL_CALLS',
734
737
  toolChoice: 'GENERATOR_LLM_TOOL_CHOICE',
735
738
  enableThinking: 'GENERATOR_LLM_ENABLE_THINKING',
739
+ thinkingBudgetTokens: 'GENERATOR_LLM_THINKING_BUDGET_TOKENS',
740
+ thinkingBudgetMessage: 'GENERATOR_LLM_THINKING_BUDGET_MESSAGE',
736
741
  useReasoningFormat: 'GENERATOR_LLM_USE_REASONING_FORMAT',
737
742
  prompt: 'GENERATOR_LLM_PROMPT',
738
743
  promptMediaPaths: 'GENERATOR_LLM_PROMPT_MEDIA_PATHS',
@@ -742,6 +747,7 @@ export const templateActionNameMap = {
742
747
  chatTemplateKwargs: 'GENERATOR_LLM_CHAT_TEMPLATE_KWARGS',
743
748
  addGenerationPrompt: 'GENERATOR_LLM_ADD_GENERATION_PROMPT',
744
749
  now: 'GENERATOR_LLM_NOW',
750
+ forcePureContent: 'GENERATOR_LLM_FORCE_PURE_CONTENT',
745
751
  grammar: 'GENERATOR_LLM_GRAMMAR',
746
752
  stopWords: 'GENERATOR_LLM_STOP_WORDS',
747
753
  predict: 'GENERATOR_LLM_PREDICT',
package/compile/index.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  /* eslint-disable no-underscore-dangle -- Uses __typename, __actionName, etc. for type system */
2
+ import camelCase from 'lodash/camelCase'
3
+ import upperFirst from 'lodash/upperFirst'
2
4
  import snakeCase from 'lodash/snakeCase'
3
5
  import omit from 'lodash/omit'
4
6
  import { parse as parseAST } from 'acorn'
@@ -91,14 +93,39 @@ const compileProperty = (property, errorReference: string, result = {}) => {
91
93
  return property
92
94
  }
93
95
 
96
+ const compileScriptCalculationCode = (code = '') => {
97
+ try {
98
+ const program = parseAST(code, { sourceType: 'module', ecmaVersion: 2020 })
99
+ // export function main() { ... }
100
+ const declarationBody = (
101
+ (program.body[0] as ExportNamedDeclaration).declaration as FunctionDeclaration
102
+ )?.body
103
+ return escodegen.generate(declarationBody, {
104
+ format: {
105
+ indent: { style: ' ' },
106
+ semicolons: false,
107
+ },
108
+ comment: true,
109
+ })
110
+ } catch {
111
+ return code || ''
112
+ }
113
+ }
114
+
115
+ const getTemplateName = (key: string) =>
116
+ upperFirst(camelCase(key.replace(/^(BRICK|GENERATOR)_/, '')))
117
+
94
118
  const compileEventActionValue = (templateKey, eventKey, value, errorReference) => {
95
- const tmplEventProperties = templateEventPropsMap[templateKey]
119
+ const tmplEventProperties = templateEventPropsMap[getTemplateName(templateKey)]
96
120
  const props = tmplEventProperties?.[eventKey]
97
121
  if (!props) return compileProperty(value, errorReference)
98
- if (props.includes(value)) return value
99
- if (typeof value === 'string' && value?.startsWith(templateKey)) {
122
+ if (typeof value === 'string' && value in props) {
123
+ const expectedType = props[value]
124
+ if (expectedType) return value
125
+ }
126
+ if (typeof value === 'string' && /^(BRICK|GENERATOR)_/.test(value)) {
100
127
  console.warn(
101
- `[Warning] Value start with template key but there is no event property: ${value} ${errorReference}`,
128
+ `[Warning] Event property "${value}" is not compatible with event "${eventKey}" of ${templateKey} ${errorReference}`,
102
129
  )
103
130
  }
104
131
  return compileProperty(value, errorReference)
@@ -144,7 +171,7 @@ const compileEvents = (
144
171
  eventMap: { [key: string]: Array<any> },
145
172
  options = { camelCase: false, errorReference: '' },
146
173
  ) => {
147
- const { camelCase, errorReference } = options
174
+ const { camelCase: useCamelCase, errorReference } = options
148
175
  return Object.entries(eventMap).reduce((acc, [key, events]) => {
149
176
  acc[convertEventKey(templateKey, key)] = events.map((event) => {
150
177
  const { handler, action } = event
@@ -169,37 +196,37 @@ const compileEvents = (
169
196
  if (!handlerKey) throw new Error(`Invalid handler: ${handler} ${errorReference}`)
170
197
 
171
198
  const parameterList: Array<object> = []
172
- if (Object.hasOwn(action, 'params')) {
199
+ if (Object.prototype.hasOwnProperty.call(action, 'params')) {
173
200
  const actionDef = action as ActionWithParams
174
201
  ;(actionDef.params || []).forEach(({ input, value, mapping }) => {
175
202
  const param = {
176
- [camelCase ? 'inputToReceiver' : 'input_to_receiver']: handlerTemplateKey
203
+ [useCamelCase ? 'inputToReceiver' : 'input_to_receiver']: handlerTemplateKey
177
204
  ? compileActionParam(handlerTemplateKey, action.__actionName, input)
178
205
  : input,
179
- [camelCase ? 'resultFromSender' : 'result_from_sender']:
206
+ [useCamelCase ? 'resultFromSender' : 'result_from_sender']:
180
207
  mapping || compileEventActionValue(handlerTemplateKey, key, value, errorReference),
181
208
  }
182
- if (mapping) param[camelCase ? 'resultDataMapping' : 'result_data_mapping'] = true
209
+ if (mapping) param[useCamelCase ? 'resultDataMapping' : 'result_data_mapping'] = true
183
210
  parameterList.push(param)
184
211
  })
185
- } else if (Object.hasOwn(action, 'dataParams')) {
212
+ } else if (Object.prototype.hasOwnProperty.call(action, 'dataParams')) {
186
213
  const actionDef = action as ActionWithDataParams
187
214
  ;(actionDef.dataParams || []).forEach(({ input, value, mapping }) => {
188
215
  if (!input) return
189
216
  const param = {
190
- [camelCase ? 'inputToReceiver' : 'input_to_receiver']: input().id,
191
- [camelCase ? 'resultFromSender' : 'result_from_sender']:
217
+ [useCamelCase ? 'inputToReceiver' : 'input_to_receiver']: input().id,
218
+ [useCamelCase ? 'resultFromSender' : 'result_from_sender']:
192
219
  mapping || compileEventActionValue(handlerTemplateKey, key, value, errorReference),
193
220
  }
194
- if (mapping) param[camelCase ? 'resultDataMapping' : 'result_data_mapping'] = true
221
+ if (mapping) param[useCamelCase ? 'resultDataMapping' : 'result_data_mapping'] = true
195
222
  parameterList.push(param)
196
223
  })
197
224
  }
198
225
  return {
199
226
  handler: handlerKey,
200
227
  action: action.__actionName,
201
- [camelCase ? 'parameterList' : 'parameter_list']: parameterList,
202
- [camelCase ? 'waitAsync' : 'wait_async']: event.waitAsync,
228
+ [useCamelCase ? 'parameterList' : 'parameter_list']: parameterList,
229
+ [useCamelCase ? 'waitAsync' : 'wait_async']: event.waitAsync,
203
230
  }
204
231
  })
205
232
  return acc
@@ -393,14 +420,21 @@ const compileTestCase = (testCase: TestCase) => ({
393
420
  pre_delay: testCase.pre_delay,
394
421
  post_delay: testCase.post_delay,
395
422
  post_delay_rule: testCase.post_delay_rule,
396
- jump_cond: testCase.jump_cond.map((cond) => ({
397
- type: cond.type,
398
- status: cond.status,
399
- variable: cond.variable,
400
- operator: cond.operator,
401
- value: cond.value,
402
- jump_to: cond.jump_to,
403
- })),
423
+ jump_cond: testCase.jump_cond.map((cond) => {
424
+ if (cond.jump_to == null) {
425
+ console.warn(
426
+ `[Warning] jump_cond is missing jump_to in test case "${testCase.name}" (${testCase.id})`,
427
+ )
428
+ }
429
+ return {
430
+ type: cond.type,
431
+ status: cond.status,
432
+ variable: cond.variable,
433
+ operator: cond.operator,
434
+ value: cond.value,
435
+ jump_to: cond.jump_to,
436
+ }
437
+ }),
404
438
  })
405
439
 
406
440
  /**
@@ -524,6 +558,8 @@ export const compile = async (app: Application) => {
524
558
  title: subspace.title,
525
559
  description: subspace.description,
526
560
  hide_short_ref: subspace.hideShortRef,
561
+ unused: subspace.unused,
562
+ portal: subspace.portal,
527
563
  _expanded: subspace.unexpanded
528
564
  ? {
529
565
  brick: !subspace.unexpanded.brick,
@@ -1105,25 +1141,10 @@ export const compile = async (app: Application) => {
1105
1141
  const scriptCalc = dataCalc as DataCalculationScript
1106
1142
  calc.type = 'script'
1107
1143
 
1108
- let code: string
1109
- try {
1110
- const program = parseAST(scriptCalc.code, { sourceType: 'module', ecmaVersion: 2020 })
1111
- // export function main() { ... }
1112
- const declarationBody = (
1113
- (program.body[0] as ExportNamedDeclaration).declaration as FunctionDeclaration
1114
- )?.body
1115
- code = escodegen.generate(declarationBody, {
1116
- format: {
1117
- indent: { style: ' ' },
1118
- semicolons: false,
1119
- },
1120
- comment: true,
1121
- })
1122
- } catch {
1123
- code = scriptCalc.code || ''
1124
- }
1144
+ const code = compileScriptCalculationCode(scriptCalc.code)
1125
1145
  calc.script_config = {
1126
- note: scriptCalc.note,
1146
+ title: scriptCalc.title ?? '',
1147
+ note: scriptCalc.note ?? '',
1127
1148
  code,
1128
1149
  enable_async: scriptCalc.enableAsync,
1129
1150
  trigger_mode: scriptCalc.triggerMode,
@@ -1151,7 +1172,7 @@ export const compile = async (app: Application) => {
1151
1172
  'PROPERTY_BANK_DATA_NODE',
1152
1173
  `(data calc: ${dataCalcId}, script output, subspace: ${subspaceId})`,
1153
1174
  )
1154
- : undefined,
1175
+ : null,
1155
1176
  outputs: scriptCalc.outputs.reduce((acc, output) => {
1156
1177
  if (!acc[output.key]) acc[output.key] = []
1157
1178
  const outputId = assertEntryId(
@@ -1168,7 +1189,7 @@ export const compile = async (app: Application) => {
1168
1189
  'PROPERTY_BANK_DATA_NODE',
1169
1190
  `(data calc: ${dataCalcId}, script error output, subspace: ${subspaceId})`,
1170
1191
  )
1171
- : undefined,
1192
+ : null,
1172
1193
  }
1173
1194
 
1174
1195
  Object.assign(
package/compile/util.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { makeId } from '../utils/id'
2
2
 
3
3
  type ScriptConfig = {
4
+ title?: string
5
+ note?: string
4
6
  inputs: Record<string, string>
5
7
  enable_async: boolean
6
8
  trigger_mode?: 'auto' | 'manual'
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.23.6",
3
+ "version": "2.23.8",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
7
7
  "build": "bun scripts/build.js"
8
8
  },
9
9
  "dependencies": {
10
- "@fugood/bricks-cli": "^2.23.6",
10
+ "@fugood/bricks-cli": "^2.23.8",
11
11
  "@huggingface/gguf": "^0.3.2",
12
12
  "@iarna/toml": "^3.0.0",
13
13
  "@modelcontextprotocol/sdk": "^1.15.0",
@@ -0,0 +1,180 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ This skill is a derivative work based on:
179
+ https://github.com/anthropics/skills/blob/main/skills/frontend-design/SKILL.md
180
+ Copyright Anthropic, PBC. Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: bricks-design
3
+ description: Create distinctive, production-grade BRICKS application interfaces with high design quality. Use this skill when the user asks to build BRICKS canvases, screens, layouts, or applications. Generates creative, polished BRICKS code that avoids generic aesthetics.
4
+ license: Complete terms in LICENSE.txt (Apache-2.0, based on github.com/anthropics/skills)
5
+ ---
6
+
7
+ This skill guides creation of distinctive, production-grade BRICKS application interfaces that avoid generic aesthetics. Implement working code with exceptional attention to visual design and creative choices.
8
+
9
+ The user provides interface requirements: a screen, layout, application, or component to build. They may include context about the purpose, audience, platform, or technical constraints.
10
+
11
+ ## Design Thinking
12
+
13
+ Before coding, understand the context and commit to a **bold** aesthetic direction:
14
+ - **Purpose**: What problem does this interface solve? Who uses it? What platform(s)?
15
+ - **Tone**: Pick a strong direction: brutally minimal, maximalist, retro-futuristic, organic/natural, luxury/refined, playful, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. Use these for inspiration but design one true to the aesthetic.
16
+ - **Constraints**: Target platform (mobile, TV, desktop, kiosk), screen dimensions, accessibility needs.
17
+ - **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
18
+
19
+ **CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work — the key is intentionality, not intensity.
20
+
21
+ Then implement working BRICKS TypeScript code that is:
22
+ - Production-grade and functional
23
+ - Visually striking and memorable
24
+ - Cohesive with a clear aesthetic point-of-view
25
+ - Meticulously refined in every detail
26
+
27
+ ## Aesthetics Guidelines
28
+
29
+ ### Typography
30
+ Choose fonts that are beautiful, unique, and interesting. Avoid defaulting to system fonts — opt for distinctive choices that elevate the interface. Pair a characterful display font with a refined body font. Create clear typographic hierarchy through weight, size, spacing, and alignment. Use auto-scaling (`fontSizeVector`) when text should fill its container proportionally.
31
+
32
+ ### Color & Theme
33
+ Commit to a cohesive palette. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. Use gradients for rich, atmospheric surfaces — multi-stop linear gradients create far more depth than flat fills. Use Data nodes as a shared color store for consistency across bricks.
34
+
35
+ ### Motion & Animation
36
+ Focus on high-impact moments: one well-orchestrated canvas enter with staggered standby reveals creates more delight than scattered micro-interactions. Use spring animations for natural, bouncy UI elements. Use composed animations (parallel/sequence) for coordinated entrance choreography. Reserve looping animations (`breatheStart`) for attention-drawing elements — overuse dulls their impact.
37
+
38
+ ### Spatial Composition
39
+ Absolute positioning gives total control — use it creatively. Overlap bricks. Create asymmetric layouts. Use generous negative space OR controlled density. Break grid expectations. Consider rotation for diagonal flow and perspective. Vary scale dramatically between elements for visual tension.
40
+
41
+ ### Depth & Atmosphere
42
+ Create atmosphere through layered elements rather than flat solid colors:
43
+ - **Gradients** with multiple color stops for rich backgrounds
44
+ - **Shadows** for elevation and hierarchy
45
+ - **Blur effects** (blur, progressive blur, liquid glass) for glass morphism on native platforms
46
+ - **Opacity layering** — stack semi-transparent rects for texture and depth
47
+ - **Border details** — per-side colors, styles, and widths for decorative framing
48
+
49
+ ### Interactive Polish
50
+ Design interactions that feel tactile and responsive:
51
+ - Scale/opacity animations on press for physical feedback
52
+ - Focus states for TV/controller navigation
53
+ - Outlet-driven switches for state-dependent visual changes
54
+ - Deliberate long-press patterns for secondary actions
55
+
56
+ ## What to NEVER Do
57
+
58
+ - **No generic aesthetics**: Avoid the same tired palette, the same safe layout, the same system font on every screen. Each design should feel distinct and intentional.
59
+ - **No flat sameness**: Don't make every canvas look like the same template with different text. Vary spatial composition, color weight, animation timing, and typographic scale.
60
+ - **No placeholder layouts**: Don't just center everything in a grid. Use the absolute positioning system to create spatial interest — overlap, offset, scale contrast.
61
+
62
+ Vary between light and dark themes, different fonts, different aesthetics across generations. NEVER converge on common choices across designs.
63
+
64
+ **IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate animations, layered rects, and rich gradients. Minimalist designs need restraint, precision in spacing, and carefully chosen typography. Elegance comes from executing the vision well.
65
+
66
+ Remember: The agent is capable of extraordinary creative work. Don't hold back — show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
package/tools/deploy.ts CHANGED
@@ -62,7 +62,7 @@ if (versionArg) {
62
62
  if (pkgExists) {
63
63
  const pkg = await pkgFile.json()
64
64
  pkg.version = version
65
- await Bun.write(`${cwd}/package.json`, JSON.stringify(pkg, null, 2) + '\n')
65
+ await Bun.write(`${cwd}/package.json`, `${JSON.stringify(pkg, null, 2)}\n`)
66
66
  }
67
67
  } else if (autoVersion && pkgExists) {
68
68
  const pkg = await pkgFile.json()
@@ -70,7 +70,7 @@ if (versionArg) {
70
70
  parts[2] = String(Number(parts[2] || 0) + 1)
71
71
  version = parts.join('.')
72
72
  pkg.version = version
73
- await Bun.write(`${cwd}/package.json`, JSON.stringify(pkg, null, 2) + '\n')
73
+ await Bun.write(`${cwd}/package.json`, `${JSON.stringify(pkg, null, 2)}\n`)
74
74
  } else {
75
75
  version = pkgExists ? (await pkgFile.json()).version : undefined
76
76
  }
package/tools/preview.ts CHANGED
@@ -66,7 +66,7 @@ const useTypecheck = !values['skip-typecheck']
66
66
 
67
67
  const compile = async () => {
68
68
  if (useTypecheck) await $`bun typecheck`
69
- await $`bun compile`
69
+ await $`bun compile.ts`
70
70
  }
71
71
 
72
72
  await compile()
@@ -45,7 +45,7 @@ export interface TestCaseJumpCondition {
45
45
  operator?: JumpConditionOperator
46
46
  value?: any
47
47
  // The test case to jump to (getter function for dynamic IDs or string for static IDs)
48
- jump_to: string | (() => TestCase)
48
+ jump_to?: string | (() => TestCase)
49
49
  }
50
50
 
51
51
  /**
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Camera view with photo capture and barcode scanning capabilities
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
  /* Take picture on the Camera */
17
21
  export type BrickCameraActionTakePicture = ActionWithParams & {
@@ -151,19 +155,23 @@ Default property:
151
155
  }
152
156
  events?: BrickBasicEvents & {
153
157
  /* Event of the Camera state change */
154
- stateChange?: Array<EventAction>
158
+ stateChange?: Array<EventAction<string & keyof TemplateEventPropsMap['Camera']['stateChange']>>
155
159
  /* Event of the Camera record start */
156
160
  recordStart?: Array<EventAction>
157
161
  /* Event of the Camera record end */
158
162
  recordEnd?: Array<EventAction>
159
163
  /* Event of the Camera barcode read */
160
- barcodeRead?: Array<EventAction>
164
+ barcodeRead?: Array<EventAction<string & keyof TemplateEventPropsMap['Camera']['barcodeRead']>>
161
165
  /* Event of the Camera picture taken */
162
- pictureTaken?: Array<EventAction>
166
+ pictureTaken?: Array<
167
+ EventAction<string & keyof TemplateEventPropsMap['Camera']['pictureTaken']>
168
+ >
163
169
  /* Event of the Camera record finished */
164
- recordFinish?: Array<EventAction>
170
+ recordFinish?: Array<
171
+ EventAction<string & keyof TemplateEventPropsMap['Camera']['recordFinish']>
172
+ >
165
173
  /* Event of the Camera mount error */
166
- mountError?: Array<EventAction>
174
+ mountError?: Array<EventAction<string & keyof TemplateEventPropsMap['Camera']['mountError']>>
167
175
  }
168
176
  outlets?: {
169
177
  /* Camera device and format information */
@@ -215,7 +223,7 @@ Default property:
215
223
  }
216
224
  }
217
225
 
218
- /* Camera view brick */
226
+ /* Camera view with photo capture and barcode scanning capabilities */
219
227
  export type BrickCamera = Brick &
220
228
  BrickCameraDef & {
221
229
  templateKey: 'BRICK_CAMERA'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Chart brick, based on [Apache ECharts](https://echarts.apache.org/en/index.html).
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
  /* Data highlight */
17
21
  export type BrickChartActionDataHighlight = ActionWithParams & {
@@ -332,9 +336,11 @@ Default property:
332
336
  /* Event of chart render */
333
337
  onRender?: Array<EventAction>
334
338
  /* Event of data point on press */
335
- onPress?: Array<EventAction>
339
+ onPress?: Array<EventAction<string & keyof TemplateEventPropsMap['Chart']['onPress']>>
336
340
  /* Event of legend select changed */
337
- onLegendSelectChanged?: Array<EventAction>
341
+ onLegendSelectChanged?: Array<
342
+ EventAction<string & keyof TemplateEventPropsMap['Chart']['onLegendSelectChanged']>
343
+ >
338
344
  }
339
345
  animation?: AnimationBasicEvents & {
340
346
  onRender?: Animation