tirtc-devtools-cli 0.0.12 → 0.0.13

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 (29) hide show
  1. package/USAGE.md +11 -7
  2. package/dist/cli/src/guide.js +3 -2
  3. package/dist/cli/src/index.js +1 -1
  4. package/dist/cli/src/token_command.js +25 -12
  5. package/dist/cli/src/token_tool.d.ts +2 -0
  6. package/dist/cli/src/token_tool.js +60 -2
  7. package/package.json +1 -1
  8. package/vendor/app-server/bin/native/linux-x64/credential_napi.node +0 -0
  9. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/error.h +36 -17
  10. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_credential.a +0 -0
  11. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_http.a +0 -0
  12. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  13. package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +1 -1
  14. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio.h +27 -0
  15. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/av.h +22 -0
  16. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +36 -17
  17. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_downlink.h +47 -0
  18. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/trp.h +10 -0
  19. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
  20. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
  21. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  22. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
  23. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  24. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  25. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  26. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  27. package/vendor/app-server/bin/runtime/macos-arm64/manifest.txt +14 -14
  28. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.d.ts +2 -5
  29. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +2 -5
package/USAGE.md CHANGED
@@ -100,8 +100,9 @@ $ node ... token issue --help
100
100
  Usage: tirtc-devtools-cli token issue [options] <remote_id>
101
101
 
102
102
  Options:
103
- --access-id <accessId>
104
- --secret-key <secretKey>
103
+ --access-key-id <accessKeyId>
104
+ --secret-key-id <secretKeyId>
105
+ --app-id <appId>
105
106
  --openapi-endpoint <url>
106
107
  --endpoint <entry>
107
108
  --qr-error-correction-level <level>
@@ -258,8 +259,9 @@ CLI 仍会在本地收紧最小组合矩阵:
258
259
  命令形态:
259
260
 
260
261
  ```bash
261
- export TIRTC_CONN_ACCESS_ID="<ACCESS_ID>"
262
- export TIRTC_CONN_SECRET_KEY="<SECRET_KEY>"
262
+ export TIRTC_ACCESS_KEY_ID="<ACCESS_KEY_ID>"
263
+ export TIRTC_SECRET_KEY_ID="<SECRET_KEY_ID>"
264
+ export TIRTC_APP_ID="<APP_ID>"
263
265
  node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID>
264
266
  ```
265
267
 
@@ -274,10 +276,11 @@ node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID> \
274
276
  当前 CLI 合同:
275
277
 
276
278
  - 位置参数改为 `<remote_id>`。
279
+ - `app_id` 必填;可通过 `--app-id` 或 `TIRTC_APP_ID` 提供。
277
280
  - `--endpoint` 取代旧 `--service-entry`。
278
281
  - `--openapi-endpoint` 取代旧 `--openapi-entry`。
279
282
  - 不再接收 `local_id`。
280
- - 显式传入的 `endpoint` / `openapi_endpoint` 会透传给 C 层签发路径,并同时进入二维码 payload。
283
+ - 显式传入的 `endpoint` / `openapi_endpoint` 会透传给 C 层签发路径;其中 `app_id` / `endpoint` / `openapi_endpoint` 会进入二维码 payload。
281
284
  - 若未显式传入 `endpoint` / `openapi_endpoint`,则 payload 中不再补默认字段。
282
285
 
283
286
  `--json` 输出保持外层 envelope 不变:
@@ -288,12 +291,13 @@ node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID> \
288
291
  "message": "OK",
289
292
  "data": {
290
293
  "payload": {
294
+ "app_id": "AD_testapp",
291
295
  "remote_id": "TESTFENGJUN4",
292
296
  "token": "<TOKEN>",
293
297
  "endpoint": "http://ep-test-tirtc.tange365.com",
294
298
  "openapi_endpoint": "http://api-test-tirtc.tange365.com"
295
299
  },
296
- "payloadJson": "{\"remote_id\":\"TESTFENGJUN4\",\"token\":\"<TOKEN>\",\"endpoint\":\"http://ep-test-tirtc.tange365.com\",\"openapi_endpoint\":\"http://api-test-tirtc.tange365.com\"}",
300
+ "payloadJson": "{\"app_id\":\"AD_testapp\",\"remote_id\":\"TESTFENGJUN4\",\"token\":\"<TOKEN>\",\"endpoint\":\"http://ep-test-tirtc.tange365.com\",\"openapi_endpoint\":\"http://api-test-tirtc.tange365.com\"}",
297
301
  "token": "<TOKEN>",
298
302
  "qrCodePngPath": "/absolute/path/to/token-*.png"
299
303
  }
@@ -302,7 +306,7 @@ node products/cli/bin/tirtc-devtools-cli.js --json token issue <REMOTE_ID> \
302
306
 
303
307
  说明:
304
308
 
305
- - payload 只保留 `remote_id`、`token`、可选 `endpoint`、可选 `openapi_endpoint`。
309
+ - payload 只保留 `app_id`、`remote_id`、`token`、可选 `endpoint`、可选 `openapi_endpoint`。
306
310
  - 已删除字段不再出现:`version`、`type`、`local_id`、`peer_id`、`openapi_entry`、`service_entry`、`user_ttl_seconds`、`channel_ttl_seconds`、`generated_at`。
307
311
 
308
312
  ### license qrcode
