@fugood/bricks-project 2.24.4 → 2.24.6
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 +5 -0
- package/compile/index.ts +8 -4
- package/package.json +2 -2
- package/skills/bricks-ctor/SKILL.md +2 -2
- package/skills/bricks-ctor/rules/architecture-patterns.md +12 -0
- package/skills/bricks-ctor/rules/automations.md +11 -0
- package/skills/bricks-ctor/rules/data-calculation.md +5 -5
- package/skills/bricks-ctor/rules/verification-toolchain.md +16 -9
- package/skills/bricks-design/SKILL.md +2 -2
- package/skills/bricks-design/references/architecture-truths.md +10 -3
- package/skills/bricks-design/references/variations-and-tweaks.md +1 -1
- package/tools/_last-pushed-commit.ts +1 -1
- package/tools/_shell.ts +8 -1
- package/tools/mcp-tools/compile.ts +17 -7
- package/tools/mcp-tools/media.ts +4 -1
- package/tools/pull.ts +1 -1
- package/tools/{update-config.ts → push-config.ts} +1 -1
- package/types/{animation.ts → animation.d.ts} +8 -3
- package/types/{automation.ts → automation.d.ts} +15 -20
- package/types/{brick-base.ts → brick-base.d.ts} +1 -1
- package/types/bricks/{Camera.ts → Camera.d.ts} +8 -8
- package/types/bricks/{Chart.ts → Chart.d.ts} +4 -4
- package/types/bricks/{GenerativeMedia.ts → GenerativeMedia.d.ts} +15 -15
- package/types/bricks/{Icon.ts → Icon.d.ts} +7 -7
- package/types/bricks/{Image.ts → Image.d.ts} +9 -9
- package/types/bricks/{Items.ts → Items.d.ts} +7 -7
- package/types/bricks/{Lottie.ts → Lottie.d.ts} +10 -10
- package/types/bricks/{Maps.ts → Maps.d.ts} +11 -11
- package/types/bricks/{QrCode.ts → QrCode.d.ts} +7 -7
- package/types/bricks/{Rect.ts → Rect.d.ts} +7 -7
- package/types/bricks/{RichText.ts → RichText.d.ts} +12 -9
- package/types/bricks/{Rive.ts → Rive.d.ts} +9 -9
- package/types/bricks/{Sketch.ts → Sketch.d.ts} +6 -6
- package/types/bricks/{Slideshow.ts → Slideshow.d.ts} +7 -7
- package/types/bricks/{Svg.ts → Svg.d.ts} +7 -7
- package/types/bricks/{Text.ts → Text.d.ts} +9 -9
- package/types/bricks/{TextInput.ts → TextInput.d.ts} +10 -10
- package/types/bricks/{Video.ts → Video.d.ts} +12 -12
- package/types/bricks/{VideoStreaming.ts → VideoStreaming.d.ts} +10 -10
- package/types/bricks/{WebRtcStream.ts → WebRtcStream.d.ts} +1 -1
- package/types/bricks/{WebView.ts → WebView.d.ts} +4 -4
- package/types/{common.ts → common.d.ts} +3 -6
- package/types/data-calc-command/base.d.ts +57 -0
- package/types/data-calc-command/collection.d.ts +418 -0
- package/types/data-calc-command/color.d.ts +432 -0
- package/types/data-calc-command/constant.d.ts +50 -0
- package/types/data-calc-command/datetime.d.ts +147 -0
- package/types/data-calc-command/file.d.ts +129 -0
- package/types/data-calc-command/index.d.ts +13 -0
- package/types/data-calc-command/iteratee.d.ts +23 -0
- package/types/data-calc-command/logictype.d.ts +190 -0
- package/types/data-calc-command/math.d.ts +275 -0
- package/types/data-calc-command/object.d.ts +119 -0
- package/types/data-calc-command/sandbox.d.ts +58 -0
- package/types/data-calc-command/string.d.ts +407 -0
- package/types/{data.ts → data.d.ts} +1 -1
- package/types/generators/{Assistant.ts → Assistant.d.ts} +2 -1
- package/types/generators/{LlmGgml.ts → LlmGgml.d.ts} +37 -0
- package/utils/data.ts +1 -1
- package/utils/id.ts +78 -27
- package/package.json.bak +0 -28
- package/types/data-calc-command.ts +0 -7005
- /package/types/bricks/{index.ts → index.d.ts} +0 -0
- /package/types/{canvas.ts → canvas.d.ts} +0 -0
- /package/types/{data-calc-script.ts → data-calc-script.d.ts} +0 -0
- /package/types/{data-calc.ts → data-calc.d.ts} +0 -0
- /package/types/generators/{AlarmClock.ts → AlarmClock.d.ts} +0 -0
- /package/types/generators/{BleCentral.ts → BleCentral.d.ts} +0 -0
- /package/types/generators/{BlePeripheral.ts → BlePeripheral.d.ts} +0 -0
- /package/types/generators/{CanvasMap.ts → CanvasMap.d.ts} +0 -0
- /package/types/generators/{CastlesPay.ts → CastlesPay.d.ts} +0 -0
- /package/types/generators/{DataBank.ts → DataBank.d.ts} +0 -0
- /package/types/generators/{File.ts → File.d.ts} +0 -0
- /package/types/generators/{GraphQl.ts → GraphQl.d.ts} +0 -0
- /package/types/generators/{Http.ts → Http.d.ts} +0 -0
- /package/types/generators/{HttpServer.ts → HttpServer.d.ts} +0 -0
- /package/types/generators/{Information.ts → Information.d.ts} +0 -0
- /package/types/generators/{Intent.ts → Intent.d.ts} +0 -0
- /package/types/generators/{Iterator.ts → Iterator.d.ts} +0 -0
- /package/types/generators/{Keyboard.ts → Keyboard.d.ts} +0 -0
- /package/types/generators/{LlmAnthropicCompat.ts → LlmAnthropicCompat.d.ts} +0 -0
- /package/types/generators/{LlmAppleBuiltin.ts → LlmAppleBuiltin.d.ts} +0 -0
- /package/types/generators/{LlmMediaTekNeuroPilot.ts → LlmMediaTekNeuroPilot.d.ts} +0 -0
- /package/types/generators/{LlmMlx.ts → LlmMlx.d.ts} +0 -0
- /package/types/generators/{LlmOnnx.ts → LlmOnnx.d.ts} +0 -0
- /package/types/generators/{LlmOpenAiCompat.ts → LlmOpenAiCompat.d.ts} +0 -0
- /package/types/generators/{LlmQualcommAiEngine.ts → LlmQualcommAiEngine.d.ts} +0 -0
- /package/types/generators/{Mcp.ts → Mcp.d.ts} +0 -0
- /package/types/generators/{McpServer.ts → McpServer.d.ts} +0 -0
- /package/types/generators/{MediaFlow.ts → MediaFlow.d.ts} +0 -0
- /package/types/generators/{MqttBroker.ts → MqttBroker.d.ts} +0 -0
- /package/types/generators/{MqttClient.ts → MqttClient.d.ts} +0 -0
- /package/types/generators/{Question.ts → Question.d.ts} +0 -0
- /package/types/generators/{RealtimeTranscription.ts → RealtimeTranscription.d.ts} +0 -0
- /package/types/generators/{RerankerGgml.ts → RerankerGgml.d.ts} +0 -0
- /package/types/generators/{SerialPort.ts → SerialPort.d.ts} +0 -0
- /package/types/generators/{SoundPlayer.ts → SoundPlayer.d.ts} +0 -0
- /package/types/generators/{SoundRecorder.ts → SoundRecorder.d.ts} +0 -0
- /package/types/generators/{SpeechToTextGgml.ts → SpeechToTextGgml.d.ts} +0 -0
- /package/types/generators/{SpeechToTextOnnx.ts → SpeechToTextOnnx.d.ts} +0 -0
- /package/types/generators/{SpeechToTextPlatform.ts → SpeechToTextPlatform.d.ts} +0 -0
- /package/types/generators/{SqLite.ts → SqLite.d.ts} +0 -0
- /package/types/generators/{Step.ts → Step.d.ts} +0 -0
- /package/types/generators/{SttAppleBuiltin.ts → SttAppleBuiltin.d.ts} +0 -0
- /package/types/generators/{Tcp.ts → Tcp.d.ts} +0 -0
- /package/types/generators/{TcpServer.ts → TcpServer.d.ts} +0 -0
- /package/types/generators/{TextToSpeechAppleBuiltin.ts → TextToSpeechAppleBuiltin.d.ts} +0 -0
- /package/types/generators/{TextToSpeechGgml.ts → TextToSpeechGgml.d.ts} +0 -0
- /package/types/generators/{TextToSpeechOnnx.ts → TextToSpeechOnnx.d.ts} +0 -0
- /package/types/generators/{TextToSpeechOpenAiLike.ts → TextToSpeechOpenAiLike.d.ts} +0 -0
- /package/types/generators/{ThermalPrinter.ts → ThermalPrinter.d.ts} +0 -0
- /package/types/generators/{Tick.ts → Tick.d.ts} +0 -0
- /package/types/generators/{Udp.ts → Udp.d.ts} +0 -0
- /package/types/generators/{VadGgml.ts → VadGgml.d.ts} +0 -0
- /package/types/generators/{VadOnnx.ts → VadOnnx.d.ts} +0 -0
- /package/types/generators/{VadTraditional.ts → VadTraditional.d.ts} +0 -0
- /package/types/generators/{VectorStore.ts → VectorStore.d.ts} +0 -0
- /package/types/generators/{Watchdog.ts → Watchdog.d.ts} +0 -0
- /package/types/generators/{WebCrawler.ts → WebCrawler.d.ts} +0 -0
- /package/types/generators/{WebRtc.ts → WebRtc.d.ts} +0 -0
- /package/types/generators/{WebSocket.ts → WebSocket.d.ts} +0 -0
- /package/types/generators/{index.ts → index.d.ts} +0 -0
- /package/types/{index.ts → index.d.ts} +0 -0
- /package/types/{subspace.ts → subspace.d.ts} +0 -0
- /package/types/{switch.ts → switch.d.ts} +0 -0
- /package/types/{system.ts → system.d.ts} +0 -0
package/utils/data.ts
CHANGED
|
@@ -85,7 +85,7 @@ type SystemDataName =
|
|
|
85
85
|
type SystemDataInfo = {
|
|
86
86
|
name: SystemDataName
|
|
87
87
|
id: string
|
|
88
|
-
type: 'string' | 'number' | 'bool' | 'array' | 'object' | 'any'
|
|
88
|
+
type: 'string' | 'number' | 'bool' | 'boolean' | 'array' | 'object' | 'any'
|
|
89
89
|
title?: string
|
|
90
90
|
description?: string
|
|
91
91
|
schema?: object
|
package/utils/id.ts
CHANGED
|
@@ -1,38 +1,83 @@
|
|
|
1
1
|
import { v4 as uuid } from 'uuid'
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
3
|
+
import { readFileSync } from 'node:fs'
|
|
4
|
+
import { join } from 'node:path'
|
|
2
5
|
|
|
3
6
|
let count = 0
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
type IdType =
|
|
9
|
+
| 'animation'
|
|
10
|
+
| 'brick'
|
|
11
|
+
| 'canvas'
|
|
12
|
+
| 'generator'
|
|
13
|
+
| 'data'
|
|
14
|
+
| 'switch'
|
|
15
|
+
| 'property_bank_command'
|
|
16
|
+
| 'property_bank_calc'
|
|
17
|
+
| 'dynamic-brick'
|
|
18
|
+
| 'automation_map'
|
|
19
|
+
| 'test'
|
|
20
|
+
| 'test_case'
|
|
21
|
+
| 'test_var'
|
|
22
|
+
| 'subspace'
|
|
23
|
+
|
|
24
|
+
type IdOptions = {
|
|
25
|
+
snapshotMode?: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const APPLICATION_ID_FALLBACK = 'unknown-application'
|
|
29
|
+
|
|
30
|
+
const usedStableAliases = new Set<string>()
|
|
31
|
+
let applicationIdCache: { cwd: string; id: string } | null = null
|
|
32
|
+
|
|
33
|
+
const readApplicationId = () => {
|
|
34
|
+
const cwd = process.cwd()
|
|
35
|
+
if (applicationIdCache?.cwd === cwd) return applicationIdCache.id
|
|
36
|
+
|
|
37
|
+
let id = APPLICATION_ID_FALLBACK
|
|
38
|
+
try {
|
|
39
|
+
const app = JSON.parse(readFileSync(join(cwd, 'application.json'), 'utf8'))
|
|
40
|
+
if (typeof app.id === 'string' && app.id) id = app.id
|
|
41
|
+
} catch {
|
|
42
|
+
// `makeId` is also used from tests and utilities outside project roots.
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
applicationIdCache = { cwd, id }
|
|
46
|
+
return id
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const hashToRandomBytes = (parts: string[]) => {
|
|
50
|
+
const hash = createHash('sha256').update(JSON.stringify(parts)).digest()
|
|
51
|
+
return new Uint8Array(hash.subarray(0, 16))
|
|
10
52
|
}
|
|
11
53
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
) => {
|
|
54
|
+
const makeStableUuid = (type: string, alias?: string) => {
|
|
55
|
+
const applicationId = readApplicationId()
|
|
56
|
+
const seed = alias ?? String(count)
|
|
57
|
+
if (alias === undefined) count += 1
|
|
58
|
+
|
|
59
|
+
if (alias !== undefined) {
|
|
60
|
+
const aliasKey = JSON.stringify([applicationId, type, alias])
|
|
61
|
+
if (usedStableAliases.has(aliasKey)) {
|
|
62
|
+
throw new Error(`Duplicate makeId alias '${alias}' for type '${type}'`)
|
|
63
|
+
}
|
|
64
|
+
usedStableAliases.add(aliasKey)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return uuid({
|
|
68
|
+
random: hashToRandomBytes([applicationId, type, seed]),
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Make stable ids by default; explicit snapshotMode: false preserves the random escape hatch.
|
|
73
|
+
export const makeId = (type: IdType, aliasOrOpts?: string | IdOptions, opts?: IdOptions) => {
|
|
33
74
|
if (type === 'subspace') {
|
|
34
75
|
throw new Error('Currently subspace is not supported for ID generation, please use a fixed ID')
|
|
35
76
|
}
|
|
77
|
+
|
|
78
|
+
const alias = typeof aliasOrOpts === 'string' ? aliasOrOpts : undefined
|
|
79
|
+
const options = typeof aliasOrOpts === 'string' ? opts : (aliasOrOpts ?? opts)
|
|
80
|
+
|
|
36
81
|
let prefix = ''
|
|
37
82
|
switch (type) {
|
|
38
83
|
case 'animation':
|
|
@@ -76,5 +121,11 @@ export const makeId = (
|
|
|
76
121
|
break
|
|
77
122
|
default:
|
|
78
123
|
}
|
|
79
|
-
|
|
124
|
+
|
|
125
|
+
const useCountFallback = aliasOrOpts === undefined && opts === undefined
|
|
126
|
+
const id =
|
|
127
|
+
alias !== undefined || options?.snapshotMode || useCountFallback
|
|
128
|
+
? makeStableUuid(type, alias)
|
|
129
|
+
: uuid()
|
|
130
|
+
return `${prefix}${id}`
|
|
80
131
|
}
|
package/package.json.bak
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fugood/bricks-ctor",
|
|
3
|
-
"version": "2.24.4",
|
|
4
|
-
"main": "index.ts",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"typecheck": "tsc --noEmit",
|
|
7
|
-
"build": "bun scripts/build.js"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"@fugood/bricks-cli": "^2.24.4",
|
|
11
|
-
"@huggingface/gguf": "^0.3.2",
|
|
12
|
-
"@iarna/toml": "^3.0.0",
|
|
13
|
-
"@modelcontextprotocol/sdk": "^1.15.0",
|
|
14
|
-
"@toon-format/toon": "^2.1.0",
|
|
15
|
-
"@types/bun": "^1.3.9",
|
|
16
|
-
"@types/escodegen": "^0.0.10",
|
|
17
|
-
"@types/lodash": "^4.17.12",
|
|
18
|
-
"acorn": "^8.13.0",
|
|
19
|
-
"escodegen": "2.1.0",
|
|
20
|
-
"fuse.js": "^7.0.0",
|
|
21
|
-
"json5": "^2.0.1",
|
|
22
|
-
"lodash": "^4.17.4",
|
|
23
|
-
"uuid": "^8.3.1"
|
|
24
|
-
},
|
|
25
|
-
"peerDependencies": {
|
|
26
|
-
"oxfmt": "^0.36.0"
|
|
27
|
-
}
|
|
28
|
-
}
|