@coze-arch/cli 0.0.36-alpha.75f808 → 0.0.36-alpha.80ccd6

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
@@ -69,7 +69,9 @@ build_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Fil
69
69
 
70
70
  ## 部署
71
71
 
72
- `coze-dev deploy` 内置于同一 CLI,登录态默认保存在 `~/.coze/cli/config.json`:
72
+ `coze-dev deploy` 内置于同一 CLI。认证优先读取
73
+ `~/.coze/desktop/runtime.beta.json`,其次读取 `~/.coze/desktop/runtime.json`;
74
+ 桌面 Token 不可用时再回退到 `COZE_API_TOKEN` 和 `~/.coze/cli/config.json` 登录态:
73
75
 
74
76
  ```bash
75
77
  coze-dev deploy auth login
package/docs/deploy.md CHANGED
@@ -1,7 +1,14 @@
1
1
  # coze-dev deploy
2
2
 
3
- `coze-dev` 内置的部署命令,复用主 Coze CLI 保存在
4
- `~/.coze/cli/config.json` 中的登录状态。
3
+ `coze-dev` 内置的部署命令。认证凭据按以下优先级读取:
4
+
5
+ 1. `~/.coze/desktop/runtime.beta.json` 的 `patToken.accessToken`
6
+ 2. `~/.coze/desktop/runtime.json` 的 `patToken.accessToken`
7
+ 3. 非空环境变量 `COZE_API_TOKEN`
8
+ 4. 主 Coze CLI 保存在 `~/.coze/cli/config.json` 中的登录状态
9
+
10
+ 桌面运行时文件不存在、不可读、JSON 无效或 Token 字段缺失、为空时,CLI
11
+ 静默尝试下一来源,不输出或持久化 Token。
5
12
 
6
13
  ## 安装与运行
7
14
 
@@ -16,7 +16,12 @@ EXPO_HOST="0.0.0.0"
16
16
  EXPO_DIR="expo"
17
17
  # DEPLOY_RUN_PORT 是平台注入的对外端口,EXPO_PORT 保留为本地覆盖项。
18
18
  EXPO_PORT="${DEPLOY_RUN_PORT:-${EXPO_PORT:-<%= port %>}}"
19
- WEB_URL="${COZE_PROJECT_DOMAIN_DEFAULT:-http://127.0.0.1:${SERVER_PORT}}"
19
+ COZE_HARDWARE_DID="${COZE_HARDWARE_DID:-}"
20
+ if [ -n "${EXPO_PORT:-}" ] && [ -n "${COZE_HARDWARE_DID}" ]; then
21
+ WEB_URL="${COZE_PROJECT_DOMAIN_DEFAULT:-https://cozedaemon-${COZE_HARDWARE_DID}-${EXPO_PORT}.dev.coze.site}"
22
+ else
23
+ WEB_URL="${COZE_PROJECT_DOMAIN_DEFAULT:-http://127.0.0.1:${SERVER_PORT}}"
24
+ fi
20
25
  ASSUME_YES="1"
21
26
  EXPO_PUBLIC_BACKEND_BASE_URL="${EXPO_PUBLIC_BACKEND_BASE_URL:-$WEB_URL}"
22
27
  EXPO_PUBLIC_COZE_PROJECT_ID="${COZE_PROJECT_ID:-}"
@@ -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
@@ -14,22 +14,42 @@ DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-${PORT}}"
14
14
 
15
15
  cd "${COZE_WORKSPACE_PATH}"
16
16
 
17
+ list_port_pids() {
18
+ local port=$1
19
+ local pids=""
20
+ local has_tool=0
21
+
22
+ if command -v ss >/dev/null 2>&1; then
23
+ has_tool=1
24
+ pids=$(ss -H -lntp 2>/dev/null | awk -v port="${port}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | sort -u | paste -sd' ' - || true)
25
+ fi
26
+ if [[ -z "${pids}" ]] && command -v lsof >/dev/null 2>&1; then
27
+ has_tool=1
28
+ pids=$(lsof -t -iTCP:"${port}" -sTCP:LISTEN 2>/dev/null | sort -u | paste -sd' ' - || true)
29
+ fi
30
+ if [[ "${has_tool}" -eq 0 ]]; then
31
+ echo "Warning: neither ss nor lsof available, cannot inspect port ${port}." >&2
32
+ fi
33
+
34
+ echo "${pids}"
35
+ }
36
+
17
37
  kill_port_if_listening() {
18
38
  local pids
19
- pids=$(ss -H -lntp 2>/dev/null | awk -v port="${DEPLOY_RUN_PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
39
+ pids=$(list_port_pids "${DEPLOY_RUN_PORT}")
20
40
  if [[ -z "${pids}" ]]; then
21
41
  echo "Port ${DEPLOY_RUN_PORT} is free."
22
42
  return
23
43
  fi
24
44
  echo "Port ${DEPLOY_RUN_PORT} in use by PIDs: ${pids} (SIGKILL)"
25
- echo "${pids}" | xargs -I {} kill -9 {}
45
+ echo "${pids}" | xargs -I {} kill -9 {} || true
26
46
  sleep 1
27
- pids=$(ss -H -lntp 2>/dev/null | awk -v port="${DEPLOY_RUN_PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
47
+ pids=$(list_port_pids "${DEPLOY_RUN_PORT}")
28
48
  if [[ -n "${pids}" ]]; then
29
- echo "Warning: port ${DEPLOY_RUN_PORT} still busy after SIGKILL, PIDs: ${pids}"
30
- else
31
- echo "Port ${DEPLOY_RUN_PORT} cleared."
49
+ echo "端口 ${DEPLOY_RUN_PORT} PID ${pids} 占用且无法清理(SIGKILL 后仍在监听),dev server 无法启动。" >&2
50
+ exit 1
32
51
  fi
52
+ echo "Port ${DEPLOY_RUN_PORT} cleared."
33
53
  }
34
54
 
35
55
  <% if (process.env.NODE_ENV === 'test') { %>
@@ -41,11 +61,9 @@ echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for dev..."
41
61
  exec env PORT="${DEPLOY_RUN_PORT}" pnpm tsx watch src/server.ts
42
62
  <% } else { %>
43
63
  LOG_DIR="${COZE_LOG_DIR:-${COZE_WORKSPACE_PATH}/logs}"
44
- LOG_FILE="${LOG_DIR}/server.log"
64
+ LOG_FILE="${LOG_DIR}/app.log"
45
65
  PID_FILE="${LOG_DIR}/server.pid"
46
66
 
47
- # coze-daemon 会在 runtime shell 退出时清理原进程组。
48
- # 通过 Node detached spawn 创建独立 session/进程组,并将 stdio 直接写入日志。
49
67
  spawn_detached() {
50
68
  local cwd="$1"
51
69
  local log_file="$2"
@@ -87,6 +105,89 @@ stop_detached() {
87
105
  kill -KILL -- "-${pid}" 2>/dev/null || true
88
106
  }
89
107
 
108
+ READY_RETRIES=10
109
+ READY_PROBE_HOSTS=("127.0.0.1" "::1")
110
+ LOG_TAIL_LINES=40
111
+
112
+ dump_log() {
113
+ echo "---- tail -n ${LOG_TAIL_LINES} ${LOG_FILE} ----" >&2
114
+ tail -n "${LOG_TAIL_LINES}" "${LOG_FILE}" >&2 || true
115
+ echo "---- end of ${LOG_FILE} ----" >&2
116
+ }
117
+
118
+ # 仅用于无 ss/lsof 时的兜底探测。服务可能只 bind IPv4 loopback、只 bind IPv6 loopback
119
+ # (server.listen(port, 'localhost') 会变成 ::1 独占),或 bind 双栈通配地址,
120
+ port_connectable() {
121
+ local port=$1
122
+ local host
123
+ for host in "${READY_PROBE_HOSTS[@]}"; do
124
+ if command -v nc >/dev/null 2>&1; then
125
+ if nc -z -w 1 "${host}" "${port}" >/dev/null 2>&1; then
126
+ return 0
127
+ fi
128
+ elif (exec 3<>"/dev/tcp/${host}/${port}") >/dev/null 2>&1; then
129
+ return 0
130
+ fi
131
+ done
132
+ return 1
133
+ }
134
+
135
+ port_probe_available() {
136
+ command -v ss >/dev/null 2>&1 || command -v lsof >/dev/null 2>&1
137
+ }
138
+
139
+ # 端口监听者是否属于本进程组:spawn detached 后 PID == PGID,子孙进程继承该 PGID。
140
+ # 0 = 是;1 = 不是(无人监听,或监听者不属于本进程组);2 = 无探测工具,无法判断
141
+ port_listened_by_pgid() {
142
+ local port=$1 pgid=$2
143
+ local listener owner
144
+
145
+ if ! port_probe_available; then
146
+ return 2
147
+ fi
148
+
149
+ for listener in $(list_port_pids "${port}" 2>/dev/null); do
150
+ owner=$(ps -o pgid= -p "${listener}" 2>/dev/null | tr -d ' ')
151
+ if [[ "${owner}" == "${pgid}" ]]; then
152
+ return 0
153
+ fi
154
+ done
155
+ return 1
156
+ }
157
+
158
+ wait_for_ready() {
159
+ local pid=$1 port=$2
160
+ local attempt=0 owned
161
+
162
+ if ! port_probe_available; then
163
+ echo "Warning: 缺少 ss 与 lsof,无法确认端口监听者归属,仅按 loopback 可连接性判断就绪。" >&2
164
+ fi
165
+
166
+ while [[ "${attempt}" -lt "${READY_RETRIES}" ]]; do
167
+ if ! kill -0 "${pid}" 2>/dev/null; then
168
+ echo "Dev server 进程在启动过程中退出。" >&2
169
+ return 1
170
+ fi
171
+
172
+ if port_listened_by_pgid "${port}" "${pid}"; then
173
+ owned=0
174
+ else
175
+ owned=$?
176
+ fi
177
+ if [[ "${owned}" -eq 0 ]]; then
178
+ return 0
179
+ fi
180
+ if [[ "${owned}" -eq 2 ]] && port_connectable "${port}"; then
181
+ return 0
182
+ fi
183
+
184
+ sleep 1
185
+ attempt=$((attempt + 1))
186
+ done
187
+
188
+ return 2
189
+ }
190
+
90
191
  # 监听端口的是孙进程(pnpm -> tsx -> node),只清端口会漏掉上层 pnpm/tsx,
91
192
  # 所以先按上次记录的 PID 把整个进程组回收掉。
92
193
  if [[ -f "${PID_FILE}" ]]; then
@@ -104,17 +205,33 @@ mkdir -p "${LOG_DIR}"
104
205
  export PORT="${DEPLOY_RUN_PORT}"
105
206
  server_pid="$(spawn_detached "${COZE_WORKSPACE_PATH}" "${LOG_FILE}" \
106
207
  "$(command -v pnpm)" tsx watch src/server.ts)"
208
+ if [[ -z "${server_pid}" ]]; then
209
+ echo "Dev server failed to start: 未获取到后台进程 PID。" >&2
210
+ dump_log
211
+ exit 1
212
+ fi
107
213
  echo "${server_pid}" > "${PID_FILE}"
108
214
 
109
- sleep 1
110
- if [[ -z "${server_pid}" ]] || ! kill -0 "${server_pid}" 2>/dev/null; then
215
+ if wait_for_ready "${server_pid}" "${DEPLOY_RUN_PORT}"; then
216
+ ready_status=0
217
+ else
218
+ ready_status=$?
219
+ fi
220
+
221
+ if [[ "${ready_status}" -eq 2 ]]; then
222
+ # 进程还活着但迟迟没监听端口:多半是编译/运行时报错后 tsx watch 驻留,日志里有真正原因。
223
+ echo "Dev server 在 ${READY_RETRIES} 次探测(每次 1s)内未就绪于端口 ${DEPLOY_RUN_PORT}(进程 ${server_pid} 仍在运行)。" >&2
224
+ dump_log
225
+ exit 1
226
+ elif [[ "${ready_status}" -ne 0 ]]; then
111
227
  echo "Dev server failed to start. See ${LOG_FILE}." >&2
112
- tail -n 20 "${LOG_FILE}" >&2 || true
228
+ dump_log
229
+ stop_detached "${server_pid}"
113
230
  rm -f "${PID_FILE}"
114
231
  exit 1
115
232
  fi
116
233
 
117
- echo "Dev server started (PID: ${server_pid})."
234
+ echo "Dev server started (PID: ${server_pid}), listening on port ${DEPLOY_RUN_PORT}."
118
235
  echo "Log file: ${LOG_FILE}"
119
236
  echo "PID file: ${PID_FILE}"
120
237
  <% } %>
package/lib/cli.js CHANGED
@@ -23,9 +23,9 @@ var Ajv = require('ajv');
23
23
  var minimist = require('minimist');
24
24
  var changeCase = require('change-case');
25
25
  var ejs = require('ejs');
26
- var node_crypto = require('node:crypto');
27
26
  var node_os = require('node:os');
28
27
  var promises = require('node:fs/promises');
28
+ var node_crypto = require('node:crypto');
29
29
  var node_child_process = require('node:child_process');
30
30
  var node_util = require('node:util');
31
31
  var tar = require('tar');
@@ -2114,7 +2114,7 @@ const EventBuilder = {
2114
2114
  };
2115
2115
 
2116
2116
  var name = "@coze-arch/cli";
2117
- var version = "0.0.36-alpha.75f808";
2117
+ var version = "0.0.36-alpha.80ccd6";
2118
2118
  var description = "coze coding devtools cli";
2119
2119
  var license = "MIT";
2120
2120
  var author = "fanwenjie.fe@bytedance.com";
@@ -10467,7 +10467,6 @@ const withRequestedApplicationType = (
10467
10467
  };
10468
10468
 
10469
10469
  function _optionalChain$b(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
10470
-
10471
10470
  const DEFAULT_CONFIG = {
10472
10471
  apiBaseUrl: 'https://code.coze.cn/',
10473
10472
  openApiBaseUrl: 'https://api.coze.cn',
@@ -10479,6 +10478,11 @@ const getSharedConfigPath = () =>
10479
10478
 
10480
10479
  const getLegacyConfigPath = () => node_path.join(node_os.homedir(), '.coze', 'config.json');
10481
10480
 
10481
+ const getDesktopRuntimePaths = () => [
10482
+ node_path.join(node_os.homedir(), '.coze', 'desktop', 'runtime.beta.json'),
10483
+ node_path.join(node_os.homedir(), '.coze', 'desktop', 'runtime.json'),
10484
+ ];
10485
+
10482
10486
  const isRecord$3 = (value) =>
10483
10487
  typeof value === 'object' && value !== null && !Array.isArray(value);
10484
10488
 
@@ -10494,6 +10498,23 @@ const readJson = async (path) => {
10494
10498
  }
10495
10499
  };
10496
10500
 
10501
+ const readDesktopAccessToken = async () => {
10502
+ for (const path of getDesktopRuntimePaths()) {
10503
+ try {
10504
+ const runtime = safeJsonParse(await promises.readFile(path, 'utf8'), undefined);
10505
+ if (!isRecord$3(runtime) || !isRecord$3(runtime.patToken)) {
10506
+ continue;
10507
+ }
10508
+ const {accessToken} = runtime.patToken;
10509
+ if (typeof accessToken === 'string' && accessToken.trim()) {
10510
+ return accessToken.trim();
10511
+ }
10512
+ } catch (error) {
10513
+ }
10514
+ }
10515
+ return undefined;
10516
+ };
10517
+
10497
10518
  const configuredPath = (options) =>
10498
10519
  _optionalChain$b([options, 'optionalAccess', _ => _.config]) || process.env.COZE_CONFIG_FILE;
10499
10520
 
@@ -10502,15 +10523,17 @@ const loadConfig = async (options = {}) => {
10502
10523
  const globalConfig = customPath
10503
10524
  ? await readJson(node_path.resolve(customPath))
10504
10525
  : (await readJson(getSharedConfigPath())) || (await readJson(getLegacyConfigPath()));
10526
+ const desktopAccessToken = await readDesktopAccessToken();
10505
10527
  const environmentAccessToken = process.env.COZE_API_TOKEN;
10528
+ const fixedAccessToken = desktopAccessToken || environmentAccessToken;
10506
10529
  const config = {
10507
10530
  ...DEFAULT_CONFIG,
10508
10531
  ...globalConfig,
10509
- ...(environmentAccessToken
10532
+ ...(fixedAccessToken
10510
10533
  ? {
10511
- accessToken: environmentAccessToken,
10512
- // COZE_API_TOKEN is a fixed runtime credential. Never combine it with
10513
- // refresh metadata left by an earlier OAuth login in config.json.
10534
+ accessToken: fixedAccessToken,
10535
+ // Desktop PAT and COZE_API_TOKEN are fixed runtime credentials. Never
10536
+ // combine them with refresh metadata from an earlier OAuth login.
10514
10537
  refreshToken: undefined,
10515
10538
  tokenExpiresAt: undefined,
10516
10539
  }
@@ -10524,7 +10547,7 @@ const loadConfig = async (options = {}) => {
10524
10547
  ...(options.apiBaseUrl ? { apiBaseUrl: options.apiBaseUrl } : {}),
10525
10548
  // Runtime-only trust decision: a value persisted in config.json must never enable
10526
10549
  // project-secret injection for an OAuth access token.
10527
- injectApiToken: Boolean(environmentAccessToken),
10550
+ injectApiToken: Boolean(fixedAccessToken),
10528
10551
  };
10529
10552
  return config;
10530
10553
  };
@@ -11250,6 +11273,7 @@ class DeployApiClient {
11250
11273
 
11251
11274
 
11252
11275
 
11276
+
11253
11277
  ) {
11254
11278
  return this.post
11255
11279
 
@@ -12269,6 +12293,7 @@ const MINI_PROGRAM_BUILD_OUTPUT_DIRS = {
12269
12293
 
12270
12294
 
12271
12295
 
12296
+
12272
12297
  const resolveConnectorId = (platform) => {
12273
12298
  const connectorId = CONNECTOR_IDS[platform ];
12274
12299
  if (!connectorId) {
@@ -12393,6 +12418,7 @@ const registerPreviewCommand = (miniProgram) => {
12393
12418
  .requiredOption('--mini-app-id <miniAppId>', 'Mini-program AppID')
12394
12419
  .option('--project-id <projectId>', 'Deployment Project ID')
12395
12420
  .option('--source-root <sourceRoot>', 'Directory containing dist or dist-tt', '.')
12421
+ .option('--server-url <serverUrl>', 'Public HTTPS server URL to whitelist for this preview')
12396
12422
  .action(async (options, command) => {
12397
12423
  const runtime = await getRuntime(command);
12398
12424
  const projectId = await resolveProjectId(command, options);
@@ -12422,6 +12448,7 @@ const registerPreviewCommand = (miniProgram) => {
12422
12448
  app_id: options.miniAppId || '',
12423
12449
  connector_id: resolveConnectorId(options.platform),
12424
12450
  source_package_base64: content.toString('base64'),
12451
+ ...(options.serverUrl ? { server_url: options.serverUrl } : {}),
12425
12452
  });
12426
12453
  if (data.failed) {
12427
12454
  throw new CliError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.0.36-alpha.75f808",
3
+ "version": "0.0.36-alpha.80ccd6",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",