tirtc-devtools-cli 0.0.12 → 0.0.14

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 (138) hide show
  1. package/README.md +42 -46
  2. package/USAGE.md +90 -311
  3. package/dist/cli/src/embedded_paths.d.ts +0 -2
  4. package/dist/cli/src/embedded_paths.js +3 -25
  5. package/dist/cli/src/index.js +82 -584
  6. package/dist/cli/src/role_driver.d.ts +33 -0
  7. package/dist/cli/src/role_driver.js +500 -0
  8. package/dist/cli/src/token_command.js +29 -14
  9. package/dist/cli/src/token_issue.d.ts +9 -0
  10. package/dist/cli/src/token_issue.js +138 -0
  11. package/dist/cli/src/token_tool.d.ts +4 -4
  12. package/dist/cli/src/token_tool.js +66 -182
  13. package/package.json +1 -1
  14. package/vendor/devtools/driver/macos-arm64/devtools_driver_probe +0 -0
  15. package/vendor/devtools/driver/macos-arm64/runtime_validation_client_bin +0 -0
  16. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio.h +83 -2
  17. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io.h +9 -0
  18. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/av.h +74 -0
  19. package/vendor/runtime/macos-arm64/include/tirtc/error.h +63 -0
  20. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_downlink.h +58 -5
  21. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_uplink.h +4 -0
  22. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/transport.h +52 -15
  23. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/trp.h +17 -5
  24. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_codec.h +41 -0
  25. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io.h +7 -0
  26. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_android.h +2 -0
  27. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
  28. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  29. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
  30. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  31. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  32. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  33. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  34. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/manifest.txt +20 -25
  35. package/vendor/runtime/script/prepare_runtime_media_dataset.sh +308 -12
  36. package/dist/app-server/protocol-client/index.d.ts +0 -25
  37. package/dist/app-server/protocol-client/index.js +0 -114
  38. package/dist/cli/src/bootstrap_flows.d.ts +0 -46
  39. package/dist/cli/src/bootstrap_flows.js +0 -249
  40. package/dist/cli/src/config.d.ts +0 -26
  41. package/dist/cli/src/config.js +0 -62
  42. package/dist/cli/src/facade.d.ts +0 -430
  43. package/dist/cli/src/facade.js +0 -170
  44. package/dist/cli/src/guide.d.ts +0 -1
  45. package/dist/cli/src/guide.js +0 -47
  46. package/dist/cli/src/session_manager.d.ts +0 -25
  47. package/dist/cli/src/session_manager.js +0 -391
  48. package/dist/cli/src/transport.d.ts +0 -30
  49. package/dist/cli/src/transport.js +0 -84
  50. package/vendor/app-server/bin/native/linux-x64/credential_napi.node +0 -0
  51. package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
  52. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/credential.h +0 -34
  53. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/error.h +0 -33
  54. package/vendor/app-server/bin/runtime/linux-x64/lib/libcrypto.a +0 -0
  55. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_credential.a +0 -0
  56. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_http.a +0 -0
  57. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  58. package/vendor/app-server/bin/runtime/linux-x64/lib/libssl.a +0 -0
  59. package/vendor/app-server/bin/runtime/linux-x64/lib/libxlog.a +0 -0
  60. package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +0 -4
  61. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/credential.h +0 -34
  62. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +0 -33
  63. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/foundation/build_info.h +0 -27
  64. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/http.h +0 -57
  65. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/logging.h +0 -55
  66. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_av_sync.h +0 -61
  67. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_source.h +0 -77
  68. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_live_source.h +0 -71
  69. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
  70. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  71. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  72. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  73. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  74. package/vendor/app-server/bin/tirtc-devtool-host.js +0 -2
  75. package/vendor/app-server/dist/host/ArtifactManager.d.ts +0 -18
  76. package/vendor/app-server/dist/host/ArtifactManager.js +0 -98
  77. package/vendor/app-server/dist/host/HostCommandCoordinator.d.ts +0 -19
  78. package/vendor/app-server/dist/host/HostCommandCoordinator.js +0 -196
  79. package/vendor/app-server/dist/host/HostProtocol.d.ts +0 -103
  80. package/vendor/app-server/dist/host/HostProtocol.js +0 -239
  81. package/vendor/app-server/dist/host/HostServer.d.ts +0 -52
  82. package/vendor/app-server/dist/host/HostServer.js +0 -727
  83. package/vendor/app-server/dist/host/HostState.d.ts +0 -69
  84. package/vendor/app-server/dist/host/HostState.js +0 -19
  85. package/vendor/app-server/dist/host/RuntimeAdapter.d.ts +0 -95
  86. package/vendor/app-server/dist/host/RuntimeAdapter.js +0 -636
  87. package/vendor/app-server/dist/host/RuntimeReceiveWorker.d.ts +0 -37
  88. package/vendor/app-server/dist/host/RuntimeReceiveWorker.js +0 -186
  89. package/vendor/app-server/dist/host/RuntimeSendWorker.d.ts +0 -58
  90. package/vendor/app-server/dist/host/RuntimeSendWorker.js +0 -438
  91. package/vendor/app-server/dist/host/TokenTool.d.ts +0 -15
  92. package/vendor/app-server/dist/host/TokenTool.js +0 -84
  93. package/vendor/app-server/dist/host/WebPreviewGateway.d.ts +0 -28
  94. package/vendor/app-server/dist/host/WebPreviewGateway.js +0 -815
  95. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.d.ts +0 -26
  96. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +0 -118
  97. package/vendor/app-server/dist/host/native/RuntimeHostBridge.d.ts +0 -32
  98. package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +0 -157
  99. package/vendor/app-server/dist/host/runtime_backed_preflight.d.ts +0 -10
  100. package/vendor/app-server/dist/host/runtime_backed_preflight.js +0 -78
  101. package/vendor/app-server/dist/host/tests/helpers/host_socket_client.d.ts +0 -28
  102. package/vendor/app-server/dist/host/tests/helpers/host_socket_client.js +0 -85
  103. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.d.ts +0 -10
  104. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +0 -41
  105. package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.d.ts +0 -11
  106. package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.js +0 -32
  107. package/vendor/app-server/dist/protocol/contract.d.ts +0 -1128
  108. package/vendor/app-server/dist/protocol/contract.js +0 -217
  109. package/vendor/app-server/dist/protocol-client/index.d.ts +0 -25
  110. package/vendor/app-server/dist/protocol-client/index.js +0 -114
  111. package/vendor/app-server/dist/src/index.d.ts +0 -1
  112. package/vendor/app-server/dist/src/index.js +0 -294
  113. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_codec.h +0 -0
  114. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_frame.h +0 -0
  115. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_android.h +0 -0
  116. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_apple.h +0 -0
  117. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_harmony.h +0 -0
  118. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_windows.h +0 -0
  119. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_processing.h +0 -0
  120. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_sample_rate.h +0 -0
  121. /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/foundation/build_info.h +0 -0
  122. /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/http.h +0 -0
  123. /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/logging.h +0 -0
  124. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_codec.h +0 -0
  125. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_frame.h +0 -0
  126. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_apple.h +0 -0
  127. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_harmony.h +0 -0
  128. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_windows.h +0 -0
  129. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_processing.h +0 -0
  130. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libTGTRP.a +0 -0
  131. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libTiRTC.a +0 -0
  132. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libcrypto.a +0 -0
  133. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libcrypto.dylib +0 -0
  134. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libssl.a +0 -0
  135. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libssl.dylib +0 -0
  136. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libtgrtc.dylib +0 -0
  137. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libwebrtc_apm.a +0 -0
  138. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libxlog.a +0 -0
