@coze-arch/cli 0.0.36-alpha.b20d2b → 0.0.36-alpha.d38260

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
@@ -71,7 +71,8 @@ build_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Fil
71
71
 
72
72
  `coze-dev deploy` 内置于同一 CLI。认证优先读取
73
73
  `~/.coze/desktop/runtime.beta.json`,其次读取 `~/.coze/desktop/runtime.json`;
74
- 桌面 Token 不可用时再回退到 `COZE_API_TOKEN` 和 `~/.coze/cli/config.json` 登录态:
74
+ CLI 会依次验证候选 Token,收到 401 时继续尝试下一项,再回退到
75
+ `COZE_API_TOKEN` 和 `~/.coze/cli/config.json` 登录态:
75
76
 
76
77
  ```bash
77
78
  coze-dev deploy auth login
package/docs/deploy.md CHANGED
@@ -8,7 +8,9 @@
8
8
  4. 主 Coze CLI 保存在 `~/.coze/cli/config.json` 中的登录状态
9
9
 
10
10
  桌面运行时文件不存在、不可读、JSON 无效或 Token 字段缺失、为空时,CLI
11
- 静默尝试下一来源,不输出或持久化 Token
11
+ 静默尝试下一来源。固定 Token 会在单次 CLI 进程首次使用时依次验证;候选返回
12
+ 401 时继续尝试下一来源,其他网络或服务端错误不会被误判成 Token 无效。选中的
13
+ Token 在本次进程内复用,不输出或持久化。
12
14
 
13
15
  ## 安装与运行
14
16
 
@@ -122,14 +122,41 @@ wait_port_connectable() {
122
122
  return 1
123
123
  }
124
124
 
125
+ # detached 出去的进程没人负责回收,超过这个时长就自己退出,避免端口与内存长期泄露。
126
+ MAX_RUNTIME_SECONDS=1200
127
+
128
+ # 真正被 detach 的是这层 bash wrapper:它是进程组 leader,组内 watchdog 到点回收整组
129
+ # (wrapper -> pnpm -> expo/node);被包的进程自己先退出时也顺手清空进程组,不留残余。
130
+ RUN_WITH_TIMEOUT='
131
+ timeout_seconds=$1
132
+ shift
133
+
134
+ "$@" &
135
+ child_pid=$!
136
+
137
+ # 先忽略 TERM,才能在向整组发 TERM(自己也在组里)之后存活下来补一发 KILL。
138
+ ( trap "" TERM
139
+ sleep "${timeout_seconds}"
140
+ echo "[dev] 后台进程运行超过 ${timeout_seconds}s,回收进程组 $$。"
141
+ kill -TERM -- "-$$" 2>/dev/null || true
142
+ sleep 5
143
+ kill -KILL -- "-$$" 2>/dev/null || true
144
+ ) &
145
+
146
+ wait "${child_pid}"
147
+ kill -KILL -- "-$$" 2>/dev/null || true
148
+ '
149
+
125
150
  # coze-daemon 会在 runtime shell 退出时清理原进程组。
126
151
  # 通过 Node detached spawn 创建独立 session/进程组,并将 stdio 直接写入日志。
152
+ # 返回的 PID 是 wrapper 的,同时也是整个进程组的 PGID,后续按组回收。
127
153
  spawn_detached() {
128
154
  local cwd="$1"
129
155
  local log_file="$2"
130
156
  shift 2
131
157
 
132
- node - "$cwd" "$log_file" "$@" <<'NODE'
158
+ node - "$cwd" "$log_file" \
159
+ /bin/bash -c "${RUN_WITH_TIMEOUT}" detached-runner "${MAX_RUNTIME_SECONDS}" "$@" <<'NODE'
133
160
  const fs = require('node:fs');
134
161
  const { spawn } = require('node:child_process');
135
162
 
@@ -263,6 +290,7 @@ if [ -z "${EXPO_PID}" ]; then
263
290
  fi
264
291
 
265
292
  echo "所有服务已启动。Server PID: ${SERVER_PID}, Expo PID: ${EXPO_PID}"
293
+ echo "两个服务均在 ${MAX_RUNTIME_SECONDS}s 后自动退出。"
266
294
 
267
295
  echo "检查 Server 服务端口:$SERVER_HOST:$SERVER_PORT"
268
296
  if wait_port_connectable "$SERVER_HOST" "$SERVER_PORT" 10 2; then
@@ -56,7 +56,7 @@
56
56
  "embla-carousel-react": "^8.6.0",
57
57
  "input-otp": "^1.4.2",
58
58
  "lucide-react": "^0.468.0",
59
- "next": "16.1.1",
59
+ "next": "16.3.3",
60
60
  "next-themes": "^0.4.6",
61
61
  "pg": "^8.16.3",
62
62
  "react": "19.2.3",
@@ -80,7 +80,7 @@
80
80
  "@types/react": "^19",
81
81
  "@types/react-dom": "^19",
82
82
  "eslint": "^9",
83
- "eslint-config-next": "16.1.1",
83
+ "eslint-config-next": "16.3.3",
84
84
  "only-allow": "^1.2.2",
85
85
  "react-dev-inspector": "^2.0.1",
86
86
  "shadcn": "latest",
@@ -135,8 +135,8 @@ importers:
135
135
  specifier: ^0.468.0
136
136
  version: 0.468.0(react@19.2.3)
137
137
  next:
138
- specifier: 16.1.1
139
- version: 16.1.1(@babel/core@7.28.6)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
138
+ specifier: 16.3.3
139
+ version: 16.3.3(@babel/core@7.28.6)(@types/node@20.19.30)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
140
140
  next-themes:
141
141
  specifier: ^0.4.6
142
142
  version: 0.4.6(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
@@ -202,8 +202,8 @@ importers:
202
202
  specifier: ^9
203
203
  version: 9.39.2(jiti@2.6.1)
204
204
  eslint-config-next:
205
- specifier: 16.1.1
206
- version: 16.1.1(@typescript-eslint/parser@8.54.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
205
+ specifier: 16.3.3
206
+ version: 16.3.3(@typescript-eslint/parser@8.54.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
207
207
  only-allow:
208
208
  specifier: ^1.2.2
209
209
  version: 1.2.2
@@ -6224,6 +6224,270 @@ packages:
6224
6224
  zod@4.3.6:
6225
6225
  resolution: {integrity: sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==}
6226
6226
 
6227
+ '@emnapi/runtime@1.11.3':
6228
+ resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==}
6229
+
6230
+ '@img/colour@1.1.0':
6231
+ resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==}
6232
+ engines: {node: '>=18'}
6233
+
6234
+ '@img/sharp-darwin-arm64@0.35.3':
6235
+ resolution: {integrity: sha512-RMnFX7YQsMoh7lWfcM4NEHHymBX/rLuKNPVM84XE9ONPcaSCDgE7CHIHpSgPcO2xcRthgBy1HfNO319mwhIAkg==}
6236
+ engines: {node: '>=20.9.0'}
6237
+ cpu: [arm64]
6238
+ os: [darwin]
6239
+
6240
+ '@img/sharp-darwin-x64@0.35.3':
6241
+ resolution: {integrity: sha512-Xo+5uFBtLN0BKqieTxiFzFPQAUlBbbH5iBKyRX/z1JrbnYsHTfKJnUfL8+p2TPXr1pXqao4eeL4Rl144uDpK9w==}
6242
+ engines: {node: '>=20.9.0'}
6243
+ cpu: [x64]
6244
+ os: [darwin]
6245
+
6246
+ '@img/sharp-freebsd-wasm32@0.35.3':
6247
+ resolution: {integrity: sha512-lUxcqWIj2wMQ9BrwNjngcr1gWUr5xgaGThBRqPPalIC2n67Cqj1uPh8NnA/ZhAg8hUbKl+kVHKwgUIwe6ZYPrg==}
6248
+ engines: {node: '>=20.9.0'}
6249
+ os: [freebsd]
6250
+
6251
+ '@img/sharp-libvips-darwin-arm64@1.3.2':
6252
+ resolution: {integrity: sha512-9J6ypZFpQBj4YnePGoq/S38w6nz+vqg5WZLrLGY4YuSemdMq47GMLBPO42MzwdGwpg/agZ7xzZcFHa48xlywfg==}
6253
+ cpu: [arm64]
6254
+ os: [darwin]
6255
+
6256
+ '@img/sharp-libvips-darwin-x64@1.3.2':
6257
+ resolution: {integrity: sha512-m2pW1n6cns9VaubNwsZ+c3CRYjxNQWgJ5gPlnL1nbBcpkBvFm6SCFN5o0psFHI8w9n11NKhFkeEDns98tiqbEw==}
6258
+ cpu: [x64]
6259
+ os: [darwin]
6260
+
6261
+ '@img/sharp-libvips-linux-arm64@1.3.2':
6262
+ resolution: {integrity: sha512-dqVSFynCox4C/J8kT16V7SIFAns0IjgLwkvYT7p8LQVmJ5OS5b6tI9IGflxTeuBS//zXeFIUbwt5dwxyZ17cnA==}
6263
+ cpu: [arm64]
6264
+ os: [linux]
6265
+
6266
+ '@img/sharp-libvips-linux-arm@1.3.2':
6267
+ resolution: {integrity: sha512-1eMLzy92I4J6rmi4mAT8yC3HxOtniyGELlzGbNMLLeqe052ahFQ0h6LFq+lh5DsDIdYViIDst08abvSbcEdLXQ==}
6268
+ cpu: [arm]
6269
+ os: [linux]
6270
+
6271
+ '@img/sharp-libvips-linux-ppc64@1.3.2':
6272
+ resolution: {integrity: sha512-3z0NHDxD6n5I9gc05U1eW1AyRm+Gznzq3naMrthPNqE6oYykcogW0l/jfpJdjYnuNl8R7yI9pNbE1XiUeyq0Aw==}
6273
+ cpu: [ppc64]
6274
+ os: [linux]
6275
+
6276
+ '@img/sharp-libvips-linux-riscv64@1.3.2':
6277
+ resolution: {integrity: sha512-bsb4rI+NldGOsXuej2r8OdSS8+zXDVaCWxyWrcv6kneTOlgAHtZABRzBBCwdsPiD90J4myNJuHpg6kA20ImW/w==}
6278
+ cpu: [riscv64]
6279
+ os: [linux]
6280
+
6281
+ '@img/sharp-libvips-linux-s390x@1.3.2':
6282
+ resolution: {integrity: sha512-/ABshyj8gCpyIrNXnHn4LorDJ0HHm1VhXPBlxZ8zAtfVPAaSafXPGn+sUSIRiwaSBy0mmFjSjiXI5mkcwdChKQ==}
6283
+ cpu: [s390x]
6284
+ os: [linux]
6285
+
6286
+ '@img/sharp-libvips-linux-x64@1.3.2':
6287
+ resolution: {integrity: sha512-ITPEtgffGJ0S6G9dRyw/366tJQqFRcHWPHhC+Stpg3Z8AEMrDrTr2lhdz4f/Y/HMbRh//7Z5mBzEpVdi62Oc3w==}
6288
+ cpu: [x64]
6289
+ os: [linux]
6290
+
6291
+ '@img/sharp-libvips-linuxmusl-arm64@1.3.2':
6292
+ resolution: {integrity: sha512-zE9EdiUzUmg5mDT5a1rk5fYJ6GWPloTwWBYDS14naqHsL+EaMpDj1AWnpLgh3u0YCORv2Tt50wrcrpYqkP97Kw==}
6293
+ cpu: [arm64]
6294
+ os: [linux]
6295
+
6296
+ '@img/sharp-libvips-linuxmusl-x64@1.3.2':
6297
+ resolution: {integrity: sha512-m0lrLiUt+lBYnCFr8qV/65yMR4E/c7/wf78I5eKTdkEakFAlZ9QlzEM3QIhhAwVeUhLAHLcCq7a7Vszq/oFNZQ==}
6298
+ cpu: [x64]
6299
+ os: [linux]
6300
+
6301
+ '@img/sharp-linux-arm64@0.35.3':
6302
+ resolution: {integrity: sha512-QgKDspHPnrU+GQ55XPhGwyhC8acLVOOSyAvo1oVfFmrIXLkDNmGWzAfDZ4xK8oSA1qBQrALcHX0G5UZni/SuFQ==}
6303
+ engines: {node: '>=20.9.0'}
6304
+ cpu: [arm64]
6305
+ os: [linux]
6306
+
6307
+ '@img/sharp-linux-arm@0.35.3':
6308
+ resolution: {integrity: sha512-affVWCTLooy8TSxbDx2qkzuDeaWLNVBA+P//FNBirHsXpP2fuBhk5AuboYUnrDnzoXes8GFjpTx0SBFOCRg+FA==}
6309
+ engines: {node: '>=20.9.0'}
6310
+ cpu: [arm]
6311
+ os: [linux]
6312
+
6313
+ '@img/sharp-linux-ppc64@0.35.3':
6314
+ resolution: {integrity: sha512-sMd8rDxmpLOwv/7N44klFjOD5DUO7FLdjiXDI0hoxYaf7Ar262dQIEkosE98bps+5HPLtp/EvNqeqQtOycP/IA==}
6315
+ engines: {node: '>=20.9.0'}
6316
+ cpu: [ppc64]
6317
+ os: [linux]
6318
+
6319
+ '@img/sharp-linux-riscv64@0.35.3':
6320
+ resolution: {integrity: sha512-0Eob78yjlYPfL5vMNWAW55l3R9Y6BQS/gOfe0ZcP9mEz9ohhKSt4im1hayiknXgf8AWrFqMvJcKIdmLmEe7yeQ==}
6321
+ engines: {node: '>=20.9.0'}
6322
+ cpu: [riscv64]
6323
+ os: [linux]
6324
+
6325
+ '@img/sharp-linux-s390x@0.35.3':
6326
+ resolution: {integrity: sha512-KgAxQ0DxpNOq1rG2t5cgTgShJFGSuU7XO45cqC+1NVOuZnP6tlgZRuSYOfNupGkHID0o3cJOsw4DVeJpMovcGw==}
6327
+ engines: {node: '>=20.9.0'}
6328
+ cpu: [s390x]
6329
+ os: [linux]
6330
+
6331
+ '@img/sharp-linux-x64@0.35.3':
6332
+ resolution: {integrity: sha512-8pqvxubL2PGdhlPy6GLqzDYMUjyRmKAwKHYKixpdJYBUK7PJ0C029XdsnpFIdgRZG68fZiGdHVWcKPvtiPB4cA==}
6333
+ engines: {node: '>=20.9.0'}
6334
+ cpu: [x64]
6335
+ os: [linux]
6336
+
6337
+ '@img/sharp-linuxmusl-arm64@0.35.3':
6338
+ resolution: {integrity: sha512-Vz0iQjzzcSX3HCbfwFfCSG/9SCIqyO0mH2sXyiHaAYfBk0cRsCWXRyQYX0ovCK/PAQBbTzQ0dsPQHh5MAFL59w==}
6339
+ engines: {node: '>=20.9.0'}
6340
+ cpu: [arm64]
6341
+ os: [linux]
6342
+
6343
+ '@img/sharp-linuxmusl-x64@0.35.3':
6344
+ resolution: {integrity: sha512-6O1NPKcDVj9QEdg7Hx549EX8U0rp6yXQERqru6yRN7fGBn32UvIRJUlWnk+8xDCiG76hXVBbX82NZ/ZKr0euIg==}
6345
+ engines: {node: '>=20.9.0'}
6346
+ cpu: [x64]
6347
+ os: [linux]
6348
+
6349
+ '@img/sharp-wasm32@0.35.3':
6350
+ resolution: {integrity: sha512-cZ0XkcYGpHZkqW6iCkqTcmUC0CD9DhD5d/qeZlZkfRBn6GnHniZXLUo5+9xw8Iv76YE6LQFN9YNBlKREcCG76w==}
6351
+ engines: {node: '>=20.9.0'}
6352
+
6353
+ '@img/sharp-webcontainers-wasm32@0.35.3':
6354
+ resolution: {integrity: sha512-2rnq7bX3NzeR2T4YWgz8qiG4h3TSdMe+vN1iQXpJleSJ3SM5zQ8Fy2SyyXAWlbxpEZ2Y+Z4u1BePgJEYbSy80Q==}
6355
+ engines: {node: '>=20.9.0'}
6356
+ cpu: [wasm32]
6357
+
6358
+ '@img/sharp-win32-arm64@0.35.3':
6359
+ resolution: {integrity: sha512-4bPwFdMbeC4JQ8L8LOyWp6nsHcboP5fxkp6iPOXz2Vg49R42TuMs2whkJ5OAP4/Ul035qOzy0AecOF9VOscn4w==}
6360
+ engines: {node: '>=20.9.0'}
6361
+ cpu: [arm64]
6362
+ os: [win32]
6363
+
6364
+ '@img/sharp-win32-ia32@0.35.3':
6365
+ resolution: {integrity: sha512-r53mXsBN6lFUDiST764SvgwUdHAqM4rPAiDzAmf4fLoB6X/rkfyTrLCg6+g17wJJiCmB3JYgHuUldCWUIRFSXw==}
6366
+ engines: {node: ^20.9.0}
6367
+ cpu: [ia32]
6368
+ os: [win32]
6369
+
6370
+ '@img/sharp-win32-x64@0.35.3':
6371
+ resolution: {integrity: sha512-D4y1vNeZrIIJCN+uHaWVtH86B+aCrdMYYjicy9pXHvbGZeGYLLSd3wdVuC37FxVXlU1ARsk84eKWfWMXGYEqvA==}
6372
+ engines: {node: '>=20.9.0'}
6373
+ cpu: [x64]
6374
+ os: [win32]
6375
+
6376
+ '@next/env@16.3.3':
6377
+ resolution: {integrity: sha512-U2eYQRwXj+dsqxV79zFqExDdatnNY/ZWc2nsJU1p/OgT7fd3dXwlF6OjYaFQCfMoeTA19PWq+wVmYgimVA+V+g==}
6378
+
6379
+ '@next/eslint-plugin-next@16.3.3':
6380
+ resolution: {integrity: sha512-pbEh30vvjKpDoTAmo1v3q2uM4JUi8QaEBpbmjWvGfoec2jLghy/WNtvzAT0bk+Ik9oz6etjt4YjXEk4BQnicCw==}
6381
+
6382
+ '@next/swc-darwin-arm64@16.3.3':
6383
+ resolution: {integrity: sha512-8Hiv32QJPwdV6KYJ8meR9SBA061tQqnIKTJDocvOXlEQqib0xMFpzArosuffFUUc0sslbh7QQ8a3Yey1QV8EIw==}
6384
+ engines: {node: '>= 10'}
6385
+ cpu: [arm64]
6386
+ os: [darwin]
6387
+
6388
+ '@next/swc-darwin-x64@16.3.3':
6389
+ resolution: {integrity: sha512-A1lgKgwVchRYmSe467zdwhxT9040dd8lH+o65sL5Jet8fjB4kegw/rDyPIpYVRb6jAqwXFOJpjIXJLxQKLiE3A==}
6390
+ engines: {node: '>= 10'}
6391
+ cpu: [x64]
6392
+ os: [darwin]
6393
+
6394
+ '@next/swc-linux-arm64-gnu@16.3.3':
6395
+ resolution: {integrity: sha512-bf0FIssMFueU2dm7vQEWWxk0c8UjKTdW0yzuh0sQsD8pf1+KCLDdaqhYZNMYGmXwEOiHAUzgBKudovIlcvvBjg==}
6396
+ engines: {node: '>= 10'}
6397
+ cpu: [arm64]
6398
+ os: [linux]
6399
+
6400
+ '@next/swc-linux-arm64-musl@16.3.3':
6401
+ resolution: {integrity: sha512-W7viwCk9JY/cAkdz/A273rd5bb3RgT/IHwR7Upv90tunjBWNtAAhGhoecHh+teRNRSinuAFmE+l7fwZ4YKkrXg==}
6402
+ engines: {node: '>= 10'}
6403
+ cpu: [arm64]
6404
+ os: [linux]
6405
+
6406
+ '@next/swc-linux-x64-gnu@16.3.3':
6407
+ resolution: {integrity: sha512-0W46zw1N3ODpI6n0GeivHvvob1pooozgZVqy65k0mh4/7vr+FbY9+WpHzNVXjHipJf/A3FDheBG19H1s5A25rA==}
6408
+ engines: {node: '>= 10'}
6409
+ cpu: [x64]
6410
+ os: [linux]
6411
+
6412
+ '@next/swc-linux-x64-musl@16.3.3':
6413
+ resolution: {integrity: sha512-H4mBso8ZTMBPtdT0PN0pBx2ayTvQuTuvS6qT13d77yVFJXAPCxkyIhLTmdMaGTJs0krQYI/qpzdHijCeihXhbg==}
6414
+ engines: {node: '>= 10'}
6415
+ cpu: [x64]
6416
+ os: [linux]
6417
+
6418
+ '@next/swc-win32-arm64-msvc@16.3.3':
6419
+ resolution: {integrity: sha512-cTMUJpcEGmeywofCUfhR+rSsoE33+rVPnPEYNTNdLNlsOeEg/vktOsKUSTb28vUGqD2jkm4Zaskcwn7OCI6FQg==}
6420
+ engines: {node: '>= 10'}
6421
+ cpu: [arm64]
6422
+ os: [win32]
6423
+
6424
+ '@next/swc-win32-x64-msvc@16.3.3':
6425
+ resolution: {integrity: sha512-2VR4cTBzHXaBjnGsuH6GyJjENzQOmHeAh11uY1iUhjm3j5dEUrVJuUj+VL78jaGi/Dik8xS76zEj18BsFhlVZQ==}
6426
+ engines: {node: '>= 10'}
6427
+ cpu: [x64]
6428
+ os: [win32]
6429
+
6430
+ '@swc/helpers@0.5.23':
6431
+ resolution: {integrity: sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==}
6432
+
6433
+ baseline-browser-mapping@2.11.19:
6434
+ resolution: {integrity: sha512-Grytf1xOxOEMTGRwx6rLGKkTabd4vMg3VrKdj/7joCmV0qgh4QwMMO6xh34YEXQqirAuUdgQGa5orJQQ+69RBw==}
6435
+ engines: {node: '>=6.0.0'}
6436
+ hasBin: true
6437
+
6438
+ eslint-config-next@16.3.3:
6439
+ resolution: {integrity: sha512-teqtsR26tnlfXFHfVLTM/4tzEzU8DMu6GS1sddZzhfGzgd2f2ofbgDUcsk6cssSCzX6Tk6fmWifJcdANSdPJrw==}
6440
+ peerDependencies:
6441
+ eslint: '>=9.0.0'
6442
+ typescript: '>=3.3.1'
6443
+ peerDependenciesMeta:
6444
+ typescript:
6445
+ optional: true
6446
+
6447
+ nanoid@3.3.18:
6448
+ resolution: {integrity: sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==}
6449
+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
6450
+ hasBin: true
6451
+
6452
+ next@16.3.3:
6453
+ resolution: {integrity: sha512-tuRTx1nQ/yVw83cwJBo9F+njGUgMn3UHQycreWHB8XsStvvAh1AthbI8/4IpKnFaF58F+iSiHejYOlMQ/eq83g==}
6454
+ engines: {node: '>=20.9.0'}
6455
+ hasBin: true
6456
+ peerDependencies:
6457
+ '@opentelemetry/api': ^1.1.0
6458
+ '@playwright/test': ^1.51.1
6459
+ babel-plugin-react-compiler: '*'
6460
+ react: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0
6461
+ react-dom: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0
6462
+ sass: ^1.3.0
6463
+ peerDependenciesMeta:
6464
+ '@opentelemetry/api':
6465
+ optional: true
6466
+ '@playwright/test':
6467
+ optional: true
6468
+ babel-plugin-react-compiler:
6469
+ optional: true
6470
+ sass:
6471
+ optional: true
6472
+
6473
+ postcss@8.5.23:
6474
+ resolution: {integrity: sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg==}
6475
+ engines: {node: ^10 || ^12 || >=14}
6476
+
6477
+ semver@7.8.5:
6478
+ resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==}
6479
+ engines: {node: '>=10'}
6480
+ hasBin: true
6481
+
6482
+ sharp@0.35.3:
6483
+ resolution: {integrity: sha512-ej0zVHuZGHCiABXcNxeYhpRnPNPAcvbG8RMdBAhDAxLKkCRVSpK3Iyu7qbqw3JMzoj0REeM6f3tJLtVwl0023Q==}
6484
+ engines: {node: '>=20.9.0'}
6485
+ peerDependencies:
6486
+ '@types/node': '*'
6487
+ peerDependenciesMeta:
6488
+ '@types/node':
6489
+ optional: true
6490
+
6227
6491
  snapshots:
6228
6492
 
6229
6493
  '@alloc/quick-lru@5.2.0': {}
@@ -12786,3 +13050,243 @@ snapshots:
12786
13050
  zod@3.25.76: {}
12787
13051
 
12788
13052
  zod@4.3.6: {}
13053
+ '@emnapi/runtime@1.11.3':
13054
+ dependencies:
13055
+ tslib: 2.8.1
13056
+ optional: true
13057
+
13058
+ '@img/colour@1.1.0':
13059
+ optional: true
13060
+
13061
+ '@img/sharp-darwin-arm64@0.35.3':
13062
+ optionalDependencies:
13063
+ '@img/sharp-libvips-darwin-arm64': 1.3.2
13064
+ optional: true
13065
+
13066
+ '@img/sharp-darwin-x64@0.35.3':
13067
+ optionalDependencies:
13068
+ '@img/sharp-libvips-darwin-x64': 1.3.2
13069
+ optional: true
13070
+
13071
+ '@img/sharp-freebsd-wasm32@0.35.3':
13072
+ dependencies:
13073
+ '@img/sharp-wasm32': 0.35.3
13074
+ optional: true
13075
+
13076
+ '@img/sharp-libvips-darwin-arm64@1.3.2':
13077
+ optional: true
13078
+
13079
+ '@img/sharp-libvips-darwin-x64@1.3.2':
13080
+ optional: true
13081
+
13082
+ '@img/sharp-libvips-linux-arm64@1.3.2':
13083
+ optional: true
13084
+
13085
+ '@img/sharp-libvips-linux-arm@1.3.2':
13086
+ optional: true
13087
+
13088
+ '@img/sharp-libvips-linux-ppc64@1.3.2':
13089
+ optional: true
13090
+
13091
+ '@img/sharp-libvips-linux-riscv64@1.3.2':
13092
+ optional: true
13093
+
13094
+ '@img/sharp-libvips-linux-s390x@1.3.2':
13095
+ optional: true
13096
+
13097
+ '@img/sharp-libvips-linux-x64@1.3.2':
13098
+ optional: true
13099
+
13100
+ '@img/sharp-libvips-linuxmusl-arm64@1.3.2':
13101
+ optional: true
13102
+
13103
+ '@img/sharp-libvips-linuxmusl-x64@1.3.2':
13104
+ optional: true
13105
+
13106
+ '@img/sharp-linux-arm64@0.35.3':
13107
+ optionalDependencies:
13108
+ '@img/sharp-libvips-linux-arm64': 1.3.2
13109
+ optional: true
13110
+
13111
+ '@img/sharp-linux-arm@0.35.3':
13112
+ optionalDependencies:
13113
+ '@img/sharp-libvips-linux-arm': 1.3.2
13114
+ optional: true
13115
+
13116
+ '@img/sharp-linux-ppc64@0.35.3':
13117
+ optionalDependencies:
13118
+ '@img/sharp-libvips-linux-ppc64': 1.3.2
13119
+ optional: true
13120
+
13121
+ '@img/sharp-linux-riscv64@0.35.3':
13122
+ optionalDependencies:
13123
+ '@img/sharp-libvips-linux-riscv64': 1.3.2
13124
+ optional: true
13125
+
13126
+ '@img/sharp-linux-s390x@0.35.3':
13127
+ optionalDependencies:
13128
+ '@img/sharp-libvips-linux-s390x': 1.3.2
13129
+ optional: true
13130
+
13131
+ '@img/sharp-linux-x64@0.35.3':
13132
+ optionalDependencies:
13133
+ '@img/sharp-libvips-linux-x64': 1.3.2
13134
+ optional: true
13135
+
13136
+ '@img/sharp-linuxmusl-arm64@0.35.3':
13137
+ optionalDependencies:
13138
+ '@img/sharp-libvips-linuxmusl-arm64': 1.3.2
13139
+ optional: true
13140
+
13141
+ '@img/sharp-linuxmusl-x64@0.35.3':
13142
+ optionalDependencies:
13143
+ '@img/sharp-libvips-linuxmusl-x64': 1.3.2
13144
+ optional: true
13145
+
13146
+ '@img/sharp-wasm32@0.35.3':
13147
+ dependencies:
13148
+ '@emnapi/runtime': 1.11.3
13149
+ optional: true
13150
+
13151
+ '@img/sharp-webcontainers-wasm32@0.35.3':
13152
+ dependencies:
13153
+ '@img/sharp-wasm32': 0.35.3
13154
+ optional: true
13155
+
13156
+ '@img/sharp-win32-arm64@0.35.3':
13157
+ optional: true
13158
+
13159
+ '@img/sharp-win32-ia32@0.35.3':
13160
+ optional: true
13161
+
13162
+ '@img/sharp-win32-x64@0.35.3':
13163
+ optional: true
13164
+
13165
+ '@next/env@16.3.3': {}
13166
+
13167
+ '@next/eslint-plugin-next@16.3.3(eslint@9.39.2(jiti@2.6.1))':
13168
+ dependencies:
13169
+ '@eslint-community/eslint-utils': 4.9.1(eslint@9.39.2(jiti@2.6.1))
13170
+ fast-glob: 3.3.1
13171
+ transitivePeerDependencies:
13172
+ - eslint
13173
+
13174
+ '@next/swc-darwin-arm64@16.3.3':
13175
+ optional: true
13176
+
13177
+ '@next/swc-darwin-x64@16.3.3':
13178
+ optional: true
13179
+
13180
+ '@next/swc-linux-arm64-gnu@16.3.3':
13181
+ optional: true
13182
+
13183
+ '@next/swc-linux-arm64-musl@16.3.3':
13184
+ optional: true
13185
+
13186
+ '@next/swc-linux-x64-gnu@16.3.3':
13187
+ optional: true
13188
+
13189
+ '@next/swc-linux-x64-musl@16.3.3':
13190
+ optional: true
13191
+
13192
+ '@next/swc-win32-arm64-msvc@16.3.3':
13193
+ optional: true
13194
+
13195
+ '@next/swc-win32-x64-msvc@16.3.3':
13196
+ optional: true
13197
+
13198
+ '@swc/helpers@0.5.23':
13199
+ dependencies:
13200
+ tslib: 2.8.1
13201
+
13202
+ baseline-browser-mapping@2.11.19: {}
13203
+
13204
+ eslint-config-next@16.3.3(@typescript-eslint/parser@8.54.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3):
13205
+ dependencies:
13206
+ '@next/eslint-plugin-next': 16.3.3(eslint@9.39.2(jiti@2.6.1))
13207
+ eslint: 9.39.2(jiti@2.6.1)
13208
+ eslint-import-resolver-node: 0.3.9
13209
+ eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.39.2(jiti@2.6.1))
13210
+ eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.54.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.2(jiti@2.6.1))
13211
+ eslint-plugin-jsx-a11y: 6.10.2(eslint@9.39.2(jiti@2.6.1))
13212
+ eslint-plugin-react: 7.37.5(eslint@9.39.2(jiti@2.6.1))
13213
+ eslint-plugin-react-hooks: 7.0.1(eslint@9.39.2(jiti@2.6.1))
13214
+ globals: 16.4.0
13215
+ typescript-eslint: 8.54.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3)
13216
+ optionalDependencies:
13217
+ typescript: 5.9.3
13218
+ transitivePeerDependencies:
13219
+ - '@typescript-eslint/parser'
13220
+ - eslint-import-resolver-webpack
13221
+ - eslint-plugin-import-x
13222
+ - supports-color
13223
+
13224
+ nanoid@3.3.18: {}
13225
+
13226
+ next@16.3.3(@babel/core@7.28.6)(@types/node@20.19.30)(react-dom@19.2.3(react@19.2.3))(react@19.2.3):
13227
+ dependencies:
13228
+ '@next/env': 16.3.3
13229
+ '@swc/helpers': 0.5.23
13230
+ baseline-browser-mapping: 2.11.19
13231
+ caniuse-lite: 1.0.30001766
13232
+ postcss: 8.5.23
13233
+ react: 19.2.3
13234
+ react-dom: 19.2.3(react@19.2.3)
13235
+ styled-jsx: 5.1.6(@babel/core@7.28.6)(react@19.2.3)
13236
+ optionalDependencies:
13237
+ '@next/swc-darwin-arm64': 16.3.3
13238
+ '@next/swc-darwin-x64': 16.3.3
13239
+ '@next/swc-linux-arm64-gnu': 16.3.3
13240
+ '@next/swc-linux-arm64-musl': 16.3.3
13241
+ '@next/swc-linux-x64-gnu': 16.3.3
13242
+ '@next/swc-linux-x64-musl': 16.3.3
13243
+ '@next/swc-win32-arm64-msvc': 16.3.3
13244
+ '@next/swc-win32-x64-msvc': 16.3.3
13245
+ sharp: 0.35.3(@types/node@20.19.30)
13246
+ transitivePeerDependencies:
13247
+ - '@babel/core'
13248
+ - '@types/node'
13249
+ - babel-plugin-macros
13250
+
13251
+ postcss@8.5.23:
13252
+ dependencies:
13253
+ nanoid: 3.3.18
13254
+ picocolors: 1.1.1
13255
+ source-map-js: 1.2.1
13256
+
13257
+ semver@7.8.5:
13258
+ optional: true
13259
+
13260
+ sharp@0.35.3(@types/node@20.19.30):
13261
+ dependencies:
13262
+ '@img/colour': 1.1.0
13263
+ detect-libc: 2.1.2
13264
+ semver: 7.8.5
13265
+ optionalDependencies:
13266
+ '@img/sharp-darwin-arm64': 0.35.3
13267
+ '@img/sharp-darwin-x64': 0.35.3
13268
+ '@img/sharp-freebsd-wasm32': 0.35.3
13269
+ '@img/sharp-libvips-darwin-arm64': 1.3.2
13270
+ '@img/sharp-libvips-darwin-x64': 1.3.2
13271
+ '@img/sharp-libvips-linux-arm': 1.3.2
13272
+ '@img/sharp-libvips-linux-arm64': 1.3.2
13273
+ '@img/sharp-libvips-linux-ppc64': 1.3.2
13274
+ '@img/sharp-libvips-linux-riscv64': 1.3.2
13275
+ '@img/sharp-libvips-linux-s390x': 1.3.2
13276
+ '@img/sharp-libvips-linux-x64': 1.3.2
13277
+ '@img/sharp-libvips-linuxmusl-arm64': 1.3.2
13278
+ '@img/sharp-libvips-linuxmusl-x64': 1.3.2
13279
+ '@img/sharp-linux-arm': 0.35.3
13280
+ '@img/sharp-linux-arm64': 0.35.3
13281
+ '@img/sharp-linux-ppc64': 0.35.3
13282
+ '@img/sharp-linux-riscv64': 0.35.3
13283
+ '@img/sharp-linux-s390x': 0.35.3
13284
+ '@img/sharp-linux-x64': 0.35.3
13285
+ '@img/sharp-linuxmusl-arm64': 0.35.3
13286
+ '@img/sharp-linuxmusl-x64': 0.35.3
13287
+ '@img/sharp-webcontainers-wasm32': 0.35.3
13288
+ '@img/sharp-win32-arm64': 0.35.3
13289
+ '@img/sharp-win32-ia32': 0.35.3
13290
+ '@img/sharp-win32-x64': 0.35.3
13291
+ '@types/node': 20.19.30
13292
+ optional: true
@@ -61,15 +61,42 @@ echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for dev..."
61
61
  exec env PORT="${DEPLOY_RUN_PORT}" pnpm tsx watch src/server.ts
62
62
  <% } else { %>
63
63
  LOG_DIR="${COZE_LOG_DIR:-${COZE_WORKSPACE_PATH}/logs}"
64
- LOG_FILE="${LOG_DIR}/server.log"
64
+ LOG_FILE="${LOG_DIR}/app.log"
65
65
  PID_FILE="${LOG_DIR}/server.pid"
66
66
 
67
+ # detached 出去的进程没人负责回收,超过这个时长就自己退出,避免端口与内存长期泄露。
68
+ MAX_RUNTIME_SECONDS=1200
69
+
70
+ # 真正被 detach 的是这层 bash wrapper:它是进程组 leader,组内 watchdog 到点回收整组
71
+ # (wrapper -> pnpm -> tsx -> node);被包的进程自己先退出时也顺手清空进程组,不留残余。
72
+ RUN_WITH_TIMEOUT='
73
+ timeout_seconds=$1
74
+ shift
75
+
76
+ "$@" &
77
+ child_pid=$!
78
+
79
+ # 先忽略 TERM,才能在向整组发 TERM(自己也在组里)之后存活下来补一发 KILL。
80
+ ( trap "" TERM
81
+ sleep "${timeout_seconds}"
82
+ echo "[dev] 后台进程运行超过 ${timeout_seconds}s,回收进程组 $$。"
83
+ kill -TERM -- "-$$" 2>/dev/null || true
84
+ sleep 5
85
+ kill -KILL -- "-$$" 2>/dev/null || true
86
+ ) &
87
+
88
+ wait "${child_pid}"
89
+ kill -KILL -- "-$$" 2>/dev/null || true
90
+ '
91
+
92
+ # 返回的 PID 是 wrapper 的,同时也是整个进程组的 PGID,后续按组回收。
67
93
  spawn_detached() {
68
94
  local cwd="$1"
69
95
  local log_file="$2"
70
96
  shift 2
71
97
 
72
- node - "$cwd" "$log_file" "$@" <<'NODE'
98
+ node - "$cwd" "$log_file" \
99
+ /bin/bash -c "${RUN_WITH_TIMEOUT}" detached-runner "${MAX_RUNTIME_SECONDS}" "$@" <<'NODE'
73
100
  const fs = require('node:fs');
74
101
  const { spawn } = require('node:child_process');
75
102
 
@@ -232,6 +259,7 @@ elif [[ "${ready_status}" -ne 0 ]]; then
232
259
  fi
233
260
 
234
261
  echo "Dev server started (PID: ${server_pid}), listening on port ${DEPLOY_RUN_PORT}."
262
+ echo "Auto stop after ${MAX_RUNTIME_SECONDS}s."
235
263
  echo "Log file: ${LOG_FILE}"
236
264
  echo "PID file: ${PID_FILE}"
237
265
  <% } %>