@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
@@ -0,0 +1,91 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
2
+ import { z } from 'zod'
3
+ import { $ } from 'bun'
4
+
5
+ export function register(server: McpServer, projectDir: string) {
6
+ const { dirname } = import.meta
7
+
8
+ server.tool('compile', {}, async () => {
9
+ let log = ''
10
+ try {
11
+ log += 'Type checking & Compiling...'
12
+ log += await $`bun compile`.cwd(projectDir).text()
13
+ } catch (err) {
14
+ log += `${err.stdout.toString()}\n${err.stderr.toString()}`
15
+ }
16
+ return {
17
+ content: [{ type: 'text', text: log }],
18
+ }
19
+ })
20
+
21
+ server.tool(
22
+ 'preview',
23
+ {
24
+ delay: z
25
+ .number()
26
+ .describe('Delay in milliseconds before taking screenshot')
27
+ .optional()
28
+ .default(3000),
29
+ width: z.number().describe('Width of the screenshot').optional().default(600),
30
+ height: z.number().optional().default(480),
31
+ responseImage: z
32
+ .boolean()
33
+ .describe(
34
+ 'Whether to response image content (base64 encoded jpeg). If false, only saved path will be responded as text.',
35
+ )
36
+ .optional()
37
+ .default(false),
38
+ testId: z.string().describe('Automation test ID to trigger').optional(),
39
+ testTitleLike: z
40
+ .string()
41
+ .describe('Find automation test by partial title match (case-insensitive)')
42
+ .optional(),
43
+ } as any,
44
+ async ({ delay, width, height, responseImage, testId, testTitleLike }: any) => {
45
+ let log = ''
46
+ let error = false
47
+ try {
48
+ const toolsDir = `${dirname}/..`
49
+ const args = [
50
+ '--no-keep-open',
51
+ '--take-screenshot',
52
+ JSON.stringify({
53
+ delay,
54
+ width,
55
+ height,
56
+ path: `${toolsDir}/screenshot.jpg`,
57
+ closeAfter: true,
58
+ headless: true,
59
+ }),
60
+ ]
61
+ if (testId) args.push('--test-id', testId)
62
+ if (testTitleLike) args.push('--test-title-like', testTitleLike)
63
+ log = await $`bunx --bun electron ${toolsDir}/preview-main.mjs ${args}`
64
+ .cwd(projectDir)
65
+ .text()
66
+ } catch (err) {
67
+ log = `${err.stdout.toString()}\n${err.stderr.toString()}`
68
+ error = true
69
+ }
70
+ let screenshotBase64: string | null = null
71
+ if (!error && responseImage) {
72
+ const toolsDir = `${dirname}/..`
73
+ const screenshot = await Bun.file(`${toolsDir}/screenshot.jpg`).arrayBuffer()
74
+ screenshotBase64 = Buffer.from(screenshot).toString('base64')
75
+ }
76
+ const content: Array<
77
+ { type: 'text'; text: string } | { type: 'image'; data: string; mimeType: string }
78
+ > = [{ type: 'text', text: log }]
79
+ if (screenshotBase64) {
80
+ content.push({
81
+ type: 'image',
82
+ data: screenshotBase64,
83
+ mimeType: 'image/jpeg',
84
+ })
85
+ }
86
+ return {
87
+ content,
88
+ }
89
+ },
90
+ )
91
+ }