package/README.md CHANGED
@@ -1,67 +1,63 @@
1
1
  # TiRTC DevTools CLI
2
2
 
3
- `products/cli/` 承接 `TiRTC DevTools CLI`。它是当前唯一用户界面的产品门面 (command client),为用户提供了一套操作 `Matrix Host` 控制面的终端工具。
4
-
5
- ## 使用说明 (C-Lite)
6
-
7
- 关于 `tirtc-devtools-cli` 命令的详细使用方法、参数说明与示例,请参考 [USAGE.md](./USAGE.md)。
8
-
9
- 如果要先快速确认当前 binary 暴露了哪些命令面,直接运行:`node products/cli/bin/tirtc-devtools-cli.js --help`。
10
-
11
- 当前正式入口补充:
12
-
13
- - server 侧最小入口:`service start`
14
- - client 本地预览正式入口:`client start --token <token>` + `[client]` TOML
3
+ `products/cli/` 承接 `TiRTC DevTools CLI`,是当前唯一公开 DevTools 命令行入口。
15
4
 
16
5
  ## 负责什么
17
6
 
18
- - **唯一用户产品门面**:提供 `tirtc-devtools-cli` 命令族,覆盖常见的 RTC 测试操作,让内部研发、外部开发者和 AI agent 脚本无需手写底层协议。
19
- - **配置解析与翻译**:负责解析用户传入的 CLI 参数和 TOML 配置文件,进行本地必填校验、脱敏,并翻译为 App Server 协议的 request。
20
- - **产品级 Observability**:将底层的运行时事件和状态翻译为结构化输出 (JSON) 或友好的终端日志输出;对长耗时命令补轻量进度提示。
21
- - **调试期工具内聚**:承接调试期必要工具(如 token bootstrap、二维码与媒体预处理)的产品化入口,避免把调试流程散落在 runtime 或外部手工步骤中。
22
- - **本地 token 工具**:提供直接签发 token、打印组合 JSON、单独 token 与本地二维码 PNG 路径的公开 CLI 能力,服务本地联调与体验验证。
23
- - **本地 license 二维码工具**:提供 server 扫码用的 license JSON 二维码生成能力,支持可选 `endpoint`。
7
+ - `token issue` / `license qrcode`:本地联调的凭据与二维码工具。
8
+ - `assets prepare`:把默认资产或任意 MP4 准备成 native role driver 使用的媒体资产。
9
+ - `send start`:作为标准上行端启动 native DevTools driver,送出音视频,产出 `bootstrap.json` 与 execution evidence。
10
+ - `receive start`:作为标准下行端消费本机 `bootstrap.json` 或显式 `remote/token`,产出 `frame_dump` 与 summary。
11
+ - CLI 负责参数、环境变量、token 签发、JSON envelope、artifact 摘要与打包定位;真实 TiRTC lifecycle `products/devtools/driver/` 承接。
24
12
 
25
13
  ## 不负责什么
26
14
 
