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
@@ -22,8 +22,8 @@ extern "C" {
22
22
  * 2. Either start a service with ::tirtc_conn_service_start, or create a
23
23
  * standalone connection with ::tirtc_conn_create and then connect it with
24
24
  * ::tirtc_conn_connect.
25
- * 3. Install observers if the caller needs connection, command, or stream
26
- * callbacks.
25
+ * 3. Install callbacks if the caller needs connection, command, or stream
26
+ * events.
27
27
  * 4. Exchange stream messages and commands while the connection is alive.
28
28
  * 5. Explicitly close resources with the matching stop, disconnect, destroy,
29
29
  * and uninit calls.
@@ -104,7 +104,7 @@ typedef enum TirtcMediaSendPolicy {
104
104
  * @brief Options for starting a service-side connection listener.
105
105
  *
106
106
  * A service accepts inbound transport connections and exposes them through
107
- * ::TirtcConnServiceObserver.on_connected.
107
+ * ::TirtcConnServiceCallbacks.on_connected.
108
108
  */
109
109
  typedef struct TirtcConnServiceStartOptions {
110
110
  /**
@@ -155,16 +155,16 @@ typedef struct TirtcConnConnectOptions {
155
155
  } TirtcConnConnectOptions;
156
156
 
157
157
  /**
158
- * @brief Optional observer bound when a connection object is created.
158
+ * @brief Optional callbacks bound when a connection object is created.
159
159
  *
160
- * The implementation copies the observer structure and stores the supplied
160
+ * The implementation copies the callback table and stores the supplied
161
161
  * user_data pointer with the created connection handle.
162
162
  */
163
163
  typedef struct TirtcConnCreateOptions {
164
- /** @brief Optional observer copied into the new connection object. */
165
- const struct TirtcConnObserver* observer;
164
+ /** @brief Optional callbacks copied into the new connection object. */
165
+ const struct TirtcConnCallbacks* callbacks;
166
166
 
167
- /** @brief Opaque pointer returned to observer callbacks. */
167
+ /** @brief Opaque pointer returned to connection callbacks. */
168
168
  void* user_data;
169
169
  } TirtcConnCreateOptions;
170
170
 
@@ -174,13 +174,13 @@ typedef struct TirtcConnService TirtcConnService;
174
174
  /**
175
175
  * @brief Opaque connection handle.
176
176
  *
177
- * A handle may come from either ::tirtc_conn_create or a service observer's
178
- * ::TirtcConnServiceObserver.on_connected callback.
177
+ * A handle may come from either ::tirtc_conn_create or a service callback's
178
+ * ::TirtcConnServiceCallbacks.on_connected callback.
179
179
  */
180
180
  typedef struct TirtcConn TirtcConn;
181
181
 
182
182
  /**
183
- * @brief High-level connection state reported through ::TirtcConnObserver.
183
+ * @brief High-level connection state reported through ::TirtcConnCallbacks.
184
184
  */
185
185
  typedef enum TirtcConnState {
186
186
  /** Connection exists but has not started connecting yet. */
@@ -196,29 +196,6 @@ typedef enum TirtcConnState {
196
196
  TIRTC_CONN_STATE_DISCONNECTED = 3,
197
197
  } TirtcConnState;
198
198
 
199
- /**
200
- * @brief Reason associated with a disconnected connection.
201
- */
202
- typedef enum TirtcConnDisconnectReason {
203
- /** The implementation could not determine a more specific reason. */
204
- TIRTC_CONN_DISCONNECT_REASON_UNKNOWN = 0,
205
-
206
- /** The local side closed the connection intentionally. */
207
- TIRTC_CONN_DISCONNECT_REASON_LOCAL_CLOSED = 1,
208
-
209
- /** The remote side closed the connection. */
210
- TIRTC_CONN_DISCONNECT_REASON_REMOTE_CLOSED = 2,
211
-
212
- /** Initial connection setup failed. */
213
- TIRTC_CONN_DISCONNECT_REASON_CONNECT_FAILED = 3,
214
-
215
- /** Descriptor exchange or validation failed. */
216
- TIRTC_CONN_DISCONNECT_REASON_INVALID_DESCRIPTOR = 4,
217
-
218
- /** The underlying transport backend reported an internal failure. */
219
- TIRTC_CONN_DISCONNECT_REASON_BACKEND_ERROR = 5,
220
- } TirtcConnDisconnectReason;
221
-
222
199
  /**
223
200
  * @brief Binary stream-message payload.
224
201
  *
@@ -242,23 +219,14 @@ typedef struct TirtcStreamMessage {
242
219
  } TirtcStreamMessage;
243
220
 
244
221
  /**
245
- * @brief Fire-and-forget command payload.
246
- *
247
- * Command identifiers are application-defined and must be agreed with the
248
- * remote peer.
222
+ * @brief Application-defined command payload.
249
223
  *
250
- * The current runtime accepts application command ids in the range
251
- * `[0x1000, 0x7FFF]`. Values below `0x1000` are reserved for
252
- * runtime-internal commands and must not be used by consumers.
224
+ * command is an opaque raw 32-bit value. The facade forwards it unchanged to
225
+ * and from the underlying transport backend.
253
226
  */
254
227
  typedef struct TirtcConnCommand {
255
- /**
256
- * @brief Application-defined command identifier agreed with the remote peer.
257
- *
258
- * A request and its reply typically reuse the same ::command_id, while the
259
- * per-request correlation is carried separately by ::remote_request_id.
260
- */
261
- uint16_t command_id;
228
+ /** @brief Opaque raw 32-bit command word agreed with the remote peer. */
229
+ uint32_t command;
262
230
 
263
231
  /** @brief Payload bytes, or NULL when ::length is zero. */
264
232
  const void* data;
@@ -268,99 +236,13 @@ typedef struct TirtcConnCommand {
268
236
  } TirtcConnCommand;
269
237
 
270
238
  /**
271
- * @brief Request payload for an asynchronous command round-trip.
272
- *
273
- * Command identifiers are application-defined and must be agreed with the
274
- * remote peer.
275
- *
276
- * The current runtime accepts application command ids in the range
277
- * `[0x1000, 0x7FFF]`. Values below `0x1000` are reserved for
278
- * runtime-internal commands and must not be used by consumers.
279
- */
280
- typedef struct TirtcConnCommandRequest {
281
- /**
282
- * @brief Application-defined command identifier agreed with the remote peer.
283
- *
284
- * In the common request-response pattern, the responder echoes the same
285
- * ::command_id back in ::TirtcConnCommandResponse.
286
- */
287
- uint16_t command_id;
288
-
289
- /** @brief Payload bytes, or NULL when ::length is zero. */
290
- const void* data;
291
-
292
- /** @brief Payload size in bytes. */
293
- size_t length;
294
-
295
- /**
296
- * @brief Response timeout in milliseconds.
297
- *
298
- * A value of zero is currently treated as a minimal non-zero timeout rather
299
- * than an infinite wait.
300
- */
301
- uint32_t timeout_ms;
302
- } TirtcConnCommandRequest;
303
-
304
- /**
305
- * @brief Response payload returned by a remote peer or local reply logic.
306
- *
307
- * Command identifiers are application-defined and must be agreed with the
308
- * remote peer.
309
- *
310
- * The current runtime accepts application command ids in the range
311
- * `[0x1000, 0x7FFF]`. Values below `0x1000` are reserved for
312
- * runtime-internal commands and must not be used by consumers.
313
- */
314
- typedef struct TirtcConnCommandResponse {
315
- /**
316
- * @brief Application-defined command identifier agreed with the remote peer.
317
- *
318
- * This usually matches the original request's ::command_id.
319
- */
320
- uint16_t command_id;
321
-
322
- /** @brief Payload bytes, or NULL when ::length is zero. */
323
- const void* data;
324
-
325
- /** @brief Payload size in bytes. */
326
- size_t length;
327
- } TirtcConnCommandResponse;
328
-
329
- /**
330
- * @brief Completion callback used by ::tirtc_conn_request_command.
331
- *
332
- * The callback may complete because of a successful response, a send failure,
333
- * a timeout, or a disconnect. The callback is not invoked after the connection
334
- * has been destroyed.
335
- *
336
- * Delivery may be synchronous or asynchronous:
337
- * - If request submission fails immediately, the callback may run before
338
- * ::tirtc_conn_request_command returns.
339
- * - After request submission succeeds, completion is reported later from the
340
- * transport or timeout path.
341
- *
342
- * Callers must not assume a fixed callback thread, and must write callback
343
- * logic so it is safe for reentrant delivery relative to
344
- * ::tirtc_conn_request_command and other connection callbacks.
345
- *
346
- * @param connection Connection that owns the request.
347
- * @param error Completion status.
348
- * @param response Non-NULL only when a response payload is available.
349
- * @param user_data Opaque pointer originally passed to
350
- * ::tirtc_conn_request_command.
351
- */
352
- typedef void (*TirtcConnCommandResponseFn)(TirtcConn* connection, TirtcError error,
353
- const TirtcConnCommandResponse* response,
354
- void* user_data);
355
-
356
- /**
357
- * @brief Optional observer for service lifecycle and accepted connections.
239
+ * @brief Optional callbacks for service lifecycle and accepted connections.
358
240
  *
359
241
  * The implementation copies this structure when the service starts. The
360
242
  * structure itself does not need to remain alive after
361
243
  * ::tirtc_conn_service_start returns.
362
244
  */
363
- typedef struct TirtcConnServiceObserver {
245
+ typedef struct TirtcConnServiceCallbacks {
364
246
  /** @brief Called after the service has started successfully. */
365
247
  void (*on_started)(TirtcConnService* service, void* user_data);
366
248
 
@@ -375,7 +257,7 @@ typedef struct TirtcConnServiceObserver {
375
257
  *
376
258
  * The runtime will not dispatch other user-facing callbacks for that
377
259
  * accepted connection until this callback returns. Callers that need full
378
- * callback coverage should install the connection observer synchronously
260
+ * callback coverage should install the connection callbacks synchronously
379
261
  * inside this callback before returning.
380
262
  */
381
263
  void (*on_connected)(TirtcConnService* service, TirtcConn* connection, void* user_data);
@@ -385,10 +267,10 @@ typedef struct TirtcConnServiceObserver {
385
267
  */
386
268
  void (*on_error)(TirtcConnService* service, TirtcError error, const char* message,
387
269
  void* user_data);
388
- } TirtcConnServiceObserver;
270
+ } TirtcConnServiceCallbacks;
389
271
 
390
272
  /**
391
- * @brief Optional observer for connection lifecycle and control-plane events.
273
+ * @brief Optional callbacks for connection lifecycle and control-plane events.
392
274
  *
393
275
  * The implementation stores a copy of this structure inside the owning
394
276
  * connection object.
@@ -398,35 +280,20 @@ typedef struct TirtcConnServiceObserver {
398
280
  * visible to the caller, while others may arrive asynchronously from the
399
281
  * internal transport layer.
400
282
  */
401
- typedef struct TirtcConnObserver {
283
+ typedef struct TirtcConnCallbacks {
402
284
  /** @brief Called when the connection state changes or is replayed. */
403
- void (*on_state_changed)(TirtcConn* connection, TirtcConnState state, void* user_data);
285
+ void (*on_state_changed)(TirtcConn* connection, TirtcConnState state, TirtcError error,
286
+ void* user_data);
404
287
 
405
- /**
406
- * @brief Called when the connection enters DISCONNECTED, or when that
407
- * terminal state is replayed to a newly installed observer.
408
- */
409
- void (*on_disconnected)(TirtcConn* connection, TirtcConnDisconnectReason reason, void* user_data);
410
-
411
- /**
412
- * @brief Called for an inbound command request that expects a reply.
413
- *
414
- * The supplied ::remote_request_id remains valid only while the request is
415
- * still pending on this connection. In the common case, reply exactly once
416
- * with ::tirtc_conn_reply_remote_command.
417
- */
418
- void (*on_remote_command_request)(TirtcConn* connection, uint64_t remote_request_id,
419
- const TirtcConnCommand* command, void* user_data);
288
+ /** @brief Called when an application-defined command is received. */
289
+ void (*on_command)(TirtcConn* connection, const TirtcConnCommand* command, void* user_data);
420
290
 
421
291
  /**
422
292
  * @brief Called when an application-defined stream message is received.
423
293
  */
424
294
  void (*on_stream_message)(TirtcConn* connection, uint8_t stream_id,
425
295
  const TirtcStreamMessage* message, void* user_data);
426
-
427
- /** @brief Called when the transport reports an error for this connection. */
428
- void (*on_error)(TirtcConn* connection, TirtcError error, const char* message, void* user_data);
429
- } TirtcConnObserver;
296
+ } TirtcConnCallbacks;
430
297
 
431
298
  /**
432
299
  * @brief Initialize the global runtime.
@@ -457,13 +324,13 @@ void tirtc_uninit(void);
457
324
  *
458
325
  * @param options Non-NULL start options with a non-empty license and a non-zero
459
326
  * max_connections.
460
- * @param observer Optional observer copied by value.
461
- * @param user_data Opaque pointer returned to observer callbacks.
327
+ * @param observer Optional callback table copied by value.
328
+ * @param user_data Opaque pointer returned to service callbacks.
462
329
  * @param out_service Receives the created service handle on success.
463
330
  * @return ::TIRTC_ERROR_OK on success.
464
331
  */
465
332
  TirtcError tirtc_conn_service_start(const TirtcConnServiceStartOptions* options,
466
- const TirtcConnServiceObserver* observer, void* user_data,
333
+ const TirtcConnServiceCallbacks* observer, void* user_data,
467
334
  TirtcConnService** out_service);
468
335
 
469
336
  /**
@@ -484,32 +351,33 @@ TirtcError tirtc_conn_service_stop(TirtcConnService* service);
484
351
  * The runtime must already be initialized. The returned handle starts in
485
352
  * ::TIRTC_CONN_STATE_IDLE and must be released with ::tirtc_conn_destroy.
486
353
  *
487
- * The observer, when provided, becomes part of the connection object's stable
354
+ * The callbacks, when provided, become part of the connection object's stable
488
355
  * lifecycle contract. After creation succeeds, reconnects on the same handle
489
- * keep using that observer.
356
+ * keep using that callback table.
490
357
  *
491
358
  * @param options Optional creation options. Pass NULL to create a connection
492
- * without an observer.
359
+ * without callbacks.
493
360
  * @param out_connection Receives the created connection handle on success.
494
361
  * @return ::TIRTC_ERROR_OK on success.
495
362
  */
496
363
  TirtcError tirtc_conn_create(const TirtcConnCreateOptions* options, TirtcConn** out_connection);
497
364
 
498
365
  /**
499
- * @brief Install, replace, or clear the connection observer.
366
+ * @brief Install, replace, or clear the connection callbacks.
500
367
  *
501
- * This legacy API remains available for accepted service connections and
502
- * existing consumers that still bind observers after handle creation.
503
- * New standalone-connection callers should prefer binding the observer through
368
+ * This API remains available for accepted service connections and existing
369
+ * consumers that still bind callbacks after handle creation. New
370
+ * standalone-connection callers should prefer binding callbacks through
504
371
  * ::TirtcConnCreateOptions.
505
372
  *
506
- * Passing NULL for ::observer clears the current observer and its user data.
507
- * After a non-NULL observer is installed, the implementation immediately
508
- * replays the current state and, when applicable, the terminal disconnected
509
- * callback.
373
+ * Passing NULL for ::callbacks clears the current callbacks and their user
374
+ * data. After non-NULL callbacks are installed, the implementation
375
+ * immediately replays the current state through ::on_state_changed. When the
376
+ * current state is ::TIRTC_CONN_STATE_DISCONNECTED, the replayed callback also
377
+ * carries the final disconnect error.
510
378
  */
511
- TirtcError tirtc_conn_set_observer(TirtcConn* connection, const TirtcConnObserver* observer,
512
- void* user_data);
379
+ TirtcError tirtc_conn_set_callbacks(TirtcConn* connection, const TirtcConnCallbacks* callbacks,
380
+ void* user_data);
513
381
 
514
382
  /**
515
383
  * @brief Connect a standalone connection handle to a remote peer.
@@ -568,10 +436,9 @@ TirtcError tirtc_conn_send_stream_message(TirtcConn* connection, uint8_t stream_
568
436
  /**
569
437
  * @brief Send an application-defined command without waiting for a response.
570
438
  *
571
- * Choose ::TirtcConnCommand.command_id from the command ids agreed with the
572
- * remote peer. The current runtime accepts application command ids in
573
- * `[0x1000, 0x7FFF]`; values below `0x1000` are reserved for
574
- * runtime-internal commands.
439
+ * The facade treats ::TirtcConnCommand.command as an opaque raw 32-bit value.
440
+ * Any request/reply correlation is owned by the caller's higher-level
441
+ * protocol, not by the standard facade contract.
575
442
  *
576
443
  * @param connection Target connection.
577
444
  * @param command Non-NULL command payload.
@@ -579,50 +446,6 @@ TirtcError tirtc_conn_send_stream_message(TirtcConn* connection, uint8_t stream_
579
446
  */
580
447
  TirtcError tirtc_conn_send_command(TirtcConn* connection, const TirtcConnCommand* command);
581
448
 
582
- /**
583
- * @brief Send an application-defined request command and complete it
584
- * asynchronously.
585
- *
586
- * Choose ::TirtcConnCommandRequest.command_id from the command ids agreed
587
- * with the remote peer. The current runtime accepts application command
588
- * ids in `[0x1000, 0x7FFF]`; values below `0x1000` are reserved for
589
- * runtime-internal commands.
590
- *
591
- * Callback delivery is mixed synchronous/asynchronous. If request submission
592
- * fails immediately after the facade has accepted the request, ::callback may
593
- * run before this function returns. After request submission succeeds,
594
- * completion is reported later from the response, timeout, or disconnect path.
595
- *
596
- * Once this call returns ::TIRTC_ERROR_OK, expect exactly one completion
597
- * callback unless the connection is destroyed first.
598
- *
599
- * @param connection Target connection.
600
- * @param request Non-NULL request payload.
601
- * @param callback Completion callback invoked for response, timeout, send
602
- * failure, or disconnect.
603
- * @param user_data Opaque pointer returned to ::callback.
604
- * @return ::TIRTC_ERROR_OK on success.
605
- */
606
- TirtcError tirtc_conn_request_command(TirtcConn* connection, const TirtcConnCommandRequest* request,
607
- TirtcConnCommandResponseFn callback, void* user_data);
608
-
609
- /**
610
- * @brief Reply to an inbound remote command request.
611
- *
612
- * In the common request-response pattern, ::TirtcConnCommandResponse.command_id
613
- * matches the inbound request's ::command_id. Use the ::remote_request_id delivered by
614
- * ::TirtcConnObserver.on_remote_command_request on the same connection. If the
615
- * request is no longer pending, this function returns a not-ready error.
616
- * In the normal case, reply at most once for each delivered request id.
617
- *
618
- * @param connection Target connection.
619
- * @param remote_request_id Request id supplied by the observer callback.
620
- * @param response Non-NULL response payload.
621
- * @return ::TIRTC_ERROR_OK on success.
622
- */
623
- TirtcError tirtc_conn_reply_remote_command(TirtcConn* connection, uint64_t remote_request_id,
624
- const TirtcConnCommandResponse* response);
625
-
626
449
  #ifdef __cplusplus
627
450
  }
628
451
  #endif
@@ -1,8 +1,9 @@
1
1
  platform=macos-arm64
2
- staged_at_utc=2026-04-10T04:27:48Z
2
+ profile=credential
3
+ staged_at_utc=2026-04-21T05:02:19Z
3
4
  source_sdk=/Users/allenfeng/Development/Repositories/tirtc-nexus/tirtc-matrix/.build/sdk/macos-arm64
4
5
 
5
- dcca0b7ab8055d84e5bcfab7f1dde56df9037c40ddb99e9ca924ef2e867d8309 include/tirtc/audio.h
6
+ 907ec636c86ec9737ee4da0ae4c26e8435104effbaa96e731b1bece9c44f6837 include/tirtc/audio.h
6
7
  6d972ccfe150a3b4f2d7f18fa92b3ade9210c1c8bb754d061ac6b7997b59e2cb include/tirtc/audio_codec.h
7
8
  7bacbdb2d8bb10d6444036a8fef42f2a8e3ea34dfc38e165ee678d61f189db41 include/tirtc/audio_frame.h
8
9
  84f1bbe67efa15ab3b2d995d661025aac43e2fe547a14a012a24d89cfe3cb859 include/tirtc/audio_io.h
@@ -12,20 +13,20 @@ c2e1f31dcc75be461c577d18b1cebe32774f212d51cb4dd2a5b5a9bfe62b693e include/tirtc/
12
13
  51cbc911fe9f9834046f0e0a1a7cdd814a8e194a615894a8b4d11f9e5f095610 include/tirtc/audio_io_windows.h
13
14
  21f60729117260a44af22c1af986ef17d22673b102b7b7a035f492d0665cce16 include/tirtc/audio_processing.h
14
15
  0ca7c3c630b1242f51a0fd8154097c0a332b4c816a5707090e4381719852998c include/tirtc/audio_sample_rate.h
15
- 59b7df33fdc2ad92b3142299ffab832443179ef895784ad51a2f6544c5b02766 include/tirtc/av.h
16
+ 2924a8466027b05cf148a1ec173a199d09719ae0ad6c6393521eeb6e594d31fa include/tirtc/av.h
16
17
  4198c95c48ae579d1c782635b00fa5c9009d0c56ba466e6e3873e8298faae029 include/tirtc/credential.h
17
- 78625b8d9f1f29bf2f35a89a8ad8a3f68f3f6ff75455d4682f5514c6c0ad7738 include/tirtc/error.h
18
+ d29f24fc665d01ab45f993c06c09fccca2bd5c844250ddbdc3c9d8d0c8548803 include/tirtc/error.h
18
19
  ae805545a9515edc9b94262e72ad2c7b7d649288166f4daeb450d8a55e82ae0b include/tirtc/foundation/build_info.h
19
20
  7cf8b372a3d48d4de4a65a04c7f102281a7b42cebb9ec247853d3c53afb63b6a include/tirtc/http.h
20
21
  70bbf93b84d9d1a85f376d9986de570c1f658319e1e5ab6d621f7a4d41033f5c include/tirtc/logging.h
21
22
  7e2f7f81afe37e22f5414d9db32438edd948ff775230c3a0a17ff9ac1a0b560e include/tirtc/media_codec.h
22
- 71eab7553274dee4cc6ea3cbaf345a9858e2bf73fe7e928a1a23851d431f3b4d include/tirtc/media_downlink.h
23
+ 3fa1d5fe3c3c2644d134e13678cbf5562440a2c5d4a652dc24bf9f124731509a include/tirtc/media_downlink.h
23
24
  21ef53b4d120aab600168c4082e7622c791ab4929fb20b3fb31f73ed01eee02a include/tirtc/media_fixture_av_sync.h
24
25
  037d9a581cef71afe9233456b1f4ef866c3739150532f3c30a67d361e8af9eef include/tirtc/media_fixture_source.h
25
26
  a4f8ab44c1a20ad37f250363a403a9d4d007e61ddb2426c7966dbc05f6a04b4f include/tirtc/media_live_source.h
26
27
  1b3be6954e547f91a047866438bff1820c8406afaf91cef68ddee29a6ac70234 include/tirtc/media_uplink.h
27
- 97ab19361d22a723af589ebae8bb08b5a7ccd8ca3aff0b85aa9ffd577252b6fc include/tirtc/transport.h
28
- 137729c534213cb161c0853a8d4d38fcdc397c41a7fd8c813fbe0e80083ec931 include/tirtc/trp.h
28
+ 26b831c7b8bd69b7699017427f3243cd22393c90c9518a820f5eb87eb3792483 include/tirtc/transport.h
29
+ 7942e62271793acd78b51a2431f25e4ccba5759eb229d06e3f582ba7f1b83401 include/tirtc/trp.h
29
30
  dff5b0a0ac4a40ad17c93e1e56b3c416371c81ab365e287ea8cd6ce37ccbed3b include/tirtc/video_codec.h
30
31
  e51379666c199588cc33279ccf52248035d1cae3d1d468b1615ebf29f0b39c9c include/tirtc/video_frame.h
31
32
  d920afad955b9f206b02b19ca152315190fa84ab6f24e895a5b24c3ab9ffd701 include/tirtc/video_io.h
@@ -34,17 +35,20 @@ d920afad955b9f206b02b19ca152315190fa84ab6f24e895a5b24c3ab9ffd701 include/tirtc/
34
35
  cae0bbeb884e5466a56da15182c78cc22baab6c743f349a58d3595f623333585 include/tirtc/video_io_harmony.h
35
36
  65b5d24fe3a6bc2a299a2220148a153ba4eb0955a49c1c3baabf1fdfed8aabdd include/tirtc/video_io_windows.h
36
37
  8cd6b66bea14890a665cc317f8572429b2c3e4463773f8b77c1e4dc30a4a8747 include/tirtc/video_processing.h
38
+ 5052a464a34508f117fec46aa6b836871014229d4290d7d8caac862e0165ae8f lib/libTGTRP.a
39
+ 8db86d6714264047e8fd4086ddd7315722d675749719e6175f89eb5a636b48a1 lib/libTiRTC.a
37
40
  b39daee6a3d39bf0ca20c45084601133c4198de8dca848dcff6dd9c70ae99016 lib/libcrypto.a
38
41
  c052857ef315e3d61db9c862cad10709a3a6b2487dc41799cbe4d74a805de875 lib/libcrypto.dylib
39
- 17545a8539f86995500b7fcaee3d1f1e5684e8f11e6094558aee46c6a9cc74a8 lib/libmatrix_runtime_audio.a
40
- bf00c3fcccbfc29696a2ee4ff6ff55e510672a2337af6c975c83d295a970a85f lib/libmatrix_runtime_credential.a
41
- 33ce400a5dfd7a234a4391bc5dd531a9a0401f6d27252246898797d8d0dcf4ed lib/libmatrix_runtime_facade.a
42
- 525c15bd4e23642c1e9939b8114828ec47d7381fb6cf30cb9c66be3181b9c70c lib/libmatrix_runtime_foundation_http.a
43
- d7cf5cd5723bbfcd3bef9191570870413303b0b67c8644c9a5bf30e194fdd487 lib/libmatrix_runtime_foundation_logging.a
44
- fefdbe0acc0dc73dd0b48fb0cd927875c5e43674e163c7ba33f57e59d2f0b178 lib/libmatrix_runtime_media.a
45
- 9361b2a4784b3068a8796033fa36f1969297bbcd4ae59f96da1725e0a27fb481 lib/libmatrix_runtime_transport.a
46
- 7e6f54cf23ad2a59f08e274e63fc25ae74f9f9b687dff08f73091789d647a94c lib/libmatrix_runtime_video.a
42
+ f164a59d6b1143f731fa8321cfa722921fa519a32403a064cb81bf524db2b50e lib/libmatrix_runtime_audio.a
43
+ fc7a666614a15cb5fdd1a770f41a0609768b4794ff7d077dd9a9747e139df784 lib/libmatrix_runtime_credential.a
44
+ 98231e83ddf8779346f48125d900f130c130b4809e69cbca4c3d72f4d3c27819 lib/libmatrix_runtime_facade.a
45
+ 4c20a760f2ca92c23bd660f0ba598e23d1222be5b347111314df391c7398cf60 lib/libmatrix_runtime_foundation_http.a
46
+ 7838ab65c09fcf5bfe85dc4d66211d890b0723ef34f222f33b758d7a70dcece5 lib/libmatrix_runtime_foundation_logging.a
47
+ e02de795cbb7298877e7b13c082523c9565a3369dd2fef37487ed55d3851a32b lib/libmatrix_runtime_media.a
48
+ 44fbcb9fb34f7866a45b685d0fa0d056ab5bc9e2034c7fd5e83edc486336c939 lib/libmatrix_runtime_transport.a
49
+ e4970a72017482cec4a3eb3dff6ca404af34348df0426731e431a3d7e4739a42 lib/libmatrix_runtime_video.a
47
50
  c11c65d373a127028350c41fa58cd2d1223f2b5d70a84e13b115d90daaba25ca lib/libssl.a
48
51
  ef1c1104bbdd2528ed7b958fb7252bd6249875f92300b0c9577d6c4bd6c0d88a lib/libssl.dylib
52
+ e14e846e43d64e240fa0e5745bf4e702b79d0f2442e7f768beb990610735c71b lib/libtgrtc.dylib
49
53
  dc3e0e6ded26e90fd59c166933a5289d57f4cf25fbe6246b6b83c86fe898e63d lib/libwebrtc_apm.a
50
54
  6b1b182cb43ad0b81b19d10f4762b137ee7571a527d0b500f31a227e5e162cb1 lib/libxlog.a
@@ -0,0 +1,19 @@
1
+ import { CommandPendingConnectionSummary, HostState } from './HostState';
2
+ import { RuntimeAdapter } from './RuntimeAdapter';
3
+ import { CommandReplyParams, CommandSendParams } from './HostProtocol';
4
+ type WriteEvent = (family: string, kind: string, payload: Record<string, unknown>) => void;
5
+ type NoteIncomingConnection = (payload: Record<string, unknown>) => void;
6
+ export declare class HostCommandCoordinator {
7
+ private readonly state;
8
+ private readonly runtimeAdapter;
9
+ private readonly writeEvent;
10
+ private readonly snapshotPendingConnectionSummary;
11
+ private readonly noteIncomingConnection;
12
+ constructor(state: HostState, runtimeAdapter: RuntimeAdapter, writeEvent: WriteEvent, snapshotPendingConnectionSummary: () => CommandPendingConnectionSummary, noteIncomingConnection: NoteIncomingConnection);
13
+ handleInboundRemoteCommandRequest(payload: Record<string, unknown>): void;
14
+ clearPendingRemoteCommands(reason: string): void;
15
+ handleCommandSend(params: CommandSendParams, nextSequenceNumber: number): Promise<unknown>;
16
+ handleCommandReply(params: CommandReplyParams): Promise<unknown>;
17
+ handleCommandPendingList(): Promise<unknown>;
18
+ }
19
+ export {};