tirtc-devtools-cli 0.0.1

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 (156) hide show
  1. package/README.md +52 -0
  2. package/USAGE.md +417 -0
  3. package/bin/tirtc-devtool.js +2 -0
  4. package/dist/app-server/protocol-client/index.d.ts +25 -0
  5. package/dist/app-server/protocol-client/index.js +114 -0
  6. package/dist/devtools/cli/src/config.d.ts +46 -0
  7. package/dist/devtools/cli/src/config.js +98 -0
  8. package/dist/devtools/cli/src/dummy.d.ts +0 -0
  9. package/dist/devtools/cli/src/dummy.js +1 -0
  10. package/dist/devtools/cli/src/embedded_paths.d.ts +7 -0
  11. package/dist/devtools/cli/src/embedded_paths.js +85 -0
  12. package/dist/devtools/cli/src/facade.d.ts +723 -0
  13. package/dist/devtools/cli/src/facade.js +194 -0
  14. package/dist/devtools/cli/src/ffmpeg_tool.d.ts +6 -0
  15. package/dist/devtools/cli/src/ffmpeg_tool.js +146 -0
  16. package/dist/devtools/cli/src/guide.d.ts +1 -0
  17. package/dist/devtools/cli/src/guide.js +49 -0
  18. package/dist/devtools/cli/src/index.d.ts +1 -0
  19. package/dist/devtools/cli/src/index.js +753 -0
  20. package/dist/devtools/cli/src/media_assets.d.ts +25 -0
  21. package/dist/devtools/cli/src/media_assets.js +121 -0
  22. package/dist/devtools/cli/src/session_manager.d.ts +25 -0
  23. package/dist/devtools/cli/src/session_manager.js +393 -0
  24. package/dist/devtools/cli/src/token_tool.d.ts +33 -0
  25. package/dist/devtools/cli/src/token_tool.js +217 -0
  26. package/dist/devtools/cli/src/transport.d.ts +30 -0
  27. package/dist/devtools/cli/src/transport.js +84 -0
  28. package/dist/dummy.d.ts +0 -0
  29. package/dist/dummy.js +1 -0
  30. package/dist/index.d.ts +1 -0
  31. package/dist/index.js +48 -0
  32. package/package.json +54 -0
  33. package/script/ensure_ffmpeg.sh +22 -0
  34. package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
  35. package/vendor/app-server/bin/native/macos-arm64/libcrypto.dylib +0 -0
  36. package/vendor/app-server/bin/native/macos-arm64/libssl.dylib +0 -0
  37. package/vendor/app-server/bin/native/macos-arm64/libtgrtc.dylib +0 -0
  38. package/vendor/app-server/bin/native/macos-arm64/runtime_host_napi.node +0 -0
  39. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_codec.h +23 -0
  40. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_frame.h +36 -0
  41. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io.h +56 -0
  42. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_android.h +19 -0
  43. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_apple.h +19 -0
  44. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_harmony.h +19 -0
  45. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_windows.h +19 -0
  46. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_processing.h +56 -0
  47. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_sample_rate.h +18 -0
  48. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/error.h +20 -0
  49. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/logging.h +53 -0
  50. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_codec.h +21 -0
  51. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_downlink.h +89 -0
  52. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_uplink.h +115 -0
  53. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/runtime.h +236 -0
  54. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_codec.h +57 -0
  55. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_frame.h +55 -0
  56. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io.h +46 -0
  57. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_android.h +32 -0
  58. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_apple.h +34 -0
  59. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_harmony.h +32 -0
  60. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_windows.h +26 -0
  61. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_processing.h +34 -0
  62. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_audio.a +0 -0
  63. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_facade.a +0 -0
  64. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  65. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_media.a +0 -0
  66. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_video.a +0 -0
  67. package/vendor/app-server/bin/runtime/linux-x64/lib/libwebrtc_apm.a +0 -0
  68. package/vendor/app-server/bin/runtime/linux-x64/lib/libxlog.a +0 -0
  69. package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +34 -0
  70. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio.h +398 -0
  71. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_codec.h +23 -0
  72. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_frame.h +36 -0
  73. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_io.h +56 -0
  74. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_io_android.h +19 -0
  75. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_io_apple.h +19 -0
  76. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_io_harmony.h +19 -0
  77. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_io_windows.h +19 -0
  78. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_processing.h +56 -0
  79. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio_sample_rate.h +18 -0
  80. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/av.h +452 -0
  81. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/credential.h +34 -0
  82. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +30 -0
  83. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/foundation/build_info.h +27 -0
  84. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/http.h +57 -0
  85. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/logging.h +55 -0
  86. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_codec.h +21 -0
  87. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_downlink.h +95 -0
  88. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_av_sync.h +61 -0
  89. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_source.h +77 -0
  90. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_live_source.h +71 -0
  91. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_uplink.h +116 -0
  92. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/transport.h +481 -0
  93. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/trp.h +541 -0
  94. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_codec.h +58 -0
  95. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_frame.h +55 -0
  96. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_io.h +46 -0
  97. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_io_android.h +32 -0
  98. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_io_apple.h +47 -0
  99. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_io_harmony.h +32 -0
  100. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_io_windows.h +26 -0
  101. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/video_processing.h +34 -0
  102. package/vendor/app-server/bin/runtime/macos-arm64/lib/libcrypto.a +0 -0
  103. package/vendor/app-server/bin/runtime/macos-arm64/lib/libcrypto.dylib +0 -0
  104. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
  105. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
  106. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  107. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
  108. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  109. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  110. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  111. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  112. package/vendor/app-server/bin/runtime/macos-arm64/lib/libssl.a +0 -0
  113. package/vendor/app-server/bin/runtime/macos-arm64/lib/libssl.dylib +0 -0
  114. package/vendor/app-server/bin/runtime/macos-arm64/lib/libwebrtc_apm.a +0 -0
  115. package/vendor/app-server/bin/runtime/macos-arm64/lib/libxlog.a +0 -0
  116. package/vendor/app-server/bin/runtime/macos-arm64/manifest.txt +50 -0
  117. package/vendor/app-server/bin/tirtc-devtool-host.js +2 -0
  118. package/vendor/app-server/dist/host/ArtifactManager.d.ts +18 -0
  119. package/vendor/app-server/dist/host/ArtifactManager.js +83 -0
  120. package/vendor/app-server/dist/host/HostProtocol.d.ts +107 -0
  121. package/vendor/app-server/dist/host/HostProtocol.js +256 -0
  122. package/vendor/app-server/dist/host/HostServer.d.ts +49 -0
  123. package/vendor/app-server/dist/host/HostServer.js +635 -0
  124. package/vendor/app-server/dist/host/HostState.d.ts +60 -0
  125. package/vendor/app-server/dist/host/HostState.js +19 -0
  126. package/vendor/app-server/dist/host/RuntimeAdapter.d.ts +81 -0
  127. package/vendor/app-server/dist/host/RuntimeAdapter.js +559 -0
  128. package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.d.ts +30 -0
  129. package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.js +224 -0
  130. package/vendor/app-server/dist/host/RuntimeReceiveWorker.d.ts +37 -0
  131. package/vendor/app-server/dist/host/RuntimeReceiveWorker.js +186 -0
  132. package/vendor/app-server/dist/host/RuntimeSendWorker.d.ts +42 -0
  133. package/vendor/app-server/dist/host/RuntimeSendWorker.js +274 -0
  134. package/vendor/app-server/dist/host/TokenTool.d.ts +15 -0
  135. package/vendor/app-server/dist/host/TokenTool.js +84 -0
  136. package/vendor/app-server/dist/host/WebPreviewGateway.d.ts +28 -0
  137. package/vendor/app-server/dist/host/WebPreviewGateway.js +815 -0
  138. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.d.ts +26 -0
  139. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +118 -0
  140. package/vendor/app-server/dist/host/native/RuntimeHostBridge.d.ts +19 -0
  141. package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +141 -0
  142. package/vendor/app-server/dist/host/runtime_backed_preflight.d.ts +10 -0
  143. package/vendor/app-server/dist/host/runtime_backed_preflight.js +78 -0
  144. package/vendor/app-server/dist/host/tests/helpers/host_socket_client.d.ts +28 -0
  145. package/vendor/app-server/dist/host/tests/helpers/host_socket_client.js +85 -0
  146. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.d.ts +10 -0
  147. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +41 -0
  148. package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.d.ts +11 -0
  149. package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.js +32 -0
  150. package/vendor/app-server/dist/protocol/contract.d.ts +983 -0
  151. package/vendor/app-server/dist/protocol/contract.js +198 -0
  152. package/vendor/app-server/dist/protocol-client/index.d.ts +25 -0
  153. package/vendor/app-server/dist/protocol-client/index.js +114 -0
  154. package/vendor/app-server/dist/src/index.d.ts +1 -0
  155. package/vendor/app-server/dist/src/index.js +294 -0
  156. package/vendor/runtime/script/prepare_runtime_media_dataset.sh +427 -0
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArtifactExportReportParamsSchema = exports.ArtifactExportLogsParamsSchema = exports.CommandSendJsonParamsSchema = exports.CommandSendParamsSchema = exports.OutputAttachOptionsSchema = exports.OutputAttachCliParamsSchema = exports.OutputAttachParamsSchema = exports.StreamRequestPolicySetParamsSchema = exports.StreamReceiveStartParamsSchema = exports.StreamSendStartParamsSchema = exports.ConnectionConnectParamsSchema = exports.ServiceStartParamsSchema = exports.ErrorReasonCodeMapping = exports.CommandToHostMethodMapping = exports.CliJsonOutputSchema = exports.CliConfigSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.CliConfigSchema = zod_1.z.object({
6
+ version: zod_1.z.number().int().optional(),
7
+ service: zod_1.z.object({
8
+ service_entry: zod_1.z.string().optional(),
9
+ license: zod_1.z.string().optional(),
10
+ }).optional(),
11
+ connection: zod_1.z.object({
12
+ service_entry: zod_1.z.string().optional(),
13
+ peer_id: zod_1.z.string().optional(),
14
+ token: zod_1.z.string().optional(),
15
+ auto_token: zod_1.z.object({
16
+ openapi_entry: zod_1.z.string().optional(),
17
+ access_id: zod_1.z.string().optional(),
18
+ secret_key: zod_1.z.string().optional(),
19
+ local_id: zod_1.z.string().optional(),
20
+ user_ttl_seconds: zod_1.z.number().int().positive().optional(),
21
+ channel_ttl_seconds: zod_1.z.number().int().positive().optional(),
22
+ }).optional(),
23
+ }).optional(),
24
+ stream: zod_1.z.object({
25
+ request_policy: zod_1.z.object({
26
+ mode: zod_1.z.enum(['manual', 'auto-if-bound']).optional(),
27
+ }).optional(),
28
+ }).optional(),
29
+ streams: zod_1.z.object({
30
+ send: zod_1.z.object({
31
+ assets_dir: zod_1.z.string().min(1),
32
+ audio_stream_id: zod_1.z.number().int().nonnegative(),
33
+ video_stream_id: zod_1.z.number().int().nonnegative(),
34
+ }).optional(),
35
+ }).optional(),
36
+ logging: zod_1.z.object({
37
+ root_dir: zod_1.z.string().optional(),
38
+ console_mirror: zod_1.z.boolean().optional(),
39
+ level: zod_1.z.enum(['verbose', 'debug', 'info', 'warn', 'error', 'fatal']).optional(),
40
+ }).optional(),
41
+ debug: zod_1.z.object({
42
+ connect_bootstrap: zod_1.z.object({
43
+ access_id: zod_1.z.string().optional(),
44
+ secret_key: zod_1.z.string().optional(),
45
+ peer_id: zod_1.z.string().optional(),
46
+ service_entry: zod_1.z.string().optional(),
47
+ }).optional(),
48
+ }).optional(),
49
+ }).passthrough();
50
+ exports.CliJsonOutputSchema = zod_1.z.object({
51
+ code: zod_1.z.number(),
52
+ message: zod_1.z.string(),
53
+ data: zod_1.z.any().optional(),
54
+ });
55
+ exports.CommandToHostMethodMapping = {
56
+ 'host status': 'host/status',
57
+ 'host stop': 'host/shutdown',
58
+ 'service start': 'service/start',
59
+ 'service stop': 'service/stop',
60
+ 'connection show': 'connection/get',
61
+ 'connection connect': 'connection/connect',
62
+ 'connection disconnect': 'connection/disconnect',
63
+ 'stream list': 'stream/list',
64
+ 'stream send start': 'stream/sendStart',
65
+ 'stream send stop': 'stream/sendStop',
66
+ 'stream receive start': 'stream/receiveStart',
67
+ 'stream receive stop': 'stream/receiveStop',
68
+ 'stream request-policy get': 'stream/requestPolicy/get',
69
+ 'stream request-policy set': 'stream/requestPolicy/set',
70
+ 'output attach': 'output/attach',
71
+ 'output detach': 'output/detach',
72
+ 'command send': 'command/send',
73
+ 'command tail': 'events/subscribe',
74
+ 'events tail': 'events/subscribe',
75
+ 'logs export': 'artifact/exportLogs',
76
+ 'report show': 'artifact/readReport',
77
+ 'report export': 'artifact/exportReport',
78
+ 'debug bootstrap qrcode': 'debug/token/qrcode',
79
+ };
80
+ exports.ErrorReasonCodeMapping = {
81
+ protocol_version_mismatch: 2,
82
+ not_initialized: 3,
83
+ invalid_request: 4,
84
+ internal_error: 5,
85
+ timeout: 6,
86
+ connection_failed: 7,
87
+ stream_not_found: 8,
88
+ protocol_malformed_frame: 9,
89
+ method_not_found: 10,
90
+ invalid_initialize_result: 11,
91
+ };
92
+ exports.ServiceStartParamsSchema = zod_1.z.object({
93
+ serviceEntry: zod_1.z.string().optional(),
94
+ license: zod_1.z.string().optional(),
95
+ });
96
+ exports.ConnectionConnectParamsSchema = zod_1.z.object({
97
+ serviceEntry: zod_1.z.string().optional(),
98
+ peerId: zod_1.z.string(),
99
+ token: zod_1.z.string().optional(),
100
+ tokenMode: zod_1.z.enum(['manual', 'auto']).optional(),
101
+ autoToken: zod_1.z.object({
102
+ openapiEntry: zod_1.z.string().optional(),
103
+ accessId: zod_1.z.string(),
104
+ secretKey: zod_1.z.string(),
105
+ localId: zod_1.z.string().optional(),
106
+ userTtlSeconds: zod_1.z.number().int().positive().optional(),
107
+ channelTtlSeconds: zod_1.z.number().int().positive().optional(),
108
+ }).optional(),
109
+ }).refine((value) => Boolean(value.token) || Boolean(value.autoToken), {
110
+ message: 'token or autoToken is required',
111
+ });
112
+ exports.StreamSendStartParamsSchema = zod_1.z.object({
113
+ streamId: zod_1.z.string(),
114
+ media: zod_1.z.enum(['audio', 'video']),
115
+ assetsDir: zod_1.z.string(),
116
+ });
117
+ exports.StreamReceiveStartParamsSchema = zod_1.z.object({
118
+ streamId: zod_1.z.string(),
119
+ media: zod_1.z.enum(['audio', 'video']),
120
+ });
121
+ exports.StreamRequestPolicySetParamsSchema = zod_1.z.object({
122
+ mode: zod_1.z.enum(['manual', 'auto-if-bound']),
123
+ });
124
+ exports.OutputAttachParamsSchema = zod_1.z.object({
125
+ streamId: zod_1.z.string(),
126
+ consumer: zod_1.z.string(),
127
+ mediaView: zod_1.z.string(),
128
+ format: zod_1.z.string(),
129
+ delivery: zod_1.z.string(),
130
+ targetPath: zod_1.z.string().optional(),
131
+ maxFiles: zod_1.z.number().int().optional(),
132
+ });
133
+ exports.OutputAttachCliParamsSchema = zod_1.z.object({
134
+ streamId: zod_1.z.number().int().nonnegative(),
135
+ consumer: zod_1.z.enum(['web_preview', 'file_sink']),
136
+ mediaView: zod_1.z.enum(['encoded', 'encoded_packet']),
137
+ format: zod_1.z.enum(['h264', 'g711a', 'jpeg', 'pcm', 'mp4']),
138
+ delivery: zod_1.z.enum(['artifact_path', 'file']),
139
+ targetPath: zod_1.z.string().optional(),
140
+ maxFiles: zod_1.z.number().int().positive().optional(),
141
+ }).superRefine((params, ctx) => {
142
+ if (params.consumer === 'web_preview') {
143
+ if (params.delivery !== 'artifact_path') {
144
+ ctx.addIssue({
145
+ code: zod_1.z.ZodIssueCode.custom,
146
+ message: 'web_preview requires delivery=artifact_path',
147
+ });
148
+ }
149
+ if (params.format !== 'h264' && params.format !== 'g711a' && params.format !== 'jpeg' && params.format !== 'pcm') {
150
+ ctx.addIssue({
151
+ code: zod_1.z.ZodIssueCode.custom,
152
+ message: 'web_preview requires format=h264|g711a|jpeg|pcm',
153
+ });
154
+ }
155
+ }
156
+ if (params.consumer === 'file_sink') {
157
+ if (params.delivery !== 'file') {
158
+ ctx.addIssue({
159
+ code: zod_1.z.ZodIssueCode.custom,
160
+ message: 'file_sink requires delivery=file',
161
+ });
162
+ }
163
+ if (params.format !== 'mp4') {
164
+ ctx.addIssue({
165
+ code: zod_1.z.ZodIssueCode.custom,
166
+ message: 'file_sink requires format=mp4',
167
+ });
168
+ }
169
+ }
170
+ });
171
+ exports.OutputAttachOptionsSchema = zod_1.z.object({
172
+ streamType: zod_1.z.enum(['audio', 'video']).optional(),
173
+ stdout: zod_1.z.boolean().optional(),
174
+ filePath: zod_1.z.string().optional(),
175
+ }).refine((data) => !(data.stdout && data.filePath), {
176
+ message: 'Cannot specify both stdout and filePath',
177
+ });
178
+ exports.CommandSendParamsSchema = zod_1.z.object({
179
+ commandId: zod_1.z.string(),
180
+ kind: zod_1.z.string(),
181
+ payloadEncoding: zod_1.z.string(),
182
+ payload: zod_1.z.string(),
183
+ });
184
+ exports.CommandSendJsonParamsSchema = zod_1.z.object({
185
+ commandId: zod_1.z.number().int().nonnegative(),
186
+ kind: zod_1.z.string().min(1),
187
+ payloadJson: zod_1.z.string().min(1),
188
+ });
189
+ exports.ArtifactExportLogsParamsSchema = zod_1.z.object({
190
+ outputPath: zod_1.z.string(),
191
+ });
192
+ exports.ArtifactExportReportParamsSchema = zod_1.z.object({
193
+ outputPath: zod_1.z.string(),
194
+ });
@@ -0,0 +1,6 @@
1
+ type FfmpegBinaryPair = {
2
+ ffmpeg: string;
3
+ ffprobe: string;
4
+ };
5
+ export declare function ensureFfmpegTools(): FfmpegBinaryPair;
6
+ export {};
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ensureFfmpegTools = ensureFfmpegTools;
7
+ const child_process_1 = require("child_process");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const os_1 = __importDefault(require("os"));
10
+ const path_1 = __importDefault(require("path"));
11
+ function resolvePlatform() {
12
+ const explicit = process.env.TIRTC_RUNTIME_PLATFORM;
13
+ if (explicit && explicit.trim().length > 0) {
14
+ return explicit.trim();
15
+ }
16
+ if (process.platform === 'darwin' && process.arch === 'arm64') {
17
+ return 'macos-arm64';
18
+ }
19
+ return 'linux-x64';
20
+ }
21
+ function resolveFfmpegCacheRoot() {
22
+ const explicit = process.env.TIRTC_FFMPEG_CACHE_DIR;
23
+ if (explicit && explicit.trim().length > 0) {
24
+ return path_1.default.resolve(explicit.trim());
25
+ }
26
+ return path_1.default.join(os_1.default.homedir(), '.tirtc-devtool', 'tools', 'ffmpeg');
27
+ }
28
+ function resolveCachedToolDir(platform) {
29
+ return path_1.default.join(resolveFfmpegCacheRoot(), platform);
30
+ }
31
+ function isExecutable(filePath) {
32
+ try {
33
+ fs_1.default.accessSync(filePath, fs_1.default.constants.X_OK);
34
+ return true;
35
+ }
36
+ catch {
37
+ return false;
38
+ }
39
+ }
40
+ function resolveSystemTool(command) {
41
+ try {
42
+ const output = (0, child_process_1.execFileSync)('bash', ['-lc', `command -v ${command}`], { encoding: 'utf8' }).trim();
43
+ return output.length > 0 ? output : undefined;
44
+ }
45
+ catch {
46
+ return undefined;
47
+ }
48
+ }
49
+ function resolveDownloadSpec(platform) {
50
+ if (platform === 'macos-arm64') {
51
+ return {
52
+ url: 'https://evermeet.cx/ffmpeg/getrelease/zip',
53
+ archiveName: 'ffmpeg.zip',
54
+ format: 'zip',
55
+ };
56
+ }
57
+ return {
58
+ url: 'https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz',
59
+ archiveName: 'ffmpeg-release-amd64-static.tar.xz',
60
+ format: 'tar.xz',
61
+ };
62
+ }
63
+ function ensureDirectory(dirPath) {
64
+ fs_1.default.mkdirSync(dirPath, { recursive: true });
65
+ }
66
+ function assertToolReady(toolPath, probeArgs) {
67
+ (0, child_process_1.execFileSync)(toolPath, probeArgs, { stdio: 'ignore' });
68
+ }
69
+ function ensureCommandAvailable(command) {
70
+ const resolved = resolveSystemTool(command);
71
+ if (!resolved) {
72
+ throw new Error(`missing required command: ${command}`);
73
+ }
74
+ }
75
+ function downloadFile(url, targetPath) {
76
+ (0, child_process_1.execFileSync)('curl', ['-fL', url, '-o', targetPath], { stdio: 'inherit' });
77
+ }
78
+ function prepareMacosArm64(toolDir) {
79
+ const ffmpegZip = path_1.default.join(toolDir, 'ffmpeg.zip');
80
+ const ffprobeZip = path_1.default.join(toolDir, 'ffprobe.zip');
81
+ const ffmpegBin = path_1.default.join(toolDir, 'ffmpeg');
82
+ const ffprobeBin = path_1.default.join(toolDir, 'ffprobe');
83
+ downloadFile('https://evermeet.cx/ffmpeg/getrelease/zip', ffmpegZip);
84
+ downloadFile('https://evermeet.cx/ffmpeg/getrelease/ffprobe/zip', ffprobeZip);
85
+ (0, child_process_1.execFileSync)('unzip', ['-o', ffmpegZip, '-d', toolDir], { stdio: 'ignore' });
86
+ (0, child_process_1.execFileSync)('unzip', ['-o', ffprobeZip, '-d', toolDir], { stdio: 'ignore' });
87
+ fs_1.default.rmSync(ffmpegZip, { force: true });
88
+ fs_1.default.rmSync(ffprobeZip, { force: true });
89
+ fs_1.default.chmodSync(ffmpegBin, 0o755);
90
+ fs_1.default.chmodSync(ffprobeBin, 0o755);
91
+ }
92
+ function prepareLinuxX64(toolDir, archivePath) {
93
+ const extractDir = path_1.default.join(toolDir, '.extract');
94
+ const ffmpegBin = path_1.default.join(toolDir, 'ffmpeg');
95
+ const ffprobeBin = path_1.default.join(toolDir, 'ffprobe');
96
+ fs_1.default.rmSync(extractDir, { recursive: true, force: true });
97
+ ensureDirectory(extractDir);
98
+ (0, child_process_1.execFileSync)('tar', ['-xf', archivePath, '-C', extractDir], { stdio: 'ignore' });
99
+ const children = fs_1.default.readdirSync(extractDir).map((entry) => path_1.default.join(extractDir, entry));
100
+ const sourceDir = children.find((entry) => fs_1.default.statSync(entry).isDirectory());
101
+ if (!sourceDir) {
102
+ throw new Error('failed to resolve extracted ffmpeg directory');
103
+ }
104
+ fs_1.default.copyFileSync(path_1.default.join(sourceDir, 'ffmpeg'), ffmpegBin);
105
+ fs_1.default.copyFileSync(path_1.default.join(sourceDir, 'ffprobe'), ffprobeBin);
106
+ fs_1.default.chmodSync(ffmpegBin, 0o755);
107
+ fs_1.default.chmodSync(ffprobeBin, 0o755);
108
+ fs_1.default.rmSync(extractDir, { recursive: true, force: true });
109
+ }
110
+ function prepareCachedTools(platform) {
111
+ const toolDir = resolveCachedToolDir(platform);
112
+ const ffmpegBin = path_1.default.join(toolDir, 'ffmpeg');
113
+ const ffprobeBin = path_1.default.join(toolDir, 'ffprobe');
114
+ if (isExecutable(ffmpegBin) && isExecutable(ffprobeBin)) {
115
+ return { ffmpeg: ffmpegBin, ffprobe: ffprobeBin };
116
+ }
117
+ ensureDirectory(toolDir);
118
+ ensureCommandAvailable('curl');
119
+ const spec = resolveDownloadSpec(platform);
120
+ const archivePath = path_1.default.join(toolDir, spec.archiveName);
121
+ downloadFile(spec.url, archivePath);
122
+ try {
123
+ if (platform === 'macos-arm64') {
124
+ ensureCommandAvailable('unzip');
125
+ prepareMacosArm64(toolDir);
126
+ }
127
+ else {
128
+ ensureCommandAvailable('tar');
129
+ prepareLinuxX64(toolDir, archivePath);
130
+ }
131
+ assertToolReady(ffmpegBin, ['-version']);
132
+ assertToolReady(ffprobeBin, ['-version']);
133
+ return { ffmpeg: ffmpegBin, ffprobe: ffprobeBin };
134
+ }
135
+ finally {
136
+ fs_1.default.rmSync(archivePath, { force: true });
137
+ }
138
+ }
139
+ function ensureFfmpegTools() {
140
+ const systemFfmpeg = resolveSystemTool('ffmpeg');
141
+ const systemFfprobe = resolveSystemTool('ffprobe');
142
+ if (systemFfmpeg && systemFfprobe) {
143
+ return { ffmpeg: systemFfmpeg, ffprobe: systemFfprobe };
144
+ }
145
+ return prepareCachedTools(resolvePlatform());
146
+ }
@@ -0,0 +1 @@
1
+ export declare function printQuickstartGuide(): void;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printQuickstartGuide = printQuickstartGuide;
4
+ function printQuickstartGuide() {
5
+ const lines = [
6
+ 'TiRTC CLI 新手快速入口(服务端 -> 安卓扫码)',
7
+ '',
8
+ '前置条件:',
9
+ '1) 已构建最新 CLI:',
10
+ ' npm --prefix app-server run build',
11
+ ' npm --prefix devtools/cli run build',
12
+ '2) 服务端已准备可发送媒体文件(示例:.refers/simple.mp4)',
13
+ '',
14
+ '步骤 1:启动服务(自动创建 session)',
15
+ ' node devtools/cli/bin/tirtc-devtool.js service start "" "<LICENSE>"',
16
+ ' # 记下输出里的 sessionId,后续命令都显式带 --session',
17
+ '',
18
+ '步骤 2:先 prepare local assets,再配置 assets_dir + 显式音视频 stream id 并启动自动按需发流',
19
+ ' node devtools/cli/bin/tirtc-devtool.js media assets prepare --source .refers/simple.mp4 --output-root ./.tmp/tirtc-devtool/assets',
20
+ ' [stream.request_policy] mode = "auto-if-bound"',
21
+ ' [streams.send] assets_dir = "./.tmp/tirtc-devtool/assets/<prepared-assets-id>" audio_stream_id = 10 video_stream_id = 11',
22
+ ' # service start 成功后会自动应用上述 request_policy + send 绑定',
23
+ '',
24
+ '步骤 3:生成连接 bootstrap 二维码(给安卓扫码)',
25
+ ' node devtools/cli/bin/tirtc-devtool.js --session <SESSION_ID> debug bootstrap qrcode \\',
26
+ ' "<ACCESS_ID>" "<SECRET_KEY>" "<PEER_ID>" "<SERVICE_ENTRY>"',
27
+ '',
28
+ '步骤 4:安卓扫码后流程(客户端侧)',
29
+ ' - 解析二维码 JSON(type=tirtc-connect-bootstrap)',
30
+ ' - 用 access_id + secret_key 在客户端/外部系统签发 token',
31
+ ' - 持 token + peer_id 连接服务端;连接成功后请求 audio_stream_id/video_stream_id',
32
+ '',
33
+ '额外:如果你只想本地直接签发并拿到可扫码 payload,可执行:',
34
+ ' node devtools/cli/bin/tirtc-devtool.js token issue "<ACCESS_ID>" "<SECRET_KEY>" "<LOCAL_ID>" "<PEER_ID>" \\',
35
+ ' --service-entry "<SERVICE_ENTRY>"',
36
+ ' # CLI 会直接打印摘要、payload JSON、token,并生成本地二维码 PNG 路径',
37
+ '',
38
+ '步骤 5:服务端观测',
39
+ ' node devtools/cli/bin/tirtc-devtool.js --session <SESSION_ID> events tail',
40
+ ' node devtools/cli/bin/tirtc-devtool.js --session <SESSION_ID> report show',
41
+ '',
42
+ '补充:',
43
+ '- debug bootstrap qrcode 仅生成连接信息二维码,不签发 token',
44
+ '- 机器可读输出:在命令后追加 --json',
45
+ '- 查看全部命令:node devtools/cli/bin/tirtc-devtool.js --help',
46
+ '- 查看单命令说明:node devtools/cli/bin/tirtc-devtool.js <command> --help',
47
+ ];
48
+ console.log(lines.join('\n'));
49
+ }
@@ -0,0 +1 @@
1
+ export {};