27
- - **不拥有底层 RTC 能力**:它只是一个客户端门面,它自己不负责跑 RTC 媒体栈,所有的执行能力均交由底层的 `Matrix Host` 进程完成。
28
- - **不重新定义协议**:不私自发明 undocumented control path;CLI 命令到 Host method 的映射必须与协议文档保持一一对应。
29
- - **不把 App Server 变成业务服务**:鉴权签发等能力仅用于本地联调 bootstrap,不替代正式业务系统。
15
+ - 不在 TypeScript 中实现媒体帧队列、PTS pacing、transport attach/detach、decoder render sink。
16
+ - 不提供长驻 Host、HTTP API、共享 session 或桌面 UI。
17
+ - 不替代业务鉴权系统;token 签发只服务 DevTools 联调与验收。
18
+ - 不把 `bootstrap.json` 定义成移动端接入协议;它只是本机 CLI receive、sample smoke 和 validation automation 的交接产物。
19
+ - 不宣称 Linux native send/receive 调试已支持;当前外部调试发布面先按 `macos-arm64` 收口。
30
20
 
31
21
  ## 依赖方向
32
22
 
33
- - **依赖 `products/app-server/protocol-client/`**:通过可复用的第一方协议客户端与 `Matrix Host` 进程通信。
34
- - **绝不依赖 `runtime/` 代码实现**:CLI 不直接链接 runtime 模块,只消费 app-server 打包好的运行时产物与 Host 协议。
23
+ - token/license 工具由 CLI 自己承接;仓库级 token helper 入口为 `./script/issue_devtools_token.sh`。
24
+ - send/receive 通过本地 native driver executable 执行,默认查找 `.build/devtools-driver/bin/<platform>/devtools_driver_probe` `vendor/devtools/driver/<platform>/devtools_driver_probe`。
25
+ - runtime bundle 默认查找 `.build/products/runtime/<platform>` 或 `vendor/runtime/<platform>`。
35
26
 
36
- ## 这里应该放什么
27
+ ## 常用命令
37
28
 
38
- - CLI 命令行入口、命令树 (Commands) 的注册与参数解析逻辑。
39
- - 配置文件 (TOML) 的读取与校验逻辑。
40
- - 终端交互、控制台进度打印、结构化输出等 UI 面板逻辑。
41
- - 与 `protocol-client/` 交互并把业务结果展示给用户的封装逻辑。
29
+ ```sh
30
+ npm --prefix products/cli run build
31
+ npm --prefix products/cli test -- --runInBand
32
+ node products/cli/bin/tirtc-devtools-cli.js --help
33
+ ```
42
34
 
43
- ## 代码规范与 lint
35
+ 常用 token 自测入口:
44
36
 
45
- - TypeScript 代码规范通过 `eslint` 承接,配置文件位于 `products/cli/.eslintrc.cjs`。
46
- - 本目录作者侧收口命令:`npm run lint`、`npm test`、`npm run build`。
47
- - 仓库级 gate 会通过 `./script/lint_node_products.sh` 在 `pre-commit` 与 `./script/check.sh` 中统一执行 Node 产品 lint。
37
+ ```sh
38
+ ./script/issue_devtools_token.sh --token-only
39
+ ```
48
40
 
49
- ## 开发与构建
41
+ 真实 send/receive 闭环优先走:
50
42
 
51
- - `npm run build`:执行 TypeScript 编译。
52
- - `npm test`:运行 CLI 门面与 Smoke 测试。
53
- - `npm run package`:执行 `./script/package.sh`,构建 CLI 本体并同步 npm 发布所需的 products/app-server/runtime vendor 资产。
54
- - 运行 `media assets prepare` 时,CLI 会优先复用系统 `ffmpeg/ffprobe`;若本机不存在,则首次使用时自动下载到用户缓存目录。
43
+ ```sh
44
+ products/devtools/driver/script/run_capability_probe.sh
45
+ ```
55
46
 
56
- ## Runtime E2E Tester Config
47
+ 一台电脑模拟上行端送任意 MP4:
57
48
 
58
- - CLI server/client E2E 本地配置路径:`products/cli/config/.local/server.local.toml` + `products/cli/config/.local/client.local.toml`。
59
- - `products/cli/config/.local/` 默认整体忽略;本地 gate 直接读取这两份 TOML,不再依赖 `tests/.local/*.json`。
60
- - `server.local.toml` 负责 `service start` 和 `debug.connect_bootstrap` 真相;`client.local.toml` 负责 `client start` 与 `token issue` 所需的本地 truth。`license qrcode` 为纯命令行输入,不依赖 TOML。
49
+ ```sh
50
+ node products/cli/bin/tirtc-devtools-cli.js --json assets prepare \
51
+ --source ./movie.mp4 \
52
+ --output-root .build/tirtc-assets
53
+ node products/cli/bin/tirtc-devtools-cli.js --json send start \
54
+ --source .build/tirtc-assets/manifest.json \
55
+ --video-codec h264 \
56
+ --artifact-root .build/devtools-cli/send-movie-h264
57
+ ```
61
58
 
62
- ## Command Loop E2E Harness
59
+ 打包入口:
63
60
 
