tirtc-devtools-cli 0.0.13 → 0.0.15

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 (137) hide show
  1. package/README.md +42 -46
  2. package/USAGE.md +87 -312
  3. package/dist/cli/src/embedded_paths.d.ts +0 -2
  4. package/dist/cli/src/embedded_paths.js +3 -25
  5. package/dist/cli/src/index.js +82 -584
  6. package/dist/cli/src/role_driver.d.ts +33 -0
  7. package/dist/cli/src/role_driver.js +500 -0
  8. package/dist/cli/src/token_command.js +4 -2
  9. package/dist/cli/src/token_issue.d.ts +9 -0
  10. package/dist/cli/src/token_issue.js +138 -0
  11. package/dist/cli/src/token_tool.d.ts +2 -4
  12. package/dist/cli/src/token_tool.js +12 -186
  13. package/package.json +3 -2
  14. package/vendor/devtools/driver/macos-arm64/devtools_driver_probe +0 -0
  15. package/vendor/devtools/driver/macos-arm64/runtime_validation_client_bin +0 -0
  16. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio.h +56 -2
  17. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io.h +9 -0
  18. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/av.h +52 -0
  19. package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/error.h +11 -0
  20. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_downlink.h +11 -5
  21. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_uplink.h +4 -0
  22. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/transport.h +52 -15
  23. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/trp.h +7 -5
  24. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_codec.h +41 -0
  25. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io.h +7 -0
  26. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_android.h +2 -0
  27. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
  28. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  29. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
  30. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  31. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  32. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  33. package/vendor/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  34. package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/manifest.txt +20 -25
  35. package/vendor/runtime/script/prepare_runtime_media_dataset.sh +308 -12
  36. package/dist/app-server/protocol-client/index.d.ts +0 -25
  37. package/dist/app-server/protocol-client/index.js +0 -114
  38. package/dist/cli/src/bootstrap_flows.d.ts +0 -46
  39. package/dist/cli/src/bootstrap_flows.js +0 -249
  40. package/dist/cli/src/config.d.ts +0 -26
  41. package/dist/cli/src/config.js +0 -62
  42. package/dist/cli/src/facade.d.ts +0 -430
  43. package/dist/cli/src/facade.js +0 -170
  44. package/dist/cli/src/guide.d.ts +0 -1
  45. package/dist/cli/src/guide.js +0 -48
  46. package/dist/cli/src/session_manager.d.ts +0 -25
  47. package/dist/cli/src/session_manager.js +0 -391
  48. package/dist/cli/src/transport.d.ts +0 -30
  49. package/dist/cli/src/transport.js +0 -84
  50. package/vendor/app-server/bin/native/linux-x64/credential_napi.node +0 -0
  51. package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
  52. package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/credential.h +0 -34
  53. package/vendor/app-server/bin/runtime/linux-x64/lib/libcrypto.a +0 -0
  54. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_credential.a +0 -0
  55. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_http.a +0 -0
  56. package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
  57. package/vendor/app-server/bin/runtime/linux-x64/lib/libssl.a +0 -0
  58. package/vendor/app-server/bin/runtime/linux-x64/lib/libxlog.a +0 -0
  59. package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +0 -4
  60. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/credential.h +0 -34
  61. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +0 -52
  62. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/foundation/build_info.h +0 -27
  63. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/http.h +0 -57
  64. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/logging.h +0 -55
  65. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_av_sync.h +0 -61
  66. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_fixture_source.h +0 -77
  67. package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_live_source.h +0 -71
  68. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
  69. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
  70. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
  71. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
  72. package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
  73. package/vendor/app-server/bin/tirtc-devtool-host.js +0 -2
  74. package/vendor/app-server/dist/host/ArtifactManager.d.ts +0 -18
  75. package/vendor/app-server/dist/host/ArtifactManager.js +0 -98
  76. package/vendor/app-server/dist/host/HostCommandCoordinator.d.ts +0 -19
  77. package/vendor/app-server/dist/host/HostCommandCoordinator.js +0 -196
  78. package/vendor/app-server/dist/host/HostProtocol.d.ts +0 -103
  79. package/vendor/app-server/dist/host/HostProtocol.js +0 -239
  80. package/vendor/app-server/dist/host/HostServer.d.ts +0 -52
  81. package/vendor/app-server/dist/host/HostServer.js +0 -727
  82. package/vendor/app-server/dist/host/HostState.d.ts +0 -69
  83. package/vendor/app-server/dist/host/HostState.js +0 -19
  84. package/vendor/app-server/dist/host/RuntimeAdapter.d.ts +0 -95
  85. package/vendor/app-server/dist/host/RuntimeAdapter.js +0 -636
  86. package/vendor/app-server/dist/host/RuntimeReceiveWorker.d.ts +0 -37
  87. package/vendor/app-server/dist/host/RuntimeReceiveWorker.js +0 -186
  88. package/vendor/app-server/dist/host/RuntimeSendWorker.d.ts +0 -58
  89. package/vendor/app-server/dist/host/RuntimeSendWorker.js +0 -438
  90. package/vendor/app-server/dist/host/TokenTool.d.ts +0 -15
  91. package/vendor/app-server/dist/host/TokenTool.js +0 -84
  92. package/vendor/app-server/dist/host/WebPreviewGateway.d.ts +0 -28
  93. package/vendor/app-server/dist/host/WebPreviewGateway.js +0 -815
  94. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.d.ts +0 -23
  95. package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +0 -115
  96. package/vendor/app-server/dist/host/native/RuntimeHostBridge.d.ts +0 -32
  97. package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +0 -157
  98. package/vendor/app-server/dist/host/runtime_backed_preflight.d.ts +0 -10
  99. package/vendor/app-server/dist/host/runtime_backed_preflight.js +0 -78
  100. package/vendor/app-server/dist/host/tests/helpers/host_socket_client.d.ts +0 -28
  101. package/vendor/app-server/dist/host/tests/helpers/host_socket_client.js +0 -85
  102. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.d.ts +0 -10
  103. package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +0 -41
  104. package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.d.ts +0 -11
  105. package/vendor/app-server/dist/host/tests/helpers/runtime_test_env.js +0 -32
  106. package/vendor/app-server/dist/protocol/contract.d.ts +0 -1128
  107. package/vendor/app-server/dist/protocol/contract.js +0 -217
  108. package/vendor/app-server/dist/protocol-client/index.d.ts +0 -25
  109. package/vendor/app-server/dist/protocol-client/index.js +0 -114
  110. package/vendor/app-server/dist/src/index.d.ts +0 -1
  111. package/vendor/app-server/dist/src/index.js +0 -294
  112. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_codec.h +0 -0
  113. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_frame.h +0 -0
  114. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_android.h +0 -0
  115. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_apple.h +0 -0
  116. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_harmony.h +0 -0
  117. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_io_windows.h +0 -0
  118. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_processing.h +0 -0
  119. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/audio_sample_rate.h +0 -0
  120. /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/foundation/build_info.h +0 -0
  121. /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/http.h +0 -0
  122. /package/vendor/{app-server/bin/runtime/linux-x64 → runtime/macos-arm64}/include/tirtc/logging.h +0 -0
  123. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/media_codec.h +0 -0
  124. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_frame.h +0 -0
  125. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_apple.h +0 -0
  126. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_harmony.h +0 -0
  127. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_io_windows.h +0 -0
  128. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/include/tirtc/video_processing.h +0 -0
  129. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libTGTRP.a +0 -0
  130. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libTiRTC.a +0 -0
  131. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libcrypto.a +0 -0
  132. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libcrypto.dylib +0 -0
  133. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libssl.a +0 -0
  134. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libssl.dylib +0 -0
  135. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libtgrtc.dylib +0 -0
  136. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libwebrtc_apm.a +0 -0
  137. /package/vendor/{app-server/bin/runtime → runtime}/macos-arm64/lib/libxlog.a +0 -0
