tirtc-devtools-cli 0.0.9 → 0.0.11

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 (115) hide show
  1. package/README.md +17 -11
  2. package/USAGE.md +72 -33
  3. package/bin/tirtc-devtools-cli.js +1 -1
  4. package/dist/cli/src/bootstrap_flows.d.ts +46 -0
  5. package/dist/cli/src/bootstrap_flows.js +249 -0
  6. package/dist/{devtools/cli → cli}/src/config.d.ts +4 -15
  7. package/dist/{devtools/cli → cli}/src/config.js +7 -31
  8. package/dist/cli/src/default_paths.d.ts +3 -0
  9. package/dist/cli/src/default_paths.js +23 -0
  10. package/dist/{devtools/cli → cli}/src/embedded_paths.d.ts +1 -0
  11. package/dist/{devtools/cli → cli}/src/embedded_paths.js +18 -1
  12. package/dist/{devtools/cli → cli}/src/facade.d.ts +41 -235
  13. package/dist/{devtools/cli → cli}/src/facade.js +8 -27
  14. package/dist/cli/src/guide.js +47 -0
  15. package/dist/{devtools/cli → cli}/src/index.js +55 -141
  16. package/dist/{devtools/cli → cli}/src/session_manager.js +9 -11
  17. package/dist/{devtools/cli → cli}/src/token_command.js +69 -0
  18. package/dist/{devtools/cli → cli}/src/token_tool.d.ts +26 -0
  19. package/dist/{devtools/cli → cli}/src/token_tool.js +123 -22
  20. package/dist/{devtools/cli → cli}/src/transport.d.ts +1 -1
  21. package/package.json +6 -2
  22. package/script/ensure_ffmpeg.sh +1 -1
  23. package/vendor/app-server/bin/native/linux-x64/credential_napi.node +0 -0
  24. package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
  25. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/credential.h +34 -0
  26. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/error.h +13 -0
  27. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/foundation/build_info.h +27 -0
  28. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/http.h +57 -0
  29. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/logging.h +3 -1
  30. package/vendor/app-server/bin/runtime/linux-x64/lib/libcrypto.a +0 -0
  31. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_credential.a +0 -0
  32. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_http.a +0 -0
  33. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  34. package/vendor/app-server/bin/runtime/linux-x64/lib/libssl.a +0 -0
  35. package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +2 -32
  36. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio.h +176 -133
  37. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/av.h +223 -182
  38. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +2 -0
  39. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_downlink.h +6 -0
  40. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/transport.h +58 -133
  41. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/trp.h +47 -224
  42. package/vendor/app-server/bin/runtime/macos-arm64/lib/libTGTRP.a +0 -0
  43. package/vendor/app-server/bin/runtime/macos-arm64/lib/libTiRTC.a +0 -0
  44. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
  45. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
  46. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  47. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
  48. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  49. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  50. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  51. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  52. package/vendor/app-server/bin/runtime/macos-arm64/manifest.txt +19 -15
  53. package/vendor/app-server/dist/host/HostCommandCoordinator.d.ts +19 -0
  54. package/vendor/app-server/dist/host/HostCommandCoordinator.js +196 -0
  55. package/vendor/app-server/dist/host/HostProtocol.d.ts +1 -11
  56. package/vendor/app-server/dist/host/HostProtocol.js +3 -37
  57. package/vendor/app-server/dist/host/HostServer.d.ts +1 -4
  58. package/vendor/app-server/dist/host/HostServer.js +16 -152
  59. package/vendor/app-server/dist/host/RuntimeAdapter.js +2 -2
  60. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +3 -3
  61. package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +4 -4
  62. package/vendor/app-server/dist/host/runtime_backed_preflight.js +2 -2
  63. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +1 -1
  64. package/vendor/app-server/dist/protocol/contract.d.ts +5 -64
  65. package/vendor/app-server/dist/protocol/contract.js +3 -12
  66. package/dist/devtools/cli/src/guide.js +0 -50
  67. package/dist/dummy.d.ts +0 -0
  68. package/dist/dummy.js +0 -1
  69. package/dist/index.d.ts +0 -1
  70. package/dist/index.js +0 -48
  71. package/vendor/app-server/bin/native/macos-arm64/libcrypto.dylib +0 -0
  72. package/vendor/app-server/bin/native/macos-arm64/libssl.dylib +0 -0
  73. package/vendor/app-server/bin/native/macos-arm64/runtime_host_napi.node +0 -0
  74. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_codec.h +0 -23
  75. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_frame.h +0 -36
  76. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io.h +0 -56
  77. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_android.h +0 -19
  78. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_apple.h +0 -19
  79. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_harmony.h +0 -19
  80. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_windows.h +0 -19
  81. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_processing.h +0 -56
  82. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_sample_rate.h +0 -18
  83. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_codec.h +0 -21
  84. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_downlink.h +0 -89
  85. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_uplink.h +0 -115
  86. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/runtime.h +0 -236
  87. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_codec.h +0 -57
  88. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_frame.h +0 -55
  89. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io.h +0 -46
  90. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_android.h +0 -32
  91. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_apple.h +0 -34
  92. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_harmony.h +0 -32
  93. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_windows.h +0 -26
  94. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_processing.h +0 -34
  95. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_audio.a +0 -0
  96. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_facade.a +0 -0
  97. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_media.a +0 -0
  98. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_video.a +0 -0
  99. package/vendor/app-server/bin/runtime/linux-x64/lib/libwebrtc_apm.a +0 -0
  100. package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.d.ts +0 -30
  101. package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.js +0 -224
  102. /package/dist/{devtools/cli → cli}/src/dummy.d.ts +0 -0
  103. /package/dist/{devtools/cli → cli}/src/dummy.js +0 -0
  104. /package/dist/{devtools/cli → cli}/src/ffmpeg_tool.d.ts +0 -0
  105. /package/dist/{devtools/cli → cli}/src/ffmpeg_tool.js +0 -0
  106. /package/dist/{devtools/cli → cli}/src/guide.d.ts +0 -0
  107. /package/dist/{devtools/cli → cli}/src/index.d.ts +0 -0
  108. /package/dist/{devtools/cli → cli}/src/media_assets.d.ts +0 -0
  109. /package/dist/{devtools/cli → cli}/src/media_assets.js +0 -0
  110. /package/dist/{devtools/cli → cli}/src/progress.d.ts +0 -0
  111. /package/dist/{devtools/cli → cli}/src/progress.js +0 -0
  112. /package/dist/{devtools/cli → cli}/src/session_manager.d.ts +0 -0
  113. /package/dist/{devtools/cli → cli}/src/token_command.d.ts +0 -0
  114. /package/dist/{devtools/cli → cli}/src/transport.js +0 -0
  115. /package/vendor/app-server/bin/{native/macos-arm64 → runtime/macos-arm64/lib}/libtgrtc.dylib +0 -0