64
- - 长驻人工验收脚本:`products/cli/script/command_loop_e2e.sh`
65
- - 示例配置:`products/cli/config/command_loop_e2e.example.toml`
66
- - 本地配置路径:`products/cli/config/.local/command_loop_e2e.local.toml`(已在 `.gitignore` 忽略)
67
- - 该脚本会先打包最新 `runtime + app-server + cli`,再清场、`service start`、周期性发送 `stream message` / time command,并轮询 `command pending list` 后自动做 CLI 侧显式 reply;启动成功后保持常驻,等待人工去操作 Android example。
61
+ ```sh
62
+ npm --prefix products/cli run package
63
+ ```
package/USAGE.md CHANGED
@@ -1,286 +1,43 @@
1
- # TiRTC DevTools CLI(用户手册)
1
+ # TiRTC DevTools CLI Usage
2
2
 
3
- `tirtc-devtools-cli` 是基于 `products/app-server/host` 的命令行门面,用来控制会话、服务、连接、流、命令通道与调试工具。
3
+ ## Build
4
4
 
5
- ## 一、关系
6
-
7
- - Runtime:底层 transport/audio/video/media 能力。
8
- - App Server:把 Runtime 组织成稳定控制面协议。
9
- - CLI:面向用户的命令行门面,通过协议驱动 App Server。
10
-
11
- ## 二、开发态构建
12
-
13
- ```bash
14
- npm --prefix products/app-server ci
5
+ ```sh
15
6
  npm --prefix products/cli ci
16
- npm --prefix products/app-server run build
17
7
  npm --prefix products/cli run build
18
- ```
19
-
20
- 运行入口:
21
-
22
- ```bash
23
- node products/cli/bin/tirtc-devtools-cli.js --help
24
- ```
25
-
26
- ## 三、Help 菜单速览
27
-
28
- 安装或构建完成后,先用 help 菜单确认当前 binary 暴露的命令面:
29
-
30
- ```bash
31
8
  node products/cli/bin/tirtc-devtools-cli.js --help
