tirtc-devtools-cli 0.0.10 → 0.0.12
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 +17 -11
- package/USAGE.md +148 -41
- package/bin/tirtc-devtools-cli.js +1 -1
- package/dist/cli/src/bootstrap_flows.d.ts +46 -0
- package/dist/cli/src/bootstrap_flows.js +249 -0
- package/dist/{devtools/cli → cli}/src/config.d.ts +4 -15
- package/dist/{devtools/cli → cli}/src/config.js +8 -8
- package/dist/cli/src/default_paths.d.ts +3 -0
- package/dist/cli/src/default_paths.js +23 -0
- package/dist/{devtools/cli → cli}/src/embedded_paths.d.ts +1 -0
- package/dist/{devtools/cli → cli}/src/embedded_paths.js +18 -1
- package/dist/{devtools/cli → cli}/src/facade.d.ts +41 -235
- package/dist/{devtools/cli → cli}/src/facade.js +8 -27
- package/dist/cli/src/guide.js +47 -0
- package/dist/{devtools/cli → cli}/src/index.js +67 -153
- package/dist/{devtools/cli → cli}/src/session_manager.js +9 -11
- package/dist/{devtools/cli → cli}/src/token_command.js +80 -16
- package/dist/cli/src/token_tool.d.ts +55 -0
- package/dist/{devtools/cli → cli}/src/token_tool.js +143 -47
- package/dist/{devtools/cli → cli}/src/transport.d.ts +1 -1
- package/package.json +6 -2
- package/script/ensure_ffmpeg.sh +1 -1
- package/vendor/app-server/bin/native/linux-x64/credential_napi.node +0 -0
- package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/credential.h +34 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/error.h +13 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/foundation/build_info.h +27 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/http.h +57 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/logging.h +3 -1
- package/vendor/app-server/bin/runtime/linux-x64/lib/libcrypto.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_credential.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_http.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libssl.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +2 -32
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio.h +44 -305
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/av.h +52 -372
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +2 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_downlink.h +6 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/transport.h +58 -133
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/trp.h +56 -511
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libTGTRP.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libTiRTC.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/manifest.txt +19 -15
- package/vendor/app-server/dist/host/HostCommandCoordinator.d.ts +19 -0
- package/vendor/app-server/dist/host/HostCommandCoordinator.js +196 -0
- package/vendor/app-server/dist/host/HostProtocol.d.ts +1 -11
- package/vendor/app-server/dist/host/HostProtocol.js +3 -37
- package/vendor/app-server/dist/host/HostServer.d.ts +1 -4
- package/vendor/app-server/dist/host/HostServer.js +16 -152
- package/vendor/app-server/dist/host/RuntimeAdapter.js +2 -2
- package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +3 -3
- package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +4 -4
- package/vendor/app-server/dist/host/runtime_backed_preflight.js +2 -2
- package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +1 -1
- package/vendor/app-server/dist/protocol/contract.d.ts +5 -64
- package/vendor/app-server/dist/protocol/contract.js +3 -12
- package/dist/devtools/cli/src/guide.js +0 -50
- package/dist/devtools/cli/src/token_tool.d.ts +0 -38
- package/dist/dummy.d.ts +0 -0
- package/dist/dummy.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -48
- package/vendor/app-server/bin/native/macos-arm64/libcrypto.dylib +0 -0
- package/vendor/app-server/bin/native/macos-arm64/libssl.dylib +0 -0
- package/vendor/app-server/bin/native/macos-arm64/runtime_host_napi.node +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_codec.h +0 -23
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_frame.h +0 -36
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io.h +0 -56
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_android.h +0 -19
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_apple.h +0 -19
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_harmony.h +0 -19
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_windows.h +0 -19
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_processing.h +0 -56
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_sample_rate.h +0 -18
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_codec.h +0 -21
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_downlink.h +0 -89
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_uplink.h +0 -115
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/runtime.h +0 -236
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_codec.h +0 -57
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_frame.h +0 -55
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io.h +0 -46
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_android.h +0 -32
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_apple.h +0 -34
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_harmony.h +0 -32
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_windows.h +0 -26
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_processing.h +0 -34
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_audio.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_facade.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_media.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_video.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libwebrtc_apm.a +0 -0
- package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.d.ts +0 -30
- package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.js +0 -224
- /package/dist/{devtools/cli → cli}/src/dummy.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/dummy.js +0 -0
- /package/dist/{devtools/cli → cli}/src/ffmpeg_tool.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/ffmpeg_tool.js +0 -0
- /package/dist/{devtools/cli → cli}/src/guide.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/index.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/media_assets.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/media_assets.js +0 -0
- /package/dist/{devtools/cli → cli}/src/progress.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/progress.js +0 -0
- /package/dist/{devtools/cli → cli}/src/session_manager.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/token_command.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/transport.js +0 -0
- /package/vendor/app-server/bin/{native/macos-arm64 → runtime/macos-arm64/lib}/libtgrtc.dylib +0 -0
package/README.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# TiRTC DevTools CLI
|
|
2
2
|
|
|
3
|
-
`
|
|
3
|
+
`products/cli/` 承接 `TiRTC DevTools CLI`。它是当前唯一用户界面的产品门面 (command client),为用户提供了一套操作 `Matrix Host` 控制面的终端工具。
|
|
4
4
|
|
|
5
5
|
## 使用说明 (C-Lite)
|
|
6
6
|
|
|
7
7
|
关于 `tirtc-devtools-cli` 命令的详细使用方法、参数说明与示例,请参考 [USAGE.md](./USAGE.md)。
|
|
8
8
|
|
|
9
|
-
如果要先快速确认当前 binary 暴露了哪些命令面,直接运行:`node
|
|
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
|
|
10
15
|
|
|
11
16
|
## 负责什么
|
|
12
17
|
|
|
@@ -15,6 +20,7 @@
|
|
|
15
20
|
- **产品级 Observability**:将底层的运行时事件和状态翻译为结构化输出 (JSON) 或友好的终端日志输出;对长耗时命令补轻量进度提示。
|
|
16
21
|
- **调试期工具内聚**:承接调试期必要工具(如 token bootstrap、二维码与媒体预处理)的产品化入口,避免把调试流程散落在 runtime 或外部手工步骤中。
|
|
17
22
|
- **本地 token 工具**:提供直接签发 token、打印组合 JSON、单独 token 与本地二维码 PNG 路径的公开 CLI 能力,服务本地联调与体验验证。
|
|
23
|
+
- **本地 license 二维码工具**:提供 server 扫码用的 license JSON 二维码生成能力,支持可选 `endpoint`。
|
|
18
24
|
|
|
19
25
|
## 不负责什么
|
|
20
26
|
|
|
@@ -24,7 +30,7 @@
|
|
|
24
30
|
|
|
25
31
|
## 依赖方向
|
|
26
32
|
|
|
27
|
-
- **依赖 `app-server/protocol-client/`**:通过可复用的第一方协议客户端与 `Matrix Host` 进程通信。
|
|
33
|
+
- **依赖 `products/app-server/protocol-client/`**:通过可复用的第一方协议客户端与 `Matrix Host` 进程通信。
|
|
28
34
|
- **绝不依赖 `runtime/` 代码实现**:CLI 不直接链接 runtime 模块,只消费 app-server 打包好的运行时产物与 Host 协议。
|
|
29
35
|
|
|
30
36
|
## 这里应该放什么
|
|
@@ -36,7 +42,7 @@
|
|
|
36
42
|
|
|
37
43
|
## 代码规范与 lint
|
|
38
44
|
|
|
39
|
-
- TypeScript 代码规范通过 `eslint` 承接,配置文件位于 `
|
|
45
|
+
- TypeScript 代码规范通过 `eslint` 承接,配置文件位于 `products/cli/.eslintrc.cjs`。
|
|
40
46
|
- 本目录作者侧收口命令:`npm run lint`、`npm test`、`npm run build`。
|
|
41
47
|
- 仓库级 gate 会通过 `./script/lint_node_products.sh` 在 `pre-commit` 与 `./script/check.sh` 中统一执行 Node 产品 lint。
|
|
42
48
|
|
|
@@ -44,18 +50,18 @@
|
|
|
44
50
|
|
|
45
51
|
- `npm run build`:执行 TypeScript 编译。
|
|
46
52
|
- `npm test`:运行 CLI 门面与 Smoke 测试。
|
|
47
|
-
- `npm run package`:执行 `./script/package.sh`,构建 CLI 本体并同步 npm 发布所需的 app-server/runtime vendor 资产。
|
|
53
|
+
- `npm run package`:执行 `./script/package.sh`,构建 CLI 本体并同步 npm 发布所需的 products/app-server/runtime vendor 资产。
|
|
48
54
|
- 运行 `media assets prepare` 时,CLI 会优先复用系统 `ffmpeg/ffprobe`;若本机不存在,则首次使用时自动下载到用户缓存目录。
|
|
49
55
|
|
|
50
56
|
## Runtime E2E Tester Config
|
|
51
57
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
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。
|
|
55
61
|
|
|
56
62
|
## Command Loop E2E Harness
|
|
57
63
|
|
|
58
|
-
- 长驻人工验收脚本:`
|
|
59
|
-
- 示例配置:`
|
|
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` 忽略)
|
|
61
67
|
- 该脚本会先打包最新 `runtime + app-server + cli`,再清场、`service start`、周期性发送 `stream message` / time command,并轮询 `command pending list` 后自动做 CLI 侧显式 reply;启动成功后保持常驻,等待人工去操作 Android example。
|
package/USAGE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TiRTC DevTools CLI(用户手册)
|
|
2
2
|
|
|
3
|
-
`tirtc-devtools-cli` 是基于 `app-server/host` 的命令行门面,用来控制会话、服务、连接、流、命令通道与调试工具。
|
|
3
|
+
`tirtc-devtools-cli` 是基于 `products/app-server/host` 的命令行门面,用来控制会话、服务、连接、流、命令通道与调试工具。
|
|
4
4
|
|
|
5
5
|
## 一、关系
|
|
6
6
|
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
## 二、开发态构建
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm --prefix app-server ci
|
|
15
|
-
npm --prefix
|
|
16
|
-
npm --prefix app-server run build
|
|
17
|
-
npm --prefix
|
|
14
|
+
npm --prefix products/app-server ci
|
|
15
|
+
npm --prefix products/cli ci
|
|
16
|
+
npm --prefix products/app-server run build
|
|
17
|
+
npm --prefix products/cli run build
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
运行入口:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
node
|
|
23
|
+
node products/cli/bin/tirtc-devtools-cli.js --help
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## 三、Help 菜单速览
|
|
@@ -28,7 +28,7 @@ node devtools/cli/bin/tirtc-devtools-cli.js --help
|
|
|
28
28
|
安装或构建完成后,先用 help 菜单确认当前 binary 暴露的命令面:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
node
|
|
31
|
+
node products/cli/bin/tirtc-devtools-cli.js --help
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
当前顶层 help 快照:
|
|
@@ -41,7 +41,7 @@ TiRTC DevTools CLI
|
|
|
41
41
|
Options:
|
|
42
42
|
--config <path> 配置文件路径(TOML)
|
|
43
43
|
--json 以机器可读 JSON 输出(便于脚本集成)
|
|
44
|
-
--session <sessionId> 指定会话 ID;除 service start/connect 外必须传
|
|
44
|
+
--session <sessionId> 指定会话 ID;除 service start / client start / connection connect 外必须传
|
|
45
45
|
-h, --help display help for command
|
|
46
46
|
|
|
47
47
|
Commands:
|
|
@@ -49,8 +49,10 @@ Commands:
|
|
|
49
49
|
init 新手第一步:生成 CLI 配置模板
|
|
50
50
|
media 媒体素材辅助:prepare local assets
|
|
51
51
|
service 服务端能力:启动/停止服务,等待远端接入
|
|
52
|
+
client 客户端正式入口:连接远端并自动挂载本地 web preview
|
|
52
53
|
connection 客户端能力:主动连接远端 peer
|
|
53
54
|
token Token 工具:签发 token,并输出可直接使用的 JSON 与本地二维码 PNG
|
|
55
|
+
license License 工具:生成 server 扫码 JSON 与本地二维码 PNG
|
|
54
56
|
stream 流控制:发送/接收/消息
|
|
55
57
|
output 输出挂载:文件等消费者 attach/detach
|
|
56
58
|
command 命令通道:发送命令与事件跟踪
|
|
@@ -64,10 +66,11 @@ Commands:
|
|
|
64
66
|
常用子菜单 help:
|
|
65
67
|
|
|
66
68
|
```bash
|
|
67
|
-
node
|
|
68
|
-
node
|
|
69
|
-
node
|
|
70
|
-
node
|
|
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
|
|
71
74
|
```
|
|
72
75
|
|
|
73
76
|
当前关键子菜单快照:
|
|
@@ -94,14 +97,21 @@ Commands:
|
|
|
94
97
|
tail 持续监听命令相关事件
|
|
95
98
|
|
|
96
99
|
$ node ... token issue --help
|
|
100
|
+
Usage: tirtc-devtools-cli token issue [options] <remote_id>
|
|
101
|
+
|
|
97
102
|
Options:
|
|
98
103
|
--access-id <accessId>
|
|
99
104
|
--secret-key <secretKey>
|
|
100
|
-
--
|
|
101
|
-
--
|
|
102
|
-
--
|
|
103
|
-
--
|
|
104
|
-
|
|
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>
|
|
105
115
|
--qr-error-correction-level <level>
|
|
106
116
|
--ascii-max-columns <columns>
|
|
107
117
|
```
|
|
@@ -110,7 +120,7 @@ Options:
|
|
|
110
120
|
|
|
111
121
|
- `--config <path>`:TOML 配置文件路径。
|
|
112
122
|
- `--json`:结构化 JSON 输出。
|
|
113
|
-
- `--session <sessionId>`:除 `service start` / `connection connect` 外,其余业务命令必须显式提供。
|
|
123
|
+
- `--session <sessionId>`:除 `service start` / `client start` / `connection connect` 外,其余业务命令必须显式提供。
|
|
114
124
|
|
|
115
125
|
## 五、会话模型
|
|
116
126
|
|
|
@@ -120,13 +130,13 @@ Options:
|
|
|
120
130
|
- `host session list`:查看会话。
|
|
121
131
|
- `host session stop <sessionId>`:停止会话。
|
|
122
132
|
- `service start`:默认创建 `service` 会话;可通过 `--session` 绑定已有空闲会话。
|
|
123
|
-
- `connection connect`:总是创建新的 `client` 会话,不允许复用 `--session`。
|
|
133
|
+
- `client start` / `connection connect`:总是创建新的 `client` 会话,不允许复用 `--session`。
|
|
124
134
|
|
|
125
135
|
## 六、server-only 正式入口
|
|
126
136
|
|
|
127
137
|
### 1. 配置真相
|
|
128
138
|
|
|
129
|
-
server-only 正式路径只认 `[server]
|
|
139
|
+
server-only 正式路径只认 `[server]`:
|
|
130
140
|
|
|
131
141
|
```toml
|
|
132
142
|
[server]
|
|
@@ -135,11 +145,6 @@ license = "runtime-license"
|
|
|
135
145
|
mp4_path = "/Users/allenfeng/Development/Repositories/tirtc-nexus/tirtc-matrix/.refers/simple.mp4"
|
|
136
146
|
video_stream_id = 11
|
|
137
147
|
audio_stream_id = 10
|
|
138
|
-
|
|
139
|
-
[logging]
|
|
140
|
-
root_dir = "./.tmp/tirtc-devtools-cli/logging"
|
|
141
|
-
console_mirror = true
|
|
142
|
-
level = "info"
|
|
143
148
|
```
|
|
144
149
|
|
|
145
150
|
说明:
|
|
@@ -147,11 +152,12 @@ level = "info"
|
|
|
147
152
|
- `license`、`mp4_path`、`video_stream_id`、`audio_stream_id` 必填。
|
|
148
153
|
- `service_entry` 可留空,回退到底层默认值。
|
|
149
154
|
- 旧 `[service]`、`[stream.request_policy]`、`[streams.send]` 不再属于正式合同。
|
|
155
|
+
- 正式命令默认开启 console mirror,并把日志固定落到 `~/.tirtc-devtools-cli/logging/`。
|
|
150
156
|
|
|
151
157
|
### 2. 启动命令
|
|
152
158
|
|
|
153
159
|
```bash
|
|
154
|
-
node
|
|
160
|
+
node products/cli/bin/tirtc-devtools-cli.js --config ./server.toml --json service start
|
|
155
161
|
```
|
|
156
162
|
|
|
157
163
|
`service start` 固定流程:
|
|
@@ -170,18 +176,49 @@ node devtools/cli/bin/tirtc-devtools-cli.js --config ./server.toml --json servic
|
|
|
170
176
|
- CLI 不再暴露 request-policy 配置或命令。
|
|
171
177
|
- 一旦远端请求对应 media,已绑定的发送流会自动转为 `active`。
|
|
172
178
|
|
|
173
|
-
## 七、
|
|
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
|
+
```
|
|
195
|
+
|
|
196
|
+
说明:
|
|
197
|
+
|
|
198
|
+
- `peer_id`、`audio_stream_id`、`video_stream_id`、`consumer` 必填。
|
|
199
|
+
- `consumer` 当前固定为 `web_preview`。
|
|
200
|
+
- token 必须通过命令行 `--token` 显式提供,不进入配置文件。
|
|
201
|
+
|
|
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
|
|
174
211
|
|
|
175
212
|
```bash
|
|
176
|
-
node
|
|
213
|
+
node products/cli/bin/tirtc-devtools-cli.js --config ./client.toml --json connection connect <serviceEntry> <peerId> <token>
|
|
177
214
|
```
|
|
178
215
|
|
|
179
216
|
说明:
|
|
180
217
|
|
|
181
|
-
-
|
|
182
|
-
-
|
|
218
|
+
- 该命令保留为 expert/atomic 路径。
|
|
219
|
+
- token 必须显式提供;CLI 不再提供 auto token 回退。
|
|
183
220
|
|
|
184
|
-
##
|
|
221
|
+
## 九、stream / output / command
|
|
185
222
|
|
|
186
223
|
### Stream
|
|
187
224
|
|
|
@@ -214,35 +251,105 @@ CLI 仍会在本地收紧最小组合矩阵:
|
|
|
214
251
|
|
|
215
252
|
`command request` 是 canonical 主语,`command send` 只保留为兼容别名。若要发 JSON,请把 JSON 文本作为 `payload` 传入。`command pending list` 用于恢复或轮询当前积压,`command reply` 基于 `remoteRequestId` 显式回复待处理请求。
|
|
216
253
|
|
|
217
|
-
##
|
|
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
|
+
node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID> \
|
|
270
|
+
--endpoint <ENDPOINT> \
|
|
271
|
+
--openapi-endpoint <OPENAPI_ENDPOINT>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
当前 CLI 合同:
|
|
275
|
+
|
|
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 中不再补默认字段。
|
|
282
|
+
|
|
283
|
+
`--json` 输出保持外层 envelope 不变:
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"code": 0,
|
|
288
|
+
"message": "OK",
|
|
289
|
+
"data": {
|
|
290
|
+
"payload": {
|
|
291
|
+
"remote_id": "TESTFENGJUN4",
|
|
292
|
+
"token": "<TOKEN>",
|
|
293
|
+
"endpoint": "http://ep-test-tirtc.tange365.com",
|
|
294
|
+
"openapi_endpoint": "http://api-test-tirtc.tange365.com"
|
|
295
|
+
},
|
|
296
|
+
"payloadJson": "{\"remote_id\":\"TESTFENGJUN4\",\"token\":\"<TOKEN>\",\"endpoint\":\"http://ep-test-tirtc.tange365.com\",\"openapi_endpoint\":\"http://api-test-tirtc.tange365.com\"}",
|
|
297
|
+
"token": "<TOKEN>",
|
|
298
|
+
"qrCodePngPath": "/absolute/path/to/token-*.png"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
说明:
|
|
304
|
+
|
|
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`。
|
|
307
|
+
|
|
308
|
+
### license qrcode
|
|
309
|
+
|
|
310
|
+
命令形态:
|
|
311
|
+
|
|
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>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
当前 CLI 合同:
|
|
318
|
+
|
|
319
|
+
- 只保留 `license` 和可选 `endpoint`。
|
|
320
|
+
- `--endpoint` 取代旧 `--service-entry`。
|
|
321
|
+
- 若未显式传入 `endpoint`,payload 中不再补默认字段。
|
|
322
|
+
|
|
323
|
+
### 其他命令
|
|
218
324
|
|
|
219
|
-
- `token issue <peerId>`:本地签发 token。
|
|
220
325
|
- `debug bootstrap qrcode ...` / `debug bootstrap qrcode-from-config`:生成联调用二维码。
|
|
221
326
|
- `events tail`:实时查看事件流。
|
|
222
327
|
- `logs export <outputPath>`:导出日志。
|
|
223
328
|
- `report show` / `report export <outputPath>`:查看或导出报告。
|
|
224
329
|
|
|
225
|
-
##
|
|
330
|
+
## 十一、本地 E2E 配置
|
|
226
331
|
|
|
227
|
-
- CLI server/client E2E 本地配置文件:`
|
|
228
|
-
-
|
|
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]`
|
|
229
336
|
- CLI server-only E2E 不再要求先手工 `media assets prepare` 再回填 `assetsDir`
|
|
230
337
|
|
|
231
|
-
##
|
|
338
|
+
## 十二、Android 人工闭环脚本
|
|
232
339
|
|
|
233
340
|
如果需要把 CLI 侧闭环常驻起来,再手工去操作 Android example,使用:
|
|
234
341
|
|
|
235
342
|
```bash
|
|
236
|
-
./
|
|
343
|
+
./products/cli/script/command_loop_e2e.sh
|
|
237
344
|
```
|
|
238
345
|
|
|
239
|
-
默认读取:`
|
|
346
|
+
默认读取:`products/cli/config/.local/command_loop_e2e.local.toml`
|
|
240
347
|
|
|
241
348
|
建议先从模板复制:
|
|
242
349
|
|
|
243
350
|
```bash
|
|
244
|
-
mkdir -p
|
|
245
|
-
cp
|
|
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
|
|
246
353
|
```
|
|
247
354
|
|
|
248
355
|
该脚本会:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require('../dist/
|
|
2
|
+
require('../dist/cli/src/index.js');
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AppServerClient } from '../../app-server/protocol-client';
|
|
2
|
+
import type { CliConfig } from './config';
|
|
3
|
+
import { ProgressIndicator } from './progress';
|
|
4
|
+
type ClientPreview = {
|
|
5
|
+
url: string;
|
|
6
|
+
token?: string;
|
|
7
|
+
endpoint?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ServerBootstrapConfig = {
|
|
10
|
+
serviceEntry?: string;
|
|
11
|
+
license: string;
|
|
12
|
+
mp4Path: string;
|
|
13
|
+
audioStreamId: number;
|
|
14
|
+
videoStreamId: number;
|
|
15
|
+
};
|
|
16
|
+
export type ClientBootstrapConfig = {
|
|
17
|
+
serviceEntry?: string;
|
|
18
|
+
peerId: string;
|
|
19
|
+
audioStreamId: number;
|
|
20
|
+
videoStreamId: number;
|
|
21
|
+
consumer: 'web_preview';
|
|
22
|
+
};
|
|
23
|
+
export declare class BootstrapStepError extends Error {
|
|
24
|
+
readonly reasonCode: string;
|
|
25
|
+
readonly data: Record<string, unknown>;
|
|
26
|
+
constructor(reasonCode: string, message: string, data: Record<string, unknown>);
|
|
27
|
+
}
|
|
28
|
+
export declare function validateServerConfig(config: CliConfig): ServerBootstrapConfig;
|
|
29
|
+
export declare function validateClientConfig(config: CliConfig): ClientBootstrapConfig;
|
|
30
|
+
export declare function applyConfiguredServerBootstrap(client: AppServerClient, config: CliConfig, progress?: ProgressIndicator): Promise<{
|
|
31
|
+
preparedAssetsDir: string;
|
|
32
|
+
mediaSendPolicy: 'AUTO_ON_CONNECTED';
|
|
33
|
+
bootstrapSendStreams: Array<Record<string, unknown>>;
|
|
34
|
+
}>;
|
|
35
|
+
export declare function applyClientStartBootstrap(client: AppServerClient, config: CliConfig, token: string, progress?: ProgressIndicator): Promise<{
|
|
36
|
+
connection: unknown;
|
|
37
|
+
autoApplied: {
|
|
38
|
+
consumer: 'web_preview';
|
|
39
|
+
audioStream: unknown;
|
|
40
|
+
videoStream: unknown;
|
|
41
|
+
audioOutput: unknown;
|
|
42
|
+
videoOutput: unknown;
|
|
43
|
+
preview: ClientPreview;
|
|
44
|
+
};
|
|
45
|
+
}>;
|
|
46
|
+
export {};
|