tirtc-devtools-cli 0.0.6 → 0.0.8

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 (37) hide show
  1. package/README.md +8 -1
  2. package/USAGE.md +45 -7
  3. package/dist/devtools/cli/src/config.js +2 -2
  4. package/dist/devtools/cli/src/facade.d.ts +19 -3
  5. package/dist/devtools/cli/src/facade.js +12 -3
  6. package/dist/devtools/cli/src/guide.js +1 -1
  7. package/dist/devtools/cli/src/index.js +68 -23
  8. package/dist/devtools/cli/src/progress.d.ts +19 -0
  9. package/dist/devtools/cli/src/progress.js +63 -0
  10. package/package.json +1 -1
  11. package/vendor/app-server/bin/native/macos-arm64/runtime_host_napi.node +0 -0
  12. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +1 -0
  13. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/transport.h +2 -0
  14. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
  15. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
  16. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  17. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
  18. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  19. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  20. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  21. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  22. package/vendor/app-server/bin/runtime/macos-arm64/manifest.txt +11 -11
  23. package/vendor/app-server/dist/host/ArtifactManager.js +17 -2
  24. package/vendor/app-server/dist/host/HostProtocol.d.ts +7 -3
  25. package/vendor/app-server/dist/host/HostProtocol.js +9 -3
  26. package/vendor/app-server/dist/host/HostServer.d.ts +6 -0
  27. package/vendor/app-server/dist/host/HostServer.js +172 -2
  28. package/vendor/app-server/dist/host/HostState.d.ts +14 -0
  29. package/vendor/app-server/dist/host/HostState.js +1 -0
  30. package/vendor/app-server/dist/host/RuntimeAdapter.d.ts +4 -2
  31. package/vendor/app-server/dist/host/RuntimeAdapter.js +51 -13
  32. package/vendor/app-server/dist/host/RuntimeSendWorker.d.ts +12 -0
  33. package/vendor/app-server/dist/host/RuntimeSendWorker.js +147 -0
  34. package/vendor/app-server/dist/host/native/RuntimeHostBridge.d.ts +13 -0
  35. package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +16 -0
  36. package/vendor/app-server/dist/protocol/contract.d.ts +158 -12
  37. package/vendor/app-server/dist/protocol/contract.js +30 -5
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  - **唯一用户产品门面**:提供 `tirtc-devtools-cli` 命令族,覆盖常见的 RTC 测试操作,让内部研发、外部开发者和 AI agent 脚本无需手写底层协议。
14
14
  - **配置解析与翻译**:负责解析用户传入的 CLI 参数和 TOML 配置文件,进行本地必填校验、脱敏,并翻译为 App Server 协议的 request。
15
- - **产品级 Observability**:将底层的运行时事件和状态翻译为结构化输出 (JSON) 或友好的终端日志输出。
15
+ - **产品级 Observability**:将底层的运行时事件和状态翻译为结构化输出 (JSON) 或友好的终端日志输出;对长耗时命令补轻量进度提示。
16
16
  - **调试期工具内聚**:承接调试期必要工具(如 token bootstrap、二维码与媒体预处理)的产品化入口,避免把调试流程散落在 runtime 或外部手工步骤中。
17
17
  - **本地 token 工具**:提供直接签发 token、打印组合 JSON、单独 token 与本地二维码 PNG 路径的公开 CLI 能力,服务本地联调与体验验证。
18
18
 
@@ -52,3 +52,10 @@
52
52
  - 本地测试配置文件路径:`devtools/cli/tests/.local/runtime-backed.e2e.local.json`(必需,已在 `.gitignore` 忽略)。
53
53
  - 示例模板:`devtools/cli/tests/runtime-backed.e2e.config.example.json`。
54
54
  - CLI server-only 正式 E2E 现在直接读取 `mp4Path`,由 `service start` 内部自动 prepare;不再要求先手工 prepare 再维护 `assetsDir`。
55
+
56
+ ## Command Loop E2E Harness
57
+
58
+ - 长驻人工验收脚本:`devtools/cli/script/command_loop_e2e.sh`
59
+ - 示例配置:`devtools/cli/config/command_loop_e2e.example.toml`
60
+ - 本地配置路径:`devtools/cli/config/.local/command_loop_e2e.local.toml`(已在 `.gitignore` 忽略)
61
+ - 该脚本会先打包最新 `runtime + app-server + cli`,再清场、`service start`、周期性发送 `stream message` / time command,并轮询 `command pending list` 后自动做 CLI 侧显式 reply;启动成功后保持常驻,等待人工去操作 Android example。
package/USAGE.md CHANGED
@@ -83,12 +83,15 @@ Commands:
83
83
  list 查看流快照列表
84
84
  send 发送流:绑定 prepared local assets 并发起上行
85
85
  receive 接收流:声明并接收下行
86
- message <send> <streamId> <payload> 发送 UTF-8 字符串型 stream message
86
+ message 发送 stream message
87
87
 
88
88
  $ node ... command --help
89
89
  Commands:
90
- send <commandId> <kind> <payloadEncoding> <payload> 发送字符串型命令并等待响应
91
- tail 持续监听命令相关事件
90
+ request [options] <commandId> <payloadEncoding> <payload> 发送命令请求并等待响应
91
+ send [options] <commandId> <payloadEncoding> <payload> 兼容别名:等价于 command request
92
+ pending 查看当前会话内待回复的远端命令请求
93
+ reply <remoteRequestId> <commandId> <payloadEncoding> <payload> 按 remoteRequestId 显式回复待处理命令
94
+ tail 持续监听命令相关事件
92
95
 
93
96
  $ node ... token issue --help
94
97
  Options:
@@ -130,8 +133,8 @@ server-only 正式路径只认 `[server] + [logging]`:
130
133
  service_entry = ""
131
134
  license = "runtime-license"
132
135
  mp4_path = "/Users/allenfeng/Development/Repositories/tirtc-nexus/tirtc-matrix/.refers/simple.mp4"
133
- video_stream_id = 10
134
- audio_stream_id = 11
136
+ video_stream_id = 11
137
+ audio_stream_id = 10
135
138
 
136
139
  [logging]
137
140
  root_dir = "./.tmp/tirtc-devtools-cli/logging"
@@ -159,6 +162,8 @@ node devtools/cli/bin/tirtc-devtools-cli.js --config ./server.toml --json servic
159
162
  4. 自动调用两次 `stream/sendStart`:一次音频、一次视频。
160
163
  5. 返回 `autoApplied` 摘要:`preparedAssetsDir`、固定 `mediaSendPolicy=AUTO_ON_CONNECTED`、以及音视频 sendStart 结果。
161
164
 
165
+ 非 `--json` 模式下,CLI 会在 `stderr` 输出轻量进度提示:先显示 MP4 prepare,再显示 service start,避免长时间静默。
166
+
162
167
  ### 3. 自动发送语义
163
168
 
164
169
  - App Server server 角色固定使用 `AUTO_ON_CONNECTED`。
@@ -201,10 +206,13 @@ CLI 仍会在本地收紧最小组合矩阵:
201
206
 
202
207
  ### Command
203
208
 
204
- - `command send <commandId> <kind> <payloadEncoding> <payload>`
209
+ - `command request <commandId> <payloadEncoding> <payload> [--timeout-ms <ms>]`
210
+ - `command send <commandId> <payloadEncoding> <payload> [--timeout-ms <ms>]`
211
+ - `command pending list`
212
+ - `command reply <remoteRequestId> <commandId> <payloadEncoding> <payload>`
205
213
  - `command tail`
206
214
 
207
- `command send` 是统一的主动发送 surface。`send-json` 不再属于正式产品合同;如果要发 JSON,请把 JSON 文本作为 `payload` 传入。
215
+ `command request` canonical 主语,`command send` 只保留为兼容别名。若要发 JSON,请把 JSON 文本作为 `payload` 传入。`command pending list` 用于恢复或轮询当前积压,`command reply` 基于 `remoteRequestId` 显式回复待处理请求。
208
216
 
209
217
  ## 九、token / debug / report
210
218
 
@@ -219,3 +227,33 @@ CLI 仍会在本地收紧最小组合矩阵:
219
227
  - CLI server/client E2E 本地配置文件:`devtools/cli/tests/.local/runtime-backed.e2e.local.json`
220
228
  - 推荐字段:`mp4Path`、`serviceEntry`、`license`、`peerId`、`accessId`、`secretKey`、可选 `e2eToken`
221
229
  - CLI server-only E2E 不再要求先手工 `media assets prepare` 再回填 `assetsDir`