32
9
  ```
33
10
 
34
- 当前顶层 help 快照:
35
-
36
- ```text
37
- Usage: tirtc-devtools-cli [options] [command]
38
-
39
- TiRTC DevTools CLI
40
-
41
- Options:
42
- --config <path> 配置文件路径(TOML)
43
- --json 以机器可读 JSON 输出(便于脚本集成)
44
- --session <sessionId> 指定会话 ID;除 service start / client start / connection connect 外必须传
45
- -h, --help display help for command
46
-
47
- Commands:
48
- host Host 基础能力(状态、停止)
49
- init 新手第一步:生成 CLI 配置模板
50
- media 媒体素材辅助:prepare local assets
51
- service 服务端能力:启动/停止服务,等待远端接入
52
- client 客户端正式入口:连接远端并自动挂载本地 web preview
53
- connection 客户端能力:主动连接远端 peer
54
- token Token 工具:签发 token,并输出可直接使用的 JSON 与本地二维码 PNG
55
- license License 工具:生成 server 扫码 JSON 与本地二维码 PNG
56
- stream 流控制:发送/接收/消息
57
- output 输出挂载:文件等消费者 attach/detach
58
- command 命令通道:发送命令与事件跟踪
59
- debug 调试工具:连接 bootstrap 二维码
60
- events 事件订阅:实时观察 Host 事件
61
- logs 日志导出:导出运行日志
62
- report 报告查看/导出:验收证据
63
- guide 新手入口:按场景给出可执行步骤
64
- ```
65
-
66
- 常用子菜单 help:
67
-
68
- ```bash
69
- node products/cli/bin/tirtc-devtools-cli.js service --help
70
- node products/cli/bin/tirtc-devtools-cli.js stream --help
71
- node products/cli/bin/tirtc-devtools-cli.js command --help
72
- node products/cli/bin/tirtc-devtools-cli.js token issue --help
73
- node products/cli/bin/tirtc-devtools-cli.js license qrcode --help
74
- ```
75
-
76
- 当前关键子菜单快照:
77
-
78
- ```text
79
- $ node ... service --help
80
- Commands:
81
- start 启动 server-only 会话(必须显式提供 --config)
82
- stop 停止服务端监听
83
-
84
- $ node ... stream --help
85
- Commands:
86
- list 查看流快照列表
87
- send 发送流:绑定 prepared local assets 并发起上行
88
- receive 接收流:声明并接收下行
89
- message 发送 stream message
90
-
91
- $ node ... command --help
92
- Commands:
93
- request [options] <commandId> <payloadEncoding> <payload> 发送命令请求并等待响应
94
- send [options] <commandId> <payloadEncoding> <payload> 兼容别名:等价于 command request
95
- pending 查看当前会话内待回复的远端命令请求
96
- reply <remoteRequestId> <commandId> <payloadEncoding> <payload> 按 remoteRequestId 显式回复待处理命令
97
- tail 持续监听命令相关事件
98
-
99
- $ node ... token issue --help
100
- Usage: tirtc-devtools-cli token issue [options] <remote_id>
101
-
102
- Options:
103
- --access-id <accessId>
104
- --secret-key <secretKey>
105
- --openapi-endpoint <url>
106
- --endpoint <entry>
107
- --qr-error-correction-level <level>
108
- --ascii-max-columns <columns>
109
-
110
- $ node ... license qrcode --help
111
- Usage: tirtc-devtools-cli license qrcode [options] <license>
112
-
113
- Options:
114
- --endpoint <entry>
115
- --qr-error-correction-level <level>
116
- --ascii-max-columns <columns>
117
- ```
118
-
119
- ## 四、全局参数
120
-
121
- - `--config <path>`:TOML 配置文件路径。
122
- - `--json`:结构化 JSON 输出。
123
- - `--session <sessionId>`:除 `service start` / `client start` / `connection connect` 外,其余业务命令必须显式提供。
124
-
125
- ## 五、会话模型
11
+ ## Global
126
12
 
127
- 一个 session = 一个常驻 Host 进程 + 一个 endpoint runtime 实例。
13
+ - `--json` prints a machine-readable envelope.
14
+ - `--version` prints CLI version and native driver contract version.
128
15
 
129
- - `host session start`:创建会话。
130
- - `host session list`:查看会话。
131
- - `host session stop <sessionId>`:停止会话。
132
- - `service start`:默认创建 `service` 会话;可通过 `--session` 绑定已有空闲会话。
133
- - `client start` / `connection connect`:总是创建新的 `client` 会话,不允许复用 `--session`。
16
+ ## Platform Support
134
17
 
135
- ## 六、server-only 正式入口
18
+ - `macos-arm64`: supported for token, assets prepare, send, receive, package smoke, and native send+receive qualification.
19
+ - `linux-x64`: runtime package surface and cross-build are covered, but native send/receive qualification is not a supported external debugging path yet.
136
20
 
137
- ### 1. 配置真相
138
-
139
- server-only 正式路径只认 `[server]`:
140
-
141
- ```toml
142
- [server]
143
- service_entry = ""
144
- license = "runtime-license"
145
- mp4_path = "/Users/allenfeng/Development/Repositories/tirtc-nexus/tirtc-matrix/.refers/simple.mp4"
146
- video_stream_id = 11
147
- audio_stream_id = 10
148
- ```
149
-
150
- 说明:
151
-
152
- - `license`、`mp4_path`、`video_stream_id`、`audio_stream_id` 必填。
153
- - `service_entry` 可留空,回退到底层默认值。
154
- - 旧 `[service]`、`[stream.request_policy]`、`[streams.send]` 不再属于正式合同。
155
- - 正式命令默认开启 console mirror,并把日志固定落到 `~/.tirtc-devtools-cli/logging/`。
156
-
157
- ### 2. 启动命令
158
-
159
- ```bash
160
- node products/cli/bin/tirtc-devtools-cli.js --config ./server.toml --json service start
161
- ```
162
-
163
- `service start` 固定流程:
164
-
165
- 1. 读取并校验 `[server]`。
166
- 2. 对 `mp4_path` 执行 prepare。
167
- 3. 调用 `service/start`。
168
- 4. 自动调用两次 `stream/sendStart`:一次音频、一次视频。
169
- 5. 返回 `autoApplied` 摘要:`preparedAssetsDir`、固定 `mediaSendPolicy=AUTO_ON_CONNECTED`、以及音视频 sendStart 结果。
170
-
171
- 非 `--json` 模式下,CLI 会在 `stderr` 输出轻量进度提示:先显示 MP4 prepare,再显示 service start,避免长时间静默。
172
-
173
- ### 3. 自动发送语义
174
-
175
- - App Server server 角色固定使用 `AUTO_ON_CONNECTED`。
176
- - CLI 不再暴露 request-policy 配置或命令。
177
- - 一旦远端请求对应 media,已绑定的发送流会自动转为 `active`。
178
-
179
- ## 七、client start
180
-
181
- ```bash
182
- node products/cli/bin/tirtc-devtools-cli.js --config ./client.toml --json client start --token <TOKEN>
183
- ```
184
-
185
- client 正式路径只认 `[client]`:
186
-
187
- ```toml
188
- [client]
189
- service_entry = ""
190
- peer_id = "peer-123"
191
- audio_stream_id = 10
192
- video_stream_id = 11
193
- consumer = "web_preview"
194
- ```
21
+ Do not treat Linux send/receive as ready until the Linux headless receive driver or a containerized online runner is delivered.
195
22
 
196
- 说明:
23
+ ## Token
197
24
 
198
- - `peer_id`、`audio_stream_id`、`video_stream_id`、`consumer` 必填。
199
- - `consumer` 当前固定为 `web_preview`。
200
- - token 必须通过命令行 `--token` 显式提供,不进入配置文件。
25
+ ```sh
26
+ export TIRTC_ACCESS_KEY_ID="<ACCESS_KEY_ID>"
27
+ export TIRTC_SECRET_KEY_ID="<SECRET_KEY_ID>"
28
+ export TIRTC_APP_ID="<APP_ID>"
29
+ export TIRTC_DEVICE_ID="<REMOTE_ID>"
30
+ export TIRTC_ENDPOINT="<SERVICE_ENTRY>"
31
+ export TIRTC_OPEN_API_ENDPOINT="<OPENAPI_ENDPOINT>"
201
32
 
