cardbuddy 0.20.0 → 0.21.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.
package/README.md CHANGED
@@ -242,7 +242,7 @@ DSL_DEV_HTTPS=1 cardbuddy
242
242
  | `GET /__cards` | 自包含 | 卡片列表 |
243
243
  | `GET /__card/:id` | 自包含 | 单卡 schema/data 读取 |
244
244
  | `POST /__sync` | 本地服务代理 | 同步远端 FinMall(依赖 `finmall-card-sync` skill) |
245
- | `POST /__save` | 本地服务代理 | 保存到远端 FinMall(依赖 `finmall-card-sync` skill) |
245
+ | `POST /__save` | 本地服务代理 | 保存到远端 FinMall(依赖 `finmall-card-sync` skill);成功后自动截图并上传远端预览图(IDC10014) |
246
246
  | `GET /__preview` | 本地服务代理 | 远端取卡(IDC10015,依赖 `finmall-card-sync` skill) |
247
247
  | `POST /__validate` | 本地服务代理 | 契约校验(依赖 `dsl-card-generator` skill) |
248
248
  | `GET /__render-status/:id` | 自包含 + 内嵌 Vite SSR | 渲染自检 |
package/dist/cli.js CHANGED
@@ -36,6 +36,20 @@ const srcTag =
36
36
  ? ''
37
37
  : chalk.magenta('▌ ') + chalk.magenta.bold('cardbuddy') + ' '
38
38
 
39
+ // 进程级兜底:cardbuddy-dev(8787)是开发者常驻服务,单个请求里的异步异常(如模型网关卡死 /
40
+ // 掉线触发未捕获 rejection)绝不该拖垮整个进程。connect 中间件框架不会 await / catch 异步中间件
41
+ // 抛出的错误,逃逸的 rejection 在 Node ≥15 默认会终止进程。这里统一兜底为「记日志、保活」,确保一个
42
+ // 坏请求 / 一个卡死的模型不会让 8787 端口整体不再响应。
43
+ function guardProcessAlive() {
44
+ process.on('unhandledRejection', (reason) => {
45
+ console.error('[cardbuddy] 未处理的 Promise rejection(已兜底,服务继续运行):', reason && reason.stack ? reason.stack : reason)
46
+ })
47
+ process.on('uncaughtException', (err) => {
48
+ console.error('[cardbuddy] 未捕获异常(已兜底,服务继续运行):', err && err.stack ? err.stack : err)
49
+ })
50
+ }
51
+ guardProcessAlive()
52
+
39
53
  // 加载环境(与 skills 同套约定:.env.cb 为共享配置,.env.cb.local 为个人覆盖层)。
40
54
  // dotenv 默认不覆盖已存在变量,故主仓库由启动器注入的 DSL_DEV_PORT / FINMALL_BASE_URL 仍优先。
41
55
  // 同时登记「dotenv 注入值」:server/core/ai-chat.js 据此区分「启动时灌进 process.env 的文件值」