@fugood/bricks-project 2.23.3 → 2.23.5-1
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/compile/action-name-map.ts +14 -0
- package/compile/index.ts +29 -0
- package/package.json +3 -3
- package/skills/bricks-project/rules/architecture-patterns.md +7 -0
- package/skills/bricks-project/rules/buttress.md +9 -6
- package/tools/mcp-server.ts +10 -880
- package/tools/mcp-tools/compile.ts +91 -0
- package/tools/mcp-tools/huggingface.ts +763 -0
- package/tools/mcp-tools/icons.ts +60 -0
- package/tools/mcp-tools/lottie.ts +102 -0
- package/tools/mcp-tools/media.ts +110 -0
- package/tools/postinstall.ts +113 -28
- package/tools/pull.ts +25 -9
- package/types/animation.ts +4 -0
- package/types/automation.ts +3 -0
- package/types/bricks/Camera.ts +33 -6
- package/types/bricks/GenerativeMedia.ts +5 -5
- package/types/bricks/Icon.ts +2 -2
- package/types/bricks/Image.ts +3 -3
- package/types/bricks/Items.ts +6 -6
- package/types/bricks/Lottie.ts +3 -3
- package/types/bricks/Maps.ts +3 -3
- package/types/bricks/QrCode.ts +3 -3
- package/types/bricks/Rect.ts +3 -3
- package/types/bricks/RichText.ts +2 -2
- package/types/bricks/Slideshow.ts +1 -1
- package/types/bricks/Svg.ts +2 -2
- package/types/bricks/Text.ts +3 -3
- package/types/bricks/TextInput.ts +10 -6
- package/types/bricks/Video.ts +3 -3
- package/types/bricks/VideoStreaming.ts +2 -2
- package/types/bricks/WebView.ts +3 -3
- package/types/canvas.ts +2 -0
- package/types/common.ts +5 -0
- package/types/data-calc-command.ts +2 -0
- package/types/data-calc.ts +1 -0
- package/types/data.ts +2 -0
- package/types/generators/AlarmClock.ts +4 -4
- package/types/generators/Assistant.ts +53 -8
- package/types/generators/BleCentral.ts +11 -3
- package/types/generators/BlePeripheral.ts +3 -3
- package/types/generators/CanvasMap.ts +3 -3
- package/types/generators/CastlesPay.ts +2 -2
- package/types/generators/DataBank.ts +29 -2
- package/types/generators/File.ts +62 -13
- package/types/generators/GraphQl.ts +2 -2
- package/types/generators/Http.ts +25 -6
- package/types/generators/HttpServer.ts +4 -4
- package/types/generators/Information.ts +1 -1
- package/types/generators/Intent.ts +7 -1
- package/types/generators/Iterator.ts +5 -5
- package/types/generators/Keyboard.ts +15 -5
- package/types/generators/LlmAnthropicCompat.ts +9 -3
- package/types/generators/LlmAppleBuiltin.ts +4 -4
- package/types/generators/LlmGgml.ts +63 -13
- package/types/generators/LlmMlx.ts +210 -0
- package/types/generators/LlmOnnx.ts +13 -4
- package/types/generators/LlmOpenAiCompat.ts +19 -3
- package/types/generators/LlmQualcommAiEngine.ts +29 -5
- package/types/generators/Mcp.ts +331 -16
- package/types/generators/McpServer.ts +34 -7
- package/types/generators/MediaFlow.ts +24 -6
- package/types/generators/MqttBroker.ts +9 -3
- package/types/generators/MqttClient.ts +10 -4
- package/types/generators/Question.ts +4 -4
- package/types/generators/RealtimeTranscription.ts +81 -10
- package/types/generators/RerankerGgml.ts +19 -5
- package/types/generators/SerialPort.ts +5 -5
- package/types/generators/SoundPlayer.ts +1 -1
- package/types/generators/SoundRecorder.ts +16 -5
- package/types/generators/SpeechToTextGgml.ts +27 -7
- package/types/generators/SpeechToTextOnnx.ts +3 -3
- package/types/generators/SpeechToTextPlatform.ts +3 -3
- package/types/generators/SqLite.ts +9 -5
- package/types/generators/Step.ts +2 -2
- package/types/generators/SttAppleBuiltin.ts +4 -4
- package/types/generators/Tcp.ts +3 -3
- package/types/generators/TcpServer.ts +5 -5
- package/types/generators/TextToSpeechAppleBuiltin.ts +3 -3
- package/types/generators/TextToSpeechGgml.ts +3 -3
- package/types/generators/TextToSpeechOnnx.ts +3 -3
- package/types/generators/TextToSpeechOpenAiLike.ts +3 -3
- package/types/generators/ThermalPrinter.ts +4 -4
- package/types/generators/Tick.ts +2 -2
- package/types/generators/Udp.ts +8 -3
- package/types/generators/VadGgml.ts +34 -5
- package/types/generators/VadOnnx.ts +27 -4
- package/types/generators/VadTraditional.ts +13 -7
- package/types/generators/VectorStore.ts +22 -5
- package/types/generators/Watchdog.ts +10 -5
- package/types/generators/WebCrawler.ts +3 -3
- package/types/generators/WebRtc.ts +14 -8
- package/types/generators/WebSocket.ts +4 -4
- package/types/generators/index.ts +1 -0
- package/types/subspace.ts +1 -0
- package/types/system.ts +1 -1
- package/utils/event-props.ts +104 -87
|
@@ -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
|
+
}
|