202
- `client start` 固定流程:
203
-
204
- 1. 读取并校验 `[client]`。
205
- 2. 调用 `connection/connect`。
206
- 3. 自动调用两次 `stream/receiveStart`:一次音频、一次视频。
207
- 4. 自动调用两次 `output/attach`,consumer 固定为 `web_preview`。
208
- 5. 返回 `autoApplied` 摘要,其中 `preview.url` 是正式浏览器入口。
209
-
210
- ## 八、connection connect
211
-
212
- ```bash
213
- node products/cli/bin/tirtc-devtools-cli.js --config ./client.toml --json connection connect <serviceEntry> <peerId> <token>
214
- ```
215
-
216
- 说明:
217
-
218
- - 该命令保留为 expert/atomic 路径。
219
- - token 必须显式提供;CLI 不再提供 auto token 回退。
220
-
221
- ## 九、stream / output / command
222
-
223
- ### Stream
224
-
225
- - `stream list`
226
- - `stream send start <streamId> <media> <assets_dir>`
227
- - `stream send stop <streamId>`
228
- - `stream message send <streamId> <payload>`
229
- - `stream receive start <streamId> <media>`
230
- - `stream receive stop <streamId>`
231
-
232
- `stream message send` 是字符串型 payload contract;当前 Host/runtime-backed adapter 至少保证连接存在时可接受请求并落事件。
233
-
234
- ### Output
235
-
236
- - `output attach <streamId> <consumer> <mediaView> <format> <delivery> [targetPath] [maxFiles]`
237
- - `output detach <outputId>`
238
-
239
- CLI 仍会在本地收紧最小组合矩阵:
240
-
241
- - `web_preview` 只允许 `delivery=artifact_path`,`format` 允许 `jpeg|pcm|h264|g711a`
242
- - `file_sink` 只允许 `delivery=file`,`format=mp4`
243
-
244
- ### Command
245
-
246
- - `command request <commandId> <payloadEncoding> <payload> [--timeout-ms <ms>]`
247
- - `command send <commandId> <payloadEncoding> <payload> [--timeout-ms <ms>]`
248
- - `command pending list`
249
- - `command reply <remoteRequestId> <commandId> <payloadEncoding> <payload>`
250
- - `command tail`
251
-
252
- `command request` 是 canonical 主语,`command send` 只保留为兼容别名。若要发 JSON,请把 JSON 文本作为 `payload` 传入。`command pending list` 用于恢复或轮询当前积压,`command reply` 基于 `remoteRequestId` 显式回复待处理请求。
253
-
254
- ## 十、token / license / debug / report
255
-
256
- ### token issue
257
-
258
- 命令形态:
259
-
260
- ```bash
261
- export TIRTC_CONN_ACCESS_ID="<ACCESS_ID>"
262
- export TIRTC_CONN_SECRET_KEY="<SECRET_KEY>"
263
- node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID>
264
- ```
265
-
266
- 如果要覆盖默认 endpoint,并显式透传给底层签发路径:
267
-
268
- ```bash
269
33
  node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID> \
270
34
  --endpoint <ENDPOINT> \
271
35
  --openapi-endpoint <OPENAPI_ENDPOINT>
272
- ```
273
-
274
- 当前 CLI 合同:
275
36
 
276
- - 位置参数改为 `<remote_id>`。
277
- - `--endpoint` 取代旧 `--service-entry`。
278
- - `--openapi-endpoint` 取代旧 `--openapi-entry`。
279
- - 不再接收 `local_id`。
280
- - 显式传入的 `endpoint` / `openapi_endpoint` 会透传给 C 层签发路径,并同时进入二维码 payload。
281
- - 若未显式传入 `endpoint` / `openapi_endpoint`,则 payload 中不再补默认字段。
37
+ ./script/issue_devtools_token.sh --token-only
38
+ ```
282
39
 
283
- `--json` 输出保持外层 envelope 不变:
40
+ `token issue` preserves the public JSON envelope:
284
41
 
285
42
  ```json
286
43
  {
@@ -288,79 +45,101 @@ node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID> \
288
45
  "message": "OK",
289
46
  "data": {
290
47
  "payload": {
291
- "remote_id": "TESTFENGJUN4",
48
+ "app_id": "APP",
49
+ "remote_id": "REMOTE",
292
50
  "token": "<TOKEN>",
293
- "endpoint": "http://ep-test-tirtc.tange365.com",
294
- "openapi_endpoint": "http://api-test-tirtc.tange365.com"
51
+ "endpoint": "http://...",
52
+ "openapi_endpoint": "http://..."
295
53
  },
296
- "payloadJson": "{\"remote_id\":\"TESTFENGJUN4\",\"token\":\"<TOKEN>\",\"endpoint\":\"http://ep-test-tirtc.tange365.com\",\"openapi_endpoint\":\"http://api-test-tirtc.tange365.com\"}",
54
+ "payloadJson": "{\"app_id\":\"APP\",\"remote_id\":\"REMOTE\",\"token\":\"<TOKEN>\"}",
297
55
  "token": "<TOKEN>",
298
- "qrCodePngPath": "/absolute/path/to/token-*.png"
56
+ "qrCodePngPath": "/absolute/path/token-*.png"
299
57
  }
300
58
  }
301
59
  ```
302
60
 
303
- 说明:
61
+ TiRTC token has anti-replay semantics. Treat every token as single-use and issue a fresh token for every new connection.
304
62
 
305
- - payload 只保留 `remote_id`、`token`、可选 `endpoint`、可选 `openapi_endpoint`。
306
- - 已删除字段不再出现:`version`、`type`、`local_id`、`peer_id`、`openapi_entry`、`service_entry`、`user_ttl_seconds`、`channel_ttl_seconds`、`generated_at`。
63
+ ## License QR
307
64
 
308
- ### license qrcode
65
+ ```sh
66
+ node products/cli/bin/tirtc-devtools-cli.js --json license qrcode <LICENSE> --endpoint <ENDPOINT>
67
+ ```
309
68
 
310
- 命令形态:
69
+ ## Assets
311
70
 
312
- ```bash
313
- node products/cli/bin/tirtc-devtools-cli.js --json license qrcode <LICENSE>
314
- node products/cli/bin/tirtc-devtools-cli.js --json license qrcode <LICENSE> --endpoint <ENDPOINT>
71
+ ```sh
72
+ node products/cli/bin/tirtc-devtools-cli.js --json assets prepare
73
+ node products/cli/bin/tirtc-devtools-cli.js --json assets prepare --source runtime/assets/source.mp4
315
74
  ```
