made-bridge 0.0.0-stage → 0.2.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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -2
  3. package/builtin/plugins/README.md +22 -0
  4. package/builtin/themes/README.md +64 -0
  5. package/builtin/themes/sunset/theme.json +19 -0
  6. package/config.example.json +20 -0
  7. package/demo-project/README.md +5 -0
  8. package/demo-project/index.mjs +14 -0
  9. package/package.json +48 -4
  10. package/public/app.js +1028 -0
  11. package/public/assistants.html +67 -0
  12. package/public/bean-icon.png +0 -0
  13. package/public/i18n-messages.js +967 -0
  14. package/public/i18n-static.js +615 -0
  15. package/public/i18n.js +50 -0
  16. package/public/index.html +149 -0
  17. package/public/made-icon.png +0 -0
  18. package/public/plugins.html +64 -0
  19. package/public/plugins.js +335 -0
  20. package/public/provider-icon.js +77 -0
  21. package/public/styles.css +445 -0
  22. package/public/tasks.html +85 -0
  23. package/src/agent-icons.mjs +138 -0
  24. package/src/agents/codex.mjs +94 -0
  25. package/src/agents/cursor.mjs +31 -0
  26. package/src/agents/events.mjs +92 -0
  27. package/src/agents/index.mjs +7 -0
  28. package/src/agents/qoder.mjs +34 -0
  29. package/src/agents/shared.mjs +191 -0
  30. package/src/agents/workbuddy.mjs +121 -0
  31. package/src/board-link.mjs +266 -0
  32. package/src/config.mjs +196 -0
  33. package/src/doctor.mjs +146 -0
  34. package/src/i18n.mjs +257 -0
  35. package/src/installed.mjs +291 -0
  36. package/src/jobs.mjs +369 -0
  37. package/src/language-settings.mjs +38 -0
  38. package/src/model-settings.mjs +63 -0
  39. package/src/openai-key.mjs +47 -0
  40. package/src/oray.mjs +243 -0
  41. package/src/pairing.mjs +203 -0
  42. package/src/plugin-package.mjs +132 -0
  43. package/src/plugin-runtime.mjs +169 -0
  44. package/src/plugins/contracts.d.ts +184 -0
  45. package/src/plugins/enhance.mjs +156 -0
  46. package/src/plugins/registry.mjs +146 -0
  47. package/src/providers.mjs +75 -0
  48. package/src/server.mjs +950 -0
  49. package/src/sessions.mjs +134 -0
  50. package/src/speech/index.mjs +10 -0
  51. package/src/speech/openai.mjs +48 -0
  52. package/src/speech/whisper.mjs +59 -0
  53. package/src/speech-settings.mjs +209 -0
  54. package/src/transcribe.mjs +85 -0
  55. package/src/tunnel.mjs +531 -0
  56. package/src/usb-receiver.mjs +664 -0
  57. package/src/voice-settings.mjs +69 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vibe Coding Agent contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,46 @@
