tirtc-devtools-cli 0.0.13 → 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 (137) hide show
  1. package/README.md +42 -46
  2. package/USAGE.md +87 -312
  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 +4 -2
  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 +2 -4
  12. package/dist/cli/src/token_tool.js +12 -186
  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 +56 -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 +52 -0
  19. package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/error.h +11 -0
  20. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_downlink.h +11 -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 +7 -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 -48
  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/lib/libcrypto.a +0 -0
  54. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_credential.a +0 -0
  55. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_http.a +0 -0
  56. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  57. package/vendor/app-server/bin/runtime/linux-x64/lib/libssl.a +0 -0
  58. package/vendor/app-server/bin/runtime/linux-x64/lib/libxlog.a +0 -0
  59. package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +0 -4
  60. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/credential.h +0 -34
  61. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +0 -52
  62. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/foundation/build_info.h +0 -27
  63. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/http.h +0 -57
  64. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/logging.h +0 -55
  65. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_av_sync.h +0 -61
  66. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_source.h +0 -77
  67. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_live_source.h +0 -71
  68. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
  69. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  70. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  71. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  72. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  73. package/vendor/app-server/bin/tirtc-devtool-host.js +0 -2
  74. package/vendor/app-server/dist/host/ArtifactManager.d.ts +0 -18
  75. package/vendor/app-server/dist/host/ArtifactManager.js +0 -98
  76. package/vendor/app-server/dist/host/HostCommandCoordinator.d.ts +0 -19
  77. package/vendor/app-server/dist/host/HostCommandCoordinator.js +0 -196
  78. package/vendor/app-server/dist/host/HostProtocol.d.ts +0 -103
  79. package/vendor/app-server/dist/host/HostProtocol.js +0 -239
  80. package/vendor/app-server/dist/host/HostServer.d.ts +0 -52
  81. package/vendor/app-server/dist/host/HostServer.js +0 -727
  82. package/vendor/app-server/dist/host/HostState.d.ts +0 -69
  83. package/vendor/app-server/dist/host/HostState.js +0 -19
  84. package/vendor/app-server/dist/host/RuntimeAdapter.d.ts +0 -95
  85. package/vendor/app-server/dist/host/RuntimeAdapter.js +0 -636
  86. package/vendor/app-server/dist/host/RuntimeReceiveWorker.d.ts +0 -37
  87. package/vendor/app-server/dist/host/RuntimeReceiveWorker.js +0 -186
  88. package/vendor/app-server/dist/host/RuntimeSendWorker.d.ts +0 -58
  89. package/vendor/app-server/dist/host/RuntimeSendWorker.js +0 -438
  90. package/vendor/app-server/dist/host/TokenTool.d.ts +0 -15
  91. package/vendor/app-server/dist/host/TokenTool.js +0 -84
  92. package/vendor/app-server/dist/host/WebPreviewGateway.d.ts +0 -28
  93. package/vendor/app-server/dist/host/WebPreviewGateway.js +0 -815
  94. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.d.ts +0 -23
  95. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +0 -115
  96. package/vendor/app-server/dist/host/native/RuntimeHostBridge.d.ts +0 -32
  97. package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +0 -157
  98. package/vendor/app-server/dist/host/runtime_backed_preflight.d.ts +0 -10
  99. package/vendor/app-server/dist/host/runtime_backed_preflight.js +0 -78
  100. package/vendor/app-server/dist/host/tests/helpers/host_socket_client.d.ts +0 -28
  101. package/vendor/app-server/dist/host/tests/helpers/host_socket_client.js +0 -85
  102. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.d.ts +0 -10
  103. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +0 -41
  104. package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.d.ts +0 -11
  105. package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.js +0 -32
  106. package/vendor/app-server/dist/protocol/contract.d.ts +0 -1128
  107. package/vendor/app-server/dist/protocol/contract.js +0 -217
  108. package/vendor/app-server/dist/protocol-client/index.d.ts +0 -25
  109. package/vendor/app-server/dist/protocol-client/index.js +0 -114
  110. package/vendor/app-server/dist/src/index.d.ts +0 -1
  111. package/vendor/app-server/dist/src/index.js +0 -294
  112. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_codec.h +0 -0
  113. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_frame.h +0 -0
  114. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_android.h +0 -0
  115. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_apple.h +0 -0
  116. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_harmony.h +0 -0
  117. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_windows.h +0 -0
  118. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_processing.h +0 -0
  119. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_sample_rate.h +0 -0
  120. /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/foundation/build_info.h +0 -0
  121. /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/http.h +0 -0
  122. /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/logging.h +0 -0
  123. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_codec.h +0 -0
  124. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_frame.h +0 -0
  125. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_apple.h +0 -0
  126. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_harmony.h +0 -0
  127. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_windows.h +0 -0
  128. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_processing.h +0 -0
  129. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libTGTRP.a +0 -0
  130. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libTiRTC.a +0 -0
  131. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libcrypto.a +0 -0
  132. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libcrypto.dylib +0 -0
  133. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libssl.a +0 -0
  134. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libssl.dylib +0 -0
  135. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libtgrtc.dylib +0 -0
  136. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libwebrtc_apm.a +0 -0
  137. /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,289 +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-key-id <accessKeyId>