@@ -1,15 +1,52 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.resolveIssueTokenEnvironment = resolveIssueTokenEnvironment;
6
40
  exports.issueToken = issueToken;
7
41
  exports.buildIssuedTokenPayload = buildIssuedTokenPayload;
42
+ exports.buildLicenseQrcodePayload = buildLicenseQrcodePayload;
8
43
  exports.writePngQrcode = writePngQrcode;
9
44
  exports.buildAsciiQrcode = buildAsciiQrcode;
10
45
  exports.issueTokenWithQrcode = issueTokenWithQrcode;
46
+ exports.buildLicenseQrcode = buildLicenseQrcode;
11
47
  exports.formatTokenIssueConsoleOutput = formatTokenIssueConsoleOutput;
12
- const child_process_1 = require("child_process");
48
+ exports.formatLicenseQrcodeConsoleOutput = formatLicenseQrcodeConsoleOutput;
49
+ const childProcess = __importStar(require("child_process"));
13
50
  const fs_1 = __importDefault(require("fs"));
14
51
  const path_1 = __importDefault(require("path"));
15
52
  const qrcode_1 = __importDefault(require("qrcode"));
@@ -30,15 +67,20 @@ function sanitizePathSegment(text) {
30
67
  function resolveQrCodeOutputDir() {
31
68
  return path_1.default.resolve(process.cwd(), '.tmp/tirtc-devtools-cli/qrcode');
32
69
  }
33
- function buildQrCodePngPath(payload) {
70
+ function buildQrCodePngPath(prefix, ...parts) {
34
71
  const fileName = [
35
- 'token',
36
- sanitizePathSegment(payload.local_id),
37
- sanitizePathSegment(payload.peer_id),
72
+ prefix,
73
+ ...parts.map((part) => sanitizePathSegment(part)),
38
74
  Date.now().toString(),
39
75
  ].join('-') + '.png';
40
76
  return path_1.default.join(resolveQrCodeOutputDir(), fileName);
41
77
  }
78
+ function buildTokenQrCodePngPath(payload) {
79
+ return buildQrCodePngPath('token', payload.local_id, payload.peer_id);
80
+ }
81
+ function buildLicenseQrCodePngPath(payload) {
82
+ return buildQrCodePngPath('license', payload.license);
83
+ }
42
84
  function resolveRuntimePlatform() {
43
85
  const raw = process.env.TIRTC_RUNTIME_PLATFORM;
44
86
  if (raw && raw.trim().length > 0) {
@@ -49,12 +91,12 @@ function resolveRuntimePlatform() {
49
91
  }
50
92
  return 'linux-x64';
51
93
  }
52
- function resolveRuntimeBundleRoot(runtimePlatform) {
94
+ function resolveRuntimeBundleRoot(runtimePlatform, fromDir = __dirname) {
53
95
  const explicit = process.env.TIRTC_RUNTIME_BUNDLE_ROOT;
54
96
  if (explicit && explicit.trim().length > 0) {
55
97
  return explicit.trim();
56
98
  }
57
- const embedded = (0, embedded_paths_1.resolveEmbeddedRuntimeBundleRoot)(__dirname, runtimePlatform);
99
+ const embedded = (0, embedded_paths_1.resolveEmbeddedRuntimeBundleRoot)(fromDir, runtimePlatform);
58
100
  if (embedded) {
59
101
  return embedded;
60
102
  }
@@ -64,7 +106,7 @@ function resolveRuntimeBundleRoot(runtimePlatform) {
64
106
  path_1.default.resolve(execDir, '../runtime', runtimePlatform),
65
107
  path_1.default.resolve(__dirname, '../bin/runtime', runtimePlatform),
66
108
  path_1.default.resolve(__dirname, '../../../../bin/runtime', runtimePlatform),
67
- path_1.default.resolve(process.cwd(), 'devtools/cli/bin/runtime', runtimePlatform),
109
+ path_1.default.resolve(process.cwd(), 'products/cli/bin/runtime', runtimePlatform),
68
110
  path_1.default.resolve(process.cwd(), 'bin/runtime', runtimePlatform),
69
111
  path_1.default.resolve(process.cwd(), '../bin/runtime', runtimePlatform),
70
112
  ];
@@ -75,8 +117,8 @@ function resolveRuntimeBundleRoot(runtimePlatform) {
75
117
  }
76
118
  return candidates[0];
77
119
  }
78
- function resolveRepoRoot() {
79
- const embeddedAppServerRoot = (0, embedded_paths_1.resolveEmbeddedAppServerRoot)(__dirname);
120
+ function resolveRepoRoot(fromDir = __dirname) {
121
+ const embeddedAppServerRoot = (0, embedded_paths_1.resolveEmbeddedAppServerRoot)(fromDir);
80
122
  if (embeddedAppServerRoot) {
81
123
  return path_1.default.resolve(embeddedAppServerRoot, '..');
82
124
  }
@@ -87,12 +129,23 @@ function resolveRepoRoot() {
87
129
  path_1.default.resolve(process.cwd()),
88
130
  ];
89
131
  for (const candidate of candidates) {
90
- if (pathExists(path_1.default.join(candidate, 'app-server')) && pathExists(path_1.default.join(candidate, 'devtools'))) {
132
+ if (pathExists(path_1.default.join(candidate, 'products/app-server')) && pathExists(path_1.default.join(candidate, 'products/cli'))) {
91
133
  return candidate;
92
134
  }
93
135
  }
94
136
  return candidates[0];
95
137
  }
138
+ function resolveEmbeddedAddonPath(runtimePlatform, fromDir = __dirname) {
139
+ const embeddedAppServerRoot = (0, embedded_paths_1.resolveEmbeddedAppServerRoot)(fromDir);
140
+ if (!embeddedAppServerRoot) {
141
+ return undefined;
142
+ }
143
+ const candidate = path_1.default.join(embeddedAppServerRoot, 'bin/native', runtimePlatform, 'credential_napi.node');
144
+ if (pathExists(candidate)) {
145
+ return candidate;
146
+ }
147
+ return undefined;
148
+ }
96
149
  function ensureRuntimeBundleReady(runtimeBundleRoot) {
97
150
  const includeDir = path_1.default.join(runtimeBundleRoot, 'include');
98
151
  const libDir = path_1.default.join(runtimeBundleRoot, 'lib');
@@ -100,12 +153,16 @@ function ensureRuntimeBundleReady(runtimeBundleRoot) {
100
153
  throw new Error('runtime-backed sdk bundle is missing: ' + runtimeBundleRoot);
101
154
  }
102
155
  }
103
- function resolveAddonPath(repoRoot, runtimePlatform) {
156
+ function resolveAddonPath(repoRoot, runtimePlatform, fromDir = __dirname) {
104
157
  const explicit = process.env.TIRTC_CREDENTIAL_ADDON_PATH;
158
+ const embedded = resolveEmbeddedAddonPath(runtimePlatform, fromDir);
105
159
  const candidates = [
106
160
  explicit,
161
+ embedded,
162
+ path_1.default.join(repoRoot, `products/app-server/bin/native/${runtimePlatform}/credential_napi.node`),
107
163
  path_1.default.join(repoRoot, `app-server/bin/native/${runtimePlatform}/credential_napi.node`),
108
- path_1.default.join(repoRoot, `app-server/.build/app-server/native/${runtimePlatform}/credential_napi.node`),
164
+ path_1.default.join(repoRoot, `.build/app-server/native/${runtimePlatform}/credential_napi.node`),
165
+ path_1.default.resolve(process.cwd(), `products/app-server/bin/native/${runtimePlatform}/credential_napi.node`),
109
166
  path_1.default.resolve(process.cwd(), `app-server/bin/native/${runtimePlatform}/credential_napi.node`),
110
167
  path_1.default.resolve(process.cwd(), `.build/app-server/native/${runtimePlatform}/credential_napi.node`),
111
168
  ].filter((entry) => typeof entry === 'string' && entry.trim().length > 0);
@@ -116,7 +173,18 @@ function resolveAddonPath(repoRoot, runtimePlatform) {
116
173
  }
117
174
  }
118
175
  throw new Error('credential addon missing for platform ' + runtimePlatform +
119
- '; run: npm --prefix app-server run build:native');
176
+ '; run: npm --prefix products/app-server run build:native');
177
+ }
178
+ function resolveIssueTokenEnvironment(runtimePlatform = resolveRuntimePlatform(), fromDir = __dirname) {
179
+ const runtimeBundleRoot = resolveRuntimeBundleRoot(runtimePlatform, fromDir);
180
+ const repoRoot = resolveRepoRoot(fromDir);
181
+ ensureRuntimeBundleReady(runtimeBundleRoot);
182
+ return {
183
+ runtimePlatform,
184
+ runtimeBundleRoot,
185
+ repoRoot,
186
+ addonPath: resolveAddonPath(repoRoot, runtimePlatform, fromDir),
187
+ };
120
188
  }
121
189
  function normalizeIssuedToken(token) {
122
190
  const normalized = token.trim();
@@ -153,7 +221,7 @@ function buildIssueTokenHelperSource() {
153
221
  ].join('\n');
154
222
  }
155
223
  function issueTokenViaSubprocess(addonPath, input) {
156
- const result = (0, child_process_1.spawnSync)(process.execPath, ['-e', buildIssueTokenHelperSource()], {
224
+ const result = childProcess.spawnSync(process.execPath, ['-e', buildIssueTokenHelperSource()], {
157
225
  encoding: 'utf8',
158
226
  env: {
159
227
  ...process.env,
@@ -227,13 +295,9 @@ function renderHalfBlockQr(modules) {
227
295
  return lines.join('\n');
228
296
  }
229
297
  async function issueToken(input) {
230
- const runtimePlatform = resolveRuntimePlatform();
231
- const runtimeBundleRoot = resolveRuntimeBundleRoot(runtimePlatform);
232
- const repoRoot = resolveRepoRoot();
233
- ensureRuntimeBundleReady(runtimeBundleRoot);
234
- const addonPath = resolveAddonPath(repoRoot, runtimePlatform);
298
+ const resolved = resolveIssueTokenEnvironment();
235
299
  try {
236
- return issueTokenViaSubprocess(addonPath, input);
300
+ return issueTokenViaSubprocess(resolved.addonPath, input);
237
301
  }
238
302
  catch (error) {
239
303
  const message = error instanceof Error ? error.message : String(error);
@@ -254,6 +318,12 @@ function buildIssuedTokenPayload(input, token) {
254
318
  generated_at: new Date().toISOString(),
255
319
  };
256
320
  }
321
+ function buildLicenseQrcodePayload(input) {
322
+ return {
323
+ license: input.license.trim(),
324
+ service_entry: input.serviceEntry?.trim() ?? '',
325
+ };
326
+ }
257
327
  async function writePngQrcode(payloadJson, outputPath, errorCorrectionLevel) {
258
328
  const resolvedPath = path_1.default.resolve(outputPath);
259
329
  ensureDirectory(path_1.default.dirname(resolvedPath));
@@ -284,7 +354,7 @@ async function issueTokenWithQrcode(input) {
284
354
  const payload = buildIssuedTokenPayload(input, token);
285
355
  const payloadJson = JSON.stringify(payload);
286
356
  const qrErrorCorrectionLevel = input.qrErrorCorrectionLevel ?? 'M';
287
- const qrCodePngPath = await writePngQrcode(payloadJson, buildQrCodePngPath(payload), qrErrorCorrectionLevel);
357
+ const qrCodePngPath = await writePngQrcode(payloadJson, buildTokenQrCodePngPath(payload), qrErrorCorrectionLevel);
288
358
  const qrCodeAscii = await buildAsciiQrcode(payloadJson, input.asciiMaxColumns, qrErrorCorrectionLevel);
289
359
  return {
290
360
  payload,
@@ -295,6 +365,20 @@ async function issueTokenWithQrcode(input) {
295
365
  qrCodeAsciiIncluded: !qrCodeAscii.startsWith('(omitted:'),
296
366
  };
297
367
  }
368
+ async function buildLicenseQrcode(input) {
369
+ const payload = buildLicenseQrcodePayload(input);
370
+ const payloadJson = JSON.stringify(payload);
371
+ const qrErrorCorrectionLevel = input.qrErrorCorrectionLevel ?? 'M';
372
+ const qrCodePngPath = await writePngQrcode(payloadJson, buildLicenseQrCodePngPath(payload), qrErrorCorrectionLevel);
373
+ const qrCodeAscii = await buildAsciiQrcode(payloadJson, input.asciiMaxColumns, qrErrorCorrectionLevel);
374
+ return {
375
+ payload,
376
+ payloadJson,
377
+ qrCodePngPath,
378
+ qrCodeAscii,
379
+ qrCodeAsciiIncluded: !qrCodeAscii.startsWith('(omitted:'),
380
+ };
381
+ }
298
382
  function formatTokenIssueConsoleOutput(output) {
299
383
  const summaryLines = [
300
384
  'Issued Token Summary:',
@@ -320,3 +404,20 @@ function formatTokenIssueConsoleOutput(output) {
320
404
  ];
321
405
  return summaryLines.join('\n');
322
406
  }
407
+ function formatLicenseQrcodeConsoleOutput(output) {
408
+ const summaryLines = [
409
+ 'License QR Code Summary:',
410
+ ' license: ' + output.payload.license,
411
+ ' service_entry: ' + (output.payload.service_entry || '(empty)'),
412
+ '',
413
+ 'Payload JSON:',
414
+ JSON.stringify(output.payload, null, 2),
415
+ '',
416
+ 'QR Code ASCII:',
417
+ output.qrCodeAscii,
418
+ '',
419
+ 'QR Code PNG:',
420
+ output.qrCodePngPath,
421
+ ];
422
+ return summaryLines.join('\n');
423
+ }
@@ -1,4 +1,4 @@
1
- import { Transport } from '../../../app-server/protocol-client';
1
+ import { Transport } from '../../app-server/protocol-client';
2
2
  type ProcessTransportOptions = {
3
3
  env?: NodeJS.ProcessEnv;
4
4
  };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "tirtc-devtools-cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "private": false,
5
- "main": "dist/index.js",
5
+ "main": "dist/cli/src/index.js",
6
+ "types": "dist/cli/src/index.d.ts",
6
7
  "bin": {
7
8
  "tirtc-devtools-cli": "bin/tirtc-devtools-cli.js"
8
9
  },
@@ -15,6 +16,7 @@
15
16
  "vendor"
16
17
  ],
17
18
  "scripts": {
19
+ "prebuild": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
18
20
  "build": "tsc",
19
21
  "test": "jest",
20
22
  "test:owner": "./script/test.sh owner",
@@ -23,6 +25,8 @@
23
25
  "test:e2e": "./script/test.sh e2e",
24
26
  "test:two-endpoints": "./script/test.sh two-endpoints",
25
27
  "test:acceptance": "./script/test.sh acceptance",
28
+ "package:token-issue-assets": "./script/package_token_issue_assets.sh",
29
+ "verify:token-issue-package": "./script/verify_token_issue_package.sh",
26
30
  "lint": "eslint . --ext .ts --max-warnings=0",
27
31
  "lint:fix": "eslint . --ext .ts --fix",
28
32
  "package": "./script/package.sh",
@@ -3,7 +3,7 @@ set -euo pipefail
3
3
 
4
4
  SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
5
5
  CLI_ROOT=$(cd "$SCRIPT_DIR/.." && pwd)
6
- CLI_DIST="$CLI_ROOT/dist/devtools/cli/src/ffmpeg_tool.js"
6
+ CLI_DIST="$CLI_ROOT/dist/cli/src/ffmpeg_tool.js"
7
7
 
8
8
  if [[ ! -f "$CLI_DIST" ]]; then
9
9
  echo "[ensure_ffmpeg] compiled helper missing: $CLI_DIST" >&2
@@ -0,0 +1,34 @@
1
+ #ifndef TIRTC_CREDENTIAL_H_
2
+ #define TIRTC_CREDENTIAL_H_
3
+
4
+ #include "tirtc/error.h"
5
+
6
+ #ifdef __cplusplus
7
+ extern "C" {
8
+ #endif
9
+
10
+ typedef struct TirtcCredentialIssueTokenOptions {
11
+ const char* openapi_entry;
12
+ const char* access_id;
13
+ const char* secret_key;
14
+ const char* local_id;
15
+ const char* peer_id;
16
+ int user_ttl_seconds;
17
+ int channel_ttl_seconds;
18
+ } TirtcCredentialIssueTokenOptions;
19
+
20
+ typedef struct TirtcCredentialIssueTokenResult {
21
+ char* token;
22
+ int http_status_code;
23
+ } TirtcCredentialIssueTokenResult;
24
+
25
+ TirtcError tirtc_credential_issue_token(const TirtcCredentialIssueTokenOptions* options,
26
+ TirtcCredentialIssueTokenResult* out_result);
27
+
28
+ void tirtc_credential_issue_token_result_dispose(TirtcCredentialIssueTokenResult* result);
29
+
30
+ #ifdef __cplusplus
31
+ }
32
+ #endif
33
+
34
+ #endif // TIRTC_CREDENTIAL_H_
@@ -11,6 +11,19 @@ typedef enum TirtcError {
11
11
  TIRTC_ERROR_NOT_INITIALIZED = 2,
12
12
  TIRTC_ERROR_INTERNAL = 3,
13
13
  TIRTC_ERROR_NOT_READY = 4,
14
+ TIRTC_ERROR_UNSUPPORTED_LOOP_POLICY = 5,
15
+ TIRTC_ERROR_SOURCE_HASH_MISMATCH = 6,
16
+ TIRTC_ERROR_STOPPED = 7,
17
+ TIRTC_ERROR_DESTROYED = 8,
18
+ TIRTC_ERROR_TRANSPORT_INVALID_LICENSE = 9,
19
+ TIRTC_ERROR_TRANSPORT_TIMEOUT = 10,
20
+ TIRTC_ERROR_TRANSPORT_BUSY = 11,
21
+ TIRTC_ERROR_TRANSPORT_CONNECTION_TIMEOUT_CLOSED = 12,
22
+ TIRTC_ERROR_TRANSPORT_REMOTE_CLOSED = 13,
23
+ TIRTC_ERROR_TRANSPORT_CONNECTION_OTHER_ERROR = 14,
24
+ TIRTC_ERROR_TRANSPORT_TOKEN_EXPIRED = 15,
25
+ TIRTC_ERROR_DUMP_ROOT_UNAVAILABLE = 16,
26
+ TIRTC_ERROR_DUMP_ALREADY_ACTIVE = 17,
14
27
  } TirtcError;
15
28
 
16
29
  #ifdef __cplusplus
@@ -0,0 +1,27 @@
1
+ #ifndef TIRTC_FOUNDATION_BUILD_INFO_H_
2
+ #define TIRTC_FOUNDATION_BUILD_INFO_H_
3
+
4
+ #include "tirtc/error.h"
5
+
6
+ #ifdef __cplusplus
7
+ extern "C" {
8
+ #endif
9
+
10
+ typedef struct TirtcBuildInfo {
11
+ const char* semver_base;
12
+ const char* semver_effective;
13
+ const char* commit_hash;
14
+ int commit_count;
15
+ const char* build_branch;
16
+ const char* build_time_utc;
17
+ const char* version_string;
18
+ } TirtcBuildInfo;
19
+
20
+ const TirtcBuildInfo* tirtc_build_info_get(void);
21
+ const char* tirtc_build_version_string(void);
22
+
23
+ #ifdef __cplusplus
24
+ }
25
+ #endif
26
+
27
+ #endif // TIRTC_FOUNDATION_BUILD_INFO_H_
@@ -0,0 +1,57 @@
1
+ #ifndef TIRTC_FOUNDATION_HTTP_H_
2
+ #define TIRTC_FOUNDATION_HTTP_H_
3
+
4
+ #include "tirtc/error.h"
5
+
6
+ #ifdef __cplusplus
7
+ extern "C" {
8
+ #endif
9
+
10
+ typedef enum TirtcHttpMethod {
11
+ TIRTC_HTTP_METHOD_GET = 0,
12
+ TIRTC_HTTP_METHOD_POST = 1,
13
+ TIRTC_HTTP_METHOD_PUT = 2,
14
+ TIRTC_HTTP_METHOD_PATCH = 3,
15
+ TIRTC_HTTP_METHOD_DELETE = 4,
16
+ } TirtcHttpMethod;
17
+
18
+ typedef struct TirtcHttpHeader {
19
+ const char* key;
20
+ const char* value;
21
+ } TirtcHttpHeader;
22
+
23
+ typedef struct TirtcHttpRequest {
24
+ const char* scheme;
25
+ const char* host;
26
+ int port;
27
+ const char* path;
28
+ const char* query;
29
+ const TirtcHttpHeader* headers;
30
+ int header_count;
31
+ const char* body;
32
+ int body_size;
33
+ int connect_timeout_ms;
34
+ int read_timeout_ms;
35
+ int write_timeout_ms;
36
+ } TirtcHttpRequest;
37
+
38
+ typedef struct TirtcHttpResponse {
39
+ int status_code;
40
+ const char* body;
41
+ int body_size;
42
+ } TirtcHttpResponse;
43
+
44
+ typedef TirtcError (*TirtcHttpMockHandler)(const TirtcHttpRequest* request, TirtcHttpMethod method,
45
+ TirtcHttpResponse* response, void* user_data);
46
+
47
+ TirtcError tirtc_http_request(const TirtcHttpRequest* request, TirtcHttpMethod method,
48
+ TirtcHttpResponse* response);
49
+ void tirtc_http_response_dispose(TirtcHttpResponse* response);
50
+ TirtcError tirtc_http_set_mock_handler(TirtcHttpMockHandler handler, void* user_data);
51
+ void tirtc_http_clear_mock_handler(void);
52
+
53
+ #ifdef __cplusplus
54
+ }
55
+ #endif
56
+
57
+ #endif // TIRTC_FOUNDATION_HTTP_H_
@@ -21,10 +21,11 @@ typedef enum TirtcLogLevel {
21
21
  typedef void (*TirtcLoggingPrintFunction)(const char* prefix, TirtcLogLevel level, const char* tag,
22
22
  const char* fmt, va_list args);
23
23
 
24
- #define TIRTC_LOG_PREFIX_DEFAULT "TIRTC"
24
+ #define TIRTC_LOG_PREFIX_DEFAULT "TIRTC_"
25
25
 
26
26
  TirtcError tirtc_logging_set_print_function(TirtcLoggingPrintFunction function);
27
27
  TirtcError tirtc_logging_set_level(TirtcLogLevel level);
28
+ TirtcError tirtc_logging_set_console_enabled(int enabled);
28
29
 
29
30
  TirtcError tirtc_logging_initialize(const char* root_dir);
30
31
  TirtcError tirtc_logging_write(TirtcLogLevel level, const char* tag, const char* message);
@@ -32,6 +33,7 @@ TirtcError tirtc_logging_print(const char* prefix, TirtcLogLevel level, const ch
32
33
  const char* fmt, ...);
33
34
  TirtcError tirtc_logging_flush(void);
34
35
  TirtcError tirtc_logging_export(const char* output_zip_path);
36
+ TirtcError tirtc_logging_upload(char* log_id, int log_id_capacity);
35
37
 
36
38
  #define TIRTC_LOGV(tag, fmt, ...) \
37
39
  tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_VERBOSE, tag, fmt, ##__VA_ARGS__)
@@ -1,34 +1,4 @@
1
1
  platform=linux-x64
2
- staged_at_utc=2026-03-31T12:26:48Z
2
+ profile=credential
3
+ staged_at_utc=2026-04-21T05:02:38Z
3
4
  source_sdk=/workspace/.build/sdk/linux-x64
4
-
5
- 6d972ccfe150a3b4f2d7f18fa92b3ade9210c1c8bb754d061ac6b7997b59e2cb include/tirtc/audio_codec.h
6
- 7bacbdb2d8bb10d6444036a8fef42f2a8e3ea34dfc38e165ee678d61f189db41 include/tirtc/audio_frame.h
7
- 818dc6ea4484e7ea37651db1ab1b50bfe1abe644d24208914691297173dce7a1 include/tirtc/audio_io.h
8
- c2e1f31dcc75be461c577d18b1cebe32774f212d51cb4dd2a5b5a9bfe62b693e include/tirtc/audio_io_android.h
9
- 878bb18220ac62304ec95807f31e83e050c8dac14811f873454f9b045028694a include/tirtc/audio_io_apple.h
10
- 0569eb1d043ee7fa8d45ca43143eca1a22e4c4bf1507ca7e045e010a3ecbc288 include/tirtc/audio_io_harmony.h
11
- 51cbc911fe9f9834046f0e0a1a7cdd814a8e194a615894a8b4d11f9e5f095610 include/tirtc/audio_io_windows.h
12
- 21f60729117260a44af22c1af986ef17d22673b102b7b7a035f492d0665cce16 include/tirtc/audio_processing.h
13
- 0ca7c3c630b1242f51a0fd8154097c0a332b4c816a5707090e4381719852998c include/tirtc/audio_sample_rate.h
14
- a484e249b1eb5f66bb0fcdde1a716c48207e99c05edf57674613d22c9293eac2 include/tirtc/error.h
15
- 5527348107b8bf88d75adf7e46d335a1f83b2377a03da0dbfd9f6d83fff88580 include/tirtc/logging.h
16
- 7e2f7f81afe37e22f5414d9db32438edd948ff775230c3a0a17ff9ac1a0b560e include/tirtc/media_codec.h
17
- bb3afc6cad8737400d51b30b523be8f7259853587c83541734460e00485d0fda include/tirtc/media_downlink.h
18
- 51658c1784b862e4f52ad5692533a3d288eb5267649f1e0fb1696f4c519299de include/tirtc/media_uplink.h
19
- 7f0f1f5afd665f0c2b826eda3c72ca37a4d4153872b9b41593b0d527fb2b4316 include/tirtc/runtime.h
20
- dbfe7cb2f8b26b37af759f54c3e254a973fe21fbd9a4e69a74a36ba28d7a448a include/tirtc/video_codec.h
21
- e51379666c199588cc33279ccf52248035d1cae3d1d468b1615ebf29f0b39c9c include/tirtc/video_frame.h
22
- d920afad955b9f206b02b19ca152315190fa84ab6f24e895a5b24c3ab9ffd701 include/tirtc/video_io.h
23
- 9294d144dbc56415ddbc06c68a26b4a662b51a3808f49ded81a37776ad243293 include/tirtc/video_io_android.h
24
- 43197ceccfbcf20de046bf19c7f6787c9daf681cbef6cf0c50e8466677cfd4ce include/tirtc/video_io_apple.h
25
- cae0bbeb884e5466a56da15182c78cc22baab6c743f349a58d3595f623333585 include/tirtc/video_io_harmony.h
26
- 65b5d24fe3a6bc2a299a2220148a153ba4eb0955a49c1c3baabf1fdfed8aabdd include/tirtc/video_io_windows.h
27
- 8cd6b66bea14890a665cc317f8572429b2c3e4463773f8b77c1e4dc30a4a8747 include/tirtc/video_processing.h
28
- c9a3a02ff8550719140dfee9ef81b5a1f8210d0ff91be919dd28008701ee6ccb lib/libmatrix_runtime_audio.a
29
- 095fc457691d15d20991a8e1eed257521f8ae5cea40cbeacea25537db4b3f420 lib/libmatrix_runtime_facade.a
30
- 210b16e023a4837d3a4d13efac2dcb733a228b4f47262dc6df60bc4c63929fbe lib/libmatrix_runtime_foundation_logging.a
31
- 574598183bb913924c9a56ae32e02abb50894687759661bc8d06b6e272b7c1ba lib/libmatrix_runtime_media.a
32
- f54f40319d63191ddc1963ef5d0032286c78eba6378a0d2f32fdc304305a6363 lib/libmatrix_runtime_video.a
33
- a67ec9034848ef24a1b17671e444daa62a8f9e6b8319a1e932593908720ff2a1 lib/libwebrtc_apm.a
34
- 700e455255897e3cffab13ca593a6e4d9d11383ae609215cbbd6043a63d47161 lib/libxlog.a