@@ -21,8 +21,9 @@ function printQuickstartGuide() {
21
21
  ' # service start 成功后会自动 prepare 并按 AUTO_ON_CONNECTED 进入待发流语义',
22
22
  '',
23
23
  '步骤 3:显式签发 client token(可本地执行,也可由外部系统提供)',
24
- ' export TIRTC_CONN_ACCESS_ID="<ACCESS_ID>"',
25
- ' export TIRTC_CONN_SECRET_KEY="<SECRET_KEY>"',
24
+ ' export TIRTC_ACCESS_KEY_ID="<ACCESS_KEY_ID>"',
25
+ ' export TIRTC_SECRET_KEY_ID="<SECRET_KEY_ID>"',
26
+ ' export TIRTC_APP_ID="<APP_ID>"',
26
27
  ' node products/cli/bin/tirtc-devtools-cli.js --json token issue "<REMOTE_ID>" --endpoint "<ENDPOINT>"',
27
28
  '',
28
29
  '步骤 4:启动 client 本地 web preview',
@@ -11,7 +11,7 @@ const media_assets_1 = require("./media_assets");
11
11
  const token_command_1 = require("./token_command");
12
12
  const transport_1 = require("./transport");
13
13
  const progress_1 = require("./progress");
14
- const CLI_VERSION = '0.0.12';
14
+ const CLI_VERSION = '0.0.13';
15
15
  const HOST_VERSION = '1.0.0';
16
16
  const PROTOCOL_VERSION = '1.0.0';
17
17
  if (process.argv.includes('--version') || process.argv.includes('-V')) {
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.registerTokenCommands = registerTokenCommands;
4
4
  const facade_1 = require("./facade");
5
5
  const token_tool_1 = require("./token_tool");
6
- const kTokenIssueAccessIdEnvVar = 'TIRTC_CONN_ACCESS_ID';
7
- const kTokenIssueSecretKeyEnvVar = 'TIRTC_CONN_SECRET_KEY';
6
+ const kTokenIssueAccessKeyIdEnvVar = 'TIRTC_ACCESS_KEY_ID';
7
+ const kTokenIssueSecretKeyIdEnvVar = 'TIRTC_SECRET_KEY_ID';
8
+ const kTokenIssueAppIdEnvVar = 'TIRTC_APP_ID';
8
9
  function normalizeTokenCommandError(error) {
9
10
  if (error instanceof Error) {
10
11
  return {
@@ -45,7 +46,16 @@ function printTokenCommandError(error, options) {
45
46
  }
46
47
  async function runTokenIssue(params, options) {
47
48
  try {
48
- const result = await (0, token_tool_1.issueTokenWithQrcode)(params);
49
+ const result = await (0, token_tool_1.issueTokenWithQrcode)({
50
+ accessId: params.accessKeyId,
51
+ secretKey: params.secretKeyId,
52
+ appId: params.appId,
53
+ remoteId: params.remoteId,
54
+ openapiEndpoint: params.openapiEndpoint,
55
+ endpoint: params.endpoint,
56
+ qrErrorCorrectionLevel: params.qrErrorCorrectionLevel,
57
+ asciiMaxColumns: params.asciiMaxColumns,
58
+ });
49
59
  if (options.json) {
50
60
  console.log(JSON.stringify({
51
61
  code: 0,
@@ -90,7 +100,7 @@ async function runLicenseQrcode(params, options) {
90
100
  return printTokenCommandError(error, options);
91
101
  }
92
102
  }
93
- function resolveTokenIssueCredential(explicitValue, envVarName, optionName) {
103
+ function resolveRequiredTokenIssueValue(explicitValue, fieldName, envVarName, optionName) {
94
104
  const normalizedExplicit = explicitValue?.trim();
95
105
  if (normalizedExplicit) {
96
106
  return normalizedExplicit;
@@ -99,7 +109,7 @@ function resolveTokenIssueCredential(explicitValue, envVarName, optionName) {
99
109
  if (normalizedEnv) {
100
110
  return normalizedEnv;
101
111
  }
102
- throw new Error('missing credential: set environment variable ' + envVarName +
112
+ throw new Error('missing required ' + fieldName + ': set environment variable ' + envVarName +
103
113
  ' or pass ' + optionName + ' explicitly');
104
114
  }
105
115
  async function runTokenIssueFromCli(remoteId, commandOptions, options) {
@@ -124,11 +134,13 @@ async function runTokenIssueFromCli(remoteId, commandOptions, options) {
124
134
  return normalized;
125
135
  };
126
136
  try {
127
- const accessId = resolveTokenIssueCredential(commandOptions.accessId, kTokenIssueAccessIdEnvVar, '--access-id');
128
- const secretKey = resolveTokenIssueCredential(commandOptions.secretKey, kTokenIssueSecretKeyEnvVar, '--secret-key');
137
+ const accessKeyId = resolveRequiredTokenIssueValue(commandOptions.accessKeyId, 'access_key_id', kTokenIssueAccessKeyIdEnvVar, '--access-key-id');
138
+ const secretKeyId = resolveRequiredTokenIssueValue(commandOptions.secretKeyId, 'secret_key_id', kTokenIssueSecretKeyIdEnvVar, '--secret-key-id');
139
+ const appId = resolveRequiredTokenIssueValue(commandOptions.appId, 'app_id', kTokenIssueAppIdEnvVar, '--app-id');
129
140
  return await runTokenIssue({
130
- accessId,
131
- secretKey,
141
+ accessKeyId,
142
+ secretKeyId,
143
+ appId,
132
144
  remoteId,
133
145
  openapiEndpoint: commandOptions.openapiEndpoint,
134
146
  endpoint: commandOptions.endpoint,
@@ -181,9 +193,10 @@ async function runLicenseQrcodeFromCli(license, commandOptions, options) {
181
193
  function registerTokenCommands(program, getCliOptions, runAndExit) {
182
194
  const token = program.command('token').description('Token 工具:签发 token,并输出可直接使用的 JSON 与本地二维码 PNG');
183
195
  token.command('issue <remote_id>')
184
- .description('默认从环境变量读取 access/secret,并基于 remote_id 签发 token')
185
- .option('--access-id <accessId>', '显式 access id;不传时读取 ' + kTokenIssueAccessIdEnvVar)
186
- .option('--secret-key <secretKey>', '显式 secret key;不传时读取 ' + kTokenIssueSecretKeyEnvVar)
196
+ .description('默认从环境变量读取 access_key_id / secret_key_id / app_id,并基于 remote_id 签发 token')
197
+ .option('--access-key-id <accessKeyId>', '显式 access_key_id;不传时读取 ' + kTokenIssueAccessKeyIdEnvVar)
198
+ .option('--secret-key-id <secretKeyId>', '显式 secret_key_id;不传时读取 ' + kTokenIssueSecretKeyIdEnvVar)
199
+ .option('--app-id <appId>', '必填 app_id;不传时读取 ' + kTokenIssueAppIdEnvVar)
187
200
  .option('--openapi-endpoint <url>', '可选 openapi endpoint;传了就透传到底层签发')
188
201
  .option('--endpoint <entry>', '可选 endpoint;传了就写入 payload 与二维码')
189
202
  .option('--qr-error-correction-level <level>', '二维码纠错级别:L/M/Q/H;默认 M')
@@ -1,6 +1,7 @@
1
1
  export type TokenIssueInput = {
2
2
  accessId: string;
3
3
  secretKey: string;
4
+ appId: string;
4
5
  remoteId: string;
5
6
  openapiEndpoint?: string;
6
7
  endpoint?: string;
@@ -8,6 +9,7 @@ export type TokenIssueInput = {
8
9
  asciiMaxColumns?: number;
9
10
  };
10
11
  export type IssuedTokenPayload = {
12
+ app_id: string;
11
13
  remote_id: string;
12
14
  token: string;
13
15
  endpoint?: string;
@@ -214,6 +214,62 @@ function buildIssueTokenHelperSource() {
214
214
  '}',
215
215
  ].join('\n');
216
216
  }
217
+ function parseIssueTokenFailure(message) {
218
+ const matched = message.match(/issue token failed error=(\d+) http_status=(\d+)/i);
219
+ if (!matched) {
220
+ return {};
221
+ }
222
+ const errorCode = Number.parseInt(matched[1] ?? '', 10);
223
+ const httpStatus = Number.parseInt(matched[2] ?? '', 10);
224
+ return {
225
+ errorCode: Number.isNaN(errorCode) ? undefined : errorCode,
226
+ httpStatus: Number.isNaN(httpStatus) ? undefined : httpStatus,
227
+ };
228
+ }
229
+ function isNodeStackNoise(line) {
230
+ return line.startsWith('[eval]:') ||
231
+ line.startsWith('at [eval]') ||
232
+ line.startsWith('at runScriptInThisContext') ||
233
+ line.startsWith('at node:internal/') ||
234
+ line.startsWith('Node.js v');
235
+ }
236
+ function sanitizeIssueTokenFailureText(message) {
237
+ const lines = message
238
+ .split(/\r?\n/)
239
+ .map((line) => line.trim())
240
+ .filter((line) => line.length > 0 && !isNodeStackNoise(line));
241
+ const collapsed = lines.join(' | ');
242
+ if (collapsed.length === 0) {
243
+ return 'token issuing failed';
244
+ }
245
+ return collapsed;
246
+ }
247
+ function formatIssueTokenFailureMessage(message) {
248
+ const parsed = parseIssueTokenFailure(message);
249
+ const detail = sanitizeIssueTokenFailureText(message);
250
+ if (parsed.httpStatus === 200 && parsed.errorCode === 3) {
251
+ return [
252
+ 'token issuing failed: remote service rejected the request.',
253
+ 'Check whether remote_id, access_key_id, secret_key_id, and openapi-endpoint are correct.',
254
+ 'detail: error=3 http_status=200',
255
+ ].join(' ');
256
+ }
257
+ if (parsed.httpStatus !== undefined || parsed.errorCode !== undefined) {
258
+ const detailParts = [];
259
+ if (parsed.errorCode !== undefined) {
260
+ detailParts.push('error=' + parsed.errorCode);
261
+ }
262
+ if (parsed.httpStatus !== undefined) {
263
+ detailParts.push('http_status=' + parsed.httpStatus);
264
+ }
265
+ return [
266
+ 'token issuing failed: remote authentication request was not accepted.',
267
+ 'Check whether remote_id, access_key_id, secret_key_id, and openapi-endpoint are correct.',
268
+ 'detail: ' + detailParts.join(' '),
269
+ ].join(' ');
270
+ }
271
+ return 'token issuing failed: ' + detail;
272
+ }
217
273
  function issueTokenViaSubprocess(addonPath, input) {
218
274
  const result = childProcess.spawnSync(process.execPath, ['-e', buildIssueTokenHelperSource()], {
219
275
  encoding: 'utf8',
@@ -229,7 +285,7 @@ function issueTokenViaSubprocess(addonPath, input) {
229
285
  }
230
286
  if (result.status !== 0) {
231
287
  const details = String(result.stderr || result.stdout || 'issue token subprocess failed').trim();
232
- throw new Error(details || 'issue token subprocess failed');
288
+ throw new Error(formatIssueTokenFailureMessage(details || 'issue token subprocess failed'));
233
289
  }
234
290
  return normalizeIssuedToken(String(result.stdout || ''));
235
291
  }
@@ -295,11 +351,12 @@ async function issueToken(input) {
295
351
  }
296
352
  catch (error) {
297
353
  const message = error instanceof Error ? error.message : String(error);
298
- throw new Error('issue token failed: ' + message);
354
+ throw new Error(message);
299
355
  }
300
356
  }
301
357
  function buildIssuedTokenPayload(input, token) {
302
358
  const payload = {
359
+ app_id: input.appId.trim(),
303
360
  remote_id: input.remoteId,
304
361
  token,
305
362
  };
@@ -381,6 +438,7 @@ async function buildLicenseQrcode(input) {
381
438
  function formatTokenIssueConsoleOutput(output) {
382
439
  const summaryLines = [
383
440
  'Issued Token Summary:',
441
+ ' app_id: ' + output.payload.app_id,
384
442
  ' remote_id: ' + output.payload.remote_id,
385
443
  ' endpoint: ' + (output.payload.endpoint ?? '(omitted)'),
386
444
  ' openapi_endpoint: ' + (output.payload.openapi_endpoint ?? '(omitted)'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tirtc-devtools-cli",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "private": false,
5
5
  "main": "dist/cli/src/index.js",
6
6
  "types": "dist/cli/src/index.d.ts",
@@ -7,25 +7,44 @@ extern "C" {
7
7
 
8
8
  typedef enum TirtcError {
9
9
  TIRTC_ERROR_OK = 0,
10
- TIRTC_ERROR_INVALID_ARGUMENT = 1,
11
- TIRTC_ERROR_NOT_INITIALIZED = 2,
12
- TIRTC_ERROR_INTERNAL = 3,
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,
10
+ TIRTC_ERROR_INVALID_ARGUMENT = 6000,
11
+ TIRTC_ERROR_NOT_INITIALIZED = 6001,
12
+ TIRTC_ERROR_INTERNAL = 6002,
13
+ TIRTC_ERROR_NOT_READY = 6003,
14
+ TIRTC_ERROR_UNSUPPORTED_LOOP_POLICY = 6004,
15
+ TIRTC_ERROR_SOURCE_HASH_MISMATCH = 6005,
16
+ TIRTC_ERROR_ALREADY_STOPPED = 6006,
17
+ TIRTC_ERROR_STOPPED = TIRTC_ERROR_ALREADY_STOPPED,
18
+ TIRTC_ERROR_ALREADY_DESTROYED = 6007,
19
+ TIRTC_ERROR_DESTROYED = TIRTC_ERROR_ALREADY_DESTROYED,
20
+ TIRTC_ERROR_TRANSPORT_INVALID_LICENSE = 6008,
21
+ TIRTC_ERROR_TRANSPORT_TIMEOUT = 6009,
22
+ TIRTC_ERROR_TRANSPORT_BUSY = 6010,
23
+ TIRTC_ERROR_TRANSPORT_CONNECTION_TIMEOUT_CLOSED = 6011,
24
+ TIRTC_ERROR_TRANSPORT_REMOTE_CLOSED = 6012,
25
+ TIRTC_ERROR_TRANSPORT_CONNECTION_OTHER_ERROR = 6013,
26
+ TIRTC_ERROR_TRANSPORT_TOKEN_EXPIRED = 6014,
27
+ TIRTC_ERROR_DUMP_ROOT_UNAVAILABLE = 6015,
28
+ TIRTC_ERROR_DUMP_ALREADY_ACTIVE = 6016,
29
+ TIRTC_ERROR_TRANSPORT_RESOURCE_EXHAUSTED = 6017,
30
+ TIRTC_ERROR_TRANSPORT_SERVER_ERROR = 6018,
31
+ TIRTC_ERROR_TRANSPORT_BACKEND_INTERNAL_ERROR = 6019,
32
+ TIRTC_ERROR_TRANSPORT_NO_SECRET_KEY = 6020,
33
+ TIRTC_ERROR_TRANSPORT_UNEXPECTED_RESPONSE = 6021,
34
+ TIRTC_ERROR_ALREADY_INITIALIZED = 6022,
35
+ TIRTC_ERROR_INVALID_THREAD = 6023,
36
+ TIRTC_ERROR_PERMISSION_DENIED = 6024,
37
+ TIRTC_ERROR_ALREADY_BOUND = 6025,
38
+ TIRTC_ERROR_IN_USE = 6026,
39
+ TIRTC_ERROR_NOT_STARTED = 6027,
40
+ TIRTC_ERROR_NOT_CONNECTED = 6028,
41
+ TIRTC_ERROR_NOT_BOUND = 6029,
42
+ TIRTC_ERROR_NOT_CONFIGURED = 6030,
43
+ TIRTC_ERROR_NOT_OPEN = 6031,
27
44
  } TirtcError;
28
45
 
46
+ const char* tirtc_error_to_string(TirtcError error);
47
+
29
48
  #ifdef __cplusplus
30
49
  }
31
50
  #endif
@@ -1,4 +1,4 @@
1
1
  platform=linux-x64
2
2
  profile=credential
3
- staged_at_utc=2026-04-21T13:44:44Z
3
+ staged_at_utc=2026-04-23T07:10:15Z
4
4
  source_sdk=/workspace/.build/sdk/linux-x64
@@ -55,6 +55,30 @@ typedef struct TirtcAudioOutputOptions {
55
55
  int noise_reduction_level;
56
56
  } TirtcAudioOutputOptions;
57
57
 
58
+ typedef struct TirtcOutputStutterMetrics {
59
+ int session_started;
60
+ uint64_t session_duration_ms;
61
+ uint64_t session_stutter_total_ms;
62
+ uint32_t session_stutter_count;
63
+ uint64_t session_stutter_peak_ms;
64
+ double session_stutter_ratio;
65
+ uint32_t recent_window_duration_ms;
66
+ uint64_t recent_window_stutter_total_ms;
67
+ uint32_t recent_window_stutter_count;
68
+ uint64_t recent_window_stutter_peak_ms;
69
+ double recent_window_stutter_ratio;
70
+ } TirtcOutputStutterMetrics;
71
+
72
+ typedef struct TirtcPendingDurationMetrics {
73
+ uint64_t undecoded_duration_ms;
74
+ uint64_t decoded_duration_ms;
75
+ } TirtcPendingDurationMetrics;
76
+
77
+ typedef struct TirtcAudioOutputMetricsSnapshot {
78
+ TirtcOutputStutterMetrics stutter;
79
+ TirtcPendingDurationMetrics pending;
80
+ } TirtcAudioOutputMetricsSnapshot;
81
+
58
82
  /**
59
83
  * Audio input observer.
60
84
  *
@@ -128,6 +152,9 @@ TirtcError tirtc_audio_output_start_raw_dump(TirtcAudioOutput* output);
128
152
 
129
153
  TirtcError tirtc_audio_output_stop_raw_dump(TirtcAudioOutput* output);
130
154
 
155
+ TirtcError tirtc_metrics_audio_output_get_snapshot(TirtcAudioOutput* output,
156
+ TirtcAudioOutputMetricsSnapshot* out_snapshot);
157
+
131
158
  #ifdef __cplusplus
132
159
  }
133
160
  #endif
@@ -26,6 +26,25 @@ typedef enum TirtcVideoOutputState {
26
26
  TIRTC_VIDEO_OUTPUT_STATE_FAILED = 3,
27
27
  } TirtcVideoOutputState;
28
28
 
29
+ typedef struct TirtcVideoOutputStartupMetrics {
30
+ int has_connect_start;
31
+ int has_connected;
32
+ int has_first_video_input;
33
+ int has_first_video_decoded;
34
+ int has_first_video_rendered;
35
+ uint64_t connect_start_monotonic_ms;
36
+ uint64_t connected_monotonic_ms;
37
+ uint64_t first_video_input_monotonic_ms;
38
+ uint64_t first_video_decoded_monotonic_ms;
39
+ uint64_t first_video_rendered_monotonic_ms;
40
+ } TirtcVideoOutputStartupMetrics;
41
+
42
+ typedef struct TirtcVideoOutputMetricsSnapshot {
43
+ TirtcVideoOutputStartupMetrics startup;
44
+ TirtcOutputStutterMetrics stutter;
45
+ TirtcPendingDurationMetrics pending;
46
+ } TirtcVideoOutputMetricsSnapshot;
47
+
29
48
  typedef struct TirtcVideoInputOptions {
30
49
  TirtcMediaCodec codec;
31
50
 
@@ -127,6 +146,9 @@ TirtcError tirtc_video_output_start_raw_dump(TirtcVideoOutput* output);
127
146
 
128
147
  TirtcError tirtc_video_output_stop_raw_dump(TirtcVideoOutput* output);
129
148
 
149
+ TirtcError tirtc_metrics_video_output_get_snapshot(TirtcVideoOutput* output,
150
+ TirtcVideoOutputMetricsSnapshot* out_snapshot);
151
+
130
152
  #ifdef __cplusplus
131
153
  }
132
154
  #endif
@@ -7,25 +7,44 @@ extern "C" {
7
7
 
8
8
  typedef enum TirtcError {
9
9
  TIRTC_ERROR_OK = 0,
10
- TIRTC_ERROR_INVALID_ARGUMENT = 1,
11
- TIRTC_ERROR_NOT_INITIALIZED = 2,
12
- TIRTC_ERROR_INTERNAL = 3,
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,
10
+ TIRTC_ERROR_INVALID_ARGUMENT = 6000,
11
+ TIRTC_ERROR_NOT_INITIALIZED = 6001,
12
+ TIRTC_ERROR_INTERNAL = 6002,
13
+ TIRTC_ERROR_NOT_READY = 6003,
14
+ TIRTC_ERROR_UNSUPPORTED_LOOP_POLICY = 6004,
15
+ TIRTC_ERROR_SOURCE_HASH_MISMATCH = 6005,
16
+ TIRTC_ERROR_ALREADY_STOPPED = 6006,
17
+ TIRTC_ERROR_STOPPED = TIRTC_ERROR_ALREADY_STOPPED,
18
+ TIRTC_ERROR_ALREADY_DESTROYED = 6007,
19
+ TIRTC_ERROR_DESTROYED = TIRTC_ERROR_ALREADY_DESTROYED,
20
+ TIRTC_ERROR_TRANSPORT_INVALID_LICENSE = 6008,
21
+ TIRTC_ERROR_TRANSPORT_TIMEOUT = 6009,
22
+ TIRTC_ERROR_TRANSPORT_BUSY = 6010,
23
+ TIRTC_ERROR_TRANSPORT_CONNECTION_TIMEOUT_CLOSED = 6011,
24
+ TIRTC_ERROR_TRANSPORT_REMOTE_CLOSED = 6012,
25
+ TIRTC_ERROR_TRANSPORT_CONNECTION_OTHER_ERROR = 6013,
26
+ TIRTC_ERROR_TRANSPORT_TOKEN_EXPIRED = 6014,
27
+ TIRTC_ERROR_DUMP_ROOT_UNAVAILABLE = 6015,
28
+ TIRTC_ERROR_DUMP_ALREADY_ACTIVE = 6016,
29
+ TIRTC_ERROR_TRANSPORT_RESOURCE_EXHAUSTED = 6017,
30
+ TIRTC_ERROR_TRANSPORT_SERVER_ERROR = 6018,
31
+ TIRTC_ERROR_TRANSPORT_BACKEND_INTERNAL_ERROR = 6019,
32
+ TIRTC_ERROR_TRANSPORT_NO_SECRET_KEY = 6020,
33
+ TIRTC_ERROR_TRANSPORT_UNEXPECTED_RESPONSE = 6021,
34
+ TIRTC_ERROR_ALREADY_INITIALIZED = 6022,
35
+ TIRTC_ERROR_INVALID_THREAD = 6023,
36
+ TIRTC_ERROR_PERMISSION_DENIED = 6024,
37
+ TIRTC_ERROR_ALREADY_BOUND = 6025,
38
+ TIRTC_ERROR_IN_USE = 6026,
39
+ TIRTC_ERROR_NOT_STARTED = 6027,
40
+ TIRTC_ERROR_NOT_CONNECTED = 6028,
41
+ TIRTC_ERROR_NOT_BOUND = 6029,
42
+ TIRTC_ERROR_NOT_CONFIGURED = 6030,
43
+ TIRTC_ERROR_NOT_OPEN = 6031,
27
44
  } TirtcError;
28
45
 
46
+ const char* tirtc_error_to_string(TirtcError error);
47
+
29
48
  #ifdef __cplusplus
30
49
  }
31
50
  #endif
@@ -43,6 +43,45 @@ typedef struct TirtcMediaDownlinkVideoObserver {
43
43
  void* user_data);
44
44
  } TirtcMediaDownlinkVideoObserver;
45
45
 
46
+ typedef struct TirtcMediaDownlinkStutterMetricsSnapshot {
47
+ int session_started;
48
+ uint64_t session_duration_ms;
49
+ uint64_t session_stutter_total_ms;
50
+ uint32_t session_stutter_count;
51
+ uint64_t session_stutter_peak_ms;
52
+ double session_stutter_ratio;
53
+ uint32_t recent_window_duration_ms;
54
+ uint64_t recent_window_stutter_total_ms;
55
+ uint32_t recent_window_stutter_count;
56
+ uint64_t recent_window_stutter_peak_ms;
57
+ double recent_window_stutter_ratio;
58
+ } TirtcMediaDownlinkStutterMetricsSnapshot;
59
+
60
+ typedef struct TirtcMediaDownlinkPendingMetricsSnapshot {
61
+ uint64_t undecoded_pending_duration_ms;
62
+ uint64_t decoded_pending_duration_ms;
63
+ } TirtcMediaDownlinkPendingMetricsSnapshot;
64
+
65
+ typedef struct TirtcMediaDownlinkAudioMetricsSnapshot {
66
+ TirtcMediaDownlinkStutterMetricsSnapshot stutter;
67
+ TirtcMediaDownlinkPendingMetricsSnapshot pending;
68
+ } TirtcMediaDownlinkAudioMetricsSnapshot;
69
+
70
+ typedef struct TirtcMediaDownlinkVideoStartupMetricsSnapshot {
71
+ int has_first_video_input;
72
+ int has_first_video_decoded;
73
+ int has_first_video_rendered;
74
+ uint64_t first_video_input_monotonic_ms;
75
+ uint64_t first_video_decoded_monotonic_ms;
76
+ uint64_t first_video_rendered_monotonic_ms;
77
+ } TirtcMediaDownlinkVideoStartupMetricsSnapshot;
78
+
79
+ typedef struct TirtcMediaDownlinkVideoMetricsSnapshot {
80
+ TirtcMediaDownlinkVideoStartupMetricsSnapshot startup;
81
+ TirtcMediaDownlinkStutterMetricsSnapshot stutter;
82
+ TirtcMediaDownlinkPendingMetricsSnapshot pending;
83
+ } TirtcMediaDownlinkVideoMetricsSnapshot;
84
+
46
85
  TirtcError tirtc_media_downlink_audio_create(TirtcMediaDownlinkAudio** out_downlink);
47
86
  void tirtc_media_downlink_audio_retain(TirtcMediaDownlinkAudio* downlink);
48
87
  void tirtc_media_downlink_audio_release(TirtcMediaDownlinkAudio* downlink);
@@ -94,6 +133,14 @@ TirtcError tirtc_media_downlink_video_start_raw_dump(TirtcMediaDownlinkVideo* do
94
133
  const char* prefix);
95
134
  TirtcError tirtc_media_downlink_video_stop_raw_dump(TirtcMediaDownlinkVideo* downlink);
96
135
 
136
+ TirtcError tirtc_media_downlink_audio_get_metrics_snapshot(
137
+ TirtcMediaDownlinkAudio* downlink, TirtcMediaDownlinkAudioMetricsSnapshot* out_snapshot);
138
+ void tirtc_media_downlink_audio_reset_metrics_session(TirtcMediaDownlinkAudio* downlink);
139
+
140
+ TirtcError tirtc_media_downlink_video_get_metrics_snapshot(
141
+ TirtcMediaDownlinkVideo* downlink, TirtcMediaDownlinkVideoMetricsSnapshot* out_snapshot);
142
+ void tirtc_media_downlink_video_reset_metrics_session(TirtcMediaDownlinkVideo* downlink);
143
+
97
144
  #ifdef __cplusplus
98
145
  }
99
146
  #endif
@@ -81,6 +81,13 @@ typedef struct TirtcConnCommand {
81
81
  size_t length;
82
82
  } TirtcConnCommand;
83
83
 
84
+ typedef struct TirtcConnMetricsSnapshot {
85
+ int has_connect_start;
86
+ int has_connected;
87
+ uint64_t connect_start_monotonic_ms;
88
+ uint64_t connected_monotonic_ms;
89
+ } TirtcConnMetricsSnapshot;
90
+
84
91
  /** Heap-owned byte payload allocated by facade callback dispatch. */
85
92
  typedef struct TirtcOwnedBytes {
86
93
  /** Payload buffer allocated by facade, or `NULL` for zero-length payloads. */
@@ -168,6 +175,9 @@ void tirtc_owned_string_release(TirtcOwnedString* owned);
168
175
 
169
176
  TirtcError tirtc_conn_send_command(TirtcConn* connection, const TirtcConnCommand* command);
170
177
 
178
+ TirtcError tirtc_metrics_conn_get_snapshot(TirtcConn* connection,
179
+ TirtcConnMetricsSnapshot* out_snapshot);
180
+
171
181
  #ifdef __cplusplus
172
182
  }
173
183
  #endif
@@ -1,9 +1,9 @@
1
1
  platform=macos-arm64
2
2
  profile=credential
3
- staged_at_utc=2026-04-21T13:44:23Z
3
+ staged_at_utc=2026-04-23T07:09:53Z
4
4
  source_sdk=/Users/allenfeng/Development/Repositories/tirtc-nexus/tirtc-matrix/.build/sdk/macos-arm64
5
5
 
6
- bfea7c19fdc3f25680946a575db9b3e60e8cd2b3fe1ddde8c7c93b57a6a3902c include/tirtc/audio.h
6
+ 959ad21722979cf6a26ab90aaa32102d2496cc4bf7eed33c29da5c752d0c9893 include/tirtc/audio.h
7
7
  6d972ccfe150a3b4f2d7f18fa92b3ade9210c1c8bb754d061ac6b7997b59e2cb include/tirtc/audio_codec.h
8
8
  7bacbdb2d8bb10d6444036a8fef42f2a8e3ea34dfc38e165ee678d61f189db41 include/tirtc/audio_frame.h
9
9
  84f1bbe67efa15ab3b2d995d661025aac43e2fe547a14a012a24d89cfe3cb859 include/tirtc/audio_io.h
@@ -13,20 +13,20 @@ c2e1f31dcc75be461c577d18b1cebe32774f212d51cb4dd2a5b5a9bfe62b693e include/tirtc/
13
13
  51cbc911fe9f9834046f0e0a1a7cdd814a8e194a615894a8b4d11f9e5f095610 include/tirtc/audio_io_windows.h
14
14
  21f60729117260a44af22c1af986ef17d22673b102b7b7a035f492d0665cce16 include/tirtc/audio_processing.h
15
15
  0ca7c3c630b1242f51a0fd8154097c0a332b4c816a5707090e4381719852998c include/tirtc/audio_sample_rate.h
16
- 339508d784d3114dd3cbf14ad90dd6345d633ec647ca0f9bb8942eb1b83533b2 include/tirtc/av.h
16
+ 42a84eb93594b9e30d98ebd2eaf829b023a0f45433cd487a523c171f0dd4ced1 include/tirtc/av.h
17
17
  4198c95c48ae579d1c782635b00fa5c9009d0c56ba466e6e3873e8298faae029 include/tirtc/credential.h
18
- d29f24fc665d01ab45f993c06c09fccca2bd5c844250ddbdc3c9d8d0c8548803 include/tirtc/error.h
18
+ fbab0b33a735aedd07284a4f1f839bd3a6613707830a18487cad5596dd47d529 include/tirtc/error.h
19
19
  ae805545a9515edc9b94262e72ad2c7b7d649288166f4daeb450d8a55e82ae0b include/tirtc/foundation/build_info.h
20
20
  7cf8b372a3d48d4de4a65a04c7f102281a7b42cebb9ec247853d3c53afb63b6a include/tirtc/http.h
21
21
  70bbf93b84d9d1a85f376d9986de570c1f658319e1e5ab6d621f7a4d41033f5c include/tirtc/logging.h
22
22
  7e2f7f81afe37e22f5414d9db32438edd948ff775230c3a0a17ff9ac1a0b560e include/tirtc/media_codec.h
23
- 3fa1d5fe3c3c2644d134e13678cbf5562440a2c5d4a652dc24bf9f124731509a include/tirtc/media_downlink.h
23
+ b541637a57758af98f87700ec3e929edcaa064ca7604ab45dd292ea5ad48f647 include/tirtc/media_downlink.h
24
24
  21ef53b4d120aab600168c4082e7622c791ab4929fb20b3fb31f73ed01eee02a include/tirtc/media_fixture_av_sync.h
25
25
  037d9a581cef71afe9233456b1f4ef866c3739150532f3c30a67d361e8af9eef include/tirtc/media_fixture_source.h
26
26
  a4f8ab44c1a20ad37f250363a403a9d4d007e61ddb2426c7966dbc05f6a04b4f include/tirtc/media_live_source.h
27
27
  1b3be6954e547f91a047866438bff1820c8406afaf91cef68ddee29a6ac70234 include/tirtc/media_uplink.h
28
28
  26b831c7b8bd69b7699017427f3243cd22393c90c9518a820f5eb87eb3792483 include/tirtc/transport.h
29
- 185183a736774cdf737504c091e4648d7f476c16abf18ee8c8ac0da2eb9a5c79 include/tirtc/trp.h
29
+ f664c51d7df17b50f27f64d489c74d0647624b5cce1493b3df90bb6b508bf0ca include/tirtc/trp.h
30
30
  dff5b0a0ac4a40ad17c93e1e56b3c416371c81ab365e287ea8cd6ce37ccbed3b include/tirtc/video_codec.h
31
31
  e51379666c199588cc33279ccf52248035d1cae3d1d468b1615ebf29f0b39c9c include/tirtc/video_frame.h
32
32
  d920afad955b9f206b02b19ca152315190fa84ab6f24e895a5b24c3ab9ffd701 include/tirtc/video_io.h
@@ -39,14 +39,14 @@ cae0bbeb884e5466a56da15182c78cc22baab6c743f349a58d3595f623333585 include/tirtc/
39
39
  8db86d6714264047e8fd4086ddd7315722d675749719e6175f89eb5a636b48a1 lib/libTiRTC.a
40
40
  b39daee6a3d39bf0ca20c45084601133c4198de8dca848dcff6dd9c70ae99016 lib/libcrypto.a
41
41
  c052857ef315e3d61db9c862cad10709a3a6b2487dc41799cbe4d74a805de875 lib/libcrypto.dylib
42
- a3cbd2372889b96346fb211846de94edb5ec7f5d15af02a150c3c24efb999187 lib/libmatrix_runtime_audio.a
43
- 012cf0bd9aaa49fe42a43de19edddb01b654df741a0f5782568c52f0d3c8dfbb lib/libmatrix_runtime_credential.a
44
- 75554a31b1c99be83d22f168de91584f19dc9ee69a13fe8b62d5dfdab6baf016 lib/libmatrix_runtime_facade.a
45
- a5235f14059d7807968353b32cefcddbebec2cc5808912898078a6c6cf9bdd50 lib/libmatrix_runtime_foundation_http.a
46
- dcb14497951c566352cf4b14a7b870872069824d6a2a067bfe5b421fc6500216 lib/libmatrix_runtime_foundation_logging.a
47
- 1b1b7980f498b603132bf11dce7d24f60bdc8a11d6a0ac916c4454dde4ebbc3f lib/libmatrix_runtime_media.a
48
- 6d6bf7d07cc35df568582218193487235452ef47dd736f36d7de3c95ac1bde18 lib/libmatrix_runtime_transport.a
49
- 0abee197077a906f6af3f5e05c72bcfe5b874478b65ad454b3013ab9df398af1 lib/libmatrix_runtime_video.a
42
+ 797a8b58938be816650925cbec1a947e5765464625326a1a57ac66c9328b64f4 lib/libmatrix_runtime_audio.a
43
+ b822f5666456bbc62d17dfc3585a75c9bbfda07f3f768c74e3fed457f945422e lib/libmatrix_runtime_credential.a
44
+ d42e207ee2f1ab2233a30cfd0294ef8bb467c1d9c7c21a01f74d4422aab32c1d lib/libmatrix_runtime_facade.a
45
+ 8c4f3e214392b4542cee913221ab27f75618da4e4caecb22874cb7cc06659ace lib/libmatrix_runtime_foundation_http.a
46
+ 0672955c878a537a94d9ffd7089add8fe226bcecb2fd192929a28f69a8915f0e lib/libmatrix_runtime_foundation_logging.a
47
+ fea63056a3c41fa9055cd537dc9e7b0203d8411a3084f63d9b6623349eff1ec6 lib/libmatrix_runtime_media.a
48
+ d5fffd76c16881c68d984284c8bb6872d5df71ec7e3f2c345ee8cf7dd7aa5d35 lib/libmatrix_runtime_transport.a
49
+ f2b3fcca7d07c10fec6bd01ba18adabedd3e68489a7ef5786bf8d2bb85148d25 lib/libmatrix_runtime_video.a
50
50
  c11c65d373a127028350c41fa58cd2d1223f2b5d70a84e13b115d90daaba25ca lib/libssl.a
51
51
  ef1c1104bbdd2528ed7b958fb7252bd6249875f92300b0c9577d6c4bd6c0d88a lib/libssl.dylib
52
52
  e14e846e43d64e240fa0e5745bf4e702b79d0f2442e7f768beb990610735c71b lib/libtgrtc.dylib
@@ -1,11 +1,8 @@
1
1
  export type AutoTokenIssueOptions = {
2
- openapiEntry?: string;
2
+ openapiEndpoint?: string;
3
3
  accessId: string;
4
4
  secretKey: string;
5
- localId: string;
6
- peerId: string;
7
- userTtlSeconds?: number;
8
- channelTtlSeconds?: number;
5
+ remoteId: string;
9
6
  };
10
7
  type RuntimeCredentialTokenIssuerOptions = {
11
8
  repoRoot: string;
@@ -95,13 +95,10 @@ class RuntimeCredentialTokenIssuer {
95
95
  let token;
96
96
  try {
97
97
  token = binding.issueToken({
98
- openapiEntry: options.openapiEntry,
98
+ openapiEndpoint: options.openapiEndpoint,
99
99
  accessId: options.accessId,
100
100
  secretKey: options.secretKey,
101
- localId: options.localId,
102
- peerId: options.peerId,
103
- userTtlSeconds: options.userTtlSeconds,
104
- channelTtlSeconds: options.channelTtlSeconds,
101
+ remoteId: options.remoteId,
105
102
  });
106
103
  }
107
104
  catch (error) {