104
- --secret-key-id <secretKeyId>
105
- --app-id <appId>
106
- --openapi-endpoint <url>
107
- --endpoint <entry>
108
- --qr-error-correction-level <level>
109
- --ascii-max-columns <columns>
110
-
111
- $ node ... license qrcode --help
112
- Usage: tirtc-devtools-cli license qrcode [options] <license>
113
-
114
- Options:
115
- --endpoint <entry>
116
- --qr-error-correction-level <level>
117
- --ascii-max-columns <columns>
118
- ```
119
-
120
- ## 四、全局参数
121
-
122
- - `--config <path>`:TOML 配置文件路径。
123
- - `--json`:结构化 JSON 输出。
124
- - `--session <sessionId>`:除 `service start` / `client start` / `connection connect` 外,其余业务命令必须显式提供。
125
-
126
- ## 五、会话模型
127
-
128
- 一个 session = 一个常驻 Host 进程 + 一个 endpoint runtime 实例。
129
-
130
- - `host session start`:创建会话。
131
- - `host session list`:查看会话。
132
- - `host session stop <sessionId>`:停止会话。
133
- - `service start`:默认创建 `service` 会话;可通过 `--session` 绑定已有空闲会话。
134
- - `client start` / `connection connect`:总是创建新的 `client` 会话,不允许复用 `--session`。
135
-
136
- ## 六、server-only 正式入口
137
-
138
- ### 1. 配置真相
139
-
140
- server-only 正式路径只认 `[server]`:
141
-
142
- ```toml
143
- [server]
144
- service_entry = ""
145
- license = "runtime-license"
146
- mp4_path = "/Users/allenfeng/Development/Repositories/tirtc-nexus/tirtc-matrix/.refers/simple.mp4"
147
- video_stream_id = 11
148
- audio_stream_id = 10
149
- ```
150
-
151
- 说明:
152
-
153
- - `license`、`mp4_path`、`video_stream_id`、`audio_stream_id` 必填。
154
- - `service_entry` 可留空,回退到底层默认值。
155
- - 旧 `[service]`、`[stream.request_policy]`、`[streams.send]` 不再属于正式合同。
156
- - 正式命令默认开启 console mirror,并把日志固定落到 `~/.tirtc-devtools-cli/logging/`。
157
-
158
- ### 2. 启动命令
159
-
160
- ```bash
161
- node products/cli/bin/tirtc-devtools-cli.js --config ./server.toml --json service start
162
- ```
163
-
164
- `service start` 固定流程:
165
-
166
- 1. 读取并校验 `[server]`。
167
- 2. 对 `mp4_path` 执行 prepare。
168
- 3. 调用 `service/start`。
169
- 4. 自动调用两次 `stream/sendStart`:一次音频、一次视频。
170
- 5. 返回 `autoApplied` 摘要:`preparedAssetsDir`、固定 `mediaSendPolicy=AUTO_ON_CONNECTED`、以及音视频 sendStart 结果。
171
-
172
- 非 `--json` 模式下,CLI 会在 `stderr` 输出轻量进度提示:先显示 MP4 prepare,再显示 service start,避免长时间静默。
173
-
174
- ### 3. 自动发送语义
175
-
176
- - App Server server 角色固定使用 `AUTO_ON_CONNECTED`。
177
- - CLI 不再暴露 request-policy 配置或命令。
178
- - 一旦远端请求对应 media,已绑定的发送流会自动转为 `active`。
179
-
180
- ## 七、client start
181
-
182
- ```bash
183
- node products/cli/bin/tirtc-devtools-cli.js --config ./client.toml --json client start --token <TOKEN>
184
- ```
185
-
186
- client 正式路径只认 `[client]`:
187
-
188
- ```toml
189
- [client]
190
- service_entry = ""
191
- peer_id = "peer-123"
192
- audio_stream_id = 10
193
- video_stream_id = 11
194
- consumer = "web_preview"
195
- ```
196
-
197
- 说明:
198
-
199
- - `peer_id`、`audio_stream_id`、`video_stream_id`、`consumer` 必填。
200
- - `consumer` 当前固定为 `web_preview`。
201
- - token 必须通过命令行 `--token` 显式提供,不进入配置文件。
202
-
203
- `client start` 固定流程:
204
-
205
- 1. 读取并校验 `[client]`。
206
- 2. 调用 `connection/connect`。
207
- 3. 自动调用两次 `stream/receiveStart`:一次音频、一次视频。
208
- 4. 自动调用两次 `output/attach`,consumer 固定为 `web_preview`。
209
- 5. 返回 `autoApplied` 摘要,其中 `preview.url` 是正式浏览器入口。
210
-
211
- ## 八、connection connect
212
-
213
- ```bash
214
- node products/cli/bin/tirtc-devtools-cli.js --config ./client.toml --json connection connect <serviceEntry> <peerId> <token>
215
- ```
216
-
217
- 说明:
218
-
219
- - 该命令保留为 expert/atomic 路径。
220
- - token 必须显式提供;CLI 不再提供 auto token 回退。
221
-
222
- ## 九、stream / output / command
223
-
224
- ### Stream
225
-
226
- - `stream list`
227
- - `stream send start <streamId> <media> <assets_dir>`
228
- - `stream send stop <streamId>`
229
- - `stream message send <streamId> <payload>`
230
- - `stream receive start <streamId> <media>`
231
- - `stream receive stop <streamId>`
232
-
233
- `stream message send` 是字符串型 payload contract;当前 Host/runtime-backed adapter 至少保证连接存在时可接受请求并落事件。
234
-
235
- ### Output
236
-
237
- - `output attach <streamId> <consumer> <mediaView> <format> <delivery> [targetPath] [maxFiles]`
238
- - `output detach <outputId>`
239
-
240
- CLI 仍会在本地收紧最小组合矩阵:
241
-
242
- - `web_preview` 只允许 `delivery=artifact_path`,`format` 允许 `jpeg|pcm|h264|g711a`
243
- - `file_sink` 只允许 `delivery=file`,`format=mp4`
11
+ ## Global
244
12
 
245
- ### Command
13
+ - `--json` prints a machine-readable envelope.
14
+ - `--version` prints CLI version and native driver contract version.
246
15
 
247
- - `command request <commandId> <payloadEncoding> <payload> [--timeout-ms <ms>]`
248
- - `command send <commandId> <payloadEncoding> <payload> [--timeout-ms <ms>]`
249
- - `command pending list`
250
- - `command reply <remoteRequestId> <commandId> <payloadEncoding> <payload>`
251
- - `command tail`
16
+ ## Platform Support
252
17
 
253
- `command request` canonical 主语,`command send` 只保留为兼容别名。若要发 JSON,请把 JSON 文本作为 `payload` 传入。`command pending list` 用于恢复或轮询当前积压,`command reply` 基于 `remoteRequestId` 显式回复待处理请求。
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.
254
20
 
255
- ## 十、token / license / debug / report
21
+ Do not treat Linux send/receive as ready until the Linux headless receive driver or a containerized online runner is delivered.
256
22
 
257
- ### token issue
23
+ ## Token
258
24
 
259
- 命令形态:
260
-
261
- ```bash
25
+ ```sh
262
26
  export TIRTC_ACCESS_KEY_ID="<ACCESS_KEY_ID>"
263
27
  export TIRTC_SECRET_KEY_ID="<SECRET_KEY_ID>"
264
28
  export TIRTC_APP_ID="<APP_ID>"
265
- node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID>
266
- ```
267
-
268
- 如果要覆盖默认 endpoint,并显式透传给底层签发路径:
29
+ export TIRTC_DEVICE_ID="<REMOTE_ID>"
30
+ export TIRTC_ENDPOINT="<SERVICE_ENTRY>"
31
+ export TIRTC_OPEN_API_ENDPOINT="<OPENAPI_ENDPOINT>"
269
32
 