316
75
 
317
- 当前 CLI 合同:
76
+ Prepare any MP4 and use the returned `data.manifest_path` as `send start --source`:
318
77
 
319
- - 只保留 `license` 和可选 `endpoint`。
320
- - `--endpoint` 取代旧 `--service-entry`。
321
- - 若未显式传入 `endpoint`,payload 中不再补默认字段。
78
+ ```sh
79
+ node products/cli/bin/tirtc-devtools-cli.js --json assets prepare \
80
+ --source ./movie.mp4 \
81
+ --output-root .build/tirtc-assets
82
+ ```
322
83
 
323
- ### 其他命令
84
+ ## Send
324
85
 
325
- - `debug bootstrap qrcode ...` / `debug bootstrap qrcode-from-config`:生成联调用二维码。
326
- - `events tail`:实时查看事件流。
327
- - `logs export <outputPath>`:导出日志。
328
- - `report show` / `report export <outputPath>`:查看或导出报告。
86
+ Required environment:
329
87
 
330
- ## 十一、本地 E2E 配置
88
+ ```sh
89
+ export TIRTC_DEVICE_ID="<DEVICE_ID>"
90
+ export TIRTC_DEVICE_SECRET_KEY="<DEVICE_SECRET_KEY>"
91
+ export TIRTC_ACCESS_KEY_ID="<ACCESS_KEY_ID>"
92
+ export TIRTC_SECRET_KEY_ID="<SECRET_KEY_ID>"
93
+ export TIRTC_APP_ID="<APP_ID>"
94
+ export TIRTC_ENDPOINT="<SERVICE_ENTRY>"
95
+ export TIRTC_OPEN_API_ENDPOINT="<OPENAPI_ENDPOINT>"
96
+ ```
331
97
 
332
- - CLI server/client E2E 本地配置文件:`products/cli/config/.local/server.local.toml` + `products/cli/config/.local/client.local.toml`
333
- - `products/cli/config/.local/` 默认整体忽略,由本地联调环境自行维护
334
- - `server.local.toml` 字段:`[server]` + `[debug.connect_bootstrap]`
335
- - `client.local.toml` 字段:`[client]` + `[debug.token_issue]`
336
- - CLI server-only E2E 不再要求先手工 `media assets prepare` 再回填 `assetsDir`
98
+ Run one send role with the default prepared asset:
337
99
 
338
- ## 十二、Android 人工闭环脚本
100
+ ```sh
101
+ node products/cli/bin/tirtc-devtools-cli.js --json send start \
102
+ --video-codec h264 \
103
+ --artifact-root .build/devtools-cli/send-h264
104
+ ```
339
105
 
340
- 如果需要把 CLI 侧闭环常驻起来,再手工去操作 Android example,使用:
106
+ Run one send role from a prepared MP4:
341
107
 
342
- ```bash
343
- ./products/cli/script/command_loop_e2e.sh
108
+ ```sh
109
+ node products/cli/bin/tirtc-devtools-cli.js --json send start \
110
+ --source .build/tirtc-assets/manifest.json \
111
+ --video-codec h264 \
112
+ --artifact-root .build/devtools-cli/send-movie-h264
344
113
  ```
345
114
 
346
- 默认读取:`products/cli/config/.local/command_loop_e2e.local.toml`
115
+ The send role writes `bootstrap.json`. That file is a local handoff artifact for
116
+ CLI receive, runtime sample smoke, and validation automation. The token in that
117
+ bootstrap is intended for one receive connection.
118
+
119
+ `bootstrap.json` is not a mobile SDK connection protocol. For phone debugging,
120
+ use token/license QR today; a full session QR or deeplink is a separate product
121
+ slice.
347
122
 
348
- 建议先从模板复制:
123
+ ## Receive
349
124
 
350
- ```bash
351
- mkdir -p products/cli/config/.local
352
- cp products/cli/config/command_loop_e2e.example.toml products/cli/config/.local/command_loop_e2e.local.toml
125
+ ```sh
126
+ node products/cli/bin/tirtc-devtools-cli.js --json receive start \
127
+ --bootstrap .build/devtools-cli/send-h264/bootstrap.json \
128
+ --artifact-root .build/devtools-cli/receive-h264
353
129
  ```
354
130
 
355
- 该脚本会:
131
+ Receive writes `summary.json`, `events.jsonl`, runtime logs, and `render/first-video-frame.*` for `frame_dump`.
356
132
 
