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,103 +0,0 @@
1
- import { StreamSource } from './HostState';
2
- export type JsonRpcId = string | number;
3
- export type JsonRpcRequest = {
4
- id?: JsonRpcId;
5
- method: string;
6
- params?: unknown;
7
- };
8
- export type ProtocolErrorPayload = {
9
- reasonCode: string;
10
- message: string;
11
- retryable: boolean;
12
- };
13
- export type ProtocolErrorResponse = {
14
- id?: JsonRpcId;
15
- error: {
16
- code: number;
17
- message: string;
18
- data?: ProtocolErrorPayload;
19
- };
20
- };
21
- export type ServiceStartParams = {
22
- serviceEntry?: string;
23
- license: string;
24
- timeoutMs: number;
25
- bootstrapSendStreams?: StreamSendStartParams[];
26
- };
27
- export type ConnectionConnectParams = {
28
- serviceEntry?: string;
29
- peerId: string;
30
- token: string;
31
- timeoutMs: number;
32
- };
33
- export type StreamSendStartParams = {
34
- streamId: number;
35
- media: 'audio' | 'video';
36
- source: StreamSource;
37
- };
38
- export type StreamStopParams = {
39
- streamId: number;
40
- };
41
- export type StreamMessageSendParams = {
42
- streamId: number;
43
- payload: string;
44
- };
45
- export type StreamReceiveStartParams = {
46
- streamId: number;
47
- media: 'audio' | 'video';
48
- };
49
- export type OutputAttachParams = {
50
- streamId: number;
51
- consumer: string;
52
- mediaView: string;
53
- format: string;
54
- delivery: string;
55
- targetPath?: string;
56
- maxFiles?: number;
57
- };
58
- export type OutputDetachParams = {
59
- outputId: string;
60
- };
61
- export type CommandSendParams = {
62
- commandId: number;
63
- payloadEncoding: string;
64
- payload: string;
65
- timeoutMs?: number;
66
- };
67
- export type CommandReplyParams = {
68
- remoteRequestId: number;
69
- commandId: number;
70
- payloadEncoding: string;
71
- payload: string;
72
- };
73
- export type EventsSubscribeParams = {
74
- families?: string[];
75
- };
76
- export type ArtifactExportParams = {
77
- outputPath: string;
78
- };
79
- export type DebugTokenQrcodeParams = {
80
- payload: string;
81
- outputStem?: string;
82
- };
83
- export declare class HostProtocolError extends Error {
84
- readonly reasonCode: string;
85
- readonly retryable: boolean;
86
- constructor(reasonCode: string, message: string, retryable: boolean);
87
- }
88
- export declare function parseRequest(message: string): JsonRpcRequest;
89
- export declare function toParamsRecord(params: unknown): Record<string, unknown>;
90
- export declare function parseServiceStartParams(params: Record<string, unknown>): ServiceStartParams;
91
- export declare function parseConnectionConnectParams(params: Record<string, unknown>): ConnectionConnectParams;
92
- export declare function parseStreamSendStartParams(params: Record<string, unknown>): StreamSendStartParams;
93
- export declare function parseStreamStopParams(params: Record<string, unknown>): StreamStopParams;
94
- export declare function parseStreamMessageSendParams(params: Record<string, unknown>): StreamMessageSendParams;
95
- export declare function parseStreamReceiveStartParams(params: Record<string, unknown>): StreamReceiveStartParams;
96
- export declare function parseOutputAttachParams(params: Record<string, unknown>): OutputAttachParams;
97
- export declare function parseOutputDetachParams(params: Record<string, unknown>): OutputDetachParams;
98
- export declare function parseCommandSendParams(params: Record<string, unknown>): CommandSendParams;
99
- export declare function parseCommandReplyParams(params: Record<string, unknown>): CommandReplyParams;
100
- export declare function parseEventsSubscribeParams(params: Record<string, unknown>): EventsSubscribeParams;
101
- export declare function parseArtifactExportParams(params: Record<string, unknown>): ArtifactExportParams;
102
- export declare function parseDebugTokenQrcodeParams(params: Record<string, unknown>): DebugTokenQrcodeParams;
103
- export declare function normalizeError(error: unknown): HostProtocolError;
@@ -1,239 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HostProtocolError = void 0;
4
- exports.parseRequest = parseRequest;
5
- exports.toParamsRecord = toParamsRecord;
6
- exports.parseServiceStartParams = parseServiceStartParams;
7
- exports.parseConnectionConnectParams = parseConnectionConnectParams;
8
- exports.parseStreamSendStartParams = parseStreamSendStartParams;
9
- exports.parseStreamStopParams = parseStreamStopParams;
10
- exports.parseStreamMessageSendParams = parseStreamMessageSendParams;
11
- exports.parseStreamReceiveStartParams = parseStreamReceiveStartParams;
12
- exports.parseOutputAttachParams = parseOutputAttachParams;
13
- exports.parseOutputDetachParams = parseOutputDetachParams;
14
- exports.parseCommandSendParams = parseCommandSendParams;
15
- exports.parseCommandReplyParams = parseCommandReplyParams;
16
- exports.parseEventsSubscribeParams = parseEventsSubscribeParams;
17
- exports.parseArtifactExportParams = parseArtifactExportParams;
18
- exports.parseDebugTokenQrcodeParams = parseDebugTokenQrcodeParams;
19
- exports.normalizeError = normalizeError;
20
- class HostProtocolError extends Error {
21
- reasonCode;
22
- retryable;
23
- constructor(reasonCode, message, retryable) {
24
- super(message);
25
- this.name = 'HostProtocolError';
26
- this.reasonCode = reasonCode;
27
- this.retryable = retryable;
28
- }
29
- }
30
- exports.HostProtocolError = HostProtocolError;
31
- function isRecord(value) {
32
- return typeof value === 'object' && value !== null;
33
- }
34
- function parseRequest(message) {
35
- const parsed = JSON.parse(message);
36
- if (!isRecord(parsed) || typeof parsed.method !== 'string') {
37
- throw new HostProtocolError('invalid_request', 'Invalid request envelope', false);
38
- }
39
- const id = parsed.id;
40
- if (id !== undefined && typeof id !== 'string' && typeof id !== 'number') {
41
- throw new HostProtocolError('invalid_request', 'Invalid request id', false);
42
- }
43
- return {
44
- id,
45
- method: parsed.method,
46
- params: parsed.params,
47
- };
48
- }
49
- function toParamsRecord(params) {
50
- if (params === undefined) {
51
- return {};
52
- }
53
- if (!isRecord(params)) {
54
- throw new HostProtocolError('invalid_request', 'Params must be an object', false);
55
- }
56
- return params;
57
- }
58
- function getString(params, key) {
59
- const value = params[key];
60
- if (typeof value !== 'string') {
61
- throw new HostProtocolError('invalid_request', `Invalid ${key}`, false);
62
- }
63
- return value;
64
- }
65
- function getOptionalString(params, key) {
66
- const value = params[key];
67
- if (value === undefined) {
68
- return undefined;
69
- }
70
- if (typeof value !== 'string') {
71
- throw new HostProtocolError('invalid_request', `Invalid ${key}`, false);
72
- }
73
- return value;
74
- }
75
- function getNumber(params, key) {
76
- const value = params[key];
77
- if (typeof value !== 'number' || Number.isNaN(value)) {
78
- throw new HostProtocolError('invalid_request', `Invalid ${key}`, false);
79
- }
80
- return value;
81
- }
82
- function getOptionalNumber(params, key) {
83
- const value = params[key];
84
- if (value === undefined) {
85
- return undefined;
86
- }
87
- if (typeof value !== 'number' || Number.isNaN(value)) {
88
- throw new HostProtocolError('invalid_request', `Invalid ${key}`, false);
89
- }
90
- return value;
91
- }
92
- function getRecord(params, key) {
93
- const value = params[key];
94
- if (!isRecord(value)) {
95
- throw new HostProtocolError('invalid_request', `Invalid ${key}`, false);
96
- }
97
- return value;
98
- }
99
- function parseStreamSource(source) {
100
- if (!isRecord(source)) {
101
- throw new HostProtocolError('invalid_request', 'Invalid source', false);
102
- }
103
- const mode = getString(source, 'mode');
104
- if (mode !== 'local_assets') {
105
- throw new HostProtocolError('invalid_request', 'Invalid source.mode', false);
106
- }
107
- const localAssets = getRecord(source, 'local_assets');
108
- return {
109
- mode: 'local_assets',
110
- local_assets: {
111
- assets_dir: getString(localAssets, 'assets_dir'),
112
- },
113
- };
114
- }
115
- function parseServiceStartParams(params) {
116
- const bootstrapSendStreamsRaw = params.bootstrapSendStreams;
117
- let bootstrapSendStreams;
118
- if (bootstrapSendStreamsRaw !== undefined) {
119
- if (!Array.isArray(bootstrapSendStreamsRaw)) {
120
- throw new HostProtocolError('invalid_request', 'Invalid bootstrapSendStreams', false);
121
- }
122
- bootstrapSendStreams = bootstrapSendStreamsRaw.map((entry) => {
123
- if (!isRecord(entry)) {
124
- throw new HostProtocolError('invalid_request', 'Invalid bootstrapSendStreams item', false);
125
- }
126
- return parseStreamSendStartParams(entry);
127
- });
128
- }
129
- return {
130
- serviceEntry: getOptionalString(params, 'serviceEntry'),
131
- license: getString(params, 'license'),
132
- timeoutMs: getNumber(params, 'timeoutMs'),
133
- bootstrapSendStreams,
134
- };
135
- }
136
- function parseConnectionConnectParams(params) {
137
- const token = getString(params, 'token').trim();
138
- if (token.length === 0) {
139
- throw new HostProtocolError('invalid_request', 'connection/connect requires non-empty token', false);
140
- }
141
- return {
142
- serviceEntry: getOptionalString(params, 'serviceEntry'),
143
- peerId: getString(params, 'peerId'),
144
- token,
145
- timeoutMs: getNumber(params, 'timeoutMs'),
146
- };
147
- }
148
- function parseStreamSendStartParams(params) {
149
- const media = getString(params, 'media');
150
- if (media !== 'audio' && media !== 'video') {
151
- throw new HostProtocolError('invalid_request', 'Invalid media', false);
152
- }
153
- return {
154
- streamId: getNumber(params, 'streamId'),
155
- media,
156
- source: parseStreamSource(params.source),
157
- };
158
- }
159
- function parseStreamStopParams(params) {
160
- return { streamId: getNumber(params, 'streamId') };
161
- }
162
- function parseStreamMessageSendParams(params) {
163
- return {
164
- streamId: getNumber(params, 'streamId'),
165
- payload: getString(params, 'payload'),
166
- };
167
- }
168
- function parseStreamReceiveStartParams(params) {
169
- const media = getString(params, 'media');
170
- if (media !== 'audio' && media !== 'video') {
171
- throw new HostProtocolError('invalid_request', 'Invalid media', false);
172
- }
173
- return {
174
- streamId: getNumber(params, 'streamId'),
175
- media,
176
- };
177
- }
178
- function parseOutputAttachParams(params) {
179
- return {
180
- streamId: getNumber(params, 'streamId'),
181
- consumer: getString(params, 'consumer'),
182
- mediaView: getString(params, 'mediaView'),
183
- format: getString(params, 'format'),
184
- delivery: getString(params, 'delivery'),
185
- targetPath: getOptionalString(params, 'targetPath'),
186
- maxFiles: getOptionalNumber(params, 'maxFiles'),
187
- };
188
- }
189
- function parseOutputDetachParams(params) {
190
- return {
191
- outputId: getString(params, 'outputId'),
192
- };
193
- }
194
- function parseCommandSendParams(params) {
195
- return {
196
- commandId: getNumber(params, 'commandId'),
197
- payloadEncoding: getString(params, 'payloadEncoding'),
198
- payload: getString(params, 'payload'),
199
- timeoutMs: getOptionalNumber(params, 'timeoutMs'),
200
- };
201
- }
202
- function parseCommandReplyParams(params) {
203
- return {
204
- remoteRequestId: getNumber(params, 'remoteRequestId'),
205
- commandId: getNumber(params, 'commandId'),
206
- payloadEncoding: getString(params, 'payloadEncoding'),
207
- payload: getString(params, 'payload'),
208
- };
209
- }
210
- function parseEventsSubscribeParams(params) {
211
- const families = params.families;
212
- if (families === undefined) {
213
- return {};
214
- }
215
- if (!Array.isArray(families) || families.some((f) => typeof f !== 'string')) {
216
- throw new HostProtocolError('invalid_request', 'Invalid families', false);
217
- }
218
- return { families };
219
- }
220
- function parseArtifactExportParams(params) {
221
- return {
222
- outputPath: getString(params, 'outputPath'),
223
- };
224
- }
225
- function parseDebugTokenQrcodeParams(params) {
226
- return {
227
- payload: getString(params, 'payload'),
228
- outputStem: getOptionalString(params, 'outputStem'),
229
- };
230
- }
231
- function normalizeError(error) {
232
- if (error instanceof HostProtocolError) {
233
- return error;
234
- }
235
- if (error instanceof Error) {
236
- return new HostProtocolError('internal_error', error.message, false);
237
- }
238
- return new HostProtocolError('internal_error', 'Internal error', false);
239
- }
@@ -1,52 +0,0 @@
1
- import { ArtifactManager } from './ArtifactManager';
2
- import { RuntimeAdapter } from './RuntimeAdapter';
3
- export declare class HostServer {
4
- private state;
5
- private artifactManager;
6
- private runtimeAdapter;
7
- private commandCoordinator;
8
- private isInitialized;
9
- private eventCounter;
10
- private commandSequence;
11
- private tokenTool;
12
- private eventSinks;
13
- constructor(artifactManager: ArtifactManager, runtimeAdapter: RuntimeAdapter, hostEndpoint?: string);
14
- handleMessage(message: string): Promise<string | undefined>;
15
- private writeEvent;
16
- private pushEvent;
17
- addEventSink(sink: (event: Record<string, unknown>) => void): void;
18
- removeEventSink(sink: (event: Record<string, unknown>) => void): void;
19
- appendHostLog(line: string): void;
20
- private handleRuntimeEvent;
21
- private snapshotPendingConnectionSummary;
22
- private noteIncomingConnection;
23
- private handleIncomingConnectionDisconnected;
24
- private maybeAutoStartStreamFromRemoteDemand;
25
- private dispatch;
26
- private handleInitialize;
27
- private handleHostStatus;
28
- private handleHostShutdown;
29
- private handleServiceStart;
30
- private handleServiceStop;
31
- private handleConnectionGet;
32
- private handleConnectionConnect;
33
- private startDeferredSendStreamsOnConnected;
34
- private activatePendingStreamsOnConnected;
35
- private handleConnectionDisconnect;
36
- private handleStreamList;
37
- private handleStreamSendStart;
38
- private handleStreamSendStop;
39
- private handleStreamMessageSend;
40
- private handleStreamReceiveStart;
41
- private handleStreamReceiveStop;
42
- private handleOutputAttach;
43
- private handleOutputDetach;
44
- private handleCommandSend;
45
- private handleCommandReply;
46
- private handleCommandPendingList;
47
- private handleEventsSubscribe;
48
- private handleArtifactReadReport;
49
- private handleArtifactExportLogs;
50
- private handleArtifactExportReport;
51
- private handleDebugTokenQrcode;
52
- }