270
- ```bash
271
33
  node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID> \
272
34
  --endpoint <ENDPOINT> \
273
35
  --openapi-endpoint <OPENAPI_ENDPOINT>
274
- ```
275
-
276
- 当前 CLI 合同:
277
36
 
278
- - 位置参数改为 `<remote_id>`。
279
- - `app_id` 必填;可通过 `--app-id` 或 `TIRTC_APP_ID` 提供。
280
- - `--endpoint` 取代旧 `--service-entry`。
281
- - `--openapi-endpoint` 取代旧 `--openapi-entry`。
282
- - 不再接收 `local_id`。
283
- - 显式传入的 `endpoint` / `openapi_endpoint` 会透传给 C 层签发路径;其中 `app_id` / `endpoint` / `openapi_endpoint` 会进入二维码 payload。
284
- - 若未显式传入 `endpoint` / `openapi_endpoint`,则 payload 中不再补默认字段。
37
+ ./script/issue_devtools_token.sh --token-only
38
+ ```
285
39
 
286
- `--json` 输出保持外层 envelope 不变:
40
+ `token issue` preserves the public JSON envelope:
287
41
 
288
42
  ```json
289
43
  {
@@ -291,80 +45,101 @@ node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID> \
291
45
  "message": "OK",
292
46
  "data": {
293
47
  "payload": {
294
- "app_id": "AD_testapp",
295
- "remote_id": "TESTFENGJUN4",
48
+ "app_id": "APP",
49
+ "remote_id": "REMOTE",
296
50
  "token": "<TOKEN>",
297
- "endpoint": "http://ep-test-tirtc.tange365.com",
298
- "openapi_endpoint": "http://api-test-tirtc.tange365.com"
51
+ "endpoint": "http://...",
52
+ "openapi_endpoint": "http://..."
299
53
  },
300
- "payloadJson": "{\"app_id\":\"AD_testapp\",\"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>\"}",
301
55
  "token": "<TOKEN>",
302
- "qrCodePngPath": "/absolute/path/to/token-*.png"
56
+ "qrCodePngPath": "/absolute/path/token-*.png"
303
57
  }
304
58
  }