1
- # Temporary Holding Version
1
+ # bridge
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 电脑侧桥接器。设备 API 在 `8788`,工作台在 `127.0.0.1:8787`。
4
+
5
+ ## 启动方式
6
+
7
+ ```sh
8
+ npx made-bridge # 任何机器一条命令(npm 包,Node >= 22)
9
+ ```
10
+
11
+ - 首次运行会在 `~/.made-bridge/config.local.json` 生成配置(含示例项目),编辑 `projects` 指向你自己的代码仓库后重启。
12
+ - 配置、状态、工作区都在 `~/.made-bridge/`,与代码分离——npm 包目录视为只读,缓存被清也不丢数据。
13
+ - 环境变量:`VIBE_CONFIG` / `VIBE_STATE_DIR` / `VIBE_DATA_DIR` 可把三个位置各自指到别处;`VIBE_USB_PORT`、`MADE_HOME` 等见 `npm run doctor` 输出。
14
+
15
+ ```sh
16
+ npm start # 源码仓库运行(本目录);沿用仓库里的 config.local.json
17
+ npm run doctor # 自检:运行环境、依赖命令、接入方式、已装插件
18
+ ```
19
+
20
+ 编程助手 CLI(codex / cursor / qoder 等)需要已安装在 PATH 上;刷机用仓库根的 `npm run flash`,不随 npm 包分发。
21
+
22
+ ## 目录结构
23
+
24
+ 内部仍是桥接器自己的运行结构:
25
+
26
+ - `src/`:服务、设备接口与内置 agent
27
+ - `public/`:工作台
28
+ - `builtin/`:随代码发布的内置插件与主题(`builtin/plugins/`、`builtin/themes/`),升级代码即升级内置包
29
+ - `examples/`:示例
30
+ - `tools/`:开发工具
31
+ - `test/`:测试
32
+
33
+ ## 插件与主题的目录
34
+
35
+ 用户包不在本目录,而是在固定的用户目录里:
36
+
37
+ - `~/made/plugins/` —— 管控插件与助手插件
38
+ - `~/made/themes/` —— 主题包
39
+
40
+ 桥接器每次启动扫描这两个目录,市场装到这里即可生效,不需要跟配置文件放在一起。路径可用 `MADE_HOME` 环境变量或 `config.local.json` 里的 `madeHome` 改成别处。
41
+
42
+ 查找顺序是「内置在前、用户目录在后」,**同名时用户目录覆盖内置**。所以 `bridge/builtin/` 里的内置包是只读的:工作台可以启用、停用,但不能移除;想覆盖就在 `~/made/` 放同名目录。
43
+
44
+ 插件市场和专家市场只负责发包,不放在这里。包安装进 `~/made/` 之后,桥接器才会加载。配置文件:源码仓库运行用本目录的 `config.local.json`;`npx made-bridge` 运行用 `~/.made-bridge/config.local.json`。
45
+
46
+ 在仓库根目录执行 `npm start` 或 `npm test` 会转到这里。
@@ -0,0 +1,22 @@
1
+ # 内置插件目录
2
+
3
+ 跟代码一起发布的内置插件,`bridge/builtin/plugins/<名字>/` 一个目录一个包(`plugin.mjs` + `plugin.json` + `settings.json`)。
4
+
5
+ ## 与用户目录的关系
6
+
7
+ 桥接器按下面的顺序扫描,**同名时后者覆盖前者**:
8
+
9
+ 1. `bridge/builtin/plugins/` —— 本目录,随代码升级
10
+ 2. `~/made/plugins/` —— 用户目录,市场安装的插件都在这里
11
+
12
+ 所以这里是只读的内置包:工作台「插件」页可以启用和停用,但**不能移除**——移除只作用于 `~/made/plugins/`。
13
+ 想在本地覆盖某个内置插件,就在 `~/made/plugins/` 放一个同名目录。
14
+
15
+ 用户目录可用 `MADE_HOME` 环境变量或配置里的 `madeHome` 改成别的路径。
16
+
17
+ ## 加载规则
18
+
19
+ - 一个插件目录必须有 `plugin.mjs`(或 `plugin.js`)与 `plugin.json`
20
+ - 单文件 `.mjs` / `.js` 也会被加载
21
+
22
+ 插件接口见 `bridge/src/plugins/contracts.d.ts`,示例在 `bridge/examples/plugins/`,配置规范见 `docs/PLUGINS.md`。
@@ -0,0 +1,64 @@
1
+ # 内置主题目录
2
+
3
+ 跟代码一起发布的内置主题,每个子目录 = 一个主题。码得在「设置 → 主题设置」打开时会实时列出,点选即应用(通过当前连接拉取数据,重启生效)。
4
+
5
+ ## 与用户目录的关系
6
+
7
+ 桥接器按下面的顺序扫描,**同名时后者覆盖前者**:
8
+
9
+ 1. `bridge/builtin/themes/` —— 本目录,随代码升级
10
+ 2. `~/made/themes/` —— 用户目录,主题市场装的主题都在这里
11
+
12
+ 所以内置主题不能从工作台删除(删除只作用于 `~/made/themes/`)。想覆盖某个内置主题,就在 `~/made/themes/` 放一个同名目录,它的 `theme.json` 与资产会顶掉内置的那份。
13
+
14
+ 用户目录可用 `MADE_HOME` 环境变量或配置里的 `madeHome` 改成别的路径。
15
+
16
+ ## 主题包结构
17
+
18
+ ```
19
+ themes/<名字>/
20
+ ├── theme.json 必需:标题、调色板、可选资产声明
21
+ ├── chime.wav 可选:提示音(新消息铃声)
22
+ ├── icon.bin 可选:锁屏图标,raw RGB565 小端
23
+ └── bg.bin 可选:锁屏背景图,raw RGB565 小端
24
+ ```
25
+
26
+ ## theme.json 完整示例
27
+
28
+ ```json
29
+ {
30
+ "title": "日落",
31
+ "colors": {
32
+ "accent": "E07840",
33
+ "btn_normal": "5C3328",
34
+ "btn_cancel": "6B4A38",
35
+ "border": "E0A080",
36
+ "text_primary": "FFF3E8",
37
+ "text_secondary": "E8C4A8",
38
+ "text_hint": "C09070",
39
+ "text_accent": "FFC088",
40
+ "title": "FFE8D0",
41
+ "bg_page": "1F1210",
42
+ "bg_panel": "2A1714",
43
+ "bg_row": "3A201B",
44
+ "danger": "A84040",
45
+ "lock_bg": "1A0F0C"
46
+ },
47
+ "sound": { "file": "chime.wav" },
48
+ "lock": {
49
+ "icon": "icon.bin", "icon_w": 112, "icon_h": 112,
50
+ "bg": "bg.bin", "bg_w": 240, "bg_h": 320
51
+ }
52
+ }
53
+ ```
54
+
55
+ ## 资产格式说明
56
+
57
+ - **提示音**:WAV(无压缩 PCM 16bit),采样率 8k~48k,单/双声道均可,
58
+ 播放时按文件头自适应;≤256KB(约 8 秒 16k 单声道)
59
+ - **图标/背景**:无头的 raw RGB565 小端像素数组(宽×高×2 字节),
60
+ 尺寸在 theme.json 里声明;bg 建议与屏幕设计分辨率一致
61
+ - **PNG 转 RGB565**:`python3 -c "from PIL import Image; import sys; im = Image.open(sys.argv[1]).convert('RGB'); open(sys.argv[2],'wb').write(b''.join(bytes(((r>>3)<<11)|((g>>2)<<5)|(b>>3)) for r,g,b in im.getdata()))" in.png out.bin`
62
+ - 颜色缺省时回落到内置默认;恢复默认主题 = 清空全部主题缓存
63
+ - **主题显示名(title)请使用常用汉字或英文**:设备内置中文字库覆盖
64
+ GB2312 常用字,生僻字(如「啵」)会显示为方框
@@ -0,0 +1,19 @@
1
+ {
2
+ "title": "日落",
3
+ "colors": {
4
+ "accent": "E07840",
5
+ "btn_normal": "5C3328",
6
+ "btn_cancel": "6B4A38",
7
+ "border": "E0A080",
8
+ "text_primary": "FFF3E8",
9
+ "text_secondary": "E8C4A8",
10
+ "text_hint": "C09070",
11
+ "text_accent": "FFC088",
12
+ "title": "FFE8D0",
13
+ "bg_page": "1F1210",
14
+ "bg_panel": "2A1714",
15
+ "bg_row": "3A201B",
16
+ "danger": "A84040",
17
+ "lock_bg": "1A0F0C"
18
+ }
19
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "port": 8787,
3
+ "devicePort": 8788,
4
+ "defaultProject": "demo",
5
+ "defaultProvider": "codex",
6
+ "codexModel": "gpt-6-astra",
7
+ "projects": [
8
+ {
9
+ "id": "demo",
10
+ "label": "演示项目",
11
+ "path": "./demo-project"
12
+ }
13
+ ],
14
+ "workbuddy": {
15
+ "allowUnscopedDispatch": false
16
+ },
17
+ "plugins": [],
18
+ "disabledPlugins": [],
19
+ "pluginSettings": {}
20
+ }
@@ -0,0 +1,5 @@
1
+ # 演示项目
2
+
3
+ 这是「码得」桥接器附带的试用项目,供连接实体板或用电脑工作台试跑任务使用。
4
+
5
+ 改这里的文件不会影响其他代码,可以放心让编程助手动手。
@@ -0,0 +1,14 @@
1
+ // 演示用的小工具函数,编程助手会在这里尝试修改代码。
2
+
3
+ export function greet(name) {
4
+ return `你好,${name}!`;
5
+ }
6
+
7
+ export function add(a, b) {
8
+ return a + b;
9
+ }
10
+
11
+ if (import.meta.url === `file://${process.argv[1]}`) {
12
+ console.log(greet('码得'));
13
+ console.log('1 + 1 =', add(1, 1));
14
+ }
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "made-bridge",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.1",
4
+ "description": "码得(made)独立语音编程设备的电脑侧桥接器:工作台 API、设备接口、任务调度与插件运行时。一条命令启动,配合 ESP32 固件使用,源码在 github.com/jobop/made。",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "engines": {
8
+ "node": ">=22"
9
+ },
10
+ "bin": {
11
+ "made-bridge": "src/server.mjs"
12
+ },
13
+ "files": [
14
+ "src/",
15
+ "public/",
16
+ "builtin/",
17
+ "config.example.json",
18
+ "demo-project/",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/jobop/made.git",
25
+ "directory": "bridge"
26
+ },
27
+ "homepage": "https://github.com/jobop/made/tree/main/bridge#readme",
28
+ "bugs": {
29
+ "url": "https://github.com/jobop/made/issues"
30
+ },
31
+ "keywords": [
32
+ "made",
33
+ "码得",
34
+ "esp32",
35
+ "bridge",
36
+ "voice-coding",
37
+ "agent",
38
+ "codex",
39
+ "plugin"
40
+ ],
41
+ "publishConfig": {
42
+ "access": "public",
43
+ "registry": "https://registry.npmjs.org/"
44
+ },
45
+ "scripts": {
46
+ "start": "node src/server.mjs",
47
+ "doctor": "node src/server.mjs --doctor",
48
+ "test": "node --test --experimental-test-isolation=none --test-concurrency=1"
49
+ }
50
+ }