230
+
231
+ ## 十一、Android 人工闭环脚本
232
+
233
+ 如果需要把 CLI 侧闭环常驻起来,再手工去操作 Android example,使用:
234
+
235
+ ```bash
236
+ ./devtools/cli/script/command_loop_e2e.sh
237
+ ```
238
+
239
+ 默认读取:`devtools/cli/config/.local/command_loop_e2e.local.toml`
240
+
241
+ 建议先从模板复制:
242
+
243
+ ```bash
244
+ mkdir -p devtools/cli/config/.local
245
+ cp devtools/cli/config/command_loop_e2e.example.toml devtools/cli/config/.local/command_loop_e2e.local.toml
246
+ ```
247
+
248
+ 该脚本会:
249
+
250
+ - 打包最新 `runtime + app-server + cli`
251
+ - 杀掉其他同类 `command_loop_e2e.sh` 进程
252
+ - `host stop --all`
253
+ - `service start`
254
+ - 可选生成 bootstrap 二维码
255
+ - 每 `15s` 执行一次 `stream message send`
256
+ - 每 `10s` 执行一次时间命令 `command request 7953 utf8 "time?"`
257
+ - 轮询 `command pending list` 并对每个 pending request 执行 `command reply`
258
+
259
+ 脚本不会替代 Android 端人工操作;它的职责是把 CLI 侧和 Host 侧闭环保持住,并把日志与产物沉到自己的 workspace。
@@ -37,8 +37,8 @@ function renderTomlConfigTemplate() {
37
37
  '# server-only service start 时必填',
38
38
  'license = ""',
39
39
  'mp4_path = "./source.mp4"',
40
- 'video_stream_id = 10',
41
- 'audio_stream_id = 11',
40
+ 'video_stream_id = 11',
41
+ 'audio_stream_id = 10',
42
42
  '',
43
43
  '[connection]',
44
44
  '# 作为客户端 connection connect 默认 service_entry(可留空)',
@@ -578,19 +578,35 @@ export declare const OutputAttachOptionsSchema: z.ZodEffects<z.ZodObject<{
578
578
  }>;
579
579
  export declare const CommandSendParamsSchema: z.ZodObject<{
580
580
  commandId: z.ZodString;
581
- kind: z.ZodString;
582
581
  payloadEncoding: z.ZodString;
583
582
  payload: z.ZodString;
583
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
584
584
  }, "strip", z.ZodTypeAny, {
585
585
  payload: string;
586
586
  commandId: string;
587
- kind: string;
588
587
  payloadEncoding: string;
588
+ timeoutMs?: number | undefined;
589
589
  }, {
590
590
  payload: string;
591
591
  commandId: string;
592
- kind: string;
593
592
  payloadEncoding: string;
593
+ timeoutMs?: number | undefined;
594
+ }>;
595
+ export declare const CommandReplyParamsSchema: z.ZodObject<{
596
+ remoteRequestId: z.ZodString;
597
+ commandId: z.ZodString;
598
+ payloadEncoding: z.ZodString;
599
+ payload: z.ZodString;
600
+ }, "strip", z.ZodTypeAny, {
601
+ payload: string;
602
+ commandId: string;
603
+ payloadEncoding: string;
604
+ remoteRequestId: string;
605
+ }, {
606
+ payload: string;
607
+ commandId: string;
608
+ payloadEncoding: string;
609
+ remoteRequestId: string;
594
610
  }>;
595
611
  export declare const ArtifactExportLogsParamsSchema: z.ZodObject<{
596
612
  outputPath: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ArtifactExportReportParamsSchema = exports.ArtifactExportLogsParamsSchema = exports.CommandSendParamsSchema = exports.OutputAttachOptionsSchema = exports.OutputAttachCliParamsSchema = exports.OutputAttachParamsSchema = exports.StreamMessageSendParamsSchema = exports.StreamReceiveStartParamsSchema = exports.StreamSendStartParamsSchema = exports.ConnectionConnectParamsSchema = exports.ServiceStartParamsSchema = exports.ErrorReasonCodeMapping = exports.CommandToHostMethodMapping = exports.CliJsonOutputSchema = exports.CliConfigSchema = void 0;
3
+ exports.ArtifactExportReportParamsSchema = exports.ArtifactExportLogsParamsSchema = exports.CommandReplyParamsSchema = exports.CommandSendParamsSchema = exports.OutputAttachOptionsSchema = exports.OutputAttachCliParamsSchema = exports.OutputAttachParamsSchema = exports.StreamMessageSendParamsSchema = exports.StreamReceiveStartParamsSchema = exports.StreamSendStartParamsSchema = exports.ConnectionConnectParamsSchema = exports.ServiceStartParamsSchema = exports.ErrorReasonCodeMapping = exports.CommandToHostMethodMapping = exports.CliJsonOutputSchema = exports.CliConfigSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.CliConfigSchema = zod_1.z.object({
6
6
  version: zod_1.z.number().int().optional(),
@@ -59,7 +59,10 @@ exports.CommandToHostMethodMapping = {
59
59
  'stream receive stop': 'stream/receiveStop',
60
60
  'output attach': 'output/attach',
61
61
  'output detach': 'output/detach',
62
- 'command send': 'command/send',
62
+ 'command request': 'command/request',
63
+ 'command send': 'command/request',
64
+ 'command pending list': 'command/pending/list',
65
+ 'command reply': 'command/reply',
63
66
  'command tail': 'events/subscribe',
64
67
  'events tail': 'events/subscribe',
65
68
  'logs export': 'artifact/exportLogs',
@@ -168,7 +171,13 @@ exports.OutputAttachOptionsSchema = zod_1.z.object({
168
171
  });
169
172
  exports.CommandSendParamsSchema = zod_1.z.object({
170
173
  commandId: zod_1.z.string(),
171
- kind: zod_1.z.string(),
174
+ payloadEncoding: zod_1.z.string(),
175
+ payload: zod_1.z.string(),
176
+ timeoutMs: zod_1.z.number().int().positive().optional(),
177
+ });
178
+ exports.CommandReplyParamsSchema = zod_1.z.object({
179
+ remoteRequestId: zod_1.z.string(),
180
+ commandId: zod_1.z.string(),
172
181
  payloadEncoding: zod_1.z.string(),
173
182
  payload: zod_1.z.string(),
174
183
  });
@@ -16,7 +16,7 @@ function printQuickstartGuide() {
16
16
  ' # 记下输出里的 sessionId,后续命令都显式带 --session',
17
17
  '',
18
18
  '步骤 2:CLI 会自动 prepare MP4 并绑定音视频 stream,不再需要手工 prepare assets_dir',
19
- ' [server] service_entry = "" license = "<LICENSE>" mp4_path = "./.refers/simple.mp4" video_stream_id = 10 audio_stream_id = 11',
19
+ ' [server] service_entry = "" license = "<LICENSE>" mp4_path = "./.refers/simple.mp4" video_stream_id = 11 audio_stream_id = 10',
20
20
  ' # service start 成功后会自动 prepare 并按 AUTO_ON_CONNECTED 进入待发流语义',
21
21
  '',
22
22
  '步骤 3:生成连接 bootstrap 二维码(给安卓扫码)',
@@ -14,7 +14,8 @@ const session_manager_1 = require("./session_manager");
14
14
  const media_assets_1 = require("./media_assets");
15
15
  const token_command_1 = require("./token_command");
16
16
  const transport_1 = require("./transport");
17
- const CLI_VERSION = '0.0.6';
17
+ const progress_1 = require("./progress");
18
+ const CLI_VERSION = '0.0.8';
18
19
  const HOST_VERSION = '1.0.0';
19
20
  const PROTOCOL_VERSION = '1.0.0';
20
21
  if (process.argv.includes('--version') || process.argv.includes('-V')) {
@@ -161,6 +162,12 @@ function validateServerConfig(config) {
161
162
  videoStreamId,
162
163
  };
163
164
  }
165
+ function createProgressIndicator(options) {
166
+ if (options.json) {
167
+ return undefined;
168
+ }
169
+ return new progress_1.ProgressIndicator();
170
+ }
164
171
  function resolvePrepareOutputRoot(config) {
165
172
  const loggingRoot = config.logging?.root_dir?.trim();
166
173
  if (loggingRoot && loggingRoot.length > 0) {
@@ -168,12 +175,14 @@ function resolvePrepareOutputRoot(config) {
168
175
  }
169
176
  return path_1.default.resolve(process.cwd(), '.tmp', 'tirtc-devtools-cli', 'prepared-assets');
170
177
  }
171
- async function applyConfiguredServerBootstrap(client, config) {
178
+ async function applyConfiguredServerBootstrap(client, config, progress) {
172
179
  const server = validateServerConfig(config);
180
+ progress?.start('Preparing MP4 assets');
173
181
  const prepared = await (0, media_assets_1.prepareMediaAssets)({
174
182
  source: server.mp4Path,
175
183
  outputRoot: resolvePrepareOutputRoot(config),
176
184
  });
185
+ progress?.update('Prepared MP4 assets');
177
186
  const bootstrapSendStreams = [
178
187
  { streamId: server.audioStreamId, media: 'audio' },
179
188
  { streamId: server.videoStreamId, media: 'video' },
@@ -207,20 +216,29 @@ async function runCommand(cmdName, params, options) {
207
216
  }
208
217
  let resultForPrint;
209
218
  if (cmdName === 'service start') {
210
- const autoApplied = await applyConfiguredServerBootstrap(client, config);
211
- const requestParams = {
212
- ...params,
213
- bootstrapSendStreams: autoApplied.bootstrapSendStreams,
214
- };
215
- const result = await client.sendRequest(method, requestParams, 180_000);
216
- const resultObject = toResultObject(result);
217
- resultForPrint = {
218
- ...resultObject,
219
- autoApplied,
220
- };
221
- printSuccess(options, resultForPrint, session, cmdName);
222
- transport.stop();
223
- return 0;
219
+ const progress = createProgressIndicator(options);
220
+ try {
221
+ const autoApplied = await applyConfiguredServerBootstrap(client, config, progress);
222
+ progress?.update('Starting service session');
223
+ const requestParams = {
224
+ ...params,
225
+ bootstrapSendStreams: autoApplied.bootstrapSendStreams,
226
+ };
227
+ const result = await client.sendRequest(method, requestParams, 180_000);
228
+ progress?.succeed('Service session is ready');
229
+ const resultObject = toResultObject(result);
230
+ resultForPrint = {
231
+ ...resultObject,
232
+ autoApplied,
233
+ };
234
+ printSuccess(options, resultForPrint, session, cmdName);
235
+ transport.stop();
236
+ return 0;
237
+ }
238
+ catch (error) {
239
+ progress?.fail('Service start failed');
240
+ throw error;
241
+ }
224
242
  }
225
243
  const result = await client.sendRequest(method, params);
226
244
  resultForPrint = result;
@@ -570,7 +588,8 @@ streamReceive.command('stop <streamId>')
570
588
  .action((streamId) => {
571
589
  runAndExit(runCommand('stream receive stop', { streamId: Number.parseInt(streamId, 10) }, getCliOptions()));
572
590
  });
573
- stream.command('message send <streamId> <payload>')
591
+ const streamMessage = stream.command('message').description('发送 stream message');
592
+ streamMessage.command('send <streamId> <payload>')
574
593
  .description('发送 UTF-8 字符串型 stream message')
575
594
  .action((streamId, payload) => {
576
595
  runAndExit(runCommand('stream message send', { streamId: Number.parseInt(streamId, 10), payload }, getCliOptions()));
@@ -606,16 +625,42 @@ output.command('detach <outputId>').description('卸载输出消费者').action(
606
625
  runAndExit(runCommand('output detach', { outputId }, getCliOptions()));
607
626
  });
608
627
  const command = program.command('command').description('命令通道:发送命令与事件跟踪');
609
- command.command('send <commandId> <kind> <payloadEncoding> <payload>')
610
- .description('发送字符串型命令并等待响应')
611
- .action((commandId, kind, payloadEncoding, payload) => {
628
+ command.command('request <commandId> <payloadEncoding> <payload>')
629
+ .description('发送命令请求并等待响应')
630
+ .option('--timeout-ms <ms>', '请求超时(毫秒)', '5000')
631
+ .action((commandId, payloadEncoding, payload, commandOptions) => {
632
+ runAndExit(runCommand('command request', {
633
+ commandId: Number.parseInt(commandId, 10),
634
+ payloadEncoding,
635
+ payload,
636
+ timeoutMs: Number.parseInt(commandOptions.timeoutMs, 10),
637
+ }, getCliOptions()));
638
+ });
639
+ command.command('send <commandId> <payloadEncoding> <payload>')
640
+ .description('兼容别名:等价于 command request')
641
+ .option('--timeout-ms <ms>', '请求超时(毫秒)', '5000')
642
+ .action((commandId, payloadEncoding, payload, commandOptions) => {
612
643
  runAndExit(runCommand('command send', {
613
644
  commandId: Number.parseInt(commandId, 10),
614
- kind,
615
645
  payloadEncoding,
616
646
  payload,
617
- awaitResponse: true,
618
- timeoutMs: 5000,
647
+ timeoutMs: Number.parseInt(commandOptions.timeoutMs, 10),
648
+ }, getCliOptions()));
649
+ });
650
+ const commandPending = command.command('pending').description('查看当前会话内待回复的远端命令请求');
651
+ commandPending.command('list')
652
+ .description('列出当前待回复的远端命令请求')
653
+ .action(() => {
654
+ runAndExit(runCommand('command pending list', {}, getCliOptions()));
655
+ });
656
+ command.command('reply <remoteRequestId> <commandId> <payloadEncoding> <payload>')
657
+ .description('按 remoteRequestId 显式回复待处理命令')
658
+ .action((remoteRequestId, commandId, payloadEncoding, payload) => {
659
+ runAndExit(runCommand('command reply', {
660
+ remoteRequestId: Number.parseInt(remoteRequestId, 10),
661
+ commandId: Number.parseInt(commandId, 10),
662
+ payloadEncoding,
663
+ payload,
619
664
  }, getCliOptions()));
620
665
  });
621
666
  command.command('tail').description('持续监听命令相关事件').action(() => {
@@ -0,0 +1,19 @@
1
+ export declare const SPINNER_INTERVAL_MS = 120;
2
+ type ProgressStream = {
3
+ isTTY?: boolean;
4
+ write(chunk: string): boolean;
5
+ };
6
+ export declare class ProgressIndicator {
7
+ private readonly stream;
8
+ private timer;
9
+ private frameIndex;
10
+ private activeMessage;
11
+ constructor(stream?: ProgressStream);
12
+ start(message: string): void;
13
+ update(message: string): void;
14
+ succeed(message: string): void;
15
+ fail(message: string): void;
16
+ private render;
17
+ private finish;
18
+ }
19
+ export {};
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProgressIndicator = exports.SPINNER_INTERVAL_MS = void 0;
4
+ const SPINNER_FRAMES = ['|', '/', '-', '\\'];
5
+ exports.SPINNER_INTERVAL_MS = 120;
6
+ function clearLine(text) {
7
+ return `\r\u001b[2K${text}`;
8
+ }
9
+ class ProgressIndicator {
10
+ stream;
11
+ timer;
12
+ frameIndex = 0;
13
+ activeMessage;
14
+ constructor(stream = process.stderr) {
15
+ this.stream = stream;
16
+ }
17
+ start(message) {
18
+ this.activeMessage = message;
19
+ if (this.stream.isTTY) {
20
+ if (this.timer === undefined) {
21
+ this.render();
22
+ this.timer = setInterval(() => {
23
+ this.render();
24
+ }, exports.SPINNER_INTERVAL_MS);
25
+ return;
26
+ }
27
+ this.render();
28
+ return;
29
+ }
30
+ this.stream.write(`${message}...\n`);
31
+ }
32
+ update(message) {
33
+ this.start(message);
34
+ }
35
+ succeed(message) {
36
+ this.finish('OK', message);
37
+ }
38
+ fail(message) {
39
+ this.finish('FAIL', message);
40
+ }
41
+ render() {
42
+ if (this.activeMessage === undefined) {
43
+ return;
44
+ }
45
+ const frame = SPINNER_FRAMES[this.frameIndex % SPINNER_FRAMES.length];
46
+ this.frameIndex += 1;
47
+ this.stream.write(clearLine(`${frame} ${this.activeMessage}...`));
48
+ }
49
+ finish(tag, message) {
50
+ if (this.timer !== undefined) {
51
+ clearInterval(this.timer);
52
+ this.timer = undefined;
53
+ }
54
+ if (this.stream.isTTY) {
55
+ this.stream.write(`${clearLine(`[${tag}] ${message}`)}\n`);
56
+ }
57
+ else {
58
+ this.stream.write(`[${tag}] ${message}\n`);
59
+ }
60
+ this.activeMessage = undefined;
61
+ }
62
+ }
63
+ exports.ProgressIndicator = ProgressIndicator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tirtc-devtools-cli",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -21,6 +21,7 @@ typedef enum TirtcError {
21
21
  TIRTC_ERROR_TRANSPORT_CONNECTION_TIMEOUT_CLOSED = 12,
22
22
  TIRTC_ERROR_TRANSPORT_REMOTE_CLOSED = 13,
23
23
  TIRTC_ERROR_TRANSPORT_CONNECTION_OTHER_ERROR = 14,
24
+ TIRTC_ERROR_TRANSPORT_TOKEN_EXPIRED = 15,
24
25
  } TirtcError;
25
26
 
26
27
  #ifdef __cplusplus
@@ -36,6 +36,8 @@ typedef enum TirtcTransportStatus {
36
36
  TIRTC_TRANSPORT_STATUS_BACKEND_REMOTE_CLOSED = 10,
37
37
  /** Backend reported other connection error. */
38
38
  TIRTC_TRANSPORT_STATUS_BACKEND_CONNECTION_OTHER_ERROR = 11,
39
+ /** Backend reported token expired. */
40
+ TIRTC_TRANSPORT_STATUS_BACKEND_TOKEN_EXPIRED = 12,
39
41
  } TirtcTransportStatus;
40
42
 
41
43
  /**
@@ -1,5 +1,5 @@
1
1
  platform=macos-arm64
2
- staged_at_utc=2026-04-09T14:57:31Z
2
+ staged_at_utc=2026-04-10T04:27:48Z
3
3
  source_sdk=/Users/allenfeng/Development/Repositories/tirtc-nexus/tirtc-matrix/.build/sdk/macos-arm64
4
4
 
5
5
  dcca0b7ab8055d84e5bcfab7f1dde56df9037c40ddb99e9ca924ef2e867d8309 include/tirtc/audio.h
@@ -14,7 +14,7 @@ c2e1f31dcc75be461c577d18b1cebe32774f212d51cb4dd2a5b5a9bfe62b693e include/tirtc/
14
14
  0ca7c3c630b1242f51a0fd8154097c0a332b4c816a5707090e4381719852998c include/tirtc/audio_sample_rate.h
15
15
  59b7df33fdc2ad92b3142299ffab832443179ef895784ad51a2f6544c5b02766 include/tirtc/av.h
16
16
  4198c95c48ae579d1c782635b00fa5c9009d0c56ba466e6e3873e8298faae029 include/tirtc/credential.h
17
- 92da1614c1cbc22d5ba7c1aefd3bbfba88be4a698d1b9990f470fe959ddd84ba include/tirtc/error.h
17
+ 78625b8d9f1f29bf2f35a89a8ad8a3f68f3f6ff75455d4682f5514c6c0ad7738 include/tirtc/error.h
18
18
  ae805545a9515edc9b94262e72ad2c7b7d649288166f4daeb450d8a55e82ae0b include/tirtc/foundation/build_info.h
19
19
  7cf8b372a3d48d4de4a65a04c7f102281a7b42cebb9ec247853d3c53afb63b6a include/tirtc/http.h
20
20
  70bbf93b84d9d1a85f376d9986de570c1f658319e1e5ab6d621f7a4d41033f5c include/tirtc/logging.h
@@ -24,7 +24,7 @@ ae805545a9515edc9b94262e72ad2c7b7d649288166f4daeb450d8a55e82ae0b include/tirtc/
24
24
  037d9a581cef71afe9233456b1f4ef866c3739150532f3c30a67d361e8af9eef include/tirtc/media_fixture_source.h
25
25
  a4f8ab44c1a20ad37f250363a403a9d4d007e61ddb2426c7966dbc05f6a04b4f include/tirtc/media_live_source.h
26
26
  1b3be6954e547f91a047866438bff1820c8406afaf91cef68ddee29a6ac70234 include/tirtc/media_uplink.h
27
- 1e12daf9c5fc2e2f848444688081c9be0cb738245f0155327e8003b49308058f include/tirtc/transport.h
27
+ 97ab19361d22a723af589ebae8bb08b5a7ccd8ca3aff0b85aa9ffd577252b6fc include/tirtc/transport.h
28
28
  137729c534213cb161c0853a8d4d38fcdc397c41a7fd8c813fbe0e80083ec931 include/tirtc/trp.h
29
29
  dff5b0a0ac4a40ad17c93e1e56b3c416371c81ab365e287ea8cd6ce37ccbed3b include/tirtc/video_codec.h
30
30
  e51379666c199588cc33279ccf52248035d1cae3d1d468b1615ebf29f0b39c9c include/tirtc/video_frame.h
@@ -36,14 +36,14 @@ cae0bbeb884e5466a56da15182c78cc22baab6c743f349a58d3595f623333585 include/tirtc/
36
36
  8cd6b66bea14890a665cc317f8572429b2c3e4463773f8b77c1e4dc30a4a8747 include/tirtc/video_processing.h
37
37
  b39daee6a3d39bf0ca20c45084601133c4198de8dca848dcff6dd9c70ae99016 lib/libcrypto.a
38
38
  c052857ef315e3d61db9c862cad10709a3a6b2487dc41799cbe4d74a805de875 lib/libcrypto.dylib
39
- 240fb613f79b39ce4ed74ebd2e56c714141a0ef858f106e1121c7d540cea7e64 lib/libmatrix_runtime_audio.a
40
- e1070b1e7b262ad8a8e1dbec1ac9d524fbf4a7fdcc855bb84f69bdd13f31ae9d lib/libmatrix_runtime_credential.a
41
- 7081b1021d32939a1cbf399bbfa2b4f72a74e7eb48f111f34c80450f8d8a4bfe lib/libmatrix_runtime_facade.a
42
- d268be4f9309c1af33f7734a692e0bf89402c96a6fe689f6d7df691d5563b391 lib/libmatrix_runtime_foundation_http.a
43
- d7c51d52995b0c1be194fafb3d922b98f8c87eccbfb3a240bad1d4b7b27de1b2 lib/libmatrix_runtime_foundation_logging.a
44
- 37332652b4cb75f1d6a0a3a7209013d05ec55874b5103b89fd37ecd3b4601702 lib/libmatrix_runtime_media.a
45
- e0ed1c103c4e2392c423aacdbf314bf13848281318c6f57496136756664c4275 lib/libmatrix_runtime_transport.a
46
- f00064a09bc2c03963518e05c659becc0a24e2ec6b696ce13ca03fa1ec576f22 lib/libmatrix_runtime_video.a
39
+ 17545a8539f86995500b7fcaee3d1f1e5684e8f11e6094558aee46c6a9cc74a8 lib/libmatrix_runtime_audio.a
40
+ bf00c3fcccbfc29696a2ee4ff6ff55e510672a2337af6c975c83d295a970a85f lib/libmatrix_runtime_credential.a
41
+ 33ce400a5dfd7a234a4391bc5dd531a9a0401f6d27252246898797d8d0dcf4ed lib/libmatrix_runtime_facade.a
42
+ 525c15bd4e23642c1e9939b8114828ec47d7381fb6cf30cb9c66be3181b9c70c lib/libmatrix_runtime_foundation_http.a
43
+ d7cf5cd5723bbfcd3bef9191570870413303b0b67c8644c9a5bf30e194fdd487 lib/libmatrix_runtime_foundation_logging.a
44
+ fefdbe0acc0dc73dd0b48fb0cd927875c5e43674e163c7ba33f57e59d2f0b178 lib/libmatrix_runtime_media.a
45
+ 9361b2a4784b3068a8796033fa36f1969297bbcd4ae59f96da1725e0a27fb481 lib/libmatrix_runtime_transport.a
46
+ 7e6f54cf23ad2a59f08e274e63fc25ae74f9f9b687dff08f73091789d647a94c lib/libmatrix_runtime_video.a
47
47
  c11c65d373a127028350c41fa58cd2d1223f2b5d70a84e13b115d90daaba25ca lib/libssl.a
48
48
  ef1c1104bbdd2528ed7b958fb7252bd6249875f92300b0c9577d6c4bd6c0d88a lib/libssl.dylib
49
49
  dc3e0e6ded26e90fd59c166933a5289d57f4cf25fbe6246b6b83c86fe898e63d lib/libwebrtc_apm.a
@@ -36,6 +36,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ArtifactManager = void 0;
37
37
  const fs = __importStar(require("fs"));
38
38
  const path = __importStar(require("path"));
39
+ function toJsonLine(value) {
40
+ return JSON.stringify(value, (_key, current) => {
41
+ if (typeof current === 'bigint') {
42
+ const normalized = Number(current);
43
+ return Number.isSafeInteger(normalized) ? normalized : current.toString();
44
+ }
45
+ return current;
46
+ });
47
+ }
39
48
  class ArtifactManager {
40
49
  paths;
41
50
  constructor(basePath) {
@@ -74,10 +83,16 @@ class ArtifactManager {
74
83
  fs.appendFileSync(this.getHostLogPath(), line);
75
84
  }
76
85
  writeReport(report) {
77
- fs.writeFileSync(this.paths.reportPath, JSON.stringify(report, null, 2));
86
+ fs.writeFileSync(this.paths.reportPath, JSON.stringify(report, (_key, current) => {
87
+ if (typeof current === 'bigint') {
88
+ const normalized = Number(current);
89
+ return Number.isSafeInteger(normalized) ? normalized : current.toString();
90
+ }
91
+ return current;
92
+ }, 2));
78
93
  }
79
94
  writeEvent(event) {
80
- fs.appendFileSync(this.paths.eventsPath, `${JSON.stringify(event)}\n`);
95
+ fs.appendFileSync(this.paths.eventsPath, `${toJsonLine(event)}\n`);
81
96
  }
82
97
  }
83
98
  exports.ArtifactManager = ArtifactManager;
@@ -70,13 +70,16 @@ export type OutputDetachParams = {
70
70
  };
71
71
  export type CommandSendParams = {
72
72
  commandId: number;
73
- kind: string;
74
73
  payloadEncoding: string;
75
74
  payload: string;
76
- replyToSequenceNumber?: number;
77
- awaitResponse?: boolean;
78
75
  timeoutMs?: number;
79
76
  };
77
+ export type CommandReplyParams = {
78
+ remoteRequestId: number;
79
+ commandId: number;
80
+ payloadEncoding: string;
81
+ payload: string;
82
+ };
80
83
  export type EventsSubscribeParams = {
81
84
  families?: string[];
82
85
  };
@@ -103,6 +106,7 @@ export declare function parseStreamReceiveStartParams(params: Record<string, unk
103
106
  export declare function parseOutputAttachParams(params: Record<string, unknown>): OutputAttachParams;
104
107
  export declare function parseOutputDetachParams(params: Record<string, unknown>): OutputDetachParams;
105
108
  export declare function parseCommandSendParams(params: Record<string, unknown>): CommandSendParams;
109
+ export declare function parseCommandReplyParams(params: Record<string, unknown>): CommandReplyParams;
106
110
  export declare function parseEventsSubscribeParams(params: Record<string, unknown>): EventsSubscribeParams;
107
111
  export declare function parseArtifactExportParams(params: Record<string, unknown>): ArtifactExportParams;
108
112
  export declare function parseDebugTokenQrcodeParams(params: Record<string, unknown>): DebugTokenQrcodeParams;
@@ -12,6 +12,7 @@ exports.parseStreamReceiveStartParams = parseStreamReceiveStartParams;
12
12
  exports.parseOutputAttachParams = parseOutputAttachParams;
13
13
  exports.parseOutputDetachParams = parseOutputDetachParams;
14
14
  exports.parseCommandSendParams = parseCommandSendParams;
15
+ exports.parseCommandReplyParams = parseCommandReplyParams;
15
16
  exports.parseEventsSubscribeParams = parseEventsSubscribeParams;
16
17
  exports.parseArtifactExportParams = parseArtifactExportParams;
17
18
  exports.parseDebugTokenQrcodeParams = parseDebugTokenQrcodeParams;
@@ -227,14 +228,19 @@ function parseOutputDetachParams(params) {
227
228
  function parseCommandSendParams(params) {
228
229
  return {
229
230
  commandId: getNumber(params, 'commandId'),
230
- kind: getString(params, 'kind'),
231
231
  payloadEncoding: getString(params, 'payloadEncoding'),
232
232
  payload: getString(params, 'payload'),
233
- replyToSequenceNumber: getOptionalNumber(params, 'replyToSequenceNumber'),
234
- awaitResponse: getOptionalBoolean(params, 'awaitResponse'),
235
233
  timeoutMs: getOptionalNumber(params, 'timeoutMs'),
236
234
  };
237
235
  }
236
+ function parseCommandReplyParams(params) {
237
+ return {
238
+ remoteRequestId: getNumber(params, 'remoteRequestId'),
239
+ commandId: getNumber(params, 'commandId'),
240
+ payloadEncoding: getString(params, 'payloadEncoding'),
241
+ payload: getString(params, 'payload'),
242
+ };
243
+ }
238
244
  function parseEventsSubscribeParams(params) {
239
245
  const families = params.families;
240
246
  if (families === undefined) {
@@ -18,7 +18,11 @@ export declare class HostServer {
18
18
  removeEventSink(sink: (event: Record<string, unknown>) => void): void;
19
19
  appendHostLog(line: string): void;
20
20
  private handleRuntimeEvent;
21
+ private snapshotPendingConnectionSummary;
22
+ private handleInboundRemoteCommandRequest;
23
+ private clearPendingRemoteCommands;
21
24
  private noteIncomingConnection;
25
+ private handleIncomingConnectionDisconnected;
22
26
  private maybeAutoStartStreamFromRemoteDemand;
23
27
  private dispatch;
24
28
  private handleInitialize;
@@ -41,6 +45,8 @@ export declare class HostServer {
41
45
  private handleOutputAttach;
42
46
  private handleOutputDetach;
43
47
  private handleCommandSend;
48
+ private handleCommandReply;
49
+ private handleCommandPendingList;
44
50
  private handleEventsSubscribe;
45
51
  private handleArtifactReadReport;
46
52
  private handleArtifactExportLogs;