305
59
  ```
306
60
 
307
- 说明:
61
+ TiRTC token has anti-replay semantics. Treat every token as single-use and issue a fresh token for every new connection.
308
62
 
309
- - payload 只保留 `app_id`、`remote_id`、`token`、可选 `endpoint`、可选 `openapi_endpoint`。
310
- - 已删除字段不再出现:`version`、`type`、`local_id`、`peer_id`、`openapi_entry`、`service_entry`、`user_ttl_seconds`、`channel_ttl_seconds`、`generated_at`。
63
+ ## License QR
311
64
 
312
- ### license qrcode
65
+ ```sh
66
+ node products/cli/bin/tirtc-devtools-cli.js --json license qrcode <LICENSE> --endpoint <ENDPOINT>
67
+ ```
313
68
 
314
- 命令形态:
69
+ ## Assets
315
70
 
316
- ```bash
317
- node products/cli/bin/tirtc-devtools-cli.js --json license qrcode <LICENSE>
318
- 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
319
74
  ```
320
75
 
321
- 当前 CLI 合同:
76
+ Prepare any MP4 and use the returned `data.manifest_path` as `send start --source`:
322
77
 
323
- - 只保留 `license` 和可选 `endpoint`。
324
- - `--endpoint` 取代旧 `--service-entry`。
325
- - 若未显式传入 `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
+ ```
326
83
 
327
- ### 其他命令
84
+ ## Send
328
85
 
329
- - `debug bootstrap qrcode ...` / `debug bootstrap qrcode-from-config`:生成联调用二维码。
330
- - `events tail`:实时查看事件流。
331
- - `logs export <outputPath>`:导出日志。
332
- - `report show` / `report export <outputPath>`:查看或导出报告。
86
+ Required environment:
333
87
 
334
- ## 十一、本地 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
+ ```
335
97
 
336
- - CLI server/client E2E 本地配置文件:`products/cli/config/.local/server.local.toml` + `products/cli/config/.local/client.local.toml`
337
- - `products/cli/config/.local/` 默认整体忽略,由本地联调环境自行维护
338
- - `server.local.toml` 字段:`[server]` + `[debug.connect_bootstrap]`
339
- - `client.local.toml` 字段:`[client]` + `[debug.token_issue]`
340
- - CLI server-only E2E 不再要求先手工 `media assets prepare` 再回填 `assetsDir`
98
+ Run one send role with the default prepared asset:
341
99
 
342
- ## 十二、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
+ ```
343
105
 
344
- 如果需要把 CLI 侧闭环常驻起来,再手工去操作 Android example,使用:
106
+ Run one send role from a prepared MP4:
345
107
 
346
- ```bash
347
- ./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
348
113
  ```
349
114
 
350
- 默认读取:`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.
351
118
 
352
- 建议先从模板复制:
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.
353
122
 
354
- ```bash
355
- mkdir -p products/cli/config/.local
356
- cp products/cli/config/command_loop_e2e.example.toml products/cli/config/.local/command_loop_e2e.local.toml
123
+ ## Receive
124
+
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
357
129
  ```
358
130
 
359
- 该脚本会:
131
+ Receive writes `summary.json`, `events.jsonl`, runtime logs, and `render/first-video-frame.*` for `frame_dump`.
132
+
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
360
138
 
361
- - 打包最新 `runtime + app-server + cli`
362
- - 杀掉其他同类 `command_loop_e2e.sh` 进程
363
- - `host stop --all`
364
- - `service start`
365
- - 可选生成 bootstrap 二维码
366
- - 每 `15s` 执行一次 `stream message send`
367
- - 每 `10s` 执行一次时间命令 `command request 7953 utf8 "time?"`
368
- - 轮询 `command pending list` 并对每个 pending request 执行 `command reply`
139
+ For the current macOS gate, use the native capability runner:
140
+
141
+ ```sh
142
+ products/devtools/driver/script/run_capability_probe.sh
143
+ ```
369
144
 
370
- 脚本不会替代 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
  }