@@ -1,57 +0,0 @@
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_
@@ -1,55 +0,0 @@
1
- #ifndef TIRTC_FOUNDATION_LOGGING_H_
2
- #define TIRTC_FOUNDATION_LOGGING_H_
3
-
4
- #include <stdarg.h>
5
-
6
- #include "tirtc/error.h"
7
-
8
- #ifdef __cplusplus
9
- extern "C" {
10
- #endif
11
-
12
- typedef enum TirtcLogLevel {
13
- TIRTC_LOG_LEVEL_VERBOSE = 0,
14
- TIRTC_LOG_LEVEL_DEBUG,
15
- TIRTC_LOG_LEVEL_INFO,
16
- TIRTC_LOG_LEVEL_WARN,
17
- TIRTC_LOG_LEVEL_ERROR,
18
- TIRTC_LOG_LEVEL_FATAL,
19
- } TirtcLogLevel;
20
-
21
- typedef void (*TirtcLoggingPrintFunction)(const char* prefix, TirtcLogLevel level, const char* tag,
22
- const char* fmt, va_list args);
23
-
24
- #define TIRTC_LOG_PREFIX_DEFAULT "TIRTC_"
25
-
26
- TirtcError tirtc_logging_set_print_function(TirtcLoggingPrintFunction function);
27
- TirtcError tirtc_logging_set_level(TirtcLogLevel level);
28
- TirtcError tirtc_logging_set_console_enabled(int enabled);
29
-
30
- TirtcError tirtc_logging_initialize(const char* root_dir);
31
- TirtcError tirtc_logging_write(TirtcLogLevel level, const char* tag, const char* message);
32
- TirtcError tirtc_logging_print(const char* prefix, TirtcLogLevel level, const char* tag,
33
- const char* fmt, ...);
34
- TirtcError tirtc_logging_flush(void);
35
- TirtcError tirtc_logging_export(const char* output_zip_path);
36
- TirtcError tirtc_logging_upload(char* log_id, int log_id_capacity);
37
-
38
- #define TIRTC_LOGV(tag, fmt, ...) \
39
- tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_VERBOSE, tag, fmt, ##__VA_ARGS__)
40
- #define TIRTC_LOGD(tag, fmt, ...) \
41
- tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_DEBUG, tag, fmt, ##__VA_ARGS__)
42
- #define TIRTC_LOGI(tag, fmt, ...) \
43
- tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_INFO, tag, fmt, ##__VA_ARGS__)
44
- #define TIRTC_LOGW(tag, fmt, ...) \
45
- tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_WARN, tag, fmt, ##__VA_ARGS__)
46
- #define TIRTC_LOGE(tag, fmt, ...) \
47
- tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_ERROR, tag, fmt, ##__VA_ARGS__)
48
- #define TIRTC_LOGF(tag, fmt, ...) \
49
- tirtc_logging_print(TIRTC_LOG_PREFIX_DEFAULT, TIRTC_LOG_LEVEL_FATAL, tag, fmt, ##__VA_ARGS__)
50
-
51
- #ifdef __cplusplus
52
- }
53
- #endif
54
-
55
- #endif // TIRTC_FOUNDATION_LOGGING_H_
@@ -1,61 +0,0 @@
1
- #ifndef TIRTC_MEDIA_FIXTURE_AV_SYNC_H_
2
- #define TIRTC_MEDIA_FIXTURE_AV_SYNC_H_
3
-
4
- #include <stddef.h>
5
- #include <stdint.h>
6
-
7
- #include "tirtc/audio_io.h"
8
- #include "tirtc/error.h"
9
- #include "tirtc/video_frame.h"
10
- #include "tirtc/video_io.h"
11
-
12
- #ifdef __cplusplus
13
- extern "C" {
14
- #endif
15
-
16
- typedef struct TirtcMediaFixtureAvSyncOptions {
17
- const char* fixture_dir;
18
-
19
- /* Encoded source paths under fixture_dir (or absolute paths). */
20
- const char* audio_g711a_path;
21
- const char* audio_packets_path;
22
- const char* video_h264_path;
23
- const char* video_packets_path;
24
-
25
- uint32_t audio_sample_rate_hz;
26
- uint32_t audio_samples_per_channel;
27
- uint32_t video_width;
28
- uint32_t video_height;
29
- uint32_t video_fps;
30
- TirtcVideoPixelFormat video_output_pixel_format;
31
-
32
- /* Deprecated legacy fields kept for API compatibility. */
33
- const char* audio_pcm_path;
34
- const char* video_preview_path;
35
- uint32_t video_stride;
36
- uint32_t video_bytes_per_frame;
37
- } TirtcMediaFixtureAvSyncOptions;
38
-
39
- typedef struct TirtcMediaFixtureAvSyncRunOptions {
40
- uint64_t duration_us;
41
- uint8_t enable_realtime_pacing;
42
- uint32_t max_audio_packets;
43
- uint32_t max_video_packets;
44
- } TirtcMediaFixtureAvSyncRunOptions;
45
-
46
- typedef struct TirtcMediaFixtureAvSyncObserver {
47
- int (*on_audio_frame)(const TirtcAudioPcmFrame* frame, void* user_data);
48
- int (*on_video_frame)(const TirtcVideoPixelFrame* frame, void* user_data);
49
- } TirtcMediaFixtureAvSyncObserver;
50
-
51
- TirtcError tirtc_media_fixture_av_sync_run(const TirtcMediaFixtureAvSyncOptions* options,
52
- const TirtcMediaFixtureAvSyncRunOptions* run_options,
53
- const TirtcMediaFixtureAvSyncObserver* observer,
54
- void* user_data, uint64_t* out_audio_frames,
55
- uint64_t* out_video_frames);
56
-
57
- #ifdef __cplusplus
58
- }
59
- #endif
60
-
61
- #endif // TIRTC_MEDIA_FIXTURE_AV_SYNC_H_
@@ -1,77 +0,0 @@
1
- #ifndef TIRTC_MEDIA_FIXTURE_SOURCE_H_
2
- #define TIRTC_MEDIA_FIXTURE_SOURCE_H_
3
-
4
- #include <stddef.h>
5
- #include <stdint.h>
6
-
7
- #include "tirtc/error.h"
8
- #include "tirtc/media_live_source.h"
9
-
10
- #ifdef __cplusplus
11
- extern "C" {
12
- #endif
13
-
14
- typedef struct TirtcMediaFixtureSource {
15
- TirtcMediaLiveSource* live_source;
16
- } TirtcMediaFixtureSource;
17
-
18
- typedef enum TirtcMediaFixturePacketKind {
19
- TIRTC_MEDIA_FIXTURE_PACKET_KIND_AUDIO = 1,
20
- TIRTC_MEDIA_FIXTURE_PACKET_KIND_VIDEO = 2,
21
- } TirtcMediaFixturePacketKind;
22
-
23
- typedef struct TirtcMediaFixturePacket {
24
- TirtcMediaFixturePacketKind kind;
25
- int64_t pts_us;
26
- uint8_t is_key_frame;
27
- uint32_t audio_sample_rate;
28
- uint32_t audio_channels;
29
- uint32_t video_width;
30
- uint32_t video_height;
31
- uint32_t video_stride;
32
- uint32_t video_pixel_format;
33
- const void* data;
34
- size_t data_bytes;
35
- } TirtcMediaFixturePacket;
36
-
37
- typedef struct TirtcMediaFixtureSourceOptions {
38
- const char* fixture_dir;
39
- const char* audio_path;
40
- const char* audio_packets_path;
41
- const char* video_path;
42
- const char* video_packets_path;
43
- } TirtcMediaFixtureSourceOptions;
44
-
45
- typedef struct TirtcMediaFixtureRunOptions {
46
- uint64_t duration_us;
47
- uint8_t enable_realtime_pacing;
48
- uint8_t emit_audio;
49
- uint8_t emit_video;
50
- uint8_t reserved0;
51
- uint8_t reserved1;
52
- } TirtcMediaFixtureRunOptions;
53
-
54
- typedef struct TirtcMediaFixtureSourceObserver {
55
- int (*on_packet)(const TirtcMediaFixturePacket* packet, void* user_data);
56
- } TirtcMediaFixtureSourceObserver;
57
-
58
- TirtcError tirtc_media_fixture_source_create(TirtcMediaFixtureSource** out_source);
59
- void tirtc_media_fixture_source_destroy(TirtcMediaFixtureSource* source);
60
-
61
- TirtcError tirtc_media_fixture_source_load(TirtcMediaFixtureSource* source,
62
- const TirtcMediaFixtureSourceOptions* options);
63
- void tirtc_media_fixture_source_unload(TirtcMediaFixtureSource* source);
64
-
65
- TirtcError tirtc_media_fixture_source_run(TirtcMediaFixtureSource* source,
66
- const TirtcMediaFixtureRunOptions* options,
67
- const TirtcMediaFixtureSourceObserver* observer,
68
- void* user_data);
69
-
70
- size_t tirtc_media_fixture_source_audio_packet_count(const TirtcMediaFixtureSource* source);
71
- size_t tirtc_media_fixture_source_video_packet_count(const TirtcMediaFixtureSource* source);
72
-
73
- #ifdef __cplusplus
74
- }
75
- #endif
76
-
77
- #endif // TIRTC_MEDIA_FIXTURE_SOURCE_H_
@@ -1,71 +0,0 @@
1
- #ifndef TIRTC_MEDIA_LIVE_SOURCE_H_
2
- #define TIRTC_MEDIA_LIVE_SOURCE_H_
3
-
4
- #include <stddef.h>
5
- #include <stdint.h>
6
-
7
- #include "tirtc/audio_io.h"
8
- #include "tirtc/error.h"
9
- #include "tirtc/video_frame.h"
10
- #include "tirtc/video_io.h"
11
-
12
- #ifdef __cplusplus
13
- extern "C" {
14
- #endif
15
-
16
- typedef struct TirtcMediaLiveSource TirtcMediaLiveSource;
17
-
18
- typedef enum TirtcMediaLiveSourceMode {
19
- TIRTC_MEDIA_LIVE_SOURCE_MODE_AIN_VIN = 1,
20
- TIRTC_MEDIA_LIVE_SOURCE_MODE_RAW_CALLBACK = 2,
21
- } TirtcMediaLiveSourceMode;
22
-
23
- typedef struct TirtcMediaLiveSourceOptions {
24
- const char* dataset_dir;
25
- TirtcMediaLiveSourceMode mode;
26
- uint32_t audio_sample_rate_hz;
27
- uint32_t enable_realtime_pacing;
28
- } TirtcMediaLiveSourceOptions;
29
-
30
- typedef struct TirtcMediaLiveSourceRawAudioFrame {
31
- int64_t pts_us;
32
- uint32_t sample_rate;
33
- uint32_t channels;
34
- uint32_t samples_per_channel;
35
- const int16_t* data;
36
- } TirtcMediaLiveSourceRawAudioFrame;
37
-
38
- typedef struct TirtcMediaLiveSourceRawVideoFrame {
39
- int64_t pts_us;
40
- uint32_t width;
41
- uint32_t height;
42
- uint32_t pixel_format;
43
- const uint8_t* data;
44
- size_t data_bytes;
45
- uint32_t stride;
46
- } TirtcMediaLiveSourceRawVideoFrame;
47
-
48
- typedef struct TirtcMediaLiveSourceRawObserver {
49
- int (*on_audio_frame)(const TirtcMediaLiveSourceRawAudioFrame* frame, void* user_data);
50
- int (*on_video_frame)(const TirtcMediaLiveSourceRawVideoFrame* frame, void* user_data);
51
- } TirtcMediaLiveSourceRawObserver;
52
-
53
- TirtcError tirtc_media_live_source_create(const TirtcMediaLiveSourceOptions* options,
54
- TirtcMediaLiveSource** out_source);
55
- TirtcError tirtc_media_live_source_start(TirtcMediaLiveSource* source);
56
- TirtcError tirtc_media_live_source_stop(TirtcMediaLiveSource* source);
57
- void tirtc_media_live_source_destroy(TirtcMediaLiveSource* source);
58
-
59
- TirtcError tirtc_media_live_source_set_raw_observer(TirtcMediaLiveSource* source,
60
- const TirtcMediaLiveSourceRawObserver* observer,
61
- void* user_data);
62
- TirtcError tirtc_media_live_source_clear_raw_observer(TirtcMediaLiveSource* source);
63
-
64
- TirtcAudioAin* tirtc_media_live_source_get_ain(TirtcMediaLiveSource* source);
65
- TirtcVideoVin* tirtc_media_live_source_get_vin(TirtcMediaLiveSource* source);
66
-
67
- #ifdef __cplusplus
68
- }
69
- #endif
70
-
71
- #endif // TIRTC_MEDIA_LIVE_SOURCE_H_
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- require('../dist/src/index.js');
@@ -1,18 +0,0 @@
1
- export interface ArtifactPaths {
2
- rootPath: string;
3
- reportPath: string;
4
- logsPath: string;
5
- eventsPath: string;
6
- receivedMediaPath: string;
7
- prepareCachePath: string;
8
- }
9
- export declare class ArtifactManager {
10
- private paths;
11
- constructor(basePath: string);
12
- setupLayout(): void;
13
- getPaths(): ArtifactPaths;
14
- getHostLogPath(): string;
15
- appendHostLog(line: string): void;
16
- writeReport(report: unknown): void;
17
- writeEvent(event: unknown): void;
18
- }
@@ -1,98 +0,0 @@
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
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ArtifactManager = void 0;
37
- const fs = __importStar(require("fs"));
38
- const path = __importStar(require("path"));
39
- function toJsonLine(value) {
40
- return JSON.stringify(value, (_key, current) => {
41
- if (typeof current === 'bigint') {
42
- const normalized = Number(current);
43
- return Number.isSafeInteger(normalized) ? normalized : current.toString();
44
- }
45
- return current;
46
- });
47
- }
48
- class ArtifactManager {
49
- paths;
50
- constructor(basePath) {
51
- this.paths = {
52
- rootPath: basePath,
53
- reportPath: path.join(basePath, 'report.json'),
54
- logsPath: path.join(basePath, 'logs'),
55
- eventsPath: path.join(basePath, 'events.jsonl'),
56
- receivedMediaPath: path.join(basePath, 'received-media'),
57
- prepareCachePath: path.join(basePath, 'prepare-cache'),
58
- };
59
- }
60
- setupLayout() {
61
- const dirs = [
62
- this.paths.rootPath,
63
- this.paths.logsPath,
64
- this.paths.receivedMediaPath,
65
- this.paths.prepareCachePath,
66
- ];
67
- for (const dir of dirs) {
68
- if (!fs.existsSync(dir)) {
69
- fs.mkdirSync(dir, { recursive: true });
70
- }
71
- }
72
- if (!fs.existsSync(this.paths.eventsPath)) {
73
- fs.writeFileSync(this.paths.eventsPath, '');
74
- }
75
- }
76
- getPaths() {
77
- return this.paths;
78
- }
79
- getHostLogPath() {
80
- return path.join(this.paths.logsPath, 'host.log');
81
- }
82
- appendHostLog(line) {
83
- fs.appendFileSync(this.getHostLogPath(), line);
84
- }
85
- writeReport(report) {
86
- fs.writeFileSync(this.paths.reportPath, JSON.stringify(report, (_key, current) => {
87
- if (typeof current === 'bigint') {
88
- const normalized = Number(current);
89
- return Number.isSafeInteger(normalized) ? normalized : current.toString();
90
- }
91
- return current;
92
- }, 2));
93
- }
94
- writeEvent(event) {
95
- fs.appendFileSync(this.paths.eventsPath, `${toJsonLine(event)}\n`);
96
- }
97
- }
98
- exports.ArtifactManager = ArtifactManager;
@@ -1,19 +0,0 @@
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 {};
@@ -1,196 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HostCommandCoordinator = void 0;
4
- const HostProtocol_1 = require("./HostProtocol");
5
- function normalizeCommandPayload(payload) {
6
- if (typeof payload === 'string') {
7
- return {
8
- payloadEncoding: 'utf8',
9
- payload,
10
- };
11
- }
12
- if (payload instanceof Uint8Array) {
13
- return {
14
- payloadEncoding: 'base64',
15
- payload: Buffer.from(payload).toString('base64'),
16
- };
17
- }
18
- if (Array.isArray(payload) && payload.every((value) => typeof value === 'number')) {
19
- return {
20
- payloadEncoding: 'base64',
21
- payload: Buffer.from(payload).toString('base64'),
22
- };
23
- }
24
- if (typeof payload === 'object' && payload !== null && 'type' in payload && payload.type === 'Buffer') {
25
- const data = payload.data;
26
- if (Array.isArray(data) && data.every((value) => typeof value === 'number')) {
27
- return {
28
- payloadEncoding: 'base64',
29
- payload: Buffer.from(data).toString('base64'),
30
- };
31
- }
32
- }
33
- return {
34
- payloadEncoding: 'utf8',
35
- payload: '',
36
- };
37
- }
38
- class HostCommandCoordinator {
39
- state;
40
- runtimeAdapter;
41
- writeEvent;
42
- snapshotPendingConnectionSummary;
43
- noteIncomingConnection;
44
- constructor(state, runtimeAdapter, writeEvent, snapshotPendingConnectionSummary, noteIncomingConnection) {
45
- this.state = state;
46
- this.runtimeAdapter = runtimeAdapter;
47
- this.writeEvent = writeEvent;
48
- this.snapshotPendingConnectionSummary = snapshotPendingConnectionSummary;
49
- this.noteIncomingConnection = noteIncomingConnection;
50
- }
51
- handleInboundRemoteCommandRequest(payload) {
52
- const remoteRequestId = Number(payload.remoteRequestId);
53
- const commandId = Number(payload.commandId);
54
- if (!Number.isInteger(remoteRequestId) || remoteRequestId <= 0 || !Number.isInteger(commandId)) {
55
- return;
56
- }
57
- this.noteIncomingConnection(payload);
58
- const normalizedPayload = normalizeCommandPayload(payload.payload);
59
- const entry = {
60
- remoteRequestId,
61
- commandId,
62
- payloadEncoding: normalizedPayload.payloadEncoding,
63
- payload: normalizedPayload.payload,
64
- receivedAt: new Date().toISOString(),
65
- connection: this.snapshotPendingConnectionSummary(),
66
- };
67
- this.state.pendingRemoteCommands.set(remoteRequestId, entry);
68
- this.writeEvent('command', 'command.remote.requested', {
69
- ...entry,
70
- });
71
- }
72
- clearPendingRemoteCommands(reason) {
73
- if (this.state.pendingRemoteCommands.size === 0) {
74
- return;
75
- }
76
- const clearedAt = new Date().toISOString();
77
- for (const entry of this.state.pendingRemoteCommands.values()) {
78
- this.writeEvent('command', 'command.remote.cleared', {
79
- remoteRequestId: entry.remoteRequestId,
80
- commandId: entry.commandId,
81
- payloadEncoding: entry.payloadEncoding,
82
- payload: entry.payload,
83
- receivedAt: entry.receivedAt,
84
- connection: entry.connection,
85
- reason,
86
- clearedAt,
87
- });
88
- }
89
- this.state.pendingRemoteCommands.clear();
90
- }
91
- async handleCommandSend(params, nextSequenceNumber) {
92
- const response = await this.runtimeAdapter.sendCommand(params.commandId, params.payloadEncoding, params.payload, params.timeoutMs);
93
- return {
94
- sequenceNumber: nextSequenceNumber,
95
- commandId: params.commandId,
96
- acceptedAt: new Date().toISOString(),
97
- response,
98
- };
99
- }
100
- async handleCommandReply(params) {
101
- const requestedAt = new Date().toISOString();
102
- this.writeEvent('command', 'reply.requested', {
103
- remoteRequestId: params.remoteRequestId,
104
- commandId: params.commandId,
105
- payloadEncoding: params.payloadEncoding,
106
- payloadLength: params.payload.length,
107
- pendingCount: this.state.pendingRemoteCommands.size,
108
- connectionState: this.state.connection.state,
109
- at: requestedAt,
110
- });
111
- const entry = this.state.pendingRemoteCommands.get(params.remoteRequestId);
112
- if (!entry) {
113
- this.writeEvent('command', 'reply.rejected', {
114
- remoteRequestId: params.remoteRequestId,
115
- commandId: params.commandId,
116
- reason: 'remote_request_not_pending',
117
- pendingCount: this.state.pendingRemoteCommands.size,
118
- connectionState: this.state.connection.state,
119
- at: new Date().toISOString(),
120
- });
121
- throw new HostProtocol_1.HostProtocolError('invalid_request', `remoteRequestId ${params.remoteRequestId} is not pending`, false);
122
- }
123
- if (entry.commandId !== params.commandId) {
124
- this.writeEvent('command', 'reply.rejected', {
125
- remoteRequestId: params.remoteRequestId,
126
- commandId: params.commandId,
127
- expectedCommandId: entry.commandId,
128
- reason: 'command_id_mismatch',
129
- pendingCount: this.state.pendingRemoteCommands.size,
130
- connectionState: this.state.connection.state,
131
- at: new Date().toISOString(),
132
- });
133
- throw new HostProtocol_1.HostProtocolError('invalid_request', 'commandId does not match pending entry', false);
134
- }
135
- if (this.state.connection.state !== 'connected') {
136
- this.writeEvent('command', 'reply.rejected', {
137
- remoteRequestId: params.remoteRequestId,
138
- commandId: params.commandId,
139
- reason: 'connection_not_ready',
140
- pendingCount: this.state.pendingRemoteCommands.size,
141
- connectionState: this.state.connection.state,
142
- at: new Date().toISOString(),
143
- });
144
- throw new HostProtocol_1.HostProtocolError('connection_not_ready', 'connection is not established', true);
145
- }
146
- try {
147
- await this.runtimeAdapter.replyRemoteCommand(params.remoteRequestId, params.commandId, params.payloadEncoding, params.payload);
148
- }
149
- catch (error) {
150
- const message = error instanceof Error ? error.message : String(error);
151
- this.writeEvent('command', 'reply.failed', {
152
- remoteRequestId: params.remoteRequestId,
153
- commandId: params.commandId,
154
- reason: 'runtime_adapter_error',
155
- message,
156
- pendingCount: this.state.pendingRemoteCommands.size,
157
- connectionState: this.state.connection.state,
158
- at: new Date().toISOString(),
159
- });
160
- throw error;
161
- }
162
- this.state.pendingRemoteCommands.delete(params.remoteRequestId);
163
- const repliedAt = new Date().toISOString();
164
- this.writeEvent('command', 'command.remote.replied', {
165
- remoteRequestId: params.remoteRequestId,
166
- commandId: params.commandId,
167
- payloadEncoding: entry.payloadEncoding,
168
- payload: entry.payload,
169
- receivedAt: entry.receivedAt,
170
- connection: entry.connection,
171
- repliedAt,
172
- });
173
- return {
174
- remoteRequestId: params.remoteRequestId,
175
- commandId: params.commandId,
176
- repliedAt,
177
- };
178
- }
179
- async handleCommandPendingList() {
180
- const items = Array.from(this.state.pendingRemoteCommands.values())
181
- .sort((left, right) => left.receivedAt.localeCompare(right.receivedAt));
182
- const listedAt = new Date().toISOString();
183
- this.writeEvent('command', 'pending.listed', {
184
- count: items.length,
185
- remoteRequestIds: items.map((item) => item.remoteRequestId),
186
- commandIds: items.map((item) => item.commandId),
187
- connectionState: this.state.connection.state,
188
- listedAt,
189
- });
190
- return {
191
- items,
192
- listedAt,
193
- };
194
- }
195
- }
196
- exports.HostCommandCoordinator = HostCommandCoordinator;