357
- - 打包最新 `runtime + app-server + cli`
358
- - 杀掉其他同类 `command_loop_e2e.sh` 进程
359
- - `host stop --all`
360
- - `service start`
361
- - 可选生成 bootstrap 二维码
362
- - 每 `15s` 执行一次 `stream message send`
363
- - `10s` 执行一次时间命令 `command request 7953 utf8 "time?"`
364
- - 轮询 `command pending list` 并对每个 pending request 执行 `command reply`
133
+ `receive start --bootstrap` is meant for the local computer-to-computer DevTools
134
+ flow. Mobile clients should not be required to fetch a local JSON file from the
135
+ developer machine.
136
+
137
+ ## Codec Matrix
138
+
139
+ For the current macOS gate, use the native capability runner:
140
+
141
+ ```sh
142
+ products/devtools/driver/script/run_capability_probe.sh
143
+ ```
365
144
 
366
- 脚本不会替代 Android 端人工操作;它的职责是把 CLI 侧和 Host 侧闭环保持住,并把日志与产物沉到自己的 workspace。
145
+ It runs H264, H265, and MJPEG send+receive with a fresh token per case.
@@ -1,8 +1,6 @@
1
1
  export declare function resolveCliPackageRoot(fromDir: string): string;
2
2
  export declare function resolveWorkspaceRepoRoot(fromDir: string): string | undefined;
3
3
  export declare function resolveEmbeddedRoot(fromDir: string): string | undefined;
4
- export declare function resolveEmbeddedAppServerRoot(fromDir: string): string | undefined;
5
- export declare function resolveEmbeddedHostBinary(fromDir: string): string | undefined;
6
4
  export declare function resolveEmbeddedRuntimeBundleRoot(fromDir: string, runtimePlatform: string): string | undefined;
7
5
  export declare function resolveEmbeddedRuntimeScript(fromDir: string): string | undefined;
8
6
  export declare function resolveCliScriptPath(fromDir: string, relativePath: string): string;
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.resolveCliPackageRoot = resolveCliPackageRoot;
7
7
  exports.resolveWorkspaceRepoRoot = resolveWorkspaceRepoRoot;
8
8
  exports.resolveEmbeddedRoot = resolveEmbeddedRoot;
9
- exports.resolveEmbeddedAppServerRoot = resolveEmbeddedAppServerRoot;
10
- exports.resolveEmbeddedHostBinary = resolveEmbeddedHostBinary;
11
9
  exports.resolveEmbeddedRuntimeBundleRoot = resolveEmbeddedRuntimeBundleRoot;
12
10
  exports.resolveEmbeddedRuntimeScript = resolveEmbeddedRuntimeScript;
13
11
  exports.resolveCliScriptPath = resolveCliScriptPath;
@@ -18,7 +16,6 @@ function pathExists(filePath) {
18
16
  }
19
17
  function isWorkspaceRepoRoot(candidate) {
20
18
  return pathExists(path_1.default.join(candidate, 'products/cli/package.json')) &&
21
- pathExists(path_1.default.join(candidate, 'products/app-server/package.json')) &&
22
19
  pathExists(path_1.default.join(candidate, 'runtime/script/prepare_runtime_media_dataset.sh'));
23
20
  }
24
21
  function resolveCliPackageRoot(fromDir) {
@@ -51,36 +48,17 @@ function resolveEmbeddedRoot(fromDir) {
51
48
  }
52
49
  const packageRoot = resolveCliPackageRoot(fromDir);
53
50
  const embeddedRoot = path_1.default.join(packageRoot, 'vendor');
54
- if (pathExists(path_1.default.join(embeddedRoot, 'app-server')) || pathExists(path_1.default.join(embeddedRoot, 'runtime'))) {
51
+ if (pathExists(path_1.default.join(embeddedRoot, 'runtime')) || pathExists(path_1.default.join(embeddedRoot, 'devtools'))) {
55
52
  return embeddedRoot;
56
53
  }
57
54
  return undefined;
58
55
  }
59
- function resolveEmbeddedAppServerRoot(fromDir) {
56
+ function resolveEmbeddedRuntimeBundleRoot(fromDir, runtimePlatform) {
60
57
  const embeddedRoot = resolveEmbeddedRoot(fromDir);
61
58
  if (!embeddedRoot) {
62
59
  return undefined;
63
60
  }
64
- const appServerRoot = path_1.default.join(embeddedRoot, 'app-server');
65
- if (pathExists(path_1.default.join(appServerRoot, 'bin/tirtc-devtool-host.js'))) {
66
- return appServerRoot;
67
- }
68
- return undefined;
69
- }
70
- function resolveEmbeddedHostBinary(fromDir) {
71
- const appServerRoot = resolveEmbeddedAppServerRoot(fromDir);
72
- if (!appServerRoot) {
73
- return undefined;
74
- }
75
- const hostPath = path_1.default.join(appServerRoot, 'bin/tirtc-devtool-host.js');
76
- return pathExists(hostPath) ? hostPath : undefined;
77
- }
78
- function resolveEmbeddedRuntimeBundleRoot(fromDir, runtimePlatform) {
79
- const appServerRoot = resolveEmbeddedAppServerRoot(fromDir);
80
- if (!appServerRoot) {
81
- return undefined;
82
- }
83
- const runtimeRoot = path_1.default.join(appServerRoot, 'bin/runtime', runtimePlatform);
61
+ const runtimeRoot = path_1.default.join(embeddedRoot, 'runtime', runtimePlatform);
84
62
  if (pathExists(path_1.default.join(runtimeRoot, 'manifest.txt'))) {
85
63
  return runtimeRoot;
86
64
  }