tirtc-devtools-cli 0.0.1 → 0.0.2
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 +3 -3
- package/USAGE.md +47 -47
- package/dist/devtools/cli/src/config.js +3 -3
- package/dist/devtools/cli/src/embedded_paths.js +1 -1
- package/dist/devtools/cli/src/ffmpeg_tool.js +1 -1
- package/dist/devtools/cli/src/guide.js +9 -9
- package/dist/devtools/cli/src/index.js +5 -5
- package/dist/devtools/cli/src/session_manager.js +2 -2
- package/dist/devtools/cli/src/token_tool.js +1 -1
- package/package.json +3 -3
- package/vendor/app-server/bin/runtime/macos-arm64/manifest.txt +1 -1
- package/vendor/app-server/dist/host/RuntimeAdapter.js +1 -1
- /package/bin/{tirtc-devtool.js → tirtc-devtools-cli.js} +0 -0
package/README.md
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
## 使用说明 (C-Lite)
|
|
6
6
|
|
|
7
|
-
关于 `tirtc-
|
|
7
|
+
关于 `tirtc-devtools-cli` 命令的详细使用方法、参数说明与示例,请参考 [USAGE.md](./USAGE.md)。
|
|
8
8
|
|
|
9
9
|
## 负责什么
|
|
10
10
|
|
|
11
|
-
- **唯一用户产品门面**:提供 `tirtc-
|
|
11
|
+
- **唯一用户产品门面**:提供 `tirtc-devtools-cli` 命令族,覆盖常见的 RTC 测试操作,让内部研发、外部开发者和 AI agent 脚本无需手写底层协议。
|
|
12
12
|
- **配置解析与翻译**:负责解析用户传入的 CLI 参数和 TOML 配置文件,进行本地必填校验、脱敏,并翻译为 App Server 协议的 request。
|
|
13
13
|
- **产品级 Observability**:将底层的运行时事件和状态翻译为结构化输出 (JSON) 或友好的终端日志输出。
|
|
14
14
|
- **调试期工具内聚**:承接调试期必要工具(如 token bootstrap、二维码与媒体预处理)的产品化入口,避免把调试流程散落在 runtime 或外部手工步骤中。
|
|
@@ -49,4 +49,4 @@
|
|
|
49
49
|
|
|
50
50
|
- 本地测试配置文件路径:`devtools/cli/tests/.local/runtime-backed.e2e.local.json`(必需,已在 `.gitignore` 忽略)。
|
|
51
51
|
- 示例模板:`devtools/cli/tests/runtime-backed.e2e.config.example.json`。
|
|
52
|
-
- 推荐先运行 `tirtc-
|
|
52
|
+
- 推荐先运行 `tirtc-devtools-cli media assets prepare --source .refers/simple.mp4 --output-root ./.tmp/tirtc-devtools-cli/assets`,再把 `assetsDir` 指向返回的 `assets_dir`。
|
package/USAGE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TiRTC DevTool CLI(用户手册)
|
|
2
2
|
|
|
3
|
-
`tirtc-
|
|
3
|
+
`tirtc-devtools-cli` 是基于 `app-server/host` 的命令行门面,用来控制会话、服务、连接、流、命令通道与调试工具。
|
|
4
4
|
|
|
5
5
|
## 一、先说清楚关系
|
|
6
6
|
|
|
@@ -26,7 +26,7 @@ npm --prefix app-server ci && \
|
|
|
26
26
|
构建后可直接运行:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
node devtools/cli/bin/tirtc-
|
|
29
|
+
node devtools/cli/bin/tirtc-devtools-cli.js --help
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
### 2) 发布态打包(可分发二进制)
|
|
@@ -60,9 +60,9 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
60
60
|
|
|
61
61
|
一个 session = 一个常驻 Host 进程 + 一个 endpoint runtime 实例。
|
|
62
62
|
|
|
63
|
-
- `tirtc-
|
|
64
|
-
- `tirtc-
|
|
65
|
-
- `tirtc-
|
|
63
|
+
- `tirtc-devtools-cli host session start`:创建会话,返回 `sessionId`
|
|
64
|
+
- `tirtc-devtools-cli host session list`:查看会话
|
|
65
|
+
- `tirtc-devtools-cli host session stop <sessionId>`:停止会话
|
|
66
66
|
|
|
67
67
|
设计约束:
|
|
68
68
|
|
|
@@ -77,22 +77,22 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
77
77
|
|
|
78
78
|
用途:初始化 CLI 配置文件,作为后续 `service/debug/logging` 等命令的参数来源。
|
|
79
79
|
|
|
80
|
-
- `tirtc-
|
|
80
|
+
- `tirtc-devtools-cli init [outputPath]`:生成配置模板;不传路径时默认写入 `./.tmp/tirtc-devtools-cli/config.toml`。
|
|
81
81
|
|
|
82
82
|
### Host
|
|
83
83
|
|
|
84
84
|
用途:管理 Host 进程生命周期与会话健康状态。
|
|
85
85
|
|
|
86
|
-
- `tirtc-
|
|
87
|
-
- `tirtc-
|
|
88
|
-
- `tirtc-
|
|
86
|
+
- `tirtc-devtools-cli host status`:查看当前 Host/service/connection/artifact 状态。
|
|
87
|
+
- `tirtc-devtools-cli host stop`:停止当前 `--session` 对应的 Host 进程。
|
|
88
|
+
- `tirtc-devtools-cli host stop --all`:停止全部 session 对应 Host,并清理本机 orphan host 进程。
|
|
89
89
|
|
|
90
90
|
### Service
|
|
91
91
|
|
|
92
92
|
用途:控制服务端角色(等待远端连接的一侧)。
|
|
93
93
|
|
|
94
|
-
- `tirtc-
|
|
95
|
-
- `tirtc-
|
|
94
|
+
- `tirtc-devtools-cli service start [serviceEntry] [license]`:启动服务并进入等待连接状态。
|
|
95
|
+
- `tirtc-devtools-cli service stop`:停止服务。
|
|
96
96
|
|
|
97
97
|
说明:`license` 必填;`serviceEntry` 可省略,省略时走 runtime/core/transport 默认值。
|
|
98
98
|
|
|
@@ -102,9 +102,9 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
102
102
|
|
|
103
103
|
用途:控制客户端侧连接动作(主动连接/断开)。
|
|
104
104
|
|
|
105
|
-
- `tirtc-
|
|
106
|
-
- `tirtc-
|
|
107
|
-
- `tirtc-
|
|
105
|
+
- `tirtc-devtools-cli connection show`:查看当前连接状态。
|
|
106
|
+
- `tirtc-devtools-cli connection connect [serviceEntry] <peerId> [token]`:主动发起连接(不传 token 时自动签发)。
|
|
107
|
+
- `tirtc-devtools-cli connection disconnect`:主动断开连接。
|
|
108
108
|
|
|
109
109
|
说明:`connect` 每次都会新建一个 session;省略 `serviceEntry` 时,Host 回退到 runtime 配置默认值。
|
|
110
110
|
|
|
@@ -118,7 +118,7 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
118
118
|
|
|
119
119
|
用途:直接签发 token,并把调试所需的核心信息一次性输出到控制台,同时在本地生成二维码 PNG。
|
|
120
120
|
|
|
121
|
-
- `tirtc-
|
|
121
|
+
- `tirtc-devtools-cli token issue <accessId> <secretKey> <localId> <peerId>`:签发 token。
|
|
122
122
|
|
|
123
123
|
可选参数:
|
|
124
124
|
|
|
@@ -144,14 +144,14 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
144
144
|
|
|
145
145
|
用途:管理音视频流的发送/接收与远端请求策略。
|
|
146
146
|
|
|
147
|
-
- `tirtc-
|
|
148
|
-
- `tirtc-
|
|
149
|
-
- `tirtc-
|
|
150
|
-
- `tirtc-
|
|
151
|
-
- `tirtc-
|
|
152
|
-
- `tirtc-
|
|
153
|
-
- `tirtc-
|
|
154
|
-
- `tirtc-
|
|
147
|
+
- `tirtc-devtools-cli stream list`:列出当前流状态。
|
|
148
|
+
- `tirtc-devtools-cli media assets prepare --source <mp4> --output-root <dir>`:把 MP4 prepare 为 local assets。
|
|
149
|
+
- `tirtc-devtools-cli stream send start <streamId> <media> <assets_dir>`:启动发送流并绑定 prepared local assets。
|
|
150
|
+
- `tirtc-devtools-cli stream send stop <streamId>`:停止发送流。
|
|
151
|
+
- `tirtc-devtools-cli stream receive start <streamId> <media>`:启动接收流。
|
|
152
|
+
- `tirtc-devtools-cli stream receive stop <streamId>`:停止接收流。
|
|
153
|
+
- `tirtc-devtools-cli stream request-policy get`:查看远端请求策略。
|
|
154
|
+
- `tirtc-devtools-cli stream request-policy set <manual|auto-if-bound>`:设置远端请求策略。
|
|
155
155
|
|
|
156
156
|
`request-policy` 行为:
|
|
157
157
|
|
|
@@ -168,8 +168,8 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
168
168
|
|
|
169
169
|
用途:把流内容挂到具体消费端(文件、预览页等)。
|
|
170
170
|
|
|
171
|
-
- `tirtc-
|
|
172
|
-
- `tirtc-
|
|
171
|
+
- `tirtc-devtools-cli output attach <streamId> <consumer> <mediaView> <format> <delivery> [targetPath] [maxFiles]`:附加输出消费。
|
|
172
|
+
- `tirtc-devtools-cli output detach <outputId>`:移除输出消费。
|
|
173
173
|
|
|
174
174
|
`output attach` 当前最小稳定组合(CLI 前置校验):
|
|
175
175
|
|
|
@@ -179,11 +179,11 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
179
179
|
`web_preview` 用法(音视频一起预览):
|
|
180
180
|
|
|
181
181
|
- 先在客户端会话中启动接收(必须两路都起):
|
|
182
|
-
- `tirtc-
|
|
183
|
-
- `tirtc-
|
|
182
|
+
- `tirtc-devtools-cli stream receive start <videoStreamId> video`
|
|
183
|
+
- `tirtc-devtools-cli stream receive start <audioStreamId> audio`
|
|
184
184
|
- 再挂接两路输出到同一个预览页:
|
|
185
|
-
- `tirtc-
|
|
186
|
-
- `tirtc-
|
|
185
|
+
- `tirtc-devtools-cli output attach <videoStreamId> web_preview encoded jpeg artifact_path [videoTargetPath]`
|
|
186
|
+
- `tirtc-devtools-cli output attach <audioStreamId> web_preview encoded pcm artifact_path [audioTargetPath]`
|
|
187
187
|
- 两次 `output attach` 返回的 `result.preview.url` 应一致;用该 URL 在 Chrome 打开本地预览。
|
|
188
188
|
- 页面打开后会自动触发 `GET /preview/start?token=...`;若浏览器拦截自动播放音频,请手动点击 `Start Stream` 解锁。
|
|
189
189
|
- 可通过 `GET /preview/status?token=...` 查看 audio/video source 启动状态与 frame 计数。
|
|
@@ -192,9 +192,9 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
192
192
|
|
|
193
193
|
用途:发送业务命令与实时观察命令事件。
|
|
194
194
|
|
|
195
|
-
- `tirtc-
|
|
196
|
-
- `tirtc-
|
|
197
|
-
- `tirtc-
|
|
195
|
+
- `tirtc-devtools-cli command send <commandId> <kind> <payloadEncoding> <payload>`:发送命令。
|
|
196
|
+
- `tirtc-devtools-cli command send-json <commandId> <kind> <payloadJson>`:以 JSON-first 形态发送命令。
|
|
197
|
+
- `tirtc-devtools-cli command tail`:持续监听命令相关事件。
|
|
198
198
|
|
|
199
199
|
`command send-json` 约束:
|
|
200
200
|
|
|
@@ -205,8 +205,8 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
205
205
|
|
|
206
206
|
用途:生成客户端扫码连接所需的 bootstrap 二维码(只包含连接信息,不签发 token)。
|
|
207
207
|
|
|
208
|
-
- `tirtc-
|
|
209
|
-
- `tirtc-
|
|
208
|
+
- `tirtc-devtools-cli debug bootstrap qrcode <accessId> <secretKey> <peerId> [serviceEntry]`:按命令参数生成二维码。
|
|
209
|
+
- `tirtc-devtools-cli debug bootstrap qrcode-from-config`:按 `[debug.connect_bootstrap]` 配置生成二维码。
|
|
210
210
|
|
|
211
211
|
二维码产物会落到 Host artifact 的 `debug/` 目录。
|
|
212
212
|
|
|
@@ -214,10 +214,10 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
214
214
|
|
|
215
215
|
用途:做运行观测与验收证据导出。
|
|
216
216
|
|
|
217
|
-
- `tirtc-
|
|
218
|
-
- `tirtc-
|
|
219
|
-
- `tirtc-
|
|
220
|
-
- `tirtc-
|
|
217
|
+
- `tirtc-devtools-cli events tail`:实时查看事件流。
|
|
218
|
+
- `tirtc-devtools-cli logs export <outputPath>`:导出日志。
|
|
219
|
+
- `tirtc-devtools-cli report show`:查看报告。
|
|
220
|
+
- `tirtc-devtools-cli report export <outputPath>`:导出报告。
|
|
221
221
|
|
|
222
222
|
## 六、服务端操作指引(对接安卓扫码)
|
|
223
223
|
|
|
@@ -226,7 +226,7 @@ node devtools/cli/bin/tirtc-devtool.js --help
|
|
|
226
226
|
### 1) 启动服务端
|
|
227
227
|
|
|
228
228
|
```bash
|
|
229
|
-
node devtools/cli/bin/tirtc-
|
|
229
|
+
node devtools/cli/bin/tirtc-devtools-cli.js service start "" "runtime-license"
|
|
230
230
|
```
|
|
231
231
|
|
|
232
232
|
记下返回里的 `sessionId`。
|
|
@@ -239,7 +239,7 @@ node devtools/cli/bin/tirtc-devtool.js service start "" "runtime-license"
|
|
|
239
239
|
mode = "auto-if-bound"
|
|
240
240
|
|
|
241
241
|
[streams.send]
|
|
242
|
-
assets_dir = "./.tmp/tirtc-
|
|
242
|
+
assets_dir = "./.tmp/tirtc-devtools-cli/assets/<prepared-assets-id>"
|
|
243
243
|
audio_stream_id = 10
|
|
244
244
|
video_stream_id = 11
|
|
245
245
|
|
|
@@ -254,7 +254,7 @@ video_stream_id = 11
|
|
|
254
254
|
### 3) 生成给安卓扫码的 bootstrap 二维码
|
|
255
255
|
|
|
256
256
|
```bash
|
|
257
|
-
node devtools/cli/bin/tirtc-
|
|
257
|
+
node devtools/cli/bin/tirtc-devtools-cli.js --session <SESSION_ID> debug bootstrap qrcode \
|
|
258
258
|
"<access-id>" "<secret-key>" "<peer-id>" "<service-entry>"
|
|
259
259
|
```
|
|
260
260
|
|
|
@@ -271,7 +271,7 @@ node devtools/cli/bin/tirtc-devtool.js --session <SESSION_ID> debug bootstrap qr
|
|
|
271
271
|
### 4.1) 本地直接签发 token(公开调试入口)
|
|
272
272
|
|
|
273
273
|
```bash
|
|
274
|
-
node devtools/cli/bin/tirtc-
|
|
274
|
+
node devtools/cli/bin/tirtc-devtools-cli.js token issue \
|
|
275
275
|
"<access-id>" "<secret-key>" "<local-id>" "<peer-id>" \
|
|
276
276
|
--service-entry "<service-entry>"
|
|
277
277
|
```
|
|
@@ -339,7 +339,7 @@ node devtools/cli/bin/tirtc-devtool.js token issue \
|
|
|
339
339
|
|
|
340
340
|
`[logging]` 段默认已在模板里生成:
|
|
341
341
|
|
|
342
|
-
- `root_dir`:会话日志根目录(默认 `./.tmp/tirtc-
|
|
342
|
+
- `root_dir`:会话日志根目录(默认 `./.tmp/tirtc-devtools-cli/logging`)
|
|
343
343
|
- `console_mirror`:是否把 Host 关键日志镜像到当前命令终端
|
|
344
344
|
- `level`:日志级别预留位(当前 Host 以统一关键路径日志为主)
|
|
345
345
|
|
|
@@ -351,13 +351,13 @@ node devtools/cli/bin/tirtc-devtool.js token issue \
|
|
|
351
351
|
|
|
352
352
|
实时观察:
|
|
353
353
|
|
|
354
|
-
- `node devtools/cli/bin/tirtc-
|
|
354
|
+
- `node devtools/cli/bin/tirtc-devtools-cli.js --session <SESSION_ID> events tail`
|
|
355
355
|
- 输出中包含 `family=logs` / `kind=host.line` 的实时日志事件
|
|
356
356
|
|
|
357
357
|
## 六点六、配置格式说明
|
|
358
358
|
|
|
359
359
|
- 推荐使用 TOML(支持注释,便于人工维护)
|
|
360
|
-
- `init` 默认生成 TOML 模板:`.tmp/tirtc-
|
|
360
|
+
- `init` 默认生成 TOML 模板:`.tmp/tirtc-devtools-cli/config.toml`
|
|
361
361
|
|
|
362
362
|
## 七、本地 E2E 配置(必需)
|
|
363
363
|
|
|
@@ -372,7 +372,7 @@ cp devtools/cli/tests/runtime-backed.e2e.config.example.json devtools/cli/tests/
|
|
|
372
372
|
|
|
373
373
|
```json
|
|
374
374
|
{
|
|
375
|
-
"assetsDir": "./.tmp/tirtc-
|
|
375
|
+
"assetsDir": "./.tmp/tirtc-devtools-cli/assets/<prepared-assets-id>",
|
|
376
376
|
"license": "<license>",
|
|
377
377
|
"peerId": "<peer-id>",
|
|
378
378
|
"useFakeToken": false,
|
|
@@ -396,7 +396,7 @@ cp devtools/cli/tests/runtime-backed.e2e.config.example.json devtools/cli/tests/
|
|
|
396
396
|
|
|
397
397
|
## 九、新手入口
|
|
398
398
|
|
|
399
|
-
- `node devtools/cli/bin/tirtc-
|
|
399
|
+
- `node devtools/cli/bin/tirtc-devtools-cli.js guide quickstart`
|
|
400
400
|
|
|
401
401
|
会直接打印“服务端启动 -> 绑定自动发流 -> 生成 bootstrap 二维码 -> 客户端扫码签发 token 并连接 -> 打开 Web Preview 后手动 Start/Stop -> 观测报告”的最小闭环步骤。
|
|
402
402
|
|
|
@@ -30,7 +30,7 @@ function resolveConfigOutputPath(outputPath) {
|
|
|
30
30
|
if (outputPath && outputPath.trim().length > 0) {
|
|
31
31
|
return path_1.default.resolve(outputPath.trim());
|
|
32
32
|
}
|
|
33
|
-
return path_1.default.resolve(process.cwd(), '.tmp/tirtc-
|
|
33
|
+
return path_1.default.resolve(process.cwd(), '.tmp/tirtc-devtools-cli/config.toml');
|
|
34
34
|
}
|
|
35
35
|
function renderTomlConfigTemplate() {
|
|
36
36
|
return [
|
|
@@ -65,13 +65,13 @@ function renderTomlConfigTemplate() {
|
|
|
65
65
|
'mode = "manual"',
|
|
66
66
|
'',
|
|
67
67
|
'[streams.send]',
|
|
68
|
-
'assets_dir = "./.tmp/tirtc-
|
|
68
|
+
'assets_dir = "./.tmp/tirtc-devtools-cli/assets/<prepared-assets-id>"',
|
|
69
69
|
'audio_stream_id = 10',
|
|
70
70
|
'video_stream_id = 11',
|
|
71
71
|
'',
|
|
72
72
|
'[logging]',
|
|
73
73
|
'# session 日志根目录;每个 session 会写到 <root_dir>/<session_id>/',
|
|
74
|
-
'root_dir = "./.tmp/tirtc-
|
|
74
|
+
'root_dir = "./.tmp/tirtc-devtools-cli/logging"',
|
|
75
75
|
'# 是否镜像 Host 控制台日志到当前终端',
|
|
76
76
|
'console_mirror = true',
|
|
77
77
|
'# verbose|debug|info|warn|error|fatal(预留)',
|
|
@@ -25,7 +25,7 @@ function resolveCliPackageRoot(fromDir) {
|
|
|
25
25
|
path_1.default.resolve(process.cwd(), 'devtools/cli'),
|
|
26
26
|
];
|
|
27
27
|
for (const candidate of candidates) {
|
|
28
|
-
if (pathExists(path_1.default.join(candidate, 'package.json')) && pathExists(path_1.default.join(candidate, 'bin/tirtc-
|
|
28
|
+
if (pathExists(path_1.default.join(candidate, 'package.json')) && pathExists(path_1.default.join(candidate, 'bin/tirtc-devtools-cli.js'))) {
|
|
29
29
|
return candidate;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -23,7 +23,7 @@ function resolveFfmpegCacheRoot() {
|
|
|
23
23
|
if (explicit && explicit.trim().length > 0) {
|
|
24
24
|
return path_1.default.resolve(explicit.trim());
|
|
25
25
|
}
|
|
26
|
-
return path_1.default.join(os_1.default.homedir(), '.tirtc-
|
|
26
|
+
return path_1.default.join(os_1.default.homedir(), '.tirtc-devtools-cli', 'tools', 'ffmpeg');
|
|
27
27
|
}
|
|
28
28
|
function resolveCachedToolDir(platform) {
|
|
29
29
|
return path_1.default.join(resolveFfmpegCacheRoot(), platform);
|
|
@@ -12,17 +12,17 @@ function printQuickstartGuide() {
|
|
|
12
12
|
'2) 服务端已准备可发送媒体文件(示例:.refers/simple.mp4)',
|
|
13
13
|
'',
|
|
14
14
|
'步骤 1:启动服务(自动创建 session)',
|
|
15
|
-
' node devtools/cli/bin/tirtc-
|
|
15
|
+
' node devtools/cli/bin/tirtc-devtools-cli.js service start "" "<LICENSE>"',
|
|
16
16
|
' # 记下输出里的 sessionId,后续命令都显式带 --session',
|
|
17
17
|
'',
|
|
18
18
|
'步骤 2:先 prepare local assets,再配置 assets_dir + 显式音视频 stream id 并启动自动按需发流',
|
|
19
|
-
' node devtools/cli/bin/tirtc-
|
|
19
|
+
' node devtools/cli/bin/tirtc-devtools-cli.js media assets prepare --source .refers/simple.mp4 --output-root ./.tmp/tirtc-devtools-cli/assets',
|
|
20
20
|
' [stream.request_policy] mode = "auto-if-bound"',
|
|
21
|
-
' [streams.send] assets_dir = "./.tmp/tirtc-
|
|
21
|
+
' [streams.send] assets_dir = "./.tmp/tirtc-devtools-cli/assets/<prepared-assets-id>" audio_stream_id = 10 video_stream_id = 11',
|
|
22
22
|
' # service start 成功后会自动应用上述 request_policy + send 绑定',
|
|
23
23
|
'',
|
|
24
24
|
'步骤 3:生成连接 bootstrap 二维码(给安卓扫码)',
|
|
25
|
-
' node devtools/cli/bin/tirtc-
|
|
25
|
+
' node devtools/cli/bin/tirtc-devtools-cli.js --session <SESSION_ID> debug bootstrap qrcode \\',
|
|
26
26
|
' "<ACCESS_ID>" "<SECRET_KEY>" "<PEER_ID>" "<SERVICE_ENTRY>"',
|
|
27
27
|
'',
|
|
28
28
|
'步骤 4:安卓扫码后流程(客户端侧)',
|
|
@@ -31,19 +31,19 @@ function printQuickstartGuide() {
|
|
|
31
31
|
' - 持 token + peer_id 连接服务端;连接成功后请求 audio_stream_id/video_stream_id',
|
|
32
32
|
'',
|
|
33
33
|
'额外:如果你只想本地直接签发并拿到可扫码 payload,可执行:',
|
|
34
|
-
' node devtools/cli/bin/tirtc-
|
|
34
|
+
' node devtools/cli/bin/tirtc-devtools-cli.js token issue "<ACCESS_ID>" "<SECRET_KEY>" "<LOCAL_ID>" "<PEER_ID>" \\',
|
|
35
35
|
' --service-entry "<SERVICE_ENTRY>"',
|
|
36
36
|
' # CLI 会直接打印摘要、payload JSON、token,并生成本地二维码 PNG 路径',
|
|
37
37
|
'',
|
|
38
38
|
'步骤 5:服务端观测',
|
|
39
|
-
' node devtools/cli/bin/tirtc-
|
|
40
|
-
' node devtools/cli/bin/tirtc-
|
|
39
|
+
' node devtools/cli/bin/tirtc-devtools-cli.js --session <SESSION_ID> events tail',
|
|
40
|
+
' node devtools/cli/bin/tirtc-devtools-cli.js --session <SESSION_ID> report show',
|
|
41
41
|
'',
|
|
42
42
|
'补充:',
|
|
43
43
|
'- debug bootstrap qrcode 仅生成连接信息二维码,不签发 token',
|
|
44
44
|
'- 机器可读输出:在命令后追加 --json',
|
|
45
|
-
'- 查看全部命令:node devtools/cli/bin/tirtc-
|
|
46
|
-
'- 查看单命令说明:node devtools/cli/bin/tirtc-
|
|
45
|
+
'- 查看全部命令:node devtools/cli/bin/tirtc-devtools-cli.js --help',
|
|
46
|
+
'- 查看单命令说明:node devtools/cli/bin/tirtc-devtools-cli.js <command> --help',
|
|
47
47
|
];
|
|
48
48
|
console.log(lines.join('\n'));
|
|
49
49
|
}
|
|
@@ -161,7 +161,7 @@ async function runCommand(cmdName, params, options) {
|
|
|
161
161
|
const session = resolveSessionForCommand(cmdName, options, config);
|
|
162
162
|
transport = createSessionTransport(session.sessionId);
|
|
163
163
|
const client = new protocol_client_1.AppServerClient(transport);
|
|
164
|
-
await client.initialize({ name: 'tirtc-
|
|
164
|
+
await client.initialize({ name: 'tirtc-devtools-cli', version: CLI_VERSION });
|
|
165
165
|
const method = facade_1.CommandToHostMethodMapping[cmdName];
|
|
166
166
|
if (!method) {
|
|
167
167
|
throw new Error('Unknown command mapping for: ' + cmdName);
|
|
@@ -226,7 +226,7 @@ async function tailEvents(_cmdName, families, options) {
|
|
|
226
226
|
}
|
|
227
227
|
transport?.stop();
|
|
228
228
|
});
|
|
229
|
-
await client.initialize({ name: 'tirtc-
|
|
229
|
+
await client.initialize({ name: 'tirtc-devtools-cli', version: CLI_VERSION });
|
|
230
230
|
await client.subscribeEvents(families);
|
|
231
231
|
await new Promise((resolve) => {
|
|
232
232
|
process.on('SIGINT', () => {
|
|
@@ -339,8 +339,8 @@ function mustParseJsonPayload(input) {
|
|
|
339
339
|
throw new Error('payloadJson must be valid JSON text');
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
program.name('tirtc-
|
|
343
|
-
.description('TiRTC
|
|
342
|
+
program.name('tirtc-devtools-cli')
|
|
343
|
+
.description('TiRTC DevTools CLI')
|
|
344
344
|
.option('--config <path>', '配置文件路径(TOML)')
|
|
345
345
|
.option('--json', '以机器可读 JSON 输出(便于脚本集成)')
|
|
346
346
|
.option('--session <sessionId>', '指定会话 ID;除 service start/connect 外必须传');
|
|
@@ -468,7 +468,7 @@ function handleConfigInit(outputPath) {
|
|
|
468
468
|
console.error('Error:', normalized.message);
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
const init = program.command('init [outputPath]').description('新手第一步:生成 CLI 配置模板(默认输出到 ./.tmp/tirtc-
|
|
471
|
+
const init = program.command('init [outputPath]').description('新手第一步:生成 CLI 配置模板(默认输出到 ./.tmp/tirtc-devtools-cli/config.toml)');
|
|
472
472
|
init.action((outputPath) => {
|
|
473
473
|
handleConfigInit(outputPath);
|
|
474
474
|
});
|
|
@@ -30,7 +30,7 @@ function getStateDir() {
|
|
|
30
30
|
if (explicit && explicit.trim().length > 0) {
|
|
31
31
|
return explicit.trim();
|
|
32
32
|
}
|
|
33
|
-
return path_1.default.join(os_1.default.homedir(), '.tirtc-
|
|
33
|
+
return path_1.default.join(os_1.default.homedir(), '.tirtc-devtools-cli');
|
|
34
34
|
}
|
|
35
35
|
function getSocketDir() {
|
|
36
36
|
const explicit = process.env.TIRTC_DEVTOOL_SOCKET_DIR;
|
|
@@ -191,7 +191,7 @@ function waitForSocketReady(socketPath, pid) {
|
|
|
191
191
|
throw new Error(`session startup timeout: socket not ready within ${kStartupTimeoutMs}ms`);
|
|
192
192
|
}
|
|
193
193
|
function resolveDefaultLogRootDir() {
|
|
194
|
-
return path_1.default.resolve(process.cwd(), '.tmp/tirtc-
|
|
194
|
+
return path_1.default.resolve(process.cwd(), '.tmp/tirtc-devtools-cli/logging');
|
|
195
195
|
}
|
|
196
196
|
function createSession(options) {
|
|
197
197
|
const runtimePlatform = resolveRuntimePlatform();
|
|
@@ -27,7 +27,7 @@ function sanitizePathSegment(text) {
|
|
|
27
27
|
return text.replace(/[^a-zA-Z0-9._-]+/g, '-').replace(/^-+|-+$/g, '') || 'value';
|
|
28
28
|
}
|
|
29
29
|
function resolveQrCodeOutputDir() {
|
|
30
|
-
return path_1.default.resolve(process.cwd(), '.tmp/tirtc-
|
|
30
|
+
return path_1.default.resolve(process.cwd(), '.tmp/tirtc-devtools-cli/qrcode');
|
|
31
31
|
}
|
|
32
32
|
function buildQrCodePngPath(payload) {
|
|
33
33
|
const fileName = [
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tirtc-devtools-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"tirtc-
|
|
7
|
+
"tirtc-devtools-cli": "./bin/tirtc-devtools-cli.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"README.md",
|
|
11
11
|
"USAGE.md",
|
|
12
|
-
"bin/tirtc-
|
|
12
|
+
"bin/tirtc-devtools-cli.js",
|
|
13
13
|
"dist",
|
|
14
14
|
"script/ensure_ffmpeg.sh",
|
|
15
15
|
"vendor"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
platform=macos-arm64
|
|
2
|
-
staged_at_utc=2026-04-09T05:
|
|
2
|
+
staged_at_utc=2026-04-09T05:31:28Z
|
|
3
3
|
source_sdk=/Users/allenfeng/Development/Repositories/tirtc-nexus/tirtc-matrix/.build/sdk/macos-arm64
|
|
4
4
|
|
|
5
5
|
58cbe872af5a68a1f5832912ab9deb7ef5af1ac5d19439b523ce6619978214c0 include/tirtc/audio.h
|
|
@@ -101,7 +101,7 @@ function resolveOutputRoot() {
|
|
|
101
101
|
if (explicit && explicit.trim().length > 0) {
|
|
102
102
|
return path.resolve(explicit.trim());
|
|
103
103
|
}
|
|
104
|
-
return path.join(path.resolve(process.cwd()), '.tmp', 'tirtc-
|
|
104
|
+
return path.join(path.resolve(process.cwd()), '.tmp', 'tirtc-devtools-cli', 'output');
|
|
105
105
|
}
|
|
106
106
|
function normalizeMedia(media) {
|
|
107
107
|
if (media === 'audio') {
